add basic files

This commit is contained in:
NaBian committed 2019-04-29 23:42:10 +08:00
1 parent 76248707c6
commit 956e7e3247
20 files changed
+270 -15

No files matched your search

@@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeInspection/CodeAnnotations/NamespacesWithAnnotations/=HandyControl_002EAnnotations/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
@@ -411,6 +411,21 @@
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>MessageToken.cs</LastGenOutput>
</Content>
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\DevOps\DevOps-Boards.png">
<Link>Resources\Img\DevOps\DevOps-Boards.png</Link>
</Resource>
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\DevOps\DevOps-Overview.png">
<Link>Resources\Img\DevOps\DevOps-Overview.png</Link>
</Resource>
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\DevOps\DevOps-Pipelines.png">
<Link>Resources\Img\DevOps\DevOps-Pipelines.png</Link>
</Resource>
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\DevOps\DevOps-Repos.png">
<Link>Resources\Img\DevOps\DevOps-Repos.png</Link>
</Resource>
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\DevOps\DevOps-TestPlans.png">
<Link>Resources\Img\DevOps\DevOps-TestPlans.png</Link>
</Resource>
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\MainMenuControl_16x.png">
<Link>Resources\Img\LeftMainContent\MainMenuControl_16x.png</Link>
</Resource>
@@ -20,7 +20,7 @@ namespace HandyControlDemo
base.OnStartup(e);
GlobalData.Init();
Thread.CurrentThread.CurrentUICulture = new CultureInfo(GlobalData.Config.Lang);
ConfigHelper.Instance.SetLang(GlobalData.Config.Lang);
if (GlobalData.Config.Skin != SkinType.Default)
{
@@ -28,7 +28,7 @@ namespace HandyControlDemo
}
#if !Core
BlurWindow.SystemVersionInfo = CommonHelper.GetSystemVersionInfo();
ConfigHelper.Instance.SetSystemVersionInfo(CommonHelper.GetSystemVersionInfo());
#endif
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

@@ -1,11 +1,38 @@
<UserControl x:Class="HandyControlDemo.UserControl.SideMenuDemoCtl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400">
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl"
xmlns:interactivity="clr-namespace:HandyControl.Interactivity;assembly=HandyControl"
Background="{DynamicResource RegionBrush}">
<Grid>
<controls:SideMenu Width="200" Margin="32">
<controls:SideMenuItem Header="Overview">
<controls:SideMenuItem.Icon>
<Image Source="/HandyControlDemo;component/Resources/Img/DevOps/DevOps-Overview.png" Width="24" Height="24"/>
</controls:SideMenuItem.Icon>
</controls:SideMenuItem>
<controls:SideMenuItem Header="Boards">
<controls:SideMenuItem.Icon>
<Image Source="/HandyControlDemo;component/Resources/Img/DevOps/DevOps-Boards.png" Width="24" Height="24"/>
</controls:SideMenuItem.Icon>
</controls:SideMenuItem>
<controls:SideMenuItem Header="Repos">
<controls:SideMenuItem.Icon>
<Image Source="/HandyControlDemo;component/Resources/Img/DevOps/DevOps-Repos.png" Width="24" Height="24"/>
</controls:SideMenuItem.Icon>
</controls:SideMenuItem>
<controls:SideMenuItem Header="Pipelines">
<controls:SideMenuItem.Icon>
<Image Source="/HandyControlDemo;component/Resources/Img/DevOps/DevOps-Pipelines.png" Width="24" Height="24"/>
</controls:SideMenuItem.Icon>
</controls:SideMenuItem>
<controls:SideMenuItem Header="Test Plans">
<controls:SideMenuItem.Icon>
<Image Source="/HandyControlDemo;component/Resources/Img/DevOps/DevOps-TestPlans.png" Width="24" Height="24"/>
</controls:SideMenuItem.Icon>
</controls:SideMenuItem>
</controls:SideMenu>
</Grid>
</UserControl>
@@ -1,5 +1,4 @@
namespace HandyControlDemo.UserControl
namespace HandyControlDemo.UserControl
{
public partial class CalendarDemoCtl
{
@@ -0,0 +1,16 @@
using System.Windows;
namespace HandyControl.Controls
{
public class HeaderedSimpleItemsControl : SimpleItemsControl
{
public static readonly DependencyProperty HeaderProperty = DependencyProperty.Register(
"Header", typeof(object), typeof(HeaderedSimpleItemsControl), new PropertyMetadata(default(object)));
public object Header
{
get => GetValue(HeaderProperty);
set => SetValue(HeaderProperty, value);
}
}
}
@@ -5,6 +5,7 @@ using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Markup;
using HandyControl.Data;
namespace HandyControl.Controls
{
@@ -33,7 +34,14 @@ namespace HandyControl.Controls
public SimpleItemsControl()
{
var items = new ObservableCollection<object>();
items.CollectionChanged += OnItemsChanged;
items.CollectionChanged += (s, e) =>
{
if (e.NewItems != null && e.NewItems.Count > 0)
{
SetValue(HasItemsPropertyKey, true);
}
OnItemsChanged(s, e);
};
Items = items;
}
@@ -118,6 +126,14 @@ namespace HandyControl.Controls
protected virtual void OnItemContainerStyleChanged(DependencyPropertyChangedEventArgs e) => Refresh();
internal static readonly DependencyPropertyKey HasItemsPropertyKey =
DependencyProperty.RegisterReadOnly(nameof(HasItems), typeof(bool), typeof(SimpleItemsControl),
new PropertyMetadata(ValueBoxes.FalseBox));
public static readonly DependencyProperty HasItemsProperty = HasItemsPropertyKey.DependencyProperty;
public bool HasItems => (bool) GetValue(HasItemsProperty);
protected virtual void Refresh()
{
if (ItemsHost == null) return;
@@ -1,9 +1,13 @@
using System.Windows.Controls;
using System.Windows;
namespace HandyControl.Controls
{
public class SideMenu : Control
public class SideMenu : HeaderedSimpleItemsControl
{
private SideMenuItem _selectedItem;
protected override DependencyObject GetContainerForItemOverride() => new SideMenuItem();
protected override bool IsItemItsOwnContainerOverride(object item) => item is SideMenuItem;
}
}
@@ -0,0 +1,55 @@
using System.Windows;
using HandyControl.Data;
namespace HandyControl.Controls
{
public class SideMenuItem : HeaderedSimpleItemsControl, ISelectable
{
public static readonly DependencyProperty IconProperty = DependencyProperty.Register(
"Icon", typeof(object), typeof(SideMenuItem), new PropertyMetadata(default(object)));
public object Icon
{
get => GetValue(IconProperty);
set => SetValue(IconProperty, value);
}
protected virtual void OnSelected(RoutedEventArgs e) => RaiseEvent(e);
public static readonly RoutedEvent SelectedEvent =
EventManager.RegisterRoutedEvent("Selected", RoutingStrategy.Bubble,
typeof(RoutedEventHandler), typeof(SideMenuItem));
public event RoutedEventHandler Selected
{
add => AddHandler(SelectedEvent, value);
remove => RemoveHandler(SelectedEvent, value);
}
public static readonly DependencyProperty IsSelectedProperty = DependencyProperty.Register(
"IsSelected", typeof(bool), typeof(SideMenuItem), new PropertyMetadata(ValueBoxes.FalseBox));
public bool IsSelected
{
get => (bool) GetValue(IsSelectedProperty);
set => SetValue(IsSelectedProperty, value);
}
private static readonly DependencyPropertyKey RolePropertyKey =
DependencyProperty.RegisterReadOnly(nameof(Role), typeof(SideMenuItemRole), typeof(SideMenuItem),
new PropertyMetadata(SideMenuItemRole.Header));
public static readonly DependencyProperty RoleProperty = RolePropertyKey.DependencyProperty;
public SideMenuItemRole Role => (SideMenuItemRole) GetValue(RoleProperty);
protected override DependencyObject GetContainerForItemOverride() => new SideMenuItem();
protected override bool IsItemItsOwnContainerOverride(object item) => item is SideMenuItem;
private void UpdateRole()
{
}
}
}
@@ -0,0 +1,8 @@
namespace HandyControl.Data
{
public enum SideMenuItemRole
{
Header,
Item
}
}
@@ -0,0 +1,9 @@
namespace HandyControl.Data
{
public class HandyControlConfig
{
public SystemVersionInfo SystemVersionInfo { get; set; }
public string Lang { get; set; }
}
}
@@ -25,6 +25,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\VisualElement.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\WindowAttach.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Base\HeaderedSelectableItem.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Base\HeaderedSimpleItemsControl.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Base\IGravatarGenerator.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Base\ISelectable.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Base\ISingleOpen.cs" />
@@ -78,6 +79,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Controls\Rate\Rate.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Rate\RateItem.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\SideMenu\SideMenu.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\SideMenu\SideMenuItem.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\CompareSlider.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\CompareTrack.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\PreviewSlider.cs" />
@@ -113,6 +115,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Data\Enum\InfoType.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Enum\IpType.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Enum\ResultType.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Enum\SideMenuItemRole.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Enum\SkinType.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Enum\StepStatus.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Enum\TextType.cs" />
@@ -124,6 +127,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Data\Gif\GifPropertyItemInternal.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Gif\GPStream.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\GrowlInfo.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\HandyControlConfig.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\MessageBoxInfo.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Operation\OperationResult!1.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Data\Operation\OperationResult.cs" />
@@ -222,6 +226,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Tools\Helper\AnimationHelper.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\Helper\ArithmeticHelper.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\Helper\ColorHelper.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\Helper\ConfigHelper.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\Helper\CreateParams.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\Helper\DesignerHelper.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\Helper\ExternDllHelper.cs" />
@@ -2,8 +2,45 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:HandyControl.Controls">
<Style x:Key="SideMenuBaseStyle" TargetType="controls:SideMenu">
<Style x:Key="SideMenuItemBaseStyle" TargetType="controls:SideMenuItem">
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="MinHeight" Value="44"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:SideMenuItem">
<Border BorderThickness="4,0,0,0" Name="BorderRoot" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}">
<DockPanel Margin="{TemplateBinding Padding}">
<ContentPresenter Width="36" ContentSource="Icon" Name="PresenterIcon"/>
<ContentPresenter ContentSource="Header" Margin="6,0,0,0" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"/>
</DockPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="Icon" Value="{x:Null}">
<Setter TargetName="PresenterIcon" Property="Visibility" Value="Collapsed"/>
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}"/>
<Setter Property="Background" Value="{DynamicResource BackgroundBrush}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="SideMenuBaseStyle" TargetType="controls:SideMenu">
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="ItemContainerStyle" Value="{StaticResource SideMenuItemBaseStyle}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:SideMenu">
<Border Name="BorderRoot">
<StackPanel x:Name="PART_Panel"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
@@ -1,6 +1,7 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:HandyControl.Controls">
xmlns:controls="clr-namespace:HandyControl.Controls"
xmlns:tools="clr-namespace:HandyControl.Tools">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="../Basic/Geometries.xaml"/>
@@ -232,6 +233,7 @@
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="Language" Value="{Binding Lang,Source={x:Static tools:ConfigHelper.Instance}}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="CalendarDayButtonStyle" Value="{StaticResource CalendarDayButtonStyle}"/>
<Setter Property="CalendarButtonStyle" Value="{StaticResource CalendarButtonStyle}"/>
@@ -0,0 +1,60 @@
using System;
using System.ComponentModel;
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Windows;
using System.Windows.Markup;
using HandyControl.Controls;
using HandyControl.Data;
namespace HandyControl.Tools
{
public class ConfigHelper : INotifyPropertyChanged
{
private ConfigHelper()
{
}
public static ConfigHelper Instance = new Lazy<ConfigHelper>(() => new ConfigHelper()).Value;
private XmlLanguage _lang = XmlLanguage.GetLanguage("zh-cn");
public XmlLanguage Lang
{
get => _lang;
set
{
if (!_lang.IetfLanguageTag.Equals(value.IetfLanguageTag))
{
_lang = value;
OnPropertyChanged();
}
}
}
public void SetSystemVersionInfo(SystemVersionInfo info)
{
BlurWindow.SystemVersionInfo = info;
}
public void SetLang(string lang)
{
Application.Current.Dispatcher.Thread.CurrentUICulture = new CultureInfo(lang);
Lang = XmlLanguage.GetLanguage(lang);
}
public void SetConfig(HandyControlConfig config)
{
SetSystemVersionInfo(config.SystemVersionInfo);
SetLang(config.Lang);
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}