Sic.Framework-Nanjing-Baishi/UnitTest/MECF.Framework.UI.Client.Test/CustomWndTests.cs

35 lines
897 B
C#

using System.Threading;
using System.Windows;
using OpenSEMI.Ctrlib.Window;
using Xunit;
namespace MECF.Framework.UI.Client.Test
{
public class CustomWndTests
{
[Fact]
public void TitleBarButtonsTest()
{
CustomWnd window = null;
// The dispatcher thread
var t = new Thread(() =>
{
window = new CustomWnd();
// Initiates the dispatcher thread shutdown when the window closes
window.Closed += (s, e) => window.Dispatcher.InvokeShutdown();
window.ShowDialog();
// Makes the thread support message pumping
System.Windows.Threading.Dispatcher.Run();
});
// Configure the thread
t.SetApartmentState(ApartmentState.STA);
t.Start();
t.Join();
}
}
}