added stylecop (#1933)

* added stylecop

* removed xml documentation

* used common stylecop file
This commit is contained in:
Lavius Motileng
2020-04-07 10:19:14 -07:00
parent 89b44f5126
commit cea6b7067a
53 changed files with 626 additions and 536 deletions

View File

@@ -1,9 +1,13 @@
using Microsoft.PowerToys.Settings.UI.ViewModels;
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Microsoft.PowerToys.Settings.UI.ViewModels;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;

View File

@@ -1,19 +1,19 @@
// <copyright file="GeneralPage.xaml.cs" company="Microsoft Corp">
// Copyright (c) Microsoft Corp. All rights reserved.
// </copyright>
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.IO;
using Microsoft.PowerToys.Settings.UI.Lib;
using Microsoft.PowerToys.Settings.UI.ViewModels;
using Windows.System;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
namespace Microsoft.PowerToys.Settings.UI.Views
{
using System;
using System.IO;
using Microsoft.PowerToys.Settings.UI.Lib;
using Microsoft.PowerToys.Settings.UI.ViewModels;
using Windows.System;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
/// <summary>
/// General Settings Page.
/// </summary>
@@ -32,7 +32,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views
{
this.InitializeComponent();
}
/// <inheritdoc/>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
@@ -42,17 +42,19 @@ namespace Microsoft.PowerToys.Settings.UI.Views
{
// get settings file if they exist.
settings = SettingsUtils.GetSettings<GeneralSettings>(string.Empty);
// load and apply theme settings
this.ReLoadTheme(settings.theme);
// load run on start-up settings value and update the ui state.
this.ToggleSwitch_RunAtStartUp.IsOn = settings.startup;
}
catch (Exception exp)
catch
{
// create settings file if one is not found.
settings = new GeneralSettings();
SettingsUtils.SaveSettings(settings.ToJsonString(), string.Empty);
// load and apply theme settings
this.ReLoadTheme(settings.theme);
@@ -106,9 +108,9 @@ namespace Microsoft.PowerToys.Settings.UI.Views
SettingsUtils.SaveSettings(settings.ToJsonString(), string.Empty);
OutGoingGeneralSettings outsettings = new OutGoingGeneralSettings(settings);
if (ShellPage.Default_SndMSG_Callback != null)
if (ShellPage.DefaultSndMSGCallback != null)
{
ShellPage.Default_SndMSG_Callback(outsettings.ToString());
ShellPage.DefaultSndMSGCallback(outsettings.ToString());
}
}
}
@@ -119,9 +121,9 @@ namespace Microsoft.PowerToys.Settings.UI.Views
settings.run_elevated = true;
OutGoingGeneralSettings outsettings = new OutGoingGeneralSettings(settings);
if (ShellPage.Default_SndMSG_Callback != null)
if (ShellPage.DefaultSndMSGCallback != null)
{
ShellPage.Default_SndMSG_Callback(outsettings.ToString());
ShellPage.DefaultSndMSGCallback(outsettings.ToString());
}
}

View File

@@ -1,9 +1,13 @@
using Microsoft.PowerToys.Settings.UI.ViewModels;
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Microsoft.PowerToys.Settings.UI.ViewModels;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;

View File

@@ -1,9 +1,13 @@
using Microsoft.PowerToys.Settings.UI.ViewModels;
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Microsoft.PowerToys.Settings.UI.ViewModels;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;

View File

