2020-03-25 10:55:02 +08:00
|
|
|
|
// <copyright file="ShellPage.xaml.cs" company="Microsoft Corp">
|
|
|
|
|
// Copyright (c) Microsoft Corp. All rights reserved.
|
|
|
|
|
// </copyright>
|
2020-03-12 01:43:32 +08:00
|
|
|
|
|
|
|
|
|
namespace Microsoft.PowerToys.Settings.UI.Views
|
|
|
|
|
{
|
2020-03-25 10:55:02 +08:00
|
|
|
|
using System;
|
|
|
|
|
using Microsoft.PowerToys.Settings.UI.Activation;
|
|
|
|
|
using Microsoft.PowerToys.Settings.UI.Helpers;
|
|
|
|
|
using Microsoft.PowerToys.Settings.UI.Services;
|
|
|
|
|
using Microsoft.PowerToys.Settings.UI.ViewModels;
|
|
|
|
|
using Windows.UI.Xaml.Controls;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Root page.
|
|
|
|
|
/// </summary>
|
2020-03-12 01:43:32 +08:00
|
|
|
|
public sealed partial class ShellPage : UserControl
|
|
|
|
|
{
|
2020-03-25 10:55:02 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Delcaration for the ipc callback function.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="msg">message.</param>
|
|
|
|
|
public delegate void IPCMessageCallback(string msg);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets view model.
|
|
|
|
|
/// </summary>
|
2020-03-12 01:43:32 +08:00
|
|
|
|
public ShellViewModel ViewModel { get; } = new ShellViewModel();
|
|
|
|
|
|
2020-03-25 10:55:02 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// A shell handler to be used to update contents of the shell dynamically from page within the frame.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static Microsoft.UI.Xaml.Controls.NavigationView ShellHandler = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// IPC callback function for restart elevated.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static IPCMessageCallback Restart_Elevated_Callback = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// IPC callback function for run on start up.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static IPCMessageCallback Run_OnStartUp_Callback = null;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Initializes a new instance of the <see cref="ShellPage"/> class.
|
|
|
|
|
/// Shell page constructor.
|
|
|
|
|
/// </summary>
|
2020-03-12 01:43:32 +08:00
|
|
|
|
public ShellPage()
|
|
|
|
|
{
|
2020-03-25 10:55:02 +08:00
|
|
|
|
this.InitializeComponent();
|
|
|
|
|
|
|
|
|
|
this.DataContext = this.ViewModel;
|
|
|
|
|
ShellHandler = this.navigationView;
|
|
|
|
|
this.ViewModel.Initialize(this.shellFrame, this.navigationView, this.KeyboardAccelerators);
|
|
|
|
|
this.shellFrame.Navigate(typeof(GeneralPage));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Restart elevated callback function initialization.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="implmentation">delegate function implementation.</param>
|
|
|
|
|
public void SetRestartElevatedCallback(IPCMessageCallback implmentation)
|
|
|
|
|
{
|
|
|
|
|
Restart_Elevated_Callback = implmentation;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Run on start up callback function elevated initialization.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="implmentation">delegate function implementation.</param>
|
|
|
|
|
public void SetRunOnStartUpCallback(IPCMessageCallback implmentation)
|
|
|
|
|
{
|
|
|
|
|
Run_OnStartUp_Callback = implmentation;
|
2020-03-12 01:43:32 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|