minor modify

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

No files matched your search

@@ -5,6 +5,7 @@
xmlns:ex="clr-namespace:HandyControlDemo.Tools.Extension" xmlns:ex="clr-namespace:HandyControlDemo.Tools.Extension"
xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:data="clr-namespace:HandyControlDemo.Data" xmlns:data="clr-namespace:HandyControlDemo.Data"
xmlns:system="clr-namespace:System;assembly=System.Runtime"
hc:Dialog.Token="{x:Static data:MessageToken.DialogContainer}" hc:Dialog.Token="{x:Static data:MessageToken.DialogContainer}"
Background="{DynamicResource RegionBrush}" Background="{DynamicResource RegionBrush}"
MinWidth="500" MinWidth="500"
@@ -15,7 +16,11 @@
<StackPanel Margin="32" VerticalAlignment="Center"> <StackPanel Margin="32" VerticalAlignment="Center">
<Button Content="{ex:Lang Key={x:Static langs:LangKeys.TextDialog}}" Command="{Binding ShowTextCmd}" /> <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.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}}"/> <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,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}"/> <Button Margin="0,32,0,0" Content="{ex:Lang Key={x:Static langs:LangKeys.NewWindow}}" Command="{Binding NewWindowCmd}"/>
@@ -348,47 +348,33 @@ namespace HandyControl.Controls
GrowlWindow.Show(true); GrowlWindow.Show(true);
Application.Current.Dispatcher?.Invoke(
#if NET40 #if NET40
Application.Current.Dispatcher?.Invoke(new Action(() => 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 #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> /// <summary>
@@ -397,67 +383,43 @@ namespace HandyControl.Controls
/// <param name="growlInfo"></param> /// <param name="growlInfo"></param>
private static void Show(GrowlInfo growlInfo) private static void Show(GrowlInfo growlInfo)
{ {
Application.Current.Dispatcher?.Invoke(
#if NET40 #if NET40
Application.Current.Dispatcher?.Invoke(new Action(() => 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 #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) private static void InitGrowlInfo(ref GrowlInfo growlInfo, InfoType infoType)
@@ -72,7 +72,7 @@ namespace HandyControl.Controls
} }
public static readonly DependencyProperty AutoSizeEnabledProperty = DependencyProperty.Register( 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 public bool AutoSizeEnabled
{ {
@@ -81,7 +81,7 @@ namespace HandyControl.Controls
} }
public static readonly DependencyProperty MarkMarginProperty = DependencyProperty.Register( 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 public Thickness MarkMargin
{ {
@@ -2,23 +2,23 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib"> 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="PrimaryColor">#326cf3</Color>
<Color x:Key="DarkPrimaryColor">#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="DangerColor">#db3340</Color>
<Color x:Key="DarkDangerColor">#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="WarningColor">#e9af20</Color>
<Color x:Key="DarkWarningColor">#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="InfoColor">#00bcd4</Color>
<Color x:Key="DarkInfoColor">#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="SuccessColor">#2db84d</Color>
<Color x:Key="DarkSuccessColor">#2db84d</Color> <Color x:Key="DarkSuccessColor">#2db84d</Color>
@@ -88,11 +88,11 @@
</interactivity:RoutedEventTrigger> </interactivity:RoutedEventTrigger>
</interactivity:Interaction.Triggers> </interactivity:Interaction.Triggers>
<RadioButton Name="PART_ButtonFirst" Content="1" IsChecked="True" Style="{StaticResource PaginationButtonStyle}"/> <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"/> <controls:SimpleText FontWeight="Bold" Foreground="{DynamicResource SecondaryTextBrush}" Text="..." VerticalAlignment="Center"/>
</Border> </Border>
<StackPanel Name="PART_PanelMain" Orientation="Horizontal"/> <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"/> <controls:SimpleText FontWeight="Bold" Foreground="{DynamicResource SecondaryTextBrush}" Text="..." VerticalAlignment="Center"/>
</Border> </Border>
<RadioButton Name="PART_ButtonLast" Content="10" Style="{StaticResource PaginationButtonStyle}"/> <RadioButton Name="PART_ButtonLast" Content="10" Style="{StaticResource PaginationButtonStyle}"/>