diff --git a/src/Shared/HandyControl_Shared/Controls/Growl/Growl.cs b/src/Shared/HandyControl_Shared/Controls/Growl/Growl.cs index 19f4ee51..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) @@ -485,7 +485,18 @@ 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 { diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Button.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Button.xaml index 41b8c2a1..91314274 100644 --- a/src/Shared/HandyControl_Shared/Themes/Styles/Button.xaml +++ b/src/Shared/HandyControl_Shared/Themes/Styles/Button.xaml @@ -10,9 +10,9 @@ - + diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/RepeatButton.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/RepeatButton.xaml index 11bc0b7b..48435c16 100644 --- a/src/Shared/HandyControl_Shared/Themes/Styles/RepeatButton.xaml +++ b/src/Shared/HandyControl_Shared/Themes/Styles/RepeatButton.xaml @@ -10,7 +10,7 @@ - + + + + + + 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 @@ - +