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;
|
2020-03-30 17:02:25 +08:00
|
|
|
|
using System.Collections.Generic;
|
2020-03-25 10:55:02 +08:00
|
|
|
|
using Microsoft.PowerToys.Settings.UI.Activation;
|
|
|
|
|
using Microsoft.PowerToys.Settings.UI.Helpers;
|
2020-03-30 17:02:25 +08:00
|
|
|
|
using Microsoft.PowerToys.Settings.UI.Lib;
|
2020-03-25 10:55:02 +08:00
|
|
|
|
using Microsoft.PowerToys.Settings.UI.Services;
|
|
|
|
|
using Microsoft.PowerToys.Settings.UI.ViewModels;
|
2020-03-30 17:02:25 +08:00
|
|
|
|
using Windows.UI.Xaml;
|
2020-03-25 10:55:02 +08:00
|
|
|
|
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>
|
2020-03-30 17:02:25 +08:00
|
|
|
|
public static ShellPage ShellHandler = null;
|
2020-03-25 10:55:02 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// IPC callback function for run on start up.
|
|
|
|
|
/// </summary>
|
2020-03-30 17:02:25 +08:00
|
|
|
|
public static IPCMessageCallback Default_SndMSG_Callback = null;
|
2020-03-25 10:55:02 +08:00
|
|
|
|
|
|
|
|
|
/// <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;
|
2020-03-30 17:02:25 +08:00
|
|
|
|
ShellHandler = this;
|
2020-03-25 10:55:02 +08:00
|
|
|
|
this.ViewModel.Initialize(this.shellFrame, this.navigationView, this.KeyboardAccelerators);
|
|
|
|
|
this.shellFrame.Navigate(typeof(GeneralPage));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2020-03-30 17:02:25 +08:00
|
|
|
|
/// Run on start up callback function elevated initialization.
|
2020-03-25 10:55:02 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="implmentation">delegate function implementation.</param>
|
2020-03-30 17:02:25 +08:00
|
|
|
|
public void SetDefaultSndMessageCallback(IPCMessageCallback implmentation)
|
2020-03-25 10:55:02 +08:00
|
|
|
|
{
|
2020-03-30 17:02:25 +08:00
|
|
|
|
Default_SndMSG_Callback = implmentation;
|
2020-03-25 10:55:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-30 17:02:25 +08:00
|
|
|
|
public void HideFeatureDetails()
|
|
|
|
|
{
|
|
|
|
|
this.Feature_Details_Title.Visibility = Visibility.Collapsed;
|
|
|
|
|
this.Feature_Details.Visibility = Visibility.Collapsed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ShowFeatureDetails()
|
2020-03-25 10:55:02 +08:00
|
|
|
|
{
|
2020-03-30 17:02:25 +08:00
|
|
|
|
this.Feature_Details_Title.Visibility = Visibility.Visible;
|
|
|
|
|
this.Feature_Details.Visibility = Visibility.Visible;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetFeatureDetails(string moduleOverviewLink,string reportBugLink)
|
|
|
|
|
{
|
|
|
|
|
this.Module_Overview_LinkButton.NavigateUri = new Uri(moduleOverviewLink);
|
|
|
|
|
this.Module_Feedback_LinkButton.NavigateUri = new Uri(reportBugLink);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void HideContributorsList()
|
|
|
|
|
{
|
|
|
|
|
this.Contributors_List_Title.Visibility = Visibility.Collapsed;
|
|
|
|
|
this.Contributors_List.Visibility = Visibility.Collapsed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ShowContributorsList()
|
|
|
|
|
{
|
|
|
|
|
this.Contributors_List_Title.Visibility = Visibility.Visible;
|
|
|
|
|
this.Contributors_List.Visibility = Visibility.Visible;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void PopulateContributorsList(List<Contributor> contributors)
|
|
|
|
|
{
|
|
|
|
|
this.Contributors_List.Items.Clear();
|
|
|
|
|
|
|
|
|
|
foreach (Contributor contributor in contributors)
|
|
|
|
|
{
|
|
|
|
|
HyperlinkButton link = new HyperlinkButton();
|
|
|
|
|
link.Content = contributor.Name;
|
|
|
|
|
link.NavigateUri = new Uri(contributor.Link);
|
|
|
|
|
this.Contributors_List.Items.Add(link);
|
|
|
|
|
}
|
2020-03-12 01:43:32 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|