diff --git a/XIVChat Desktop/MainWindow.xaml b/XIVChat Desktop/MainWindow.xaml index c7521a6..e17dda2 100644 --- a/XIVChat Desktop/MainWindow.xaml +++ b/XIVChat Desktop/MainWindow.xaml @@ -47,11 +47,6 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/XIVChat Desktop/MainWindow.xaml.cs b/XIVChat Desktop/MainWindow.xaml.cs index 66e2313..c084c54 100644 --- a/XIVChat Desktop/MainWindow.xaml.cs +++ b/XIVChat Desktop/MainWindow.xaml.cs @@ -15,6 +15,63 @@ namespace XIVChat_Desktop { /// Interaction logic for MainWindow.xaml /// public partial class MainWindow : INotifyPropertyChanged { + #region commands + + private void AlwaysTrue_CanExecute(object sender, CanExecuteRoutedEventArgs e) { + e.CanExecute = true; + } + + public static readonly RoutedUICommand EditTab = new RoutedUICommand( + "EditTab", + "EditTab", + typeof(MainWindow) + ); + + private void EditTab_OnExecuted(object sender, ExecutedRoutedEventArgs e) { + if (!(e.Parameter is Tab tab)) { + return; + } + + new ManageTab(this, tab).Show(); + } + + public static readonly RoutedUICommand DeleteTab = new RoutedUICommand( + "DeleteTab", + "DeleteTab", + typeof(MainWindow) + ); + + private void DeleteTab_OnExecuted(object sender, ExecutedRoutedEventArgs e) { + if (!(e.Parameter is Tab tab)) { + return; + } + + this.App.Config.Tabs.Remove(tab); + this.App.Config.Save(); + } + + public static readonly RoutedUICommand AddTab = new RoutedUICommand( + "AddTab", + "AddTab", + typeof(MainWindow) + ); + + private void AddTab_OnExecuted(object sender, ExecutedRoutedEventArgs e) { + new ManageTab(this, null).Show(); + } + + public static readonly RoutedUICommand ManageTabs = new RoutedUICommand( + "ManageTabs", + "ManageTabs", + typeof(MainWindow) + ); + + private void ManageTabs_OnExecuted(object sender, ExecutedRoutedEventArgs e) { + new ManageTabs(this).Show(); + } + + #endregion + public App App => (App)Application.Current; public List Messages { get; } = new List(); @@ -169,10 +226,6 @@ namespace XIVChat_Desktop { scroller?.ScrollToBottom(); } - private void ManageTabs_Click(object sender, RoutedEventArgs e) { - new ManageTabs(this).Show(); - } - private void Scan_Click(object sender, RoutedEventArgs e) { new ServerScan(this).Show(); }