Skip to content

Commit

Permalink
Removed legacy code (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
lpeyr committed Apr 17, 2024
1 parent 05498a0 commit 15c3d9e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 45 deletions.
42 changes: 3 additions & 39 deletions DayBar/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -83,6 +80,7 @@ private async void InitUI()
}
}
catch { }
HomeBtn.IsChecked = true;
}

DispatcherTimer dispatcherTimer = new();
Expand Down Expand Up @@ -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();
}
Expand All @@ -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);

}
}
3 changes: 0 additions & 3 deletions DayBar/Pages/FirstRun/CustomizePage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);

}

Expand All @@ -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)
Expand Down
3 changes: 0 additions & 3 deletions DayBar/Pages/ThemePage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);

}

Expand All @@ -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);
}
}
}

0 comments on commit 15c3d9e

Please sign in to comment.