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
"Microsoft Defender" U+E83D
"Context Menu" U+E292
Сменить язык U+F2B7
Перейти на Github U+E71B
Применить U+E8FB
Сохранить U+E74E
Загрузить U+E896
--------------------------------------
Конфиденциальность и телеметрия
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">
<TextBlock Name="textIcon" FontFamily="Segoe MDL2 Assets" FontSize="{DynamicResource buttonHamburgerIconsSize}"
Margin="10 10 10 10" Foreground="{DynamicResource textHamburgerForeground}"
Text="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl}}, Path=IconText}"/>
Margin="10 0 10 0" Foreground="{DynamicResource textHamburgerForeground}"
VerticalAlignment="Center"
Text="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl}}, Path=Icon}"/>
<TextBlock Name="textCategory" FontSize="{DynamicResource textHamburgerSize}"
Margin="0 0 0 5"
Margin="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl}}, Path=TextMargin}"
Foreground="{DynamicResource textHamburgerForeground}"
VerticalAlignment="Center"
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...
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="textHamburgerStartMenu">Start Menu</system:String>
<system:String x:Key="textHamburgerUwp">UWP Apps</system:String>
<system:String x:Key="textHamburgerWinGame" xml:space="preserve">Windows Game
Recording</system:String>
<system:String x:Key="textHamburgerWinGame">Windows Game</system:String>
<system:String x:Key="textHamburgerTaskScheduler">Task Scheduler</system:String>
<system:String x:Key="textHamburgerDefender">Microsoft Defender</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">
<Grid Name="gridWindow">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!--#region Hamburger Panel-->
<Canvas Name="panelHamburger"
Grid.Column="0"
MinWidth="{StaticResource panelHamburgerMinWidth}"
Width="{StaticResource panelHamburgerMinWidth}"
MaxWidth="{StaticResource panelHamburgerMaxWidth}"
Background="{DynamicResource buttonHamburgerBackground}"
HorizontalAlignment="Left" Panel.ZIndex="10">
HorizontalAlignment="Left">
<Canvas.Triggers>
<EventTrigger RoutedEvent="MouseEnter">
<BeginStoryboard Storyboard="{StaticResource animationHamburgerOpen}"/>
@ -35,56 +40,80 @@
<uc:HamburgerCategoryButton Icon="{StaticResource iconHamburgerPrivacy}"
Text="{DynamicResource textHamburgerPrivacy}"
Width="{Binding ElementName=panelHamburger, Path=Width}"
TextMargin="0 0 10 3"
Canvas.Top="0" Canvas.Right="0"/>
<uc:HamburgerCategoryButton Icon="{StaticResource iconHamburgerUi}"
Text="{DynamicResource textHamburgerUi}"
Width="{Binding ElementName=panelHamburger, Path=Width}"
TextMargin="0 0 10 -2"
Canvas.Top="40" Canvas.Right="0"/>
<uc:HamburgerCategoryButton Icon="{StaticResource iconHamburgerOneDrive}"
Text="{DynamicResource textHamburgerOneDrive}"
Width="{Binding ElementName=panelHamburger, Path=Width}"
TextMargin="0 0 10 3"
Canvas.Top="80" Canvas.Right="0"/>
<uc:HamburgerCategoryButton Icon="{StaticResource iconHamburgerSystem}"
Text="{DynamicResource textHamburgerSystem}"
Width="{Binding ElementName=panelHamburger, Path=Width}"
TextMargin="0 0 10 1"
Canvas.Top="120" Canvas.Right="0"/>
<uc:HamburgerCategoryButton Icon="{StaticResource iconHamburgerStartMenu}"
Text="{DynamicResource textHamburgerStartMenu}"
Width="{Binding ElementName=panelHamburger, Path=Width}"
TextMargin="0 0 10 5"
Canvas.Top="160" Canvas.Right="0"/>
<uc:HamburgerCategoryButton Icon="{StaticResource iconHamburgerUwp}"
Text="{DynamicResource textHamburgerUwp}"
Width="{Binding ElementName=panelHamburger, Path=Width}"
TextMargin="0 0 10 1"
Canvas.Top="200" Canvas.Right="0" Loaded="HamburgerCategoryButton_Loaded"/>
<uc:HamburgerCategoryButton Icon="{StaticResource iconHamburgerWinGame}"
Text="{DynamicResource textHamburgerWinGame}"
Width="{Binding ElementName=panelHamburger, Path=Width}"
TextMargin="0 0 10 4"
Canvas.Top="240" Canvas.Right="0"/>
<uc:HamburgerCategoryButton Icon="{StaticResource iconHamburgerTaskScheduler}"
Text="{DynamicResource textHamburgerTaskScheduler}"
Width="{Binding ElementName=panelHamburger, Path=Width}"
TextMargin="0 0 10 2"
Canvas.Top="280" Canvas.Right="0"/>
<uc:HamburgerCategoryButton Icon="{StaticResource iconHamburgerDefender}"
Text="{DynamicResource textHamburgerDefender}"
Width="{Binding ElementName=panelHamburger, Path=Width}"
TextMargin="0 0 10 4"
Canvas.Top="320" Canvas.Right="0"/>
<uc:HamburgerCategoryButton Icon="{StaticResource iconHamburgerContextMenu}"
Text="{DynamicResource textHamburgerContextMenu}"
Width="{Binding ElementName=panelHamburger, Path=Width}"
TextMargin="0 0 10 3"
Canvas.Top="360" Canvas.Right="0"/>
</Canvas>
<!--#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>
</Window>

20
W10SS_GUI_2/W10SS_GUI/MainWindow.xaml.cs

@ -21,9 +21,6 @@ namespace W10SS_GUI
/// </summary>
public partial class MainWindow : Window
{
//TODO: УДАЛИТЬ Animation Factory
AnimationFactory AnimationFactory = new AnimationFactory();
public MainWindow()
{
InitializeComponent();
@ -32,13 +29,8 @@ namespace W10SS_GUI
private void Window_Initialized(object sender, EventArgs e)
{
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()
{
ResourceDictionary dict = new ResourceDictionary();
@ -52,17 +44,5 @@ namespace W10SS_GUI
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>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Data.Linq" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
@ -90,7 +91,6 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="AnimationFactory.cs" />
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
@ -134,6 +134,8 @@
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<WCFMetadata Include="Connected Services\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Loading…
Cancel
Save