-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWindow.xaml.cs
More file actions
42 lines (36 loc) · 1.1 KB
/
Copy pathMainWindow.xaml.cs
File metadata and controls
42 lines (36 loc) · 1.1 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
using Microsoft.UI.Xaml;
using SameGame.UI;
namespace SameGame;
/// <summary>
/// The primary application window hosting navigation to the main game page.
/// </summary>
public sealed partial class MainWindow : Window
{
/// <summary>
/// Initializes the main window, configures the title bar, and navigates to the game page.
/// </summary>
public MainWindow()
{
InitializeComponent();
ExtendsContentIntoTitleBar = true;
SetTitleBar(AppTitleBar);
WindowHelper.Configure(this, 900, 700, minimumWidth: 720, minimumHeight: 560);
RootFrame.Navigate(typeof(MainPage));
RootFrame.Navigated += (_, _) => UpdateTitle();
Closed += (_, _) =>
{
if (RootFrame.Content is MainPage page)
{
page.PersistSessionState();
}
};
}
/// <summary>
/// Updates the window and custom title bar text from the localized application name.
/// </summary>
public void UpdateTitle()
{
Title = SameGame.I18n.Messages.Get("app.name");
AppTitleBar.Title = Title;
}
}