2024-11-15 15:02:16 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Windows;
|
|
|
|
|
|
2024-12-05 14:37:31 +08:00
|
|
|
|
namespace Sinvo.EplanHpD.Plugin.WPFUI.Extension
|
2024-11-15 15:02:16 +08:00
|
|
|
|
{
|
|
|
|
|
public static class ApplicationExt
|
|
|
|
|
{
|
|
|
|
|
public static void SetMainWindow(this Application application, Window window)
|
|
|
|
|
{
|
|
|
|
|
if (application == null)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentNullException(nameof(application));
|
|
|
|
|
}
|
|
|
|
|
if (window == null)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentNullException(nameof(window));
|
|
|
|
|
}
|
|
|
|
|
application.MainWindow = window;
|
|
|
|
|
}
|
|
|
|
|
public static void InitApplication()
|
|
|
|
|
{
|
|
|
|
|
if (Application.Current == null)
|
|
|
|
|
{
|
|
|
|
|
new System.Windows.Application
|
|
|
|
|
{
|
|
|
|
|
ShutdownMode = ShutdownMode.OnExplicitShutdown,
|
|
|
|
|
Resources = new ResourceDictionary
|
|
|
|
|
{
|
|
|
|
|
Source = new Uri("pack://application:,,,/Sinvo.EplanHpD.Plugin.WPFUI;component/Themes/Theme.xaml")
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|