minor modify

This commit is contained in:
NaBian committed 2020-05-25 23:09:15 +08:00
1 parent 7433e25930
commit 1e17137bd3
6 files changed
+93 -126

No files matched your search

@@ -1,17 +1,17 @@
<hc:Window x:Class="HandyControlDemo.MainWindow"
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"
xmlns:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d"
Title="HandyControlDemo"
ShowTitle="False"
Background="{DynamicResource SecondaryRegionBrush}"
ResizeMode="CanResizeWithGrip"
WindowStartupLocation="CenterScreen"
d:DesignHeight="800"
d:DesignWidth="1400"
Icon="/HandyControlDemo;component/Resources/Img/icon.ico">
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"
xmlns:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d"
Title="HandyControlDemo"
ShowTitle="False"
Background="{DynamicResource SecondaryRegionBrush}"
ResizeMode="CanResizeWithGrip"
WindowStartupLocation="CenterScreen"
d:DesignHeight="800"
d:DesignWidth="1400"
Icon="/HandyControlDemo;component/Resources/Img/icon.ico">
<ContentControl Name="ControlMain"/>
</hc:Window>
@@ -5,6 +5,7 @@
xmlns:ex="clr-namespace:HandyControlDemo.Tools.Extension"
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:data="clr-namespace:HandyControlDemo.Data"
xmlns:system="clr-namespace:System;assembly=System.Runtime"
hc:Dialog.Token="{x:Static data:MessageToken.DialogContainer}"
Background="{DynamicResource RegionBrush}"
MinWidth="500"
@@ -15,7 +16,11 @@
<StackPanel Margin="32" VerticalAlignment="Center">
<Button Content="{ex:Lang Key={x:Static langs:LangKeys.TextDialog}}" Command="{Binding ShowTextCmd}" />
<Button Margin="0,32,0,0" Content="{ex:Lang Key={x:Static langs:LangKeys.TextDialogInControl}}" Command="{Binding ShowTextCmd}" CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType=UserControl}}"/>
<Button Margin="0,32,0,0" Content="{ex:Lang Key={x:Static langs:LangKeys.TextDialogWithTimer}}" Command="{Binding ShowInteractiveDialogCmd}" CommandParameter="True"/>
<Button Margin="0,32,0,0" Content="{ex:Lang Key={x:Static langs:LangKeys.TextDialogWithTimer}}" Command="{Binding ShowInteractiveDialogCmd}">
<Button.CommandParameter>
<system:Boolean>True</system:Boolean>
</Button.CommandParameter>
</Button>
<TextBox Margin="0,32,0,0" Text="{Binding DialogResult,UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource TextBoxExtend}" hc:InfoElement.Placeholder="{ex:Lang Key={x:Static langs:LangKeys.PleaseInput}}"/>
<Button Margin="0,10,0,0" Content="{ex:Lang Key={x:Static langs:LangKeys.InteractiveDialog}}" Command="{Binding ShowInteractiveDialogCmd}"/>
<Button Margin="0,32,0,0" Content="{ex:Lang Key={x:Static langs:LangKeys.NewWindow}}" Command="{Binding NewWindowCmd}"/>
@@ -207,7 +207,7 @@ namespace HandyControl.Controls
=> element.SetValue(TokenProperty, value);
public static string GetToken(DependencyObject element)
=> (string) element.GetValue(TokenProperty);
=> (string)element.GetValue(TokenProperty);
public static void SetGrowlParent(DependencyObject element, bool value) => element.SetValue(GrowlParentProperty, value);
@@ -348,47 +348,33 @@ namespace HandyControl.Controls
GrowlWindow.Show(true);
Application.Current.Dispatcher?.Invoke(
#if NET40
Application.Current.Dispatcher?.Invoke(new Action(() =>
{
var ctl = new Growl
{
Message = growlInfo.Message,
Time = DateTime.Now,
Icon = ResourceHelper.GetResource<Geometry>(growlInfo.IconKey),
IconBrush = ResourceHelper.GetResource<Brush>(growlInfo.IconBrushKey),
_showCloseButton = growlInfo.ShowCloseButton,
ActionBeforeClose = growlInfo.ActionBeforeClose,
_staysOpen = growlInfo.StaysOpen,
ShowDateTime = growlInfo.ShowDateTime,
ConfirmStr = growlInfo.ConfirmStr,
CancelStr = growlInfo.CancelStr,
Type = growlInfo.Type,
_waitTime = Math.Max(growlInfo.WaitTime, 2)
};
GrowlWindow.GrowlPanel.Children.Insert(0, ctl);
}));
#else
Application.Current.Dispatcher?.Invoke(() =>
{
var ctl = new Growl
{
Message = growlInfo.Message,
Time = DateTime.Now,
Icon = ResourceHelper.GetResource<Geometry>(growlInfo.IconKey),
IconBrush = ResourceHelper.GetResource<Brush>(growlInfo.IconBrushKey),
_showCloseButton = growlInfo.ShowCloseButton,
ActionBeforeClose = growlInfo.ActionBeforeClose,
_staysOpen = growlInfo.StaysOpen,
ShowDateTime = growlInfo.ShowDateTime,
ConfirmStr = growlInfo.ConfirmStr,
CancelStr = growlInfo.CancelStr,
Type = growlInfo.Type,
_waitTime = Math.Max(growlInfo.WaitTime, 2)
};
GrowlWindow.GrowlPanel.Children.Insert(0, ctl);
});
#endif
new Action(
#endif
() =>
{
var ctl = new Growl
{
Message = growlInfo.Message,
Time = DateTime.Now,
Icon = ResourceHelper.GetResource<Geometry>(growlInfo.IconKey),
IconBrush = ResourceHelper.GetResource<Brush>(growlInfo.IconBrushKey),
_showCloseButton = growlInfo.ShowCloseButton,
ActionBeforeClose = growlInfo.ActionBeforeClose,
_staysOpen = growlInfo.StaysOpen,
ShowDateTime = growlInfo.ShowDateTime,
ConfirmStr = growlInfo.ConfirmStr,
CancelStr = growlInfo.CancelStr,
Type = growlInfo.Type,
_waitTime = Math.Max(growlInfo.WaitTime, 2)
};
GrowlWindow.GrowlPanel.Children.Insert(0, ctl);
}
#if NET40
)
#endif
);
}
/// <summary>
@@ -397,67 +383,43 @@ namespace HandyControl.Controls
/// <param name="growlInfo"></param>
private static void Show(GrowlInfo growlInfo)
{
Application.Current.Dispatcher?.Invoke(
#if NET40
Application.Current.Dispatcher?.Invoke(new Action(() =>
{
var ctl = new Growl
{
Message = growlInfo.Message,
Time = DateTime.Now,
Icon = ResourceHelper.GetResource<Geometry>(growlInfo.IconKey),
IconBrush = ResourceHelper.GetResource<Brush>(growlInfo.IconBrushKey),
_showCloseButton = growlInfo.ShowCloseButton,
ActionBeforeClose = growlInfo.ActionBeforeClose,
_staysOpen = growlInfo.StaysOpen,
ShowDateTime = growlInfo.ShowDateTime,
ConfirmStr = growlInfo.ConfirmStr,
CancelStr = growlInfo.CancelStr,
Type = growlInfo.Type,
_waitTime = Math.Max(growlInfo.WaitTime, 2)
};
if (!string.IsNullOrEmpty(growlInfo.Token))
{
if (PanelDic.TryGetValue(growlInfo.Token, out var panel))
{
panel?.Children.Insert(0, ctl);
}
}
else
{
GrowlPanel.Children.Insert(0, ctl);
}
}));
#else
Application.Current.Dispatcher?.Invoke(() =>
{
var ctl = new Growl
{
Message = growlInfo.Message,
Time = DateTime.Now,
Icon = ResourceHelper.GetResource<Geometry>(growlInfo.IconKey),
IconBrush = ResourceHelper.GetResource<Brush>(growlInfo.IconBrushKey),
_showCloseButton = growlInfo.ShowCloseButton,
ActionBeforeClose = growlInfo.ActionBeforeClose,
_staysOpen = growlInfo.StaysOpen,
ShowDateTime = growlInfo.ShowDateTime,
ConfirmStr = growlInfo.ConfirmStr,
CancelStr = growlInfo.CancelStr,
Type = growlInfo.Type,
_waitTime = Math.Max(growlInfo.WaitTime, 2)
};
if (!string.IsNullOrEmpty(growlInfo.Token))
{
if (PanelDic.TryGetValue(growlInfo.Token, out var panel))
{
panel?.Children.Insert(0, ctl);
}
}
else
{
GrowlPanel.Children.Insert(0, ctl);
}
});
#endif
new Action(
#endif
() =>
{
var ctl = new Growl
{
Message = growlInfo.Message,
Time = DateTime.Now,
Icon = ResourceHelper.GetResource<Geometry>(growlInfo.IconKey),
IconBrush = ResourceHelper.GetResource<Brush>(growlInfo.IconBrushKey),
_showCloseButton = growlInfo.ShowCloseButton,
ActionBeforeClose = growlInfo.ActionBeforeClose,
_staysOpen = growlInfo.StaysOpen,
ShowDateTime = growlInfo.ShowDateTime,
ConfirmStr = growlInfo.ConfirmStr,
CancelStr = growlInfo.CancelStr,
Type = growlInfo.Type,
_waitTime = Math.Max(growlInfo.WaitTime, 2)
};
if (!string.IsNullOrEmpty(growlInfo.Token))
{
if (PanelDic.TryGetValue(growlInfo.Token, out var panel))
{
panel?.Children.Insert(0, ctl);
}
}
else
{
GrowlPanel?.Children.Insert(0, ctl);
}
}
#if NET40
)
#endif
);
}
private static void InitGrowlInfo(ref GrowlInfo growlInfo, InfoType infoType)
@@ -72,7 +72,7 @@ namespace HandyControl.Controls
}
public static readonly DependencyProperty AutoSizeEnabledProperty = DependencyProperty.Register(
"AutoSizeEnabled", typeof(bool), typeof(Watermark), new PropertyMetadata(ValueBoxes.TrueBox));
"AutoSizeEnabled", typeof(bool), typeof(Watermark), new FrameworkPropertyMetadata(ValueBoxes.TrueBox, FrameworkPropertyMetadataOptions.AffectsRender));
public bool AutoSizeEnabled
{
@@ -81,7 +81,7 @@ namespace HandyControl.Controls
}
public static readonly DependencyProperty MarkMarginProperty = DependencyProperty.Register(
"MarkMargin", typeof(Thickness), typeof(Watermark), new PropertyMetadata(default(Thickness)));
"MarkMargin", typeof(Thickness), typeof(Watermark), new FrameworkPropertyMetadata(default(Thickness), FrameworkPropertyMetadataOptions.AffectsRender));
public Thickness MarkMargin
{
@@ -2,23 +2,23 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<Color x:Key="LightPrimaryColor">#f3fbff</Color>
<Color x:Key="LightPrimaryColor">#044289</Color>
<Color x:Key="PrimaryColor">#326cf3</Color>
<Color x:Key="DarkPrimaryColor">#326cf3</Color>
<Color x:Key="LightDangerColor">#fff6f7</Color>
<Color x:Key="LightDangerColor">#450c0f</Color>
<Color x:Key="DangerColor">#db3340</Color>
<Color x:Key="DarkDangerColor">#db3340</Color>
<Color x:Key="LightWarningColor">#fffcf5</Color>
<Color x:Key="LightWarningColor">#4c3a0f</Color>
<Color x:Key="WarningColor">#e9af20</Color>
<Color x:Key="DarkWarningColor">#e9af20</Color>
<Color x:Key="LightInfoColor">#f1fdff</Color>
<Color x:Key="LightInfoColor">#003c44</Color>
<Color x:Key="InfoColor">#00bcd4</Color>
<Color x:Key="DarkInfoColor">#00bcd4</Color>
<Color x:Key="LightSuccessColor">#f3fff6</Color>
<Color x:Key="LightSuccessColor">#113a1b</Color>
<Color x:Key="SuccessColor">#2db84d</Color>
<Color x:Key="DarkSuccessColor">#2db84d</Color>
@@ -81,18 +81,18 @@
<ControlTemplate TargetType="controls:Pagination">
<StackPanel Orientation="Horizontal">
<Button x:Name="PART_ButtonLeft" MinWidth="30" Padding="10,8" controls:IconElement.Geometry="{StaticResource LeftGeometry}" controls:BorderElement.CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource CornerRadiusSplitConverter},ConverterParameter='1,0,0,1'}" Command="interactivity:ControlCommands.Prev"/>
<StackPanel ZIndex="999" HorizontalAlignment="Center" Orientation="Horizontal">
<StackPanel ZIndex="999" HorizontalAlignment="Center" Orientation="Horizontal">
<interactivity:Interaction.Triggers>
<interactivity:RoutedEventTrigger RoutedEvent="RadioButton.Checked">
<interactivity:EventToCommand Command="interactivity:ControlCommands.Selected" PassEventArgsToCommand="True" />
</interactivity:RoutedEventTrigger>
</interactivity:Interaction.Triggers>
<RadioButton Name="PART_ButtonFirst" Content="1" IsChecked="True" Style="{StaticResource PaginationButtonStyle}"/>
<Border Name="PART_MoreLeft" Cursor="No" Margin="-1,0,0,0" BorderThickness="1" BorderBrush="{TemplateBinding BorderBrush}" Background="{DynamicResource SecondaryRegionBrush}" Padding="10,0">
<Border Name="PART_MoreLeft" VerticalAlignment="Center" Cursor="No" Margin="-1,0,0,0" BorderThickness="1" BorderBrush="{TemplateBinding BorderBrush}" Background="{DynamicResource SecondaryRegionBrush}" Padding="10,0">
<controls:SimpleText FontWeight="Bold" Foreground="{DynamicResource SecondaryTextBrush}" Text="..." VerticalAlignment="Center"/>
</Border>
<StackPanel Name="PART_PanelMain" Orientation="Horizontal"/>
<Border Name="PART_MoreRight" Cursor="No" Margin="-1,0,0,0" BorderThickness="1" BorderBrush="{TemplateBinding BorderBrush}" Background="{DynamicResource SecondaryRegionBrush}" Padding="10,0">
<Border Name="PART_MoreRight" VerticalAlignment="Center" Cursor="No" Margin="-1,0,0,0" BorderThickness="1" BorderBrush="{TemplateBinding BorderBrush}" Background="{DynamicResource SecondaryRegionBrush}" Padding="10,0">
<controls:SimpleText FontWeight="Bold" Foreground="{DynamicResource SecondaryTextBrush}" Text="..." VerticalAlignment="Center"/>
</Border>
<RadioButton Name="PART_ButtonLast" Content="10" Style="{StaticResource PaginationButtonStyle}"/>