-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWindow.xaml.cs
More file actions
83 lines (72 loc) · 2.78 KB
/
Copy pathMainWindow.xaml.cs
File metadata and controls
83 lines (72 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
namespace ToolkitApp
{
public partial class MainWindow : Window
{
private Views.HomeView homeView;
private Views.ToolsView toolsView;
private Views.AboutView aboutView;
private Views.GithubInstallView githubInstallView;
public MainWindow()
{
InitializeComponent();
homeView = new Views.HomeView();
toolsView = new Views.ToolsView();
aboutView = new Views.AboutView();
githubInstallView = new Views.GithubInstallView();
// Default view
Nav_Home(null, null);
}
private void ResetNavButtons()
{
btnHome.Background = Brushes.Transparent;
btnTools.Background = Brushes.Transparent;
btnInstalledTools.Background = Brushes.Transparent;
btnInstalledTools.Foreground = (SolidColorBrush)Application.Current.Resources["TextLightBrush"];
btnAbout.Background = Brushes.Transparent;
}
private void Nav_Home(object sender, RoutedEventArgs e)
{
ResetNavButtons();
btnHome.Background = (SolidColorBrush)Application.Current.Resources["AccentBrush"];
MainContent.Content = homeView;
}
private void Nav_Tools(object sender, RoutedEventArgs e)
{
ResetNavButtons();
btnTools.Background = (SolidColorBrush)Application.Current.Resources["AccentBrush"];
MainContent.Content = toolsView;
// Re-load config in case new tools were added via GithubInstallView
toolsView.LoadConfiguration();
}
private void Nav_About(object sender, RoutedEventArgs e)
{
ResetNavButtons();
btnAbout.Background = (SolidColorBrush)Application.Current.Resources["AccentBrush"];
MainContent.Content = aboutView;
}
private void Nav_InstalledTools(object sender, RoutedEventArgs e)
{
ResetNavButtons();
btnInstalledTools.Background = (SolidColorBrush)Application.Current.Resources["AccentBrush"];
btnInstalledTools.Foreground = Brushes.White;
MainContent.Content = new Views.InstalledToolsView();
}
private void Nav_InstallGithub(object sender, RoutedEventArgs e)
{
ResetNavButtons();
MainContent.Content = githubInstallView;
}
private void Window_KeyDown(object sender, KeyEventArgs e)
{
if (Keyboard.Modifiers == ModifierKeys.Control && e.Key == Key.Q)
{
Nav_InstallGithub(null, null);
e.Handled = true;
}
}
}
}