Skip to content

Commit

Permalink
v2.2.14-alpha (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mochengvia authored Nov 27, 2021
1 parent b29f59b commit 15c3855
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 16 deletions.
13 changes: 13 additions & 0 deletions DotNet/WPF/Src/Samples/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@
</pu:MessageBoxXSettings.ButtonStyle>
</pu:MessageBoxXSettings>

<pu:NoticeBoxSettings x:Key="noticeSetting">
<pu:NoticeBoxSettings.NoticeBoxItemStyle>
<Style TargetType="pu:NoticeBoxItem"
BasedOn="{StaticResource {ComponentResourceKey ResourceId=NoticeBoxItemStyle, TypeInTargetAssembly={x:Type pu:NoticeBox}}}">
<Setter Property="Background"
Value="#1E1E1E" />
<Setter Property="BorderBrush"
Value="#4E4E4E" />
<Setter Property="Foreground"
Value="White" />
</Style>
</pu:NoticeBoxSettings.NoticeBoxItemStyle>
</pu:NoticeBoxSettings>

<pu:PendingBoxSettings x:Key="pendingSetting">
<pu:PendingBoxSettings.SpinnerStyle>
Expand Down
7 changes: 6 additions & 1 deletion DotNet/WPF/Src/Samples/Views/MainView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ public MainView()
{
InitExampleItems();
}));

var thread = new Thread(() =>
{
NoticeBox.Show("123", "123");
});
thread.Start();
}
#endregion

Expand Down Expand Up @@ -122,7 +128,6 @@ private UIElement CreatePreviewView(WindowX view, object content)
return border;
}
#endregion

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ public PendingBoxWindow(Window owner, bool interopOwnersMask, Rect? ownerRect, s
_cancelButtonStyle = XamlUtil.FromXaml<Style>(cancelButtonStyle);
_spinnerStyle = XamlUtil.FromXaml<Style>(spinnerStyle);

WindowStartupLocation = (ownerRect != null || owner == null)
? WindowStartupLocation.Manual
WindowStartupLocation = owner == null
? (ownerRect == null ? WindowStartupLocation.CenterScreen : WindowStartupLocation.Manual)
: WindowStartupLocation.CenterOwner;

if (ownerRect == null)
Expand All @@ -76,6 +76,7 @@ public PendingBoxWindow(Window owner, bool interopOwnersMask, Rect? ownerRect, s
else
{
_ownerRect = ownerRect;
Topmost = true;
}
if (owner is WindowX ownerX && interopOwnersMask)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public static INoticeHandler Show(string message, string caption, bool canClose,
#region Functions
private static INoticeHandler Show(string message, string caption, bool canClose, MessageBoxIcon icon, ImageSource imageIcon, int? duration)
{
return Application.Current.Dispatcher.Invoke(new Func<INoticeHandler>(() =>
return (INoticeHandler)Application.Current.Dispatcher.Invoke(new Func<INoticeHandler>(() =>
{
var setting = NoticeBoxSettings.Setting;
var animationEase = setting.AnimationEase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,12 @@ public class NoticeBoxSettings
#region Ctor
static NoticeBoxSettings()
{
Application.Current.Dispatcher.Invoke(new Action(() =>
{
Setting = new NoticeBoxSetting();
}));
Setting = new NoticeBoxSetting();
}
#endregion

#region Static Properties
public static NoticeBoxSetting Setting { get; private set; }
public static NoticeBoxSetting Setting { get; }
#endregion

#region Properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static IPendingHandler Show(Window owner, string message, string caption,
#region Functions
private static IPendingHandler CallPendingBox(Window owner, string message, string caption, bool canCancel)
{
return Application.Current.Dispatcher.Invoke(new Func<IPendingHandler>(() =>
return (IPendingHandler)Application.Current.Dispatcher.Invoke(new Func<IPendingHandler>(() =>
{
var setting = PendingBoxSettings.Setting;
var windowStyle = XamlUtil.ToXaml(setting.WindowStyle);
Expand Down Expand Up @@ -98,12 +98,11 @@ private static IPendingHandler CallPendingBox(Window owner, string message, stri
}));
}

private static Rect GetOwnerRect(Window owner)
private static Rect? GetOwnerRect(Window owner)
{
var rect = new Rect();
if (owner != null)
{
return owner.Dispatcher.Invoke(new Func<Rect>(() =>
return (Rect)owner.Dispatcher.Invoke(new Func<Rect>(() =>
{
var handle = new WindowInteropHelper(owner).Handle;
Win32Util.GetWindowRect(handle, out Win32Util.RECT windowRect);
Expand All @@ -116,7 +115,7 @@ private static Rect GetOwnerRect(Window owner)
};
}));
}
return rect;
return null;
}
#endregion
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.2.13.3")]
[assembly: AssemblyFileVersion("2.2.13.3")]
[assembly: AssemblyVersion("2.2.14")]
[assembly: AssemblyFileVersion("2.2.14")]

0 comments on commit 15c3855

Please sign in to comment.