Update Growl.cs

This commit is contained in:
NaBian committed 2020-11-26 22:59:59 +08:00
1 parent 8ac36929eb
commit 57f500bcf7
1 file changed
+49 -50
@@ -353,28 +353,28 @@ namespace HandyControl.Controls
new Action( new Action(
#endif #endif
() => () =>
{
var ctl = new Growl
{ {
var ctl = new Growl Message = growlInfo.Message,
{ Time = DateTime.Now,
Message = growlInfo.Message, Icon = ResourceHelper.GetResource<Geometry>(growlInfo.IconKey),
Time = DateTime.Now, IconBrush = ResourceHelper.GetResource<Brush>(growlInfo.IconBrushKey),
Icon = ResourceHelper.GetResource<Geometry>(growlInfo.IconKey), _showCloseButton = growlInfo.ShowCloseButton,
IconBrush = ResourceHelper.GetResource<Brush>(growlInfo.IconBrushKey), ActionBeforeClose = growlInfo.ActionBeforeClose,
_showCloseButton = growlInfo.ShowCloseButton, _staysOpen = growlInfo.StaysOpen,
ActionBeforeClose = growlInfo.ActionBeforeClose, ShowDateTime = growlInfo.ShowDateTime,
_staysOpen = growlInfo.StaysOpen, ConfirmStr = growlInfo.ConfirmStr,
ShowDateTime = growlInfo.ShowDateTime, CancelStr = growlInfo.CancelStr,
ConfirmStr = growlInfo.ConfirmStr, Type = growlInfo.Type,
CancelStr = growlInfo.CancelStr, _waitTime = Math.Max(growlInfo.WaitTime, 2)
Type = growlInfo.Type, };
_waitTime = Math.Max(growlInfo.WaitTime, 2) GrowlWindow.GrowlPanel.Children.Insert(0, ctl);
}; }
GrowlWindow.GrowlPanel.Children.Insert(0, ctl);
}
#if NET40 #if NET40
) )
#endif #endif
); );
} }
/// <summary> /// <summary>
@@ -386,40 +386,40 @@ namespace HandyControl.Controls
Application.Current.Dispatcher?.Invoke( Application.Current.Dispatcher?.Invoke(
#if NET40 #if NET40
new Action( new Action(
#endif #endif
() => () =>
{
var ctl = new Growl
{ {
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))
{ {
Message = growlInfo.Message, panel?.Children.Insert(0, ctl);
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
{
GrowlPanel?.Children.Insert(0, ctl);
}
}
#if NET40 #if NET40
) )
#endif #endif
); );
} }
private static void InitGrowlInfo(ref GrowlInfo growlInfo, InfoType infoType) private static void InitGrowlInfo(ref GrowlInfo growlInfo, InfoType infoType)
@@ -491,13 +491,12 @@ namespace HandyControl.Controls
#endif #endif
() => () =>
{ {
if (GrowlPanel.ContextMenu != null) GrowlPanel.ContextMenu.Opacity = 0; if (GrowlPanel.ContextMenu != null) GrowlPanel.ContextMenu.Opacity = 0;
} }
#if NET40 #if NET40
) )
#endif #endif
); );
} }
else else
{ {