@@ -1,23 +1,13 @@
using Microsoft.PowerToys.Settings.UI.Lib;
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using System.ServiceModel.Channels;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Popups;
using Microsoft.PowerToys.Settings.UI.Lib;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
namespace Microsoft.PowerToys.Settings.UI.Views
{
/// <summary>
@@ -40,15 +30,15 @@ namespace Microsoft.PowerToys.Settings.UI.Views
{
base.OnNavigatedTo(e);
settings = SettingsUtils.GetSettings<PowerPreviewSettings>(POWERTOY_NAME);
ToggleSwitch_Preview_SVG.IsOn = settings.properties.IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL.value;
ToggleSwitch_Preview_MD.IsOn = settings.properties.PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID.value;
this.ToggleSwitch_Preview_SVG.IsOn = settings.properties.IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL.value;
this.ToggleSwitch_Preview_MD.IsOn = settings.properties.PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID.value;
}
catch(Exception exp)
catch
{
settings = new PowerPreviewSettings(POWERTOY_NAME);
SettingsUtils.SaveSettings(settings.ToJsonString(), POWERTOY_NAME);
ToggleSwitch_Preview_SVG.IsOn = settings.properties.IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL.value;
ToggleSwitch_Preview_MD.IsOn = settings.properties.PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID.value;
this.ToggleSwitch_Preview_SVG.IsOn = settings.properties.IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL.value;
this.ToggleSwitch_Preview_MD.IsOn = settings.properties.PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID.value;
}
}
@@ -61,11 +51,11 @@ namespace Microsoft.PowerToys.Settings.UI.Views
PowerPreviewSettings settings = SettingsUtils.GetSettings<PowerPreviewSettings>(POWERTOY_NAME);
settings.properties.IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL.value = swt.IsOn;
if (ShellPage.Default_SndMSG_Callback != null)
if (ShellPage.DefaultSndMSGCallback != null)
{
SndPowerPreviewSettings snd = new SndPowerPreviewSettings(settings);
SndModuleSettings<SndPowerPreviewSettings> ipcMessage = new SndModuleSettings<SndPowerPreviewSettings>(snd);
ShellPage.Default_SndMSG_Callback(ipcMessage.ToJsonString());
ShellPage.DefaultSndMSGCallback(ipcMessage.ToJsonString());
}
}
}
@@ -79,11 +69,11 @@ namespace Microsoft.PowerToys.Settings.UI.Views
PowerPreviewSettings settings = SettingsUtils.GetSettings<PowerPreviewSettings>(POWERTOY_NAME);
settings.properties.PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID.value = swt.IsOn;
if (ShellPage.Default_SndMSG_Callback != null)
if (ShellPage.DefaultSndMSGCallback != null)
{
SndPowerPreviewSettings snd = new SndPowerPreviewSettings(settings);
SndModuleSettings<SndPowerPreviewSettings> ipcMessage = new SndModuleSettings<SndPowerPreviewSettings>(snd);
ShellPage.Default_SndMSG_Callback(ipcMessage.ToJsonString());
ShellPage.DefaultSndMSGCallback(ipcMessage.ToJsonString());
}
}
}

View File

