completed the branch

This commit is contained in:
NaBian committed 2019-08-13 23:36:13 +08:00
1 parent 86c58476c6
commit d25ff966c2
17 files changed
+152 -18

No files matched your search

@@ -328,6 +328,7 @@
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\PaginationDemoViewModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\SearchBarDemoViewModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\SideMenuDemoViewModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\SpriteDemoViewModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\StepBarDemoViewModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\TabControlDemoViewModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\WindowDemoViewModel.cs" />
@@ -339,6 +340,9 @@
<Compile Include="$(MSBuildThisFileDirectory)Window\AboutWindow.xaml.cs">
<DependentUpon>AboutWindow.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Main\AppSprite.xaml.cs">
<DependentUpon>AppSprite.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Window\BlurWindow.xaml.cs">
<DependentUpon>BlurWindow.xaml</DependentUpon>
</Compile>
@@ -787,6 +791,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)UserControl\Main\AppSprite.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Window\BlurWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -987,6 +987,15 @@ namespace HandyControlDemo.Properties.Langs {
}
}
/// <summary>
/// 查找类似 打开精灵 的本地化字符串。
/// </summary>
public static string OpenSprite {
get {
return ResourceManager.GetString("OpenSprite", resourceCulture);
}
}
/// <summary>
/// 查找类似 轮廓文本 的本地化字符串。
/// </summary>
@@ -648,4 +648,7 @@
<data name="Sprite" xml:space="preserve">
<value>Sprite</value>
</data>
<data name="OpenSprite" xml:space="preserve">
<value>Open sprite</value>
</data>
</root>
@@ -648,4 +648,7 @@
<data name="Sprite" xml:space="preserve">
<value>精灵</value>
</data>
<data name="OpenSprite" xml:space="preserve">
<value>打开精灵</value>
</data>
</root>
@@ -94,4 +94,8 @@
<Setter Property="FontSize" Value="14"/>
</Style>
<Style TargetType="hc:Sprite" BasedOn="{StaticResource {x:Type hc:Sprite}}">
<Setter Property="Padding" Value="25"/>
</Style>
</ResourceDictionary>
@@ -1,7 +1,12 @@
<UserControl x:Class="HandyControlDemo.UserControl.SpriteDemoCtl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:userControl="clr-namespace:HandyControlDemo.UserControl"
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
DataContext="{Binding SpriteDemo,Source={StaticResource Locator}}"
Width="300"
Background="{DynamicResource RegionBrush}">
<userControl:UnderConstruction/>
<hc:TransitioningContentControl>
<Button Margin="32" Command="{Binding OpenCmd}" Content="{x:Static langs:Lang.OpenSprite}"/>
</hc:TransitioningContentControl>
</UserControl>
@@ -0,0 +1,9 @@
<hc:SimplePanel x:Class="HandyControlDemo.UserControl.AppSprite"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:hc="https://handyorg.github.io/handycontrol">
<Border Background="White" CornerRadius="20" Effect="{StaticResource EffectShadow4}">
<Path Width="70" Height="70" Data="{StaticResource LogoGeometry}" Fill="#f06632"/>
</Border>
<Button Command="hc:ControlCommands.CloseWindow" CommandParameter="{Binding RelativeSource={RelativeSource Self}}" Visibility="{Binding IsMouseOver,RelativeSource={RelativeSource AncestorType=hc:SimplePanel},Converter={StaticResource Boolean2VisibilityConverter}}" Width="22" Height="22" Style="{StaticResource ButtonIcon}" Foreground="White" hc:IconElement.Geometry="{StaticResource ErrorGeometry}" Padding="0" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,-8,-8,0"/>
</hc:SimplePanel>
@@ -0,0 +1,10 @@
namespace HandyControlDemo.UserControl
{
public partial class AppSprite
{
public AppSprite()
{
InitializeComponent();
}
}
}
@@ -0,0 +1,18 @@
using System;
using GalaSoft.MvvmLight;
using HandyControl.Controls;
using HandyControlDemo.UserControl;
#if netle40
using GalaSoft.MvvmLight.Command;
#else
using GalaSoft.MvvmLight.CommandWpf;
# endif
namespace HandyControlDemo
{
public class SpriteDemoViewModel : ViewModelBase
{
public RelayCommand OpenCmd => new Lazy<RelayCommand>(() =>
new RelayCommand(()=> Sprite.Show(new AppSprite()))).Value;
}
}
@@ -39,6 +39,7 @@ namespace HandyControlDemo.ViewModel
SimpleIoc.Default.Register<TabControlDemoViewModel>();
SimpleIoc.Default.Register<NoUserViewModel>();
SimpleIoc.Default.Register<CardDemoViewModel>();
SimpleIoc.Default.Register<SpriteDemoViewModel>();
}
public static ViewModelLocator Instance => new Lazy<ViewModelLocator>(() =>
@@ -90,6 +91,8 @@ namespace HandyControlDemo.ViewModel
public CardDemoViewModel CardDemo => new CardDemoViewModel(ServiceLocator.Current.GetInstance<DataService>());
public SpriteDemoViewModel SpriteDemo => ServiceLocator.Current.GetInstance<SpriteDemoViewModel>();
#endregion
}
}
@@ -1,6 +1,9 @@
using System.Windows;
using System;
using System.Windows;
using System.Windows.Input;
using System.Windows.Interop;
using HandyControl.Data;
using HandyControl.Tools.Interop;
namespace HandyControl.Controls
{
@@ -21,7 +24,7 @@ namespace HandyControl.Controls
{
if ((bool)e.NewValue)
{
ctl.MouseLeftButtonDown += DragElement_MouseLeftButtonDown; ;
ctl.MouseLeftButtonDown += DragElement_MouseLeftButtonDown;
}
else
{
@@ -69,5 +72,40 @@ namespace HandyControl.Controls
public static bool GetIgnoreAltF4(DependencyObject element)
=> (bool) element.GetValue(IgnoreAltF4Property);
public static readonly DependencyProperty ShowInTaskManagerProperty = DependencyProperty.RegisterAttached(
"ShowInTaskManager", typeof(bool), typeof(WindowAttach), new PropertyMetadata(ValueBoxes.TrueBox, OnShowInTaskManagerChanged));
private static void OnShowInTaskManagerChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (d is System.Windows.Window window)
{
if ((bool)e.NewValue)
{
window.SourceInitialized -= Window_SourceInitialized;
}
else
{
window.SourceInitialized += Window_SourceInitialized;
}
}
}
private static void Window_SourceInitialized(object sender, EventArgs e)
{
if (sender is System.Windows.Window window)
{
var _ = new WindowInteropHelper(window)
{
Owner = NativeMethods.GetDesktopWindow()
};
}
}
public static void SetShowInTaskManager(DependencyObject element, bool value)
=> element.SetValue(ShowInTaskManagerProperty, value);
public static bool GetShowInTaskManager(DependencyObject element)
=> (bool) element.GetValue(ShowInTaskManagerProperty);
}
}
@@ -1,8 +1,5 @@
using System;
using System.Windows;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Interop;
using HandyControl.Tools.Interop;
namespace HandyControl.Controls
{
@@ -26,16 +23,6 @@ namespace HandyControl.Controls
GrowlPanel = GetTemplateChild(ElementGrowPanel) as Panel;
}
protected override void OnSourceInitialized(EventArgs e)
{
base.OnSourceInitialized(e);
var _ = new WindowInteropHelper(this)
{
Owner = NativeMethods.GetDesktopWindow()
};
}
public void Init()
{
var desktopWorkingArea = SystemParameters.WorkArea;
@@ -31,6 +31,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\RangeSlider\RangeThumb.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\RangeSlider\TwoWayRangeBase.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\RunningBlock.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Commands\CloseWindowCommand.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Commands\OpenLinkCommand.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\BorderCircularClipConverter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\Number2PercentageConverter.cs" />
@@ -763,6 +764,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\Sprite.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\StepBar.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -0,0 +1,24 @@
using System;
using System.Windows;
using System.Windows.Input;
namespace HandyControl.Interactivity
{
public class CloseWindowCommand : ICommand
{
public bool CanExecute(object parameter) => true;
public void Execute(object parameter)
{
if (parameter is DependencyObject dependencyObject)
{
if (Window.GetWindow(dependencyObject) is Window window)
{
window.Close();
}
}
}
public event EventHandler CanExecuteChanged;
}
}
@@ -156,5 +156,10 @@ namespace HandyControl.Interactivity
/// 前置主窗口
/// </summary>
public static PushMainWindow2TopCommand PushMainWindow2Top { get; } = new PushMainWindow2TopCommand();
/// <summary>
/// 关闭窗口
/// </summary>
public static CloseWindowCommand CloseWindow { get; } = new CloseWindowCommand();
}
}
@@ -11,6 +11,8 @@
</ResourceDictionary.MergedDictionaries>
<Style TargetType="controls:GrowlWindow">
<Setter Property="controls:WindowAttach.IgnoreAltF4" Value="True"/>
<Setter Property="controls:WindowAttach.ShowInTaskManager" Value="False"/>
<Setter Property="Width" Value="340"/>
<Setter Property="MaxWidth" Value="340"/>
<Setter Property="Background" Value="Transparent"/>
@@ -71,6 +71,7 @@
<ResourceDictionary Source="Magnifier.xaml"/>
<ResourceDictionary Source="ToggleBlock.xaml"/>
<ResourceDictionary Source="RunningBlock.xaml"/>
<ResourceDictionary Source="Sprite.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>