//
// Copyright (c) Microsoft Corp. All rights reserved.
//
namespace Microsoft.PowerToys.Settings.UI.Views
{
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;
///
/// Root page.
///
public sealed partial class ShellPage : UserControl
{
///
/// Delcaration for the ipc callback function.
///
/// message.
public delegate void IPCMessageCallback(string msg);
///
/// Gets view model.
///
public ShellViewModel ViewModel { get; } = new ShellViewModel();
///
/// A shell handler to be used to update contents of the shell dynamically from page within the frame.
///
public static Microsoft.UI.Xaml.Controls.NavigationView ShellHandler = null;
///
/// IPC callback function for restart elevated.
///
public static IPCMessageCallback Restart_Elevated_Callback = null;
///
/// IPC callback function for run on start up.
///
public static IPCMessageCallback Run_OnStartUp_Callback = null;
///
/// Initializes a new instance of the class.
/// Shell page constructor.
///
public ShellPage()
{
this.InitializeComponent();
this.DataContext = this.ViewModel;
ShellHandler = this.navigationView;
this.ViewModel.Initialize(this.shellFrame, this.navigationView, this.KeyboardAccelerators);
this.shellFrame.Navigate(typeof(GeneralPage));
}
///
/// Restart elevated callback function initialization.
///
/// delegate function implementation.
public void SetRestartElevatedCallback(IPCMessageCallback implmentation)
{
Restart_Elevated_Callback = implmentation;
}
///
/// Run on start up callback function elevated initialization.
///
/// delegate function implementation.
public void SetRunOnStartUpCallback(IPCMessageCallback implmentation)
{
Run_OnStartUp_Callback = implmentation;
}
}
}