-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.xaml.cs
89 lines (78 loc) · 3.29 KB
/
MainWindow.xaml.cs
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
84
85
86
87
88
89
using MahApps.Metro.Controls;
using System.Windows;
using GameHaven.Views;
using GameHaven.UserControls;
using GameHaven.Window;
using GameHaven.Models;
using System.Web.UI.WebControls;
namespace GameHaven
{
public partial class MainWindow : MetroWindow
{
private Main MainWindowContentPage;
private TopGamesWrapped MyTopGamesWrappedPage;
private DownloadsAndUpdates DownloadsAndUpdatesPage;
private MetroWindow accentThemeTestWindow;
public MainWindow()
{
InitializeComponent();
MainWindowContentPage = new Main();
MainWindowContentPage.TopGameButtonClicked += MainWindowContentPage_TopAppButtonClicked;
MainWindowContentPage.GameClicked += MainWindowContentPage_AppClicked;
MainWindowContentPage.DownloadsAndUpdatesClicked += MainWindowContentPage_DownloadsAndUpdatesClicked;
MyTopGamesWrappedPage = new TopGamesWrapped();
MyTopGamesWrappedPage.AnAppClicked += MainWindowContentPage_AppClicked;
MyTopGamesWrappedPage.BackButtonClicked += BackButtonClicked;
DownloadsAndUpdatesPage = new DownloadsAndUpdates();
DownloadsAndUpdatesPage.BackButtonClicked += BackButtonClicked;
}
private void MainWindowContentPage_DownloadsAndUpdatesClicked()
{
MainWindowFrame.Content = DownloadsAndUpdatesPage;
}
private void MainWindowContentPage_TopAppButtonClicked(object sender, RoutedEventArgs e)
{
MainWindowFrame.Content = MyTopGamesWrappedPage;
}
private void MainWindowContentPage_AppClicked(AnGame sender, RoutedEventArgs e)
{
GameDetails myAppDetails = new GameDetails(sender);
myAppDetails.GameClicked += MainWindowContentPage_AppClicked;
myAppDetails.BackButtonClicked += BackButtonClicked;
MainWindowFrame.Content = myAppDetails;
}
private void BackButtonClicked(object sender, RoutedEventArgs e)
{
if (MainWindowFrame.NavigationService.CanGoBack)
MainWindowFrame.NavigationService.GoBack();
}
private void MainWindowFrame_Loaded(object sender, RoutedEventArgs e)
{
//MainWindowFrame.Content = MainWindowContentPage;
}
public void NavigateToMain()
{
MainWindowFrame.Content = MainWindowContentPage;
}
public void ShowLogin()
{
var dbContext = new GameHavenContext();
var login = new GameHaven.Views.Login(dbContext) { MainWindow = this };
MainWindowFrame.Content = login;
}
private void ChangeAppStyleButtonClick(object sender, RoutedEventArgs e)
{
if (accentThemeTestWindow != null)
{
accentThemeTestWindow.Activate();
return;
}
accentThemeTestWindow = new AccentStyleWindow();
accentThemeTestWindow.Owner = this;
accentThemeTestWindow.Closed += (o, args) => accentThemeTestWindow = null;
accentThemeTestWindow.Left = this.Left + this.ActualWidth / 2.0;
accentThemeTestWindow.Top = this.Top + this.ActualHeight / 2.0;
accentThemeTestWindow.Show();
}
}
}