wakka/BinkPage.xaml.cs
2025-05-17 19:17:45 -05:00

57 lines
1.6 KiB
C#

using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using System;
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
namespace wakka
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class BinkPage : Page
{
public BinkPage()
{
this.InitializeComponent();
binksListView.ItemsSource = Bink.LoadedBinks;
}
private void BinkSubmit(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
var message = binkComposeBox.Text;
if (!string.IsNullOrEmpty(message))
{
Bink.PostBink(message);
binkComposeBox.Text = string.Empty;
Bink.GetNewBinks();
}
}
private void OnTextChanged(object sender, TextChangedEventArgs e)
{
if (string.IsNullOrEmpty(binkComposeBox.Text))
{
binkComposeDialog.IsPrimaryButtonEnabled = false;
}
else
{
binkComposeDialog.IsPrimaryButtonEnabled = true;
}
}
private async void OnBinkCreateButton(object sender, RoutedEventArgs e)
{
binkComposeDialog.IsPrimaryButtonEnabled = false;
await binkComposeDialog.ShowAsync();
}
public void RefreshButton(object sender, RoutedEventArgs e)
{
Bink.GetNewBinks();
}
}
}