Browse Source

New hamburger design

pull/17/head
oZ-Zo 5 years ago
parent
commit
839fe4f745
  1. 11
      Hamburger Icons.txt
  2. 45
      W10SS_GUI_2/W10SS_GUI/AnimationFactory.cs
  3. 7
      W10SS_GUI_2/W10SS_GUI/Controls/HamburgerCategoryButton.xaml
  4. 16
      W10SS_GUI_2/W10SS_GUI/Controls/HamburgerCategoryButton.xaml.cs
  5. 3
      W10SS_GUI_2/W10SS_GUI/Localized/EN.xaml
  6. 31
      W10SS_GUI_2/W10SS_GUI/MainWindow.xaml
  7. 20
      W10SS_GUI_2/W10SS_GUI/MainWindow.xaml.cs
  8. 6
      W10SS_GUI_2/W10SS_GUI/W10SS_GUI.csproj

11
Hamburger Icons.txt

@ -8,6 +8,13 @@
"Task Scheduler" U+E823 "Task Scheduler" U+E823
"Microsoft Defender" U+E83D "Microsoft Defender" U+E83D
"Context Menu" U+E292 "Context Menu" U+E292
Сменить язык U+F2B7
Перейти на Github U+E71B
Применить U+E8FB
Сохранить U+E74E
Загрузить U+E896
-------------------------------------- --------------------------------------
Конфиденциальность и телеметрия Конфиденциальность и телеметрия
UI и персонализация UI и персонализация
@ -27,11 +34,11 @@ Microsoft Defender
Text="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl}}, Path=Icon}"
Text="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl}}, Path=Text}"

45
W10SS_GUI_2/W10SS_GUI/AnimationFactory.cs

@ -1,45 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Media.Animation;
namespace W10SS_GUI
{
internal class AnimationFactory
{
private struct Duration
{
internal const int ButtonHamburger = 1;
}
private struct Speed
{
internal const int ButtonHamburger = 5;
}
internal Dictionary<string, Storyboard> Storyboards = new Dictionary<string, Storyboard>();
internal Dictionary<string, DoubleAnimation> Animations = new Dictionary<string, DoubleAnimation>();
public AnimationFactory()
{
#region Hamburger Animation
DoubleAnimation animation = new DoubleAnimation
{
Duration = new System.Windows.Duration(new TimeSpan(hours: 0, minutes: 0, seconds: Duration.ButtonHamburger)),
SpeedRatio = Speed.ButtonHamburger
};
Storyboard storyboard = new Storyboard();
Storyboard.SetTargetProperty(animation, new PropertyPath(FrameworkElement.WidthProperty));
storyboard.Children.Add(animation);
Animations.Add("Hamburger", animation);
Storyboards.Add("Hamburger", storyboard);
#endregion Hamburger Animation
}
}
}

7
W10SS_GUI_2/W10SS_GUI/Controls/HamburgerCategoryButton.xaml

@ -44,11 +44,12 @@
<StackPanel Name="hamburgerContainer" Orientation="Horizontal"> <StackPanel Name="hamburgerContainer" Orientation="Horizontal">
<TextBlock Name="textIcon" FontFamily="Segoe MDL2 Assets" FontSize="{DynamicResource buttonHamburgerIconsSize}" <TextBlock Name="textIcon" FontFamily="Segoe MDL2 Assets" FontSize="{DynamicResource buttonHamburgerIconsSize}"
Margin="10 10 10 10" Foreground="{DynamicResource textHamburgerForeground}" Margin="10 0 10 0" Foreground="{DynamicResource textHamburgerForeground}"
Text="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl}}, Path=IconText}"/> VerticalAlignment="Center"
Text="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl}}, Path=Icon}"/>
<TextBlock Name="textCategory" FontSize="{DynamicResource textHamburgerSize}" <TextBlock Name="textCategory" FontSize="{DynamicResource textHamburgerSize}"
Margin="0 0 0 5" Margin="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl}}, Path=TextMargin}"
Foreground="{DynamicResource textHamburgerForeground}" Foreground="{DynamicResource textHamburgerForeground}"
VerticalAlignment="Center" VerticalAlignment="Center"
Text="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl}}, Path=Text}"/> Text="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl}}, Path=Text}"/>

16
W10SS_GUI_2/W10SS_GUI/Controls/HamburgerCategoryButton.xaml.cs

