61 lines
1.9 KiB
C#
61 lines
1.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Net.Http;
|
|
using System.Reflection;
|
|
using System.Runtime.InteropServices.WindowsRuntime;
|
|
using APIToolkit.Classes;
|
|
using Microsoft.UI.Xaml;
|
|
using Microsoft.UI.Xaml.Controls;
|
|
using Microsoft.UI.Xaml.Controls.Primitives;
|
|
using Microsoft.UI.Xaml.Data;
|
|
using Microsoft.UI.Xaml.Input;
|
|
using Microsoft.UI.Xaml.Media;
|
|
using Microsoft.UI.Xaml.Navigation;
|
|
using Windows.Foundation;
|
|
using Windows.Foundation.Collections;
|
|
|
|
// To learn more about WinUI, the WinUI project structure,
|
|
// and more about our project templates, see: http://aka.ms/winui-project-info.
|
|
|
|
namespace APIToolkit
|
|
{
|
|
public sealed partial class MainWindow : Window
|
|
{
|
|
public MainWindow()
|
|
{
|
|
this.InitializeComponent();
|
|
|
|
this.ExtendsContentIntoTitleBar = true; // Set the apps titlebar to be defined in MainWindow.xaml
|
|
this.SetTitleBar(AppTitleBar);
|
|
|
|
ContentArea.Navigate(typeof(URLShortener)); // Set default page
|
|
}
|
|
|
|
private void NavigationView_ItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args)
|
|
{
|
|
if (args.IsSettingsInvoked)
|
|
{
|
|
ContentArea.Navigate(typeof(Settings));
|
|
}
|
|
else
|
|
{
|
|
// If the page set in MainWindow.xaml does not exist (is null), then show an error message
|
|
if (Type.GetType($"APIToolkit.{args.InvokedItemContainer.Tag}") == null)
|
|
{
|
|
UIFunctions.ShowError(MainWindow_MainGrid.XamlRoot, "Requested page is not implemented (Destination returned null)");
|
|
}
|
|
else // Otherwise, navigate to page based on tag set in MainWindow.xaml
|
|
{
|
|
ContentArea.Navigate(Type.GetType($"APIToolkit.{args.InvokedItemContainer.Tag}"));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|