From 15c3d9e354870fca1aafa2f528d962e442eb488f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Peyronnet?= Date: Wed, 17 Apr 2024 10:14:06 +0200 Subject: [PATCH] Removed legacy code (#16) --- DayBar/MainWindow.xaml.cs | 42 ++------------------- DayBar/Pages/FirstRun/CustomizePage.xaml.cs | 3 -- DayBar/Pages/ThemePage.xaml.cs | 3 -- 3 files changed, 3 insertions(+), 45 deletions(-) diff --git a/DayBar/MainWindow.xaml.cs b/DayBar/MainWindow.xaml.cs index 91f7372..f51c541 100644 --- a/DayBar/MainWindow.xaml.cs +++ b/DayBar/MainWindow.xaml.cs @@ -71,9 +71,6 @@ private async void InitUI() { HelloTxt.Text = Global.GetHiSentence; - UnCheckAll(); - CheckButton(HomeBtn); - PageContent.Navigate(Global.HomePage); try { lastVersion = await Update.GetLastVersionAsync(Global.LastVersionLink); @@ -83,6 +80,7 @@ private async void InitUI() } } catch { } + HomeBtn.IsChecked = true; } DispatcherTimer dispatcherTimer = new(); @@ -223,54 +221,21 @@ private void MinimizeBtn_Click(object sender, RoutedEventArgs e) WindowState = WindowState.Minimized; } - private void UnCheckAll() - { - HomeBtn.Background = Brushes.Transparent; - NotificationsBtn.Background = Brushes.Transparent; - ThemeBtn.Background = Brushes.Transparent; - SettingsBtn.Background = Brushes.Transparent; - - HomeBtn.BorderBrush = Brushes.Transparent; - NotificationsBtn.BorderBrush = Brushes.Transparent; - ThemeBtn.BorderBrush = Brushes.Transparent; - SettingsBtn.BorderBrush = Brushes.Transparent; - } - internal void CheckButton(Button btn) - { - UnCheckAll(); - btn.Background = Global.GetSolidColor("Background2"); - btn.BorderBrush = Global.GetSolidColor("Accent"); - } private void HomeBtn_Click(object sender, RoutedEventArgs e) { - CheckButton(HomeBtn); PageContent.Navigate(Global.HomePage); } - private void NotificationsBtn_Click(object sender, RoutedEventArgs e) - { - CheckButton(NotificationsBtn); - PageContent.Navigate(Global.NotificationsPage); - } - - private void SettingsBtn_Click(object sender, RoutedEventArgs e) - { - CheckButton(SettingsBtn); - PageContent.Navigate(Global.AboutPage); - } - private void SettingsMenu_Click(object sender, RoutedEventArgs e) { - CheckButton(HomeBtn); PageContent.Navigate(Global.HomePage); Show(); } private void AboutMenu_Click(object sender, RoutedEventArgs e) { - CheckButton(SettingsBtn); PageContent.Navigate(Global.AboutPage); Show(); } @@ -280,9 +245,8 @@ private void QuitMenu_Click(object sender, RoutedEventArgs e) Application.Current.Shutdown(); // Close the application } - private void ThemeBtn_Click(object sender, RoutedEventArgs e) + private void SettingsBtn_Click(object sender, RoutedEventArgs e) { - CheckButton(ThemeBtn); - PageContent.Navigate(Global.ThemePage); + } } diff --git a/DayBar/Pages/FirstRun/CustomizePage.xaml.cs b/DayBar/Pages/FirstRun/CustomizePage.xaml.cs index 1768944..60e4be6 100644 --- a/DayBar/Pages/FirstRun/CustomizePage.xaml.cs +++ b/DayBar/Pages/FirstRun/CustomizePage.xaml.cs @@ -99,7 +99,6 @@ private void LightBorder_MouseLeftButtonUp(object sender, MouseButtonEventArgs e Global.Settings.Theme = Themes.Light; SettingsManager.Save(); Global.ChangeTheme(); - Global.MainWindow.CheckButton(Global.MainWindow.HomeBtn); } private void DarkBorder_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) @@ -111,7 +110,6 @@ private void DarkBorder_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) Global.Settings.Theme = Themes.Dark; SettingsManager.Save(); Global.ChangeTheme(); - Global.MainWindow.CheckButton(Global.MainWindow.HomeBtn); } @@ -123,7 +121,6 @@ private void SystemBorder_MouseLeftButtonUp(object sender, MouseButtonEventArgs Global.Settings.Theme = Themes.System; SettingsManager.Save(); Global.ChangeTheme(); - Global.MainWindow.CheckButton(Global.MainWindow.HomeBtn); } private void RadioButton_Checked(object sender, RoutedEventArgs e) diff --git a/DayBar/Pages/ThemePage.xaml.cs b/DayBar/Pages/ThemePage.xaml.cs index 52f0512..ffd6d97 100644 --- a/DayBar/Pages/ThemePage.xaml.cs +++ b/DayBar/Pages/ThemePage.xaml.cs @@ -100,7 +100,6 @@ private void LightBorder_MouseLeftButtonUp(object sender, MouseButtonEventArgs e Global.Settings.Theme = Themes.Light; SettingsManager.Save(); Global.ChangeTheme(); - Global.MainWindow.CheckButton(Global.MainWindow.ThemeBtn); } private void DarkBorder_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) @@ -112,7 +111,6 @@ private void DarkBorder_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) Global.Settings.Theme = Themes.Dark; SettingsManager.Save(); Global.ChangeTheme(); - Global.MainWindow.CheckButton(Global.MainWindow.ThemeBtn); } @@ -124,7 +122,6 @@ private void SystemBorder_MouseLeftButtonUp(object sender, MouseButtonEventArgs Global.Settings.Theme = Themes.System; SettingsManager.Save(); Global.ChangeTheme(); - Global.MainWindow.CheckButton(Global.MainWindow.ThemeBtn); } } }