@ -46,7 +46,21 @@ namespace W10SS_GUI.Controls
// Using a DependencyProperty as the backing store for IconText. This enables animation, styling, binding, etc... // Using a DependencyProperty as the backing store for IconText. This enables animation, styling, binding, etc...
public static readonly DependencyProperty IconProperty = public static readonly DependencyProperty IconProperty =
DependencyProperty.Register("IconText", typeof(string), typeof(HamburgerCategoryButton), new PropertyMetadata(default (string))); DependencyProperty.Register("Icon", typeof(string), typeof(HamburgerCategoryButton), new PropertyMetadata(default(string)));
public Thickness TextMargin
{
get { return (Thickness)GetValue(TextMarginProperty); }
set { SetValue(TextMarginProperty, value); }
}
// Using a DependencyProperty as the backing store for TextMargin. This enables animation, styling, binding, etc...
public static readonly DependencyProperty TextMarginProperty =
DependencyProperty.Register("TextMargin", typeof(Thickness), typeof(HamburgerCategoryButton), new PropertyMetadata(default(Thickness)));
} }

3
W10SS_GUI_2/W10SS_GUI/Localized/EN.xaml

@ -7,8 +7,7 @@
<system:String x:Key="textHamburgerSystem">System</system:String> <system:String x:Key="textHamburgerSystem">System</system:String>
<system:String x:Key="textHamburgerStartMenu">Start Menu</system:String> <system:String x:Key="textHamburgerStartMenu">Start Menu</system:String>
<system:String x:Key="textHamburgerUwp">UWP Apps</system:String> <system:String x:Key="textHamburgerUwp">UWP Apps</system:String>
<system:String x:Key="textHamburgerWinGame" xml:space="preserve">Windows Game <system:String x:Key="textHamburgerWinGame">Windows Game</system:String>
Recording</system:String>
<system:String x:Key="textHamburgerTaskScheduler">Task Scheduler</system:String> <system:String x:Key="textHamburgerTaskScheduler">Task Scheduler</system:String>
<system:String x:Key="textHamburgerDefender">Microsoft Defender</system:String> <system:String x:Key="textHamburgerDefender">Microsoft Defender</system:String>
<system:String x:Key="textHamburgerContextMenu">Context Menu</system:String> <system:String x:Key="textHamburgerContextMenu">Context Menu</system:String>

31
W10SS_GUI_2/W10SS_GUI/MainWindow.xaml

@ -15,14 +15,19 @@
Initialized="Window_Initialized" SizeToContent="WidthAndHeight"> Initialized="Window_Initialized" SizeToContent="WidthAndHeight">
<Grid Name="gridWindow"> <Grid Name="gridWindow">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!--#region Hamburger Panel--> <!--#region Hamburger Panel-->
<Canvas Name="panelHamburger" <Canvas Name="panelHamburger"
Grid.Column="0"
MinWidth="{StaticResource panelHamburgerMinWidth}" MinWidth="{StaticResource panelHamburgerMinWidth}"
Width="{StaticResource panelHamburgerMinWidth}" Width="{StaticResource panelHamburgerMinWidth}"
MaxWidth="{StaticResource panelHamburgerMaxWidth}" MaxWidth="{StaticResource panelHamburgerMaxWidth}"
Background="{DynamicResource buttonHamburgerBackground}" Background="{DynamicResource buttonHamburgerBackground}"
HorizontalAlignment="Left" Panel.ZIndex="10"> HorizontalAlignment="Left">
<Canvas.Triggers> <Canvas.Triggers>
<EventTrigger RoutedEvent="MouseEnter"> <EventTrigger RoutedEvent="MouseEnter">
<BeginStoryboard Storyboard="{StaticResource animationHamburgerOpen}"/> <BeginStoryboard Storyboard="{StaticResource animationHamburgerOpen}"/>
@ -35,56 +40,80 @@
<uc:HamburgerCategoryButton Icon="{StaticResource iconHamburgerPrivacy}" <uc:HamburgerCategoryButton Icon="{StaticResource iconHamburgerPrivacy}"
Text="{DynamicResource textHamburgerPrivacy}" Text="{DynamicResource textHamburgerPrivacy}"
Width="{Binding ElementName=panelHamburger, Path=Width}" Width="{Binding ElementName=panelHamburger, Path=Width}"
TextMargin="0 0 10 3"
Canvas.Top="0" Canvas.Right="0"/> Canvas.Top="0" Canvas.Right="0"/>
<uc:HamburgerCategoryButton Icon="{StaticResource iconHamburgerUi}" <uc:HamburgerCategoryButton Icon="{StaticResource iconHamburgerUi}"
Text="{DynamicResource textHamburgerUi}" Text="{DynamicResource textHamburgerUi}"
Width="{Binding ElementName=panelHamburger, Path=Width}" Width="{Binding ElementName=panelHamburger, Path=Width}"
TextMargin="0 0 10 -2"
Canvas.Top="40" Canvas.Right="0"/> Canvas.Top="40" Canvas.Right="0"/>
<uc:HamburgerCategoryButton Icon="{StaticResource iconHamburgerOneDrive}" <uc:HamburgerCategoryButton Icon="{StaticResource iconHamburgerOneDrive}"
Text="{DynamicResource textHamburgerOneDrive}" Text="{DynamicResource textHamburgerOneDrive}"
Width="{Binding ElementName=panelHamburger, Path=Width}" Width="{Binding ElementName=panelHamburger, Path=Width}"
TextMargin="0 0 10 3"
Canvas.Top="80" Canvas.Right="0"/> Canvas.Top="80" Canvas.Right="0"/>
<uc:HamburgerCategoryButton Icon="{StaticResource iconHamburgerSystem}" <uc:HamburgerCategoryButton Icon="{StaticResource iconHamburgerSystem}"
Text="{DynamicResource textHamburgerSystem}" Text="{DynamicResource textHamburgerSystem}"
Width="{Binding ElementName=panelHamburger, Path=Width}" Width="{Binding ElementName=panelHamburger, Path=Width}"
TextMargin="0 0 10 1"
Canvas.Top="120" Canvas.Right="0"/> Canvas.Top="120" Canvas.Right="0"/>
<uc:HamburgerCategoryButton Icon="{StaticResource iconHamburgerStartMenu}" <uc:HamburgerCategoryButton Icon="{StaticResource iconHamburgerStartMenu}"
Text="{DynamicResource textHamburgerStartMenu}" Text="{DynamicResource textHamburgerStartMenu}"
Width="{Binding ElementName=panelHamburger, Path=Width}" Width="{Binding ElementName=panelHamburger, Path=Width}"
TextMargin="0 0 10 5"
Canvas.Top="160" Canvas.Right="0"/> Canvas.Top="160" Canvas.Right="0"/>
<uc:HamburgerCategoryButton Icon="{StaticResource iconHamburgerUwp}" <uc:HamburgerCategoryButton Icon="{StaticResource iconHamburgerUwp}"
Text="{DynamicResource textHamburgerUwp}" Text="{DynamicResource textHamburgerUwp}"
Width="{Binding ElementName=panelHamburger, Path=Width}" Width="{Binding ElementName=panelHamburger, Path=Width}"
TextMargin="0 0 10 1"
Canvas.Top="200" Canvas.Right="0" Loaded="HamburgerCategoryButton_Loaded"/> Canvas.Top="200" Canvas.Right="0" Loaded="HamburgerCategoryButton_Loaded"/>
<uc:HamburgerCategoryButton Icon="{StaticResource iconHamburgerWinGame}" <uc:HamburgerCategoryButton Icon="{StaticResource iconHamburgerWinGame}"
Text="{DynamicResource textHamburgerWinGame}" Text="{DynamicResource textHamburgerWinGame}"
Width="{Binding ElementName=panelHamburger, Path=Width}" Width="{Binding ElementName=panelHamburger, Path=Width}"
TextMargin="0 0 10 4"
Canvas.Top="240" Canvas.Right="0"/> Canvas.Top="240" Canvas.Right="0"/>
<uc:HamburgerCategoryButton Icon="{StaticResource iconHamburgerTaskScheduler}" <uc:HamburgerCategoryButton Icon="{StaticResource iconHamburgerTaskScheduler}"
Text="{DynamicResource textHamburgerTaskScheduler}" Text="{DynamicResource textHamburgerTaskScheduler}"
Width="{Binding ElementName=panelHamburger, Path=Width}" Width="{Binding ElementName=panelHamburger, Path=Width}"
TextMargin="0 0 10 2"
Canvas.Top="280" Canvas.Right="0"/> Canvas.Top="280" Canvas.Right="0"/>
<uc:HamburgerCategoryButton Icon="{StaticResource iconHamburgerDefender}" <uc:HamburgerCategoryButton Icon="{StaticResource iconHamburgerDefender}"
Text="{DynamicResource textHamburgerDefender}" Text="{DynamicResource textHamburgerDefender}"
Width="{Binding ElementName=panelHamburger, Path=Width}" Width="{Binding ElementName=panelHamburger, Path=Width}"
TextMargin="0 0 10 4"
Canvas.Top="320" Canvas.Right="0"/> Canvas.Top="320" Canvas.Right="0"/>
<uc:HamburgerCategoryButton Icon="{StaticResource iconHamburgerContextMenu}" <uc:HamburgerCategoryButton Icon="{StaticResource iconHamburgerContextMenu}"
Text="{DynamicResource textHamburgerContextMenu}" Text="{DynamicResource textHamburgerContextMenu}"
Width="{Binding ElementName=panelHamburger, Path=Width}" Width="{Binding ElementName=panelHamburger, Path=Width}"
TextMargin="0 0 10 3"
Canvas.Top="360" Canvas.Right="0"/> Canvas.Top="360" Canvas.Right="0"/>
</Canvas> </Canvas>
<!--#endregion Hamburger Panel--> <!--#endregion Hamburger Panel-->
<!--#region Category Panels -->
<ScrollViewer Name="scrollCategory"
Grid.Column="1"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Disabled">
<Grid Name="gridCategoryPanels" Grid.Column="1"
Width="500"
HorizontalAlignment="Left">
</Grid>
</ScrollViewer>
<!--#region Category Panels -->
</Grid> </Grid>
</Window> </Window>

20
W10SS_GUI_2/W10SS_GUI/MainWindow.xaml.cs

@ -21,9 +21,6 @@ namespace W10SS_GUI
/// </summary> /// </summary>
public partial class MainWindow : Window public partial class MainWindow : Window
{ {
//TODO: УДАЛИТЬ Animation Factory
AnimationFactory AnimationFactory = new AnimationFactory();
public MainWindow() public MainWindow()
{ {
InitializeComponent(); InitializeComponent();
@ -32,13 +29,8 @@ namespace W10SS_GUI
private void Window_Initialized(object sender, EventArgs e) private void Window_Initialized(object sender, EventArgs e)
{ {
SetLanguageDictionary(); SetLanguageDictionary();
//buttonHamburger.Click += ButtonHamburger_Click;
} }
private void ButtonWindowMinimize_Click(object sender, RoutedEventArgs e) => Application.Current.MainWindow.WindowState = WindowState.Minimized;
private void ButtonWindowClose_Click(object sender, RoutedEventArgs e) => Application.Current.MainWindow.Close();
private void SetLanguageDictionary() private void SetLanguageDictionary()
{ {
ResourceDictionary dict = new ResourceDictionary(); ResourceDictionary dict = new ResourceDictionary();
@ -52,17 +44,5 @@ namespace W10SS_GUI
Resources.MergedDictionaries.Add(dict); Resources.MergedDictionaries.Add(dict);
} }
private void ButtonHamburger_Click(object sender, RoutedEventArgs e)
{
//AnimationFactory.Animations["Hamburger"].To = panelHamburger.ActualWidth == panelHamburger.MinWidth ?
// panelHamburger.MaxWidth : panelHamburger.MinWidth;
//AnimationFactory.Storyboards["Hamburger"].Begin(panelHamburger);
}
private void HamburgerCategoryButton_Loaded(object sender, RoutedEventArgs e)
{
}
} }
} }

6
W10SS_GUI_2/W10SS_GUI/W10SS_GUI.csproj

@ -40,6 +40,7 @@
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Data.Linq" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
@ -90,7 +91,6 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
<Compile Include="AnimationFactory.cs" />
<Compile Include="App.xaml.cs"> <Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon> <DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType> <SubType>Code</SubType>
@ -134,6 +134,8 @@
<ItemGroup> <ItemGroup>
<None Include="App.config" /> <None Include="App.config" />
</ItemGroup> </ItemGroup>
<ItemGroup /> <ItemGroup>
<WCFMetadata Include="Connected Services\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>
Loading…
Cancel
Save