Added Tests and Refactored code (#2129)

* Added Tests and Refactored code

* removed un-used file

* delete test files when test completes

* removed extra build configs

* added clean-up method

* removed unused variable

* re-added removed attributtion

* added error handling and move strings to string resource

* added error handling to file explorer view model

* moved varible assignment to if statement block

* removed savin of settings file from the UI

* re-added open source notice

* added missing controls for powerrename and fancy zones

* removed dead coded

* remove un-used configuration

* added error handling for file saving and updated powerreanme constructor

* removed added configurations

* added settings state
This commit is contained in:
Lavius Motileng
2020-04-17 15:25:08 -07:00
committed by GitHub
parent 7e1f554c4e
commit 3fc738b53a
37 changed files with 1538 additions and 504 deletions

View File

@@ -1,14 +1,20 @@
<Page
<Page
x:Class="Microsoft.PowerToys.Settings.UI.Views.GeneralPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Views"
xmlns:viewModel="using:Microsoft.PowerToys.Settings.UI.ViewModels"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Page.Resources>
<viewModel:GeneralViewModel x:Key="eventViewModel"/>
</Page.Resources>
<Grid ColumnSpacing="{StaticResource DefaultColumnSpacing}" RowSpacing="{StaticResource DefaultRowSpacing}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="LayoutVisualStates">
@@ -40,76 +46,70 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<StackPanel Orientation="Vertical">
<ToggleSwitch Header="Run at startup" x:Name="ToggleSwitch_RunAtStartUp" Margin="{StaticResource SmallTopMargin}" Toggled="ToggleSwitch_RunAtStartUp_Toggled" />
<StackPanel Orientation="Vertical"
x:Name="GeneralSettingsView">
<muxc:RadioButtons Header="Theme" Margin="{StaticResource MediumTopMargin}">
<RadioButton x:Name="Radio_Theme_Dark" Content="Dark" Tag="Dark" Checked="Theme_Changed"/>
<RadioButton x:Name="Radio_Theme_Light" Content="Light" Tag="Light" Checked="Theme_Changed"/>
<RadioButton x:Name="Radio_Theme_Default" Content="System default" Tag="System" Checked="Theme_Changed"/>
<ToggleSwitch x:Uid="GeneralPage_ToggleSwitch_RunAtStartUp"
Margin="{StaticResource SmallTopMargin}"
IsOn="{Binding Mode=TwoWay, Path=Startup}"/>
<muxc:RadioButtons x:Uid="RadioButtons_Name_Theme" Margin="{StaticResource SmallTopMargin}">
<RadioButton x:Uid="GeneralPage_Radio_Theme_Dark"
Content="Dark"
IsChecked="{ Binding Mode=TwoWay, Path=IsDarkThemeRadioButtonChecked}"/>
<RadioButton x:Uid="GeneralPage_Radio_Theme_Light"
Content="Light"
IsChecked="{ Binding Mode=TwoWay, Path=IsLightThemeRadioButtonChecked}"/>
<RadioButton x:Uid="GeneralPage_Radio_Theme_Default"
Content="System default"
IsChecked="{ Binding Mode=TwoWay, Path=IsSystemThemeRadioButtonChecked}"/>
</muxc:RadioButtons>
<!--
<TextBlock Text="Default apps" Style="{StaticResource SettingsGroupTitleStyle}"/>
<ToggleSwitch Header="Disable telemetry" IsOn="True" Margin="0,14,0,0" />
<TextBlock Text="PowerToys currently respects the Windows data &amp; feedback setting" Opacity="0.8" Margin="0,0,0,0" />
-->
<Button
Content="Restart as admin"
Margin="{StaticResource MediumTopMargin}"
Style="{StaticResource AccentButtonStyle}"
Click="Restart_Elevated" />
<!--
<TextBlock Text="Default apps" Style="{StaticResource SubtitleTextBlockStyle}" Margin="0,34,0,8"/>
<ComboBox Header="Shell" SelectedIndex="0" MinWidth="240" Margin="0,14,0,0">
<ComboBoxItem>PowerShell</ComboBoxItem>
</ComboBox>
<ComboBox Header="Terminal" SelectedIndex="0" MinWidth="240" Margin="0,14,0,0">
<ComboBoxItem>Windows Console</ComboBoxItem>
</ComboBox>
-->
<Button x:Uid="GeneralPage_RestartAsAdmin_Button"
Margin="{StaticResource SmallTopMargin}"
Style="{StaticResource AccentButtonStyle}"
Command = "{Binding RestartElevatedButtonEventHandler, Source={StaticResource eventViewModel}}"
/>
</StackPanel>
<StackPanel
x:Name="SidePanel"
Orientation="Vertical"
HorizontalAlignment="Left"
Width="{StaticResource SidePanelWidth}"
Grid.Column="1">
<StackPanel x:Name="SidePanel"
Orientation="Vertical"
HorizontalAlignment="Left"
Width="{StaticResource SidePanelWidth}"
Grid.Column="1">
<TextBlock
Text="About PowerToys"
Style="{StaticResource SettingsGroupTitleStyle}"
Margin="{StaticResource XSmallBottomMargin}"/>
<TextBlock
Text="Version 0.15.2"
FontWeight="Bold"
Margin="{StaticResource SmallTopMargin}" />
<HyperlinkButton
Content="Release notes"
NavigateUri="https://github.com/microsoft/PowerToys/releases" />
<Button
Content="Check for updates"
Margin="{StaticResource SmallTopMargin}"
Style="{StaticResource AccentButtonStyle}"
Click="CheckForUpdates_Click" />
<HyperlinkButton
Content="Report a bug"
NavigateUri="https://github.com/microsoft/PowerToys/issues"
Margin="{StaticResource MediumTopMargin}" />
<HyperlinkButton
Content="Request a feature"
NavigateUri="https://github.com/microsoft/PowerToys/issues"/>
<HyperlinkButton
Content="Privacy statement"
NavigateUri="http://go.microsoft.com/fwlink/?LinkId=521839" />
<HyperlinkButton
Content="Open-source notice"
NavigateUri="https://github.com/microsoft/PowerToys/blob/master/NOTICE.md" />
<TextBlock x:Uid="GeneralPage_AboutPowerToysHeader"
Style="{StaticResource SettingsGroupTitleStyle}"
Margin="{StaticResource XSmallBottomMargin}"/>
<TextBlock Text="Version 0.15.2"
FontWeight="Bold"
Margin="{StaticResource SmallTopMargin}" />
<Button x:Uid="GeneralPage_CheckForUpdates"
Margin="{StaticResource SmallTopMargin}"
Style="{StaticResource AccentButtonStyle}"
Foreground="White"
Command = "{Binding CheckFoUpdatesEventHandler, Source={StaticResource eventViewModel}}"
/>
<HyperlinkButton x:Uid="GeneralPage_ReportAbug"
NavigateUri="https://github.com/microsoft/PowerToys/issues"
Margin="{StaticResource SmallTopMargin}" />
<HyperlinkButton x:Uid="GeneralPage_RequestAFeature_URL"
NavigateUri="https://github.com/microsoft/PowerToys/issues"/>
<HyperlinkButton x:Uid="GeneralPage_PrivacyStatement_URL"
NavigateUri=" http://go.microsoft.com/fwlink/?LinkId=521839" />
<HyperlinkButton x:Uid="OpenSource_Notice"
NavigateUri="https://github.com/microsoft/PowerToys/blob/master/NOTICE.md"
/>
</StackPanel>
</Grid>
</Page>