diff --git a/PowerToys.sln b/PowerToys.sln
index 1b28621629..699cc04d1c 100644
--- a/PowerToys.sln
+++ b/PowerToys.sln
@@ -173,7 +173,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.editorconfig = .editorconfig
EndProjectSection
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.PowerToys.Settings.UI.Lib", "src\core\Microsoft.PowerToys.Settings.UI.Lib\Microsoft.PowerToys.Settings.UI.Lib.csproj", "{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.PowerToys.Settings.UI.Lib", "src\core\Microsoft.PowerToys.Settings.UI.Lib\Microsoft.PowerToys.Settings.UI.Lib.csproj", "{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Lib/Contributor.cs b/src/core/Microsoft.PowerToys.Settings.UI.Lib/Contributor.cs
new file mode 100644
index 0000000000..4d4e53de9e
--- /dev/null
+++ b/src/core/Microsoft.PowerToys.Settings.UI.Lib/Contributor.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Microsoft.PowerToys.Settings.UI.Lib
+{
+ public class Contributor
+ {
+ public string Name { get; set; }
+ public string Link { get; set; }
+ }
+}
diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Lib/GeneralSettings.cs b/src/core/Microsoft.PowerToys.Settings.UI.Lib/GeneralSettings.cs
index d9e9eff886..f66079f577 100644
--- a/src/core/Microsoft.PowerToys.Settings.UI.Lib/GeneralSettings.cs
+++ b/src/core/Microsoft.PowerToys.Settings.UI.Lib/GeneralSettings.cs
@@ -19,6 +19,17 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
public string system_theme { get; set; }
public string powertoys_version { get; set; }
+ public GeneralSettings()
+ {
+ this.packaged = false;
+ this.startup = false;
+ this.is_admin = false;
+ this.is_elevated = false;
+ this.theme = "system";
+ this.system_theme = "light";
+ this.powertoys_version = "v0.15.3";
+ }
+
public override string ToString()
{
return JsonSerializer.Serialize(this);
diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerPreviewSettings.cs b/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerPreviewSettings.cs
new file mode 100644
index 0000000000..3552260b22
--- /dev/null
+++ b/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerPreviewSettings.cs
@@ -0,0 +1,73 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Text.Json;
+
+namespace Microsoft.PowerToys.Settings.UI.Lib
+{
+ ///
+ /// This class models the settings for the PowerPreview class.
+ /// Eaxmple JSON:
+ /// {
+ /// "name": "File Explorer Preview",
+ /// "properties": {
+ /// "IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL": { "value": true },
+ /// "PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID": { "value": true }
+ /// },
+ /// "version": "1.0"
+ /// }
+
+ ///
+ public class PowerPreviewSettings
+ {
+ public string name { get; set; }
+ public Properties properties { get; set; }
+ public string version { get; set; }
+
+ public PowerPreviewSettings()
+ {
+ this.properties = new Properties();
+ this.version = "1";
+ this.name = "_unset_";
+ }
+
+ public PowerPreviewSettings(string ptName)
+ {
+ this.properties = new Properties();
+ this.version = "1";
+ this.name = ptName;
+ }
+
+ public override string ToString()
+ {
+ return "{\"" + this.name + "\":" + JsonSerializer.Serialize(this) + "}";
+ }
+ }
+
+ public class Property
+ {
+ public bool value { get; set; }
+
+ public override string ToString()
+ {
+ return JsonSerializer.Serialize(this);
+ }
+ }
+
+ public class Properties
+ {
+ public Property IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL { get; set; }
+ public Property PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID { get; set; }
+
+ public Properties()
+ {
+ this.IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL = new Property();
+ this.PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID = new Property();
+ }
+
+ public override string ToString()
+ {
+ return JsonSerializer.Serialize(this);
+ }
+ }
+}
diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Lib/SndModuleSettings.cs b/src/core/Microsoft.PowerToys.Settings.UI.Lib/SndModuleSettings.cs
new file mode 100644
index 0000000000..a2e2c21037
--- /dev/null
+++ b/src/core/Microsoft.PowerToys.Settings.UI.Lib/SndModuleSettings.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Text.Json;
+
+namespace Microsoft.PowerToys.Settings.UI.Lib
+{
+ ///
+ /// PowerToys runner expects a json text that contains one of the following attributes: refresh, general and powertoys.
+ /// The one for general settings is placed in the General settings model. This class represents the json text that starts with the "powertoys" attribute.
+ /// this will tell the runner that we are sending settings for a powertoy module and not for general settings.
+ ///
+ /// M stands for the Model of PT Module Settings to be sent.
+ public class SndModuleSettings
+ {
+ public M powertoys { get; set; }
+
+ public SndModuleSettings(M ptModuleSettings)
+ {
+ this.powertoys = ptModuleSettings;
+ }
+
+ public override string ToString()
+ {
+ return "{\"powertoys\":" + this.powertoys.ToString() + "}";
+ }
+ }
+}
diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Runner/MainWindow.xaml b/src/core/Microsoft.PowerToys.Settings.UI.Runner/MainWindow.xaml
index 9106799e66..73fb39bcc5 100644
--- a/src/core/Microsoft.PowerToys.Settings.UI.Runner/MainWindow.xaml
+++ b/src/core/Microsoft.PowerToys.Settings.UI.Runner/MainWindow.xaml
@@ -7,12 +7,9 @@
xmlns:Controls="clr-namespace:Microsoft.Toolkit.Wpf.UI.Controls;assembly=Microsoft.Toolkit.Wpf.UI.Controls"
xmlns:xaml="clr-namespace:Microsoft.Toolkit.Wpf.UI.XamlHost;assembly=Microsoft.Toolkit.Wpf.UI.XamlHost"
mc:Ignorable="d"
- Title="PowerToys Settings" Height="800" Width="800">
-
-
-
+ Title="PowerToys Settings" Height="800" Width="1000">
+
-
diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Runner/MainWindow.xaml.cs b/src/core/Microsoft.PowerToys.Settings.UI.Runner/MainWindow.xaml.cs
index ffde9eddaf..3129e5b4e6 100644
--- a/src/core/Microsoft.PowerToys.Settings.UI.Runner/MainWindow.xaml.cs
+++ b/src/core/Microsoft.PowerToys.Settings.UI.Runner/MainWindow.xaml.cs
@@ -25,30 +25,12 @@ namespace Microsoft.PowerToys.Settings.UI.Runner
if (shellPage != null)
{
- shellPage.SetRestartElevatedCallback(delegate(string msg)
+ // send IPC Message
+ shellPage.SetDefaultSndMessageCallback(delegate (string msg)
{
- MessageBox.Show(
- msg,
- "Restart Elevated",
- MessageBoxButton.OK);
-
- Program.ipcmanager.SendMessage(msg);
-
- int milliseconds = 2000;
- Thread.Sleep(milliseconds);
-
- System.Windows.Application.Current.Shutdown();
- });
-
- shellPage.SetRunOnStartUpCallback(delegate (string msg)
- {
- MessageBox.Show(
- msg,
- "Run On Start Up",
- MessageBoxButton.OK);
-
Program.ipcmanager.SendMessage(msg);
});
+
}
}
diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Microsoft.PowerToys.Settings.UI.csproj b/src/core/Microsoft.PowerToys.Settings.UI/Microsoft.PowerToys.Settings.UI.csproj
index 43216981ac..7e03c5abd2 100644
--- a/src/core/Microsoft.PowerToys.Settings.UI/Microsoft.PowerToys.Settings.UI.csproj
+++ b/src/core/Microsoft.PowerToys.Settings.UI/Microsoft.PowerToys.Settings.UI.csproj
@@ -1,4 +1,4 @@
-
+
@@ -75,7 +75,10 @@
PowerLauncherPage.xaml
-
+
+ PowerPreviewPage.xaml
+
+
FancyZonesPage.xaml
@@ -165,6 +168,10 @@
MSBuild:Compile
Designer
+
+ MSBuild:Compile
+ Designer
+
Designer
MSBuild:Compile
diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw b/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw
index eaf8c9dcfc..0ccb936aa8 100644
--- a/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw
+++ b/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw
@@ -1,4 +1,4 @@
-
+
-
-
-
-
-
-
-
-
-
-
+
-
+
-
-
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Views/ShellPage.xaml.cs b/src/core/Microsoft.PowerToys.Settings.UI/Views/ShellPage.xaml.cs
index 2fc23de931..bc4c14f497 100644
--- a/src/core/Microsoft.PowerToys.Settings.UI/Views/ShellPage.xaml.cs
+++ b/src/core/Microsoft.PowerToys.Settings.UI/Views/ShellPage.xaml.cs
@@ -5,10 +5,13 @@
namespace Microsoft.PowerToys.Settings.UI.Views
{
using System;
+ using System.Collections.Generic;
using Microsoft.PowerToys.Settings.UI.Activation;
using Microsoft.PowerToys.Settings.UI.Helpers;
+ using Microsoft.PowerToys.Settings.UI.Lib;
using Microsoft.PowerToys.Settings.UI.Services;
using Microsoft.PowerToys.Settings.UI.ViewModels;
+ using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
///
@@ -30,19 +33,12 @@ namespace Microsoft.PowerToys.Settings.UI.Views
///
/// 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;
-
+ public static ShellPage ShellHandler = null;
///
/// IPC callback function for run on start up.
///
- public static IPCMessageCallback Run_OnStartUp_Callback = null;
+ public static IPCMessageCallback Default_SndMSG_Callback = null;
///
/// Initializes a new instance of the class.
@@ -53,27 +49,61 @@ namespace Microsoft.PowerToys.Settings.UI.Views
this.InitializeComponent();
this.DataContext = this.ViewModel;
- ShellHandler = this.navigationView;
+ ShellHandler = this;
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)
+ public void SetDefaultSndMessageCallback(IPCMessageCallback implmentation)
{
- Run_OnStartUp_Callback = implmentation;
+ Default_SndMSG_Callback = implmentation;
+ }
+
+ public void HideFeatureDetails()
+ {
+ this.Feature_Details_Title.Visibility = Visibility.Collapsed;
+ this.Feature_Details.Visibility = Visibility.Collapsed;
+ }
+
+ public void ShowFeatureDetails()
+ {
+ 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 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);
+ }
}
}
}
diff --git a/src/core/Test/Program.cs b/src/core/Test/Program.cs
index f991ebb520..6b6e9fb5aa 100644
--- a/src/core/Test/Program.cs
+++ b/src/core/Test/Program.cs
@@ -10,9 +10,12 @@ namespace Test
{
static void Main(string[] args)
{
- GeneralSettings settings = SettingsUtils.GetSettings(string.Empty);
- OutGoingGeneralSettings outSettings = new OutGoingGeneralSettings(settings);
- Console.WriteLine(outSettings.ToString());
+ PowerPreviewSettings pvst = new PowerPreviewSettings();
+ pvst.name = "File Explorer";
+
+ SndModuleSettings snd = new SndModuleSettings(pvst);
+
+ Console.WriteLine(snd.ToString());
}
}
}