36 lines
1.0 KiB
C#
36 lines
1.0 KiB
C#
using System;
|
|
using System.Windows;
|
|
|
|
namespace Sinvo.EplanHpD.Plugin.WPFUI.Utils
|
|
{
|
|
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")
|
|
}
|
|
};
|
|
}
|
|
}
|
|
}
|
|
}
|