From 4b5a88834c7e9b1a7ce5f4014eeaf9f5b5d465cd Mon Sep 17 00:00:00 2001 From: cuiliang Date: Wed, 25 Nov 2020 10:17:58 +0800 Subject: [PATCH 1/5] Add ButtonDefault Style, So that users can customize based on the default style. --- .../HandyControl_Shared/Themes/Styles/Button.xaml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Button.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Button.xaml index 41b8c2a1..ac84338a 100644 --- a/src/Shared/HandyControl_Shared/Themes/Styles/Button.xaml +++ b/src/Shared/HandyControl_Shared/Themes/Styles/Button.xaml @@ -10,19 +10,24 @@ - + From 26dab18c0a5c5cb2b30fff7ce8adbf7fb8629837 Mon Sep 17 00:00:00 2001 From: cuiliang Date: Wed, 25 Nov 2020 11:51:03 +0800 Subject: [PATCH 2/5] =?UTF-8?q?Fix=EF=BC=9A=E6=A3=80=E6=9F=A5=E6=A1=86?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E6=97=A0=E6=B3=95=E9=A1=B6=E7=AB=AF=E5=AF=B9?= =?UTF-8?q?=E9=BD=90=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Themes/Styles/Base/CheckBoxBaseStyle.xaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/CheckBoxBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/CheckBoxBaseStyle.xaml index 1de71209..d4116f39 100644 --- a/src/Shared/HandyControl_Shared/Themes/Styles/Base/CheckBoxBaseStyle.xaml +++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/CheckBoxBaseStyle.xaml @@ -49,8 +49,8 @@ - - + + From 837a8ad04e9c2421b9d218d94c65e0f6e56759f2 Mon Sep 17 00:00:00 2001 From: lwq Date: Thu, 26 Nov 2020 13:46:18 +0800 Subject: [PATCH 3/5] fixd using FatalGlobal not in dispather caused attempt to access control and throw an UnvalidOprationException --- .../HandyControl_Shared/Controls/Growl/Growl.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Shared/HandyControl_Shared/Controls/Growl/Growl.cs b/src/Shared/HandyControl_Shared/Controls/Growl/Growl.cs index 19f4ee51..0e1842a6 100644 --- a/src/Shared/HandyControl_Shared/Controls/Growl/Growl.cs +++ b/src/Shared/HandyControl_Shared/Controls/Growl/Growl.cs @@ -485,7 +485,19 @@ namespace HandyControl.Controls growlInfo.IconBrushKey = ResourceToken.PrimaryTextBrush; growlInfo.StaysOpen = true; growlInfo.ShowCloseButton = false; - if (GrowlPanel.ContextMenu != null) GrowlPanel.ContextMenu.Opacity = 0; + Application.Current.Dispatcher?.Invoke( +#if NET40 + new Action( +#endif + () => + { + if (GrowlPanel.ContextMenu != null) GrowlPanel.ContextMenu.Opacity = 0; + } + +#if NET40 + ) +#endif + ); } else { From 2bb261859206fbb5b1f5c3952723e79629af45e4 Mon Sep 17 00:00:00 2001 From: NaBian <836904362@qq.com> Date: Thu, 26 Nov 2020 22:26:25 +0800 Subject: [PATCH 4/5] synchronize RepeatButton & ToggleButton --- .../Themes/Styles/Base/CheckBoxBaseStyle.xaml | 2 +- .../HandyControl_Shared/Themes/Styles/Button.xaml | 13 +++++-------- .../Themes/Styles/RepeatButton.xaml | 9 ++++++++- .../Themes/Styles/ToggleButton.xaml | 4 +++- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/CheckBoxBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/CheckBoxBaseStyle.xaml index d4116f39..1213ccdb 100644 --- a/src/Shared/HandyControl_Shared/Themes/Styles/Base/CheckBoxBaseStyle.xaml +++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/CheckBoxBaseStyle.xaml @@ -49,7 +49,7 @@ - + diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Button.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Button.xaml index ac84338a..91314274 100644 --- a/src/Shared/HandyControl_Shared/Themes/Styles/Button.xaml +++ b/src/Shared/HandyControl_Shared/Themes/Styles/Button.xaml @@ -10,23 +10,20 @@ - - + + + + + + diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/ToggleButton.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/ToggleButton.xaml index 1e73d5c1..a0aff0af 100644 --- a/src/Shared/HandyControl_Shared/Themes/Styles/ToggleButton.xaml +++ b/src/Shared/HandyControl_Shared/Themes/Styles/ToggleButton.xaml @@ -9,7 +9,7 @@ - + From 57f500bcf7a6871607d387b5868842d6d39149d5 Mon Sep 17 00:00:00 2001 From: NaBian <836904362@qq.com> Date: Thu, 26 Nov 2020 22:59:59 +0800 Subject: [PATCH 5/5] Update Growl.cs --- .../Controls/Growl/Growl.cs | 99 +++++++++---------- 1 file changed, 49 insertions(+), 50 deletions(-) diff --git a/src/Shared/HandyControl_Shared/Controls/Growl/Growl.cs b/src/Shared/HandyControl_Shared/Controls/Growl/Growl.cs index 0e1842a6..337ad319 100644 --- a/src/Shared/HandyControl_Shared/Controls/Growl/Growl.cs +++ b/src/Shared/HandyControl_Shared/Controls/Growl/Growl.cs @@ -353,28 +353,28 @@ namespace HandyControl.Controls new Action( #endif () => + { + var ctl = new Growl { - var ctl = new Growl - { - Message = growlInfo.Message, - Time = DateTime.Now, - Icon = ResourceHelper.GetResource(growlInfo.IconKey), - IconBrush = ResourceHelper.GetResource(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); - } + Message = growlInfo.Message, + Time = DateTime.Now, + Icon = ResourceHelper.GetResource(growlInfo.IconKey), + IconBrush = ResourceHelper.GetResource(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 - ); + ); } /// @@ -386,40 +386,40 @@ namespace HandyControl.Controls Application.Current.Dispatcher?.Invoke( #if NET40 new Action( -#endif +#endif () => + { + var ctl = new Growl { - var ctl = new Growl + Message = growlInfo.Message, + Time = DateTime.Now, + Icon = ResourceHelper.GetResource(growlInfo.IconKey), + IconBrush = ResourceHelper.GetResource(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)) { - Message = growlInfo.Message, - Time = DateTime.Now, - Icon = ResourceHelper.GetResource(growlInfo.IconKey), - IconBrush = ResourceHelper.GetResource(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); + panel?.Children.Insert(0, ctl); } } + else + { + GrowlPanel?.Children.Insert(0, ctl); + } + } #if NET40 - ) + ) #endif - ); + ); } private static void InitGrowlInfo(ref GrowlInfo growlInfo, InfoType infoType) @@ -491,13 +491,12 @@ namespace HandyControl.Controls #endif () => { - if (GrowlPanel.ContextMenu != null) GrowlPanel.ContextMenu.Opacity = 0; + if (GrowlPanel.ContextMenu != null) GrowlPanel.ContextMenu.Opacity = 0; } - #if NET40 - ) + ) #endif - ); + ); } else {