@@ -1,21 +1,13 @@
using Microsoft.PowerToys.Settings.UI.Lib;
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using Microsoft.PowerToys.Settings.UI.Lib;
using Microsoft.PowerToys.Settings.UI.ViewModels;
using Microsoft.UI.Xaml.Controls;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using System.ServiceModel.Channels;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
namespace Microsoft.PowerToys.Settings.UI.Views
@@ -23,7 +15,8 @@ namespace Microsoft.PowerToys.Settings.UI.Views
public sealed partial class PowerRenamePage : Page
{
public PowerRenameViewModel ViewModel { get; } = new PowerRenameViewModel();
private const string POWERTOY_NAME = "PowerRename";
private const string POWERTOYNAME = "PowerRename";
public PowerRenamePage()
{
@@ -37,18 +30,17 @@ namespace Microsoft.PowerToys.Settings.UI.Views
PowerRenameSettings settings;
try
{
settings = SettingsUtils.GetSettings<PowerRenameSettings>(POWERTOY_NAME);
UpdateView(settings);
settings = SettingsUtils.GetSettings<PowerRenameSettings>(POWERTOYNAME);
this.UpdateView(settings);
}
catch (Exception exp)
catch
{
settings = new PowerRenameSettings(POWERTOY_NAME);
SettingsUtils.SaveSettings(settings.ToJsonString(), POWERTOY_NAME);
UpdateView(settings);
settings = new PowerRenameSettings(POWERTOYNAME);
SettingsUtils.SaveSettings(settings.ToJsonString(), POWERTOYNAME);
this.UpdateView(settings);
}
}
private void UpdateView(PowerRenameSettings settings)
{
this.Toggle_PowerRename_Enable.IsOn = settings.properties.bool_mru_enabled.value;
@@ -64,32 +56,32 @@ namespace Microsoft.PowerToys.Settings.UI.Views
if (swt != null)
{
PowerRenameSettings settings = SettingsUtils.GetSettings<PowerRenameSettings>(POWERTOY_NAME);
PowerRenameSettings settings = SettingsUtils.GetSettings<PowerRenameSettings>(POWERTOYNAME);
settings.properties.bool_mru_enabled.value = swt.IsOn;
if (ShellPage.Default_SndMSG_Callback != null)
if (ShellPage.DefaultSndMSGCallback != null)
{
SndPowerRenameSettings snd = new SndPowerRenameSettings(settings);
SndModuleSettings<SndPowerRenameSettings> ipcMessage = new SndModuleSettings<SndPowerRenameSettings>(snd);
ShellPage.Default_SndMSG_Callback(ipcMessage.ToJsonString());
ShellPage.DefaultSndMSGCallback(ipcMessage.ToJsonString());
}
}
}
private void Toggle_PowerRename_EnableOnContextMenu_Toggled(object sender, RoutedEventArgs e)
{
ToggleSwitch swt = sender as ToggleSwitch;
if (swt != null)
{
PowerRenameSettings settings = SettingsUtils.GetSettings<PowerRenameSettings>(POWERTOY_NAME);
PowerRenameSettings settings = SettingsUtils.GetSettings<PowerRenameSettings>(POWERTOYNAME);
settings.properties.bool_show_icon_on_menu.value = swt.IsOn;
if (ShellPage.Default_SndMSG_Callback != null)
if (ShellPage.DefaultSndMSGCallback != null)
{
SndPowerRenameSettings snd = new SndPowerRenameSettings(settings);
SndModuleSettings<SndPowerRenameSettings> ipcMessage = new SndModuleSettings<SndPowerRenameSettings>(snd);
ShellPage.Default_SndMSG_Callback(ipcMessage.ToJsonString());
ShellPage.DefaultSndMSGCallback(ipcMessage.ToJsonString());
}
}
}
@@ -100,14 +92,14 @@ namespace Microsoft.PowerToys.Settings.UI.Views
if (swt != null)
{
PowerRenameSettings settings = SettingsUtils.GetSettings<PowerRenameSettings>(POWERTOY_NAME);
PowerRenameSettings settings = SettingsUtils.GetSettings<PowerRenameSettings>(POWERTOYNAME);
settings.properties.bool_show_extended_menu.value = swt.IsOn;
if (ShellPage.Default_SndMSG_Callback != null)
if (ShellPage.DefaultSndMSGCallback != null)
{
SndPowerRenameSettings snd = new SndPowerRenameSettings(settings);
SndModuleSettings<SndPowerRenameSettings> ipcMessage = new SndModuleSettings<SndPowerRenameSettings>(snd);
ShellPage.Default_SndMSG_Callback(ipcMessage.ToJsonString());
ShellPage.DefaultSndMSGCallback(ipcMessage.ToJsonString());
}
}
}
@@ -118,14 +110,14 @@ namespace Microsoft.PowerToys.Settings.UI.Views
if (swt != null)
{
PowerRenameSettings settings = SettingsUtils.GetSettings<PowerRenameSettings>(POWERTOY_NAME);
PowerRenameSettings settings = SettingsUtils.GetSettings<PowerRenameSettings>(POWERTOYNAME);
settings.properties.bool_persist_input.value = swt.IsOn;
if (ShellPage.Default_SndMSG_Callback != null)
if (ShellPage.DefaultSndMSGCallback != null)
{
SndPowerRenameSettings snd = new SndPowerRenameSettings(settings);
SndModuleSettings<SndPowerRenameSettings> ipcMessage = new SndModuleSettings<SndPowerRenameSettings>(snd);
ShellPage.Default_SndMSG_Callback(ipcMessage.ToJsonString());
ShellPage.DefaultSndMSGCallback(ipcMessage.ToJsonString());
}
}
}
@@ -134,14 +126,14 @@ namespace Microsoft.PowerToys.Settings.UI.Views
{
if (sender != null)
{
PowerRenameSettings settings = SettingsUtils.GetSettings<PowerRenameSettings>(POWERTOY_NAME);
PowerRenameSettings settings = SettingsUtils.GetSettings<PowerRenameSettings>(POWERTOYNAME);
settings.properties.int_max_mru_size.value = Convert.ToInt32(sender.Value);
if (ShellPage.Default_SndMSG_Callback != null)
if (ShellPage.DefaultSndMSGCallback != null)
{
SndPowerRenameSettings snd = new SndPowerRenameSettings(settings);
SndModuleSettings<SndPowerRenameSettings> ipcMessage = new SndModuleSettings<SndPowerRenameSettings>(snd);
ShellPage.Default_SndMSG_Callback(ipcMessage.ToJsonString());
ShellPage.DefaultSndMSGCallback(ipcMessage.ToJsonString());
}
}
}

View File

@@ -55,7 +55,7 @@
<!-- TO DO: Update icon -->
<winui:NavigationViewItem x:Uid="Shell_FancyZones" helpers:NavHelper.NavigateTo="views:FancyZonesPage">
<winui:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE8AC;"/>
<PathIcon Data="M896 0v896H0V0h896zM768 768V128H128v640h640zM0 1920v-896h1920v896H0zm128-768v640h1664v-640H128zM1024 0h896v896h-896V0zm768 768V128h-640v640h640z"></PathIcon>
</winui:NavigationViewItem.Icon>
</winui:NavigationViewItem>
@@ -89,7 +89,7 @@
<!-- TO DO: Update icon -->
<winui:NavigationViewItem x:Uid="Shell_ImageResizer" helpers:NavHelper.NavigateTo="views:ImageResizerPage">
<winui:NavigationViewItem.Icon>
<FontIcon Glyph="&#xEDA7;"/>
<PathIcon Data="M0 768h1408v1152H0V768zm128 1024h870l-582-581-288 288v293zm1152 0v-102l-224-223-101 101 223 224h102zM128 896v421l288-287 448 447 192-191 224 224V896H128zm832 256q-26 0-45-19t-19-45q0-26 19-45t45-19q26 0 45 19t19 45q0 26-19 45t-45 19zm960-512V347l-339 338-90-90 338-339h-293V128h512v512h-128zm-768-512h256v128h-256V128zm-128 128H768V128h256v128zm-384 0H384V128h256v128zm-384 0H0V128h256v128zM128 640H0V384h128v256zm1920 128v256h-128V768h128zm-128 384h128v256h-128v-256zm0 384h128v256h-128v-256zm-384 256h256v128h-256v-128z"></PathIcon>
</winui:NavigationViewItem.Icon>
</winui:NavigationViewItem>
</winui:NavigationView.MenuItems>

View File

@@ -1,19 +1,8 @@
// <copyright file="ShellPage.xaml.cs" company="Microsoft Corp">
// Copyright (c) Microsoft Corp. All rights reserved.
// </copyright>
using Microsoft.PowerToys.Settings.UI.ViewModels;
using Windows.UI.Xaml.Controls;
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;
/// <summary>
/// Root page.
/// </summary>
@@ -25,21 +14,21 @@ namespace Microsoft.PowerToys.Settings.UI.Views
/// <param name="msg">message.</param>
public delegate void IPCMessageCallback(string msg);
/// <summary>
/// Gets or sets a shell handler to be used to update contents of the shell dynamically from page within the frame.
/// </summary>
public static ShellPage ShellHandler { get; set; }
/// <summary>
/// Gets or sets iPC callback function for run on start up.
/// </summary>
public static IPCMessageCallback DefaultSndMSGCallback { get; set; }
/// <summary>
/// Gets view model.
/// </summary>
public ShellViewModel ViewModel { get; } = new ShellViewModel();
/// <summary>
/// A shell handler to be used to update contents of the shell dynamically from page within the frame.
/// </summary>
public static ShellPage ShellHandler = null;
/// <summary>
/// IPC callback function for run on start up.
/// </summary>
public static IPCMessageCallback Default_SndMSG_Callback = null;
/// <summary>
/// Initializes a new instance of the <see cref="ShellPage"/> class.
/// Shell page constructor.
@@ -60,7 +49,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views
/// <param name="implmentation">delegate function implementation.</param>
public void SetDefaultSndMessageCallback(IPCMessageCallback implmentation)
{
Default_SndMSG_Callback = implmentation;
DefaultSndMSGCallback = implmentation;
}
}
}
}

View File

@@ -1,18 +1,9 @@
using Microsoft.PowerToys.Settings.UI.ViewModels;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.PowerToys.Settings.UI.ViewModels;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
namespace Microsoft.PowerToys.Settings.UI.Views
{