Browse Source

add "Save", "Load", "Apply" buttons functionality

pull/17/head
oZ-Zo 6 years ago
parent
commit
aeb000ddc2
  1. 66
      VS/Script_Gui/Script_Gui_3/MainWindow.xaml
  2. 143
      Win-10-Setup-Script-GUI-2511.ps1

66
VS/Script_Gui/Script_Gui_3/MainWindow.xaml

@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Script_Gui_3" xmlns:local="clr-namespace:Script_Gui_3"
mc:Ignorable="d" mc:Ignorable="d"
Name="Window" Title="Windows 10 Setup Script" MinHeight="863" MinWidth="950" Height="863" Width="950" Name="Window" Title="Windows 10 Setup Script" MinHeight="863" MinWidth="800" Height="863" Width="800"
FontFamily="Calibri" FontSize="18" TextOptions.TextFormattingMode="Display" WindowStartupLocation="CenterScreen" FontFamily="Calibri" FontSize="18" TextOptions.TextFormattingMode="Display" WindowStartupLocation="CenterScreen"
SnapsToDevicePixels="True" ResizeMode="CanResize" ShowInTaskbar="True" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" SnapsToDevicePixels="True" ResizeMode="CanResize" ShowInTaskbar="True" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"
Foreground="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"> Foreground="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}">
@ -54,7 +54,7 @@
<Style x:Key="PanelHamburgerMenu" TargetType="StackPanel"> <Style x:Key="PanelHamburgerMenu" TargetType="StackPanel">
<Setter Property="Orientation" Value="Horizontal"/> <Setter Property="Orientation" Value="Horizontal"/>
<Setter Property="Height" Value="55"/> <Setter Property="Height" Value="55"/>
<Setter Property="Width" Value="{Binding ElementName=HamburgerMenu, Path=Width}"/> <Setter Property="Width" Value="{Binding ElementName=HamburgerMenu, Path=Width}"/>
<Style.Triggers> <Style.Triggers>
<Trigger Property="IsMouseOver" Value="True"> <Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#2196F3"/> <Setter Property="Background" Value="#2196F3"/>
@ -116,8 +116,8 @@
<Trigger Property="IsMouseOver" Value="True"> <Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#2196F3"/> <Setter Property="Background" Value="#2196F3"/>
<Setter Property="BorderBrush" Value="#2196F3"/> <Setter Property="BorderBrush" Value="#2196F3"/>
</Trigger> </Trigger>
<EventTrigger RoutedEvent="MouseDown"> <EventTrigger RoutedEvent="MouseDown">
<EventTrigger.Actions> <EventTrigger.Actions>
<BeginStoryboard> <BeginStoryboard>
@ -129,7 +129,7 @@
</EventTrigger> </EventTrigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
<Style x:Key="ToggleSwitchLeftStyle" TargetType="{x:Type ToggleButton}"> <Style x:Key="ToggleSwitchLeftStyle" TargetType="{x:Type ToggleButton}">
<Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Background" Value="{StaticResource RadioButton.Static.Background}"/> <Setter Property="Background" Value="{StaticResource RadioButton.Static.Background}"/>
@ -280,15 +280,15 @@
<Setter Property="BorderThickness" Value="0 0 0 1"/> <Setter Property="BorderThickness" Value="0 0 0 1"/>
<Setter Property="Margin" Value="0 0 0 0"/> <Setter Property="Margin" Value="0 0 0 0"/>
<Setter Property="Background" Value="#FFFFFF"/> <Setter Property="Background" Value="#FFFFFF"/>
</Style> </Style>
</Window.Resources> </Window.Resources>
<Grid> <Grid Name="GridWindow">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="50"/> <RowDefinition Height="50"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!--#region Title Panel--> <!--#region Title Panel-->
<Canvas Grid.Row="0" Background="#E4E4E4"> <Canvas Grid.Row="0" Background="#E4E4E4">
@ -534,7 +534,7 @@
<Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Foreground" Value="#FFFFFF"/> <Setter Property="Foreground" Value="#FFFFFF"/>
<Setter Property="FontSize" Value="16"/> <Setter Property="FontSize" Value="16"/>
<Setter Property="Margin" Value="5 0 5 0"/> <Setter Property="Margin" Value="5 0 5 0"/>
<Style.Triggers> <Style.Triggers>
<DataTrigger Binding="{Binding ElementName=Button_Hamburger_Privacy, Path=IsMouseOver}" Value="True"> <DataTrigger Binding="{Binding ElementName=Button_Hamburger_Privacy, Path=IsMouseOver}" Value="True">
<Setter Property="Opacity" Value="1"/> <Setter Property="Opacity" Value="1"/>
@ -589,7 +589,7 @@
<Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Foreground" Value="#FFFFFF"/> <Setter Property="Foreground" Value="#FFFFFF"/>
<Setter Property="FontSize" Value="16"/> <Setter Property="FontSize" Value="16"/>
<Setter Property="Margin" Value="5 0 5 0"/> <Setter Property="Margin" Value="5 0 5 0"/>
<Style.Triggers> <Style.Triggers>
<DataTrigger Binding="{Binding ElementName=Button_Hamburger_UI, Path=IsMouseOver}" Value="True"> <DataTrigger Binding="{Binding ElementName=Button_Hamburger_UI, Path=IsMouseOver}" Value="True">
<Setter Property="Opacity" Value="1"/> <Setter Property="Opacity" Value="1"/>
@ -644,7 +644,7 @@
<Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Foreground" Value="#FFFFFF"/> <Setter Property="Foreground" Value="#FFFFFF"/>
<Setter Property="FontSize" Value="16"/> <Setter Property="FontSize" Value="16"/>
<Setter Property="Margin" Value="5 0 5 0"/> <Setter Property="Margin" Value="5 0 5 0"/>
<Style.Triggers> <Style.Triggers>
<DataTrigger Binding="{Binding ElementName=Button_Hamburger_OneDrive, Path=IsMouseOver}" Value="True"> <DataTrigger Binding="{Binding ElementName=Button_Hamburger_OneDrive, Path=IsMouseOver}" Value="True">
<Setter Property="Opacity" Value="1"/> <Setter Property="Opacity" Value="1"/>
@ -699,7 +699,7 @@
<Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Foreground" Value="#FFFFFF"/> <Setter Property="Foreground" Value="#FFFFFF"/>
<Setter Property="FontSize" Value="16"/> <Setter Property="FontSize" Value="16"/>
<Setter Property="Margin" Value="5 0 5 0"/> <Setter Property="Margin" Value="5 0 5 0"/>
<Style.Triggers> <Style.Triggers>
<DataTrigger Binding="{Binding ElementName=Button_Hamburger_System, Path=IsMouseOver}" Value="True"> <DataTrigger Binding="{Binding ElementName=Button_Hamburger_System, Path=IsMouseOver}" Value="True">
<Setter Property="Opacity" Value="1"/> <Setter Property="Opacity" Value="1"/>
@ -754,7 +754,7 @@
<Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Foreground" Value="#FFFFFF"/> <Setter Property="Foreground" Value="#FFFFFF"/>
<Setter Property="FontSize" Value="16"/> <Setter Property="FontSize" Value="16"/>
<Setter Property="Margin" Value="5 0 5 0"/> <Setter Property="Margin" Value="5 0 5 0"/>
<Style.Triggers> <Style.Triggers>
<DataTrigger Binding="{Binding ElementName=Button_Hamburger_StartMenu, Path=IsMouseOver}" Value="True"> <DataTrigger Binding="{Binding ElementName=Button_Hamburger_StartMenu, Path=IsMouseOver}" Value="True">
<Setter Property="Opacity" Value="1"/> <Setter Property="Opacity" Value="1"/>
@ -809,7 +809,7 @@
<Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Foreground" Value="#FFFFFF"/> <Setter Property="Foreground" Value="#FFFFFF"/>
<Setter Property="FontSize" Value="16"/> <Setter Property="FontSize" Value="16"/>
<Setter Property="Margin" Value="5 0 5 0"/> <Setter Property="Margin" Value="5 0 5 0"/>
<Style.Triggers> <Style.Triggers>
<DataTrigger Binding="{Binding ElementName=Button_Hamburger_Edge, Path=IsMouseOver}" Value="True"> <DataTrigger Binding="{Binding ElementName=Button_Hamburger_Edge, Path=IsMouseOver}" Value="True">
<Setter Property="Opacity" Value="1"/> <Setter Property="Opacity" Value="1"/>
@ -864,7 +864,7 @@
<Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Foreground" Value="#FFFFFF"/> <Setter Property="Foreground" Value="#FFFFFF"/>
<Setter Property="FontSize" Value="16"/> <Setter Property="FontSize" Value="16"/>
<Setter Property="Margin" Value="5 0 5 0"/> <Setter Property="Margin" Value="5 0 5 0"/>
<Style.Triggers> <Style.Triggers>
<DataTrigger Binding="{Binding ElementName=Button_Hamburger_Uwp, Path=IsMouseOver}" Value="True"> <DataTrigger Binding="{Binding ElementName=Button_Hamburger_Uwp, Path=IsMouseOver}" Value="True">
<Setter Property="Opacity" Value="1"/> <Setter Property="Opacity" Value="1"/>
@ -919,7 +919,7 @@
<Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Foreground" Value="#FFFFFF"/> <Setter Property="Foreground" Value="#FFFFFF"/>
<Setter Property="FontSize" Value="16"/> <Setter Property="FontSize" Value="16"/>
<Setter Property="Margin" Value="5 0 5 0"/> <Setter Property="Margin" Value="5 0 5 0"/>
<Style.Triggers> <Style.Triggers>
<DataTrigger Binding="{Binding ElementName=Button_Hamburger_Game, Path=IsMouseOver}" Value="True"> <DataTrigger Binding="{Binding ElementName=Button_Hamburger_Game, Path=IsMouseOver}" Value="True">
<Setter Property="Opacity" Value="1"/> <Setter Property="Opacity" Value="1"/>
@ -974,7 +974,7 @@
<Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Foreground" Value="#FFFFFF"/> <Setter Property="Foreground" Value="#FFFFFF"/>
<Setter Property="FontSize" Value="16"/> <Setter Property="FontSize" Value="16"/>
<Setter Property="Margin" Value="5 0 5 0"/> <Setter Property="Margin" Value="5 0 5 0"/>
<Style.Triggers> <Style.Triggers>
<DataTrigger Binding="{Binding ElementName=Button_Hamburger_Tasks, Path=IsMouseOver}" Value="True"> <DataTrigger Binding="{Binding ElementName=Button_Hamburger_Tasks, Path=IsMouseOver}" Value="True">
<Setter Property="Opacity" Value="1"/> <Setter Property="Opacity" Value="1"/>
@ -1029,7 +1029,7 @@
<Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Foreground" Value="#FFFFFF"/> <Setter Property="Foreground" Value="#FFFFFF"/>
<Setter Property="FontSize" Value="16"/> <Setter Property="FontSize" Value="16"/>
<Setter Property="Margin" Value="5 0 5 0"/> <Setter Property="Margin" Value="5 0 5 0"/>
<Style.Triggers> <Style.Triggers>
<DataTrigger Binding="{Binding ElementName=Button_Hamburger_Defender, Path=IsMouseOver}" Value="True"> <DataTrigger Binding="{Binding ElementName=Button_Hamburger_Defender, Path=IsMouseOver}" Value="True">
<Setter Property="Opacity" Value="1"/> <Setter Property="Opacity" Value="1"/>
@ -1084,7 +1084,7 @@
<Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Foreground" Value="#FFFFFF"/> <Setter Property="Foreground" Value="#FFFFFF"/>
<Setter Property="FontSize" Value="16"/> <Setter Property="FontSize" Value="16"/>
<Setter Property="Margin" Value="5 0 5 0"/> <Setter Property="Margin" Value="5 0 5 0"/>
<Style.Triggers> <Style.Triggers>
<DataTrigger Binding="{Binding ElementName=Button_Hamburger_ContextMenu, Path=IsMouseOver}" Value="True"> <DataTrigger Binding="{Binding ElementName=Button_Hamburger_ContextMenu, Path=IsMouseOver}" Value="True">
<Setter Property="Opacity" Value="1"/> <Setter Property="Opacity" Value="1"/>
@ -1139,7 +1139,7 @@
<Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Foreground" Value="#FFFFFF"/> <Setter Property="Foreground" Value="#FFFFFF"/>
<Setter Property="FontSize" Value="16"/> <Setter Property="FontSize" Value="16"/>
<Setter Property="Margin" Value="5 0 5 0"/> <Setter Property="Margin" Value="5 0 5 0"/>
<Style.Triggers> <Style.Triggers>
<DataTrigger Binding="{Binding ElementName=Button_Hamburger_ChangeLanguage, Path=IsMouseOver}" Value="True"> <DataTrigger Binding="{Binding ElementName=Button_Hamburger_ChangeLanguage, Path=IsMouseOver}" Value="True">
<Setter Property="Opacity" Value="1"/> <Setter Property="Opacity" Value="1"/>
@ -1194,7 +1194,7 @@
<Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Foreground" Value="#FFFFFF"/> <Setter Property="Foreground" Value="#FFFFFF"/>
<Setter Property="FontSize" Value="16"/> <Setter Property="FontSize" Value="16"/>
<Setter Property="Margin" Value="5 0 5 0"/> <Setter Property="Margin" Value="5 0 5 0"/>
<Style.Triggers> <Style.Triggers>
<DataTrigger Binding="{Binding ElementName=Button_Hamburger_GitHub, Path=IsMouseOver}" Value="True"> <DataTrigger Binding="{Binding ElementName=Button_Hamburger_GitHub, Path=IsMouseOver}" Value="True">
<Setter Property="Opacity" Value="1"/> <Setter Property="Opacity" Value="1"/>
@ -1542,7 +1542,7 @@
</Grid> </Grid>
</DockPanel> </DockPanel>
</Border> </Border>
</StackPanel> </StackPanel>
<!--#endregion Privacy Toggles--> <!--#endregion Privacy Toggles-->
@ -2251,7 +2251,7 @@
</Grid> </Grid>
</DockPanel> </DockPanel>
</Border> </Border>
</StackPanel> </StackPanel>
<!--#endregion UI Toggles--> <!--#endregion UI Toggles-->
@ -2276,7 +2276,7 @@
</Grid> </Grid>
</DockPanel> </DockPanel>
</Border> </Border>
</StackPanel> </StackPanel>
<!--#endregion OneDrive Toggles--> <!--#endregion OneDrive Toggles-->
@ -3099,7 +3099,7 @@
</Grid> </Grid>
</DockPanel> </DockPanel>
</Border> </Border>
</StackPanel> </StackPanel>
<!--#endregion System Toggles--> <!--#endregion System Toggles-->
@ -3200,7 +3200,7 @@
</Grid> </Grid>
</DockPanel> </DockPanel>
</Border> </Border>
</StackPanel> </StackPanel>
<!--#endregion StartMenu Toggles--> <!--#endregion StartMenu Toggles-->
@ -3282,14 +3282,14 @@
</Grid> </Grid>
</DockPanel> </DockPanel>
</Border> </Border>
</StackPanel> </StackPanel>
<!--#endregion Edge Toggles--> <!--#endregion Edge Toggles-->
<!--#region UWP Apps Toggles--> <!--#region UWP Apps Toggles-->
<StackPanel Name="PanelToggle_Uwp" Visibility="Collapsed"> <StackPanel Name="PanelToggle_Uwp" Visibility="Collapsed">
</StackPanel> </StackPanel>
<!--#endregion UWPApps Toggles--> <!--#endregion UWPApps Toggles-->
@ -3371,7 +3371,7 @@
</Grid> </Grid>
</DockPanel> </DockPanel>
</Border> </Border>
</StackPanel> </StackPanel>
<!--#endregion WindowsGameRecording Toggles--> <!--#endregion WindowsGameRecording Toggles-->
@ -3434,7 +3434,7 @@
</Grid> </Grid>
</DockPanel> </DockPanel>
</Border> </Border>
</StackPanel> </StackPanel>
<!--#endregion ScheduledTasks Toggles--> <!--#endregion ScheduledTasks Toggles-->
@ -3592,7 +3592,7 @@
</Grid> </Grid>
</DockPanel> </DockPanel>
</Border> </Border>
</StackPanel> </StackPanel>
<!--#endregion MicrosoftDefender Toggles--> <!--#endregion MicrosoftDefender Toggles-->
@ -3921,9 +3921,9 @@
</Grid> </Grid>
</DockPanel> </DockPanel>
</Border> </Border>
</StackPanel> </StackPanel>
<!--#endregion ContextMenu Toggles--> <!--#endregion ContextMenu Toggles-->
</StackPanel> </StackPanel>
</ScrollViewer> </ScrollViewer>

143
Win-10-Setup-Script-GUI-2511.ps1

@ -1,6 +1,38 @@
Add-Type -AssemblyName "PresentationCore", "PresentationFramework", "WindowsBase" Add-Type -AssemblyName "PresentationCore", "PresentationFramework", "WindowsBase"
#region Variable #region Variable
# Default Script Settings File Extension for File Dialogs
$scriptSettingExt = ".wtss"
$scriptSettingFilter = 'Win10 Setup Script Settings|*{0}'-f $scriptSettingExt
$scriptSettingFileName = "My Win10 Setup Script Settings"
$scriptSettingInitialDir = [environment]::getfolderpath("MyDocuments")
# Create and Tune Open File Dialog
$openFileDialog = New-Object Microsoft.Win32.OpenFileDialog($null)
$openFileDialog.Multiselect = $false
$openFileDialog.ReadOnlyChecked = $false
$openFileDialog.ShowReadOnly = $false
$openFileDialog.AddExtension = $true
$openFileDialog.CheckFileExists = $true
$openFileDialog.CheckPathExists = $true
$openFileDialog.DefaultExt = $scriptSettingExt
$openFileDialog.DereferenceLinks = $true
$openFileDialog.Filter = $scriptSettingFilter
$openFileDialog.InitialDirectory = $scriptSettingInitialDir
$openFileDialog.ValidateNames = $true
# Create and Tune Save File Dialog
$saveFileDialog = New-Object Microsoft.Win32.SaveFileDialog($null)
$saveFileDialog.CreatePrompt = $false
$saveFileDialog.AddExtension = $true
$saveFileDialog.CheckFileExists = $true
$saveFileDialog.CheckPathExists = $true
$saveFileDialog.DefaultExt = $scriptSettingExt
$saveFileDialog.DereferenceLinks = $true
$saveFileDialog.Filter = $scriptSettingFilter
$saveFileDialog.InitialDirectory = $scriptSettingInitialDir
$saveFileDialog.ValidateNames = $true
$saveFileDialog.OverwritePrompt = $true
# If variable clickedToggle > 0 show "Save" and "Apply" button, else hide "Save" and "Apply" button # If variable clickedToggle > 0 show "Save" and "Apply" button, else hide "Save" and "Apply" button
$clickedToggle = 0 $clickedToggle = 0
@ -316,7 +348,7 @@ $TextRu = "Добавить пункт ""Extract"" для MSI в контекс
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Name="Window" Title="Windows 10 Setup Script" MinHeight="863" MinWidth="750" Height="863" Width="750" Name="Window" Title="Windows 10 Setup Script" MinHeight="863" MinWidth="800" Height="863" Width="800"
FontFamily="Calibri" FontSize="18" TextOptions.TextFormattingMode="Display" WindowStartupLocation="CenterScreen" FontFamily="Calibri" FontSize="18" TextOptions.TextFormattingMode="Display" WindowStartupLocation="CenterScreen"
SnapsToDevicePixels="True" ResizeMode="CanResize" ShowInTaskbar="True" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" SnapsToDevicePixels="True" ResizeMode="CanResize" ShowInTaskbar="True" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"
Foreground="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"> Foreground="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}">
@ -595,7 +627,7 @@ $TextRu = "Добавить пункт ""Extract"" для MSI в контекс
</Window.Resources> </Window.Resources>
<Grid> <Grid Name="GridWindow">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="50"/> <RowDefinition Height="50"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
@ -4279,6 +4311,7 @@ $togglesPanels = $PanelToggle_ContextMenu, $PanelToggle_Defender, $PanelToggle_E
#endregion Gui Elements Array Collections #endregion Gui Elements Array Collections
#region Script Functions #region Script Functions
function Hide-Console { function Hide-Console {
<# <#
.SYNOPSIS .SYNOPSIS
@ -4315,13 +4348,13 @@ function Click-HamburgerMenu {
if ($HamburgerMenu.ActualWidth -eq $minWidth) if ($HamburgerMenu.ActualWidth -eq $minWidth)
{ {
$animation = New-Object System.Windows.Media.Animation.DoubleAnimation($minWidth, $maxWidth, $duration) $animation = New-Object System.Windows.Media.Animation.DoubleAnimation($minWidth, $maxWidth, $duration)
$Window.Width += 200 $Window.Width += 150
} }
else else
{ {
$animation = New-Object System.Windows.Media.Animation.DoubleAnimation($maxWidth, $minWidth, $duration) $animation = New-Object System.Windows.Media.Animation.DoubleAnimation($maxWidth, $minWidth, $duration)
$Window.Width -= 200 $Window.Width -= 150
} }
$animation.SpeedRatio ="2" $animation.SpeedRatio ="2"
@ -4537,38 +4570,50 @@ function Show-InfoPanel {
[CmdletBinding()] [CmdletBinding()]
param param
( (
[Parameter(Mandatory=$false)] [Parameter(Mandatory=$true)]
[ValidateNotNull()] [ValidateNotNull()]
[string]$TextRu, [string]$TextRu,
[Parameter(Mandatory=$false)] [Parameter(Mandatory=$true)]
[ValidateNotNull()] [ValidateNotNull()]
[string]$TextEng, [string]$TextEng,
[Parameter(Mandatory=$true)]
[ValidateNotNull()]
[string]$HeaderRu,
[Parameter(Mandatory=$true)]
[ValidateNotNull()]
[string]$HeaderEng,
[Parameter(Mandatory=$false)] [Parameter(Mandatory=$false)]
[switch]$ShowAnimation, [switch]$ShowAnimation,
[Parameter(Mandatory=$false)] [Parameter(Mandatory=$false)]
[switch]$Hide [switch]$Hide
) )
if ($Hide)
{
$ButtonApply.Visibility = "Visible"
$ButtonSave.Visibility = "Visible"
$ButtonLoad.Visibility = "Visible"
$UserInfo_Border.Visibility = "Collapsed"
Exit
}
$TextBlock_Category.Text = "" else
$panelName = "PanelToggle_UserInfo" {
$ButtonApply.Visibility = "Collapsed"
$ButtonSave.Visibility = "Collapsed"
$ButtonLoad.Visibility = "Collapsed"
}
for ($i=0;$i -lt $togglesPanels.Count;$i++) for ($i=0;$i -lt $togglesPanels.Count;$i++)
{ {
if ($togglesPanels[$i].Name -eq $panelName) if ($togglesPanels[$i].Name -eq "PanelToggle_UserInfo")
{ {
if ($Hide) $togglesPanels[$i].Visibility = "Visible"
{
$togglesPanels[$i].Visibility = "Collapsed"
$UserInfo_TextBlock.Text = ""
}
else
{
$togglesPanels[$i].Visibility = "Visible"
}
} }
else else
@ -4577,25 +4622,22 @@ function Show-InfoPanel {
} }
} }
if ($ShowAnimation)
{
$UserInfo_Border.Visibility = "Visible"
}
else
{
$UserInfo_Border.Visibility = "Collapsed"
}
if ($RU) if ($RU)
{ {
$TextBlock_Category.Text = $HeaderRu
$UserInfo_TextBlock.Text = $TextRu $UserInfo_TextBlock.Text = $TextRu
} }
else else
{ {
$TextBlock_Category.Text = $HeaderEng
$UserInfo_TextBlock.Text = $TextEng $UserInfo_TextBlock.Text = $TextEng
} }
if ($ShowAnimation)
{
$UserInfo_Border.Visibility = "Visible"
}
} }
function Follow-OnGitHub { function Follow-OnGitHub {
@ -4614,7 +4656,7 @@ function Follow-OnGitHub {
#region Controls Events #region Controls Events
$ButtonHamburger.Add_MouseLeftButtonDown({ $ButtonHamburger.Add_MouseLeftButtonUp({
Click-HamburgerMenu Click-HamburgerMenu
}) })
@ -4626,60 +4668,73 @@ $ButtonHamburger.Add_MouseLeave({
Set-HamburgerHover Set-HamburgerHover
}) })
$Button_Hamburger_ChangeLanguage.Add_MouseLeftButtonDown({ $Button_Hamburger_ChangeLanguage.Add_MouseLeftButtonUp({
$panelName = Get-ActivePanel $panelName = Get-ActivePanel
Set-GuiLanguage -Switch Set-GuiLanguage -Switch
Set-ActivePanel -Name $panelName Set-ActivePanel -Name $panelName
}) })
$Button_Hamburger_ContextMenu.Add_MouseLeftButtonDown({ $Button_Hamburger_ContextMenu.Add_MouseLeftButtonUp({
Set-ActivePanel -Name "ContextMenu" Set-ActivePanel -Name "ContextMenu"
}) })
$Button_Hamburger_Defender.Add_MouseLeftButtonDown({ $Button_Hamburger_Defender.Add_MouseLeftButtonUp({
Set-ActivePanel -Name "Defender" Set-ActivePanel -Name "Defender"
}) })
$Button_Hamburger_Edge.Add_MouseLeftButtonDown({ $Button_Hamburger_Edge.Add_MouseLeftButtonUp({
Set-ActivePanel -Name "Edge" Set-ActivePanel -Name "Edge"
}) })
$Button_Hamburger_Game.Add_MouseLeftButtonDown({ $Button_Hamburger_Game.Add_MouseLeftButtonUp({
Set-ActivePanel -Name "Game" Set-ActivePanel -Name "Game"
}) })
$Button_Hamburger_GitHub.Add_MouseLeftButtonDown({ $Button_Hamburger_GitHub.Add_MouseLeftButtonUp({
Follow-OnGitHub Follow-OnGitHub
}) })
$Button_Hamburger_OneDrive.Add_MouseLeftButtonDown({ $Button_Hamburger_OneDrive.Add_MouseLeftButtonUp({
Set-ActivePanel -Name "OneDrive" Set-ActivePanel -Name "OneDrive"
}) })
$Button_Hamburger_Privacy.Add_MouseLeftButtonDown({ $Button_Hamburger_Privacy.Add_MouseLeftButtonUp({
Set-ActivePanel -Name "Privacy" Set-ActivePanel -Name "Privacy"
}) })
$Button_Hamburger_StartMenu.Add_MouseLeftButtonDown({ $Button_Hamburger_StartMenu.Add_MouseLeftButtonUp({
Set-ActivePanel -Name "StartMenu" Set-ActivePanel -Name "StartMenu"
}) })
$Button_Hamburger_System.Add_MouseLeftButtonDown({ $Button_Hamburger_System.Add_MouseLeftButtonUp({
Set-ActivePanel -Name "System" Set-ActivePanel -Name "System"
}) })
$Button_Hamburger_Tasks.Add_MouseLeftButtonDown({ $Button_Hamburger_Tasks.Add_MouseLeftButtonUp({
Set-ActivePanel -Name "Tasks" Set-ActivePanel -Name "Tasks"
}) })
$Button_Hamburger_UI.Add_MouseLeftButtonDown({ $Button_Hamburger_UI.Add_MouseLeftButtonUp({
Set-ActivePanel -Name "Ui" Set-ActivePanel -Name "Ui"
}) })
$Button_Hamburger_Uwp.Add_MouseLeftButtonDown({ $Button_Hamburger_Uwp.Add_MouseLeftButtonUp({
Set-ActivePanel -Name "Uwp" Set-ActivePanel -Name "Uwp"
}) })
$ButtonLoad.add_MouseLeftButtonUp({
$openFileDialog.ShowDialog()
})
$ButtonSave.add_MouseLeftButtonUp({
$saveFileDialog.ShowDialog()
})
$ButtonApply.add_MouseLeftButtonUp({
Show-InfoPanel -TextRu "Мы применяем настройки, пожалуйста подождите..." -TextEng "We apply settings, please wait..." -HeaderRu "Применение настроек" -HeaderEng "Apply settings" -ShowAnimation
$GridWindow.IsEnabled = $false
})
#region Add Toggle Buttons Click Event #region Add Toggle Buttons Click Event
for ($i=0;$i -lt $toggleSwitch.Count;$i++) for ($i=0;$i -lt $toggleSwitch.Count;$i++)

Loading…
Cancel
Save