Sic.Framework-Nanjing-Baishi/UIDebug/SicUI/Bootstrapper.cs

98 lines
3.7 KiB
C#
Raw Normal View History

using Caliburn.Micro;
using Caliburn.Micro.Core;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.ServiceModel.Configuration;
using System.Text.RegularExpressions;
using System.Threading;
using System.Windows;
using System.Xml.Linq;
using Aitex.Core.RT.Log;
using Aitex.Core.Util;
using Aitex.Core.WCF;
using CommandLine;
using MECF.Framework.UI.Client.ClientBase;
using SciChart.Charting.Visuals;
namespace SicUI.Client
{
public class Bootstrapper : BootstrapperBase
{
#region Variables
private Splash _splashScreen;
#endregion
//static Mutex mutex;
//bool isNewMutex;
protected override void OnStartup(object sender, StartupEventArgs e)
{
BaseApp.Instance = new ClientApp();
DisplayRootViewFor<MainViewModel>();
base.OnStartup(sender, e);
}
protected override void OnExit(object sender, EventArgs e)
{
base.OnExit(sender, e);
Singleton<Aitex.Core.RT.Log.LogManager>.Instance.Terminate();
Application.Current.Shutdown();
}
protected override void OnUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
if (e.Exception != null)
{
LOG.Write(e.Exception);
if (e.Exception.InnerException != null)
LOG.Write(e.Exception.InnerException);
}
e.Handled = true;
}
private SimpleContainer container;
public Bootstrapper()
{
SciChartSurface.SetRuntimeLicenseKey("vwAIyu6FysOMMV/v7pag3WEENpK0hDMQx5zbMKYtlb3PMTsV9R+v2toHl/Z2YJ7t/MDVkKCBsZjBxOUs1djpkyLqgCFMlX5DMrKFdP82QRqZRCOht0hQjW5Omy5z9ZRbalxSx4mlgnL/YXWr2JQrD1dWoTeoDP7xm8JB3+KZ4M5pqxeUCib6VvRpfq3O7HVIyFfcDk0JVByjV+vtgGpOo5RP630lKr9VLS3CPk1aUeul4XQAnJX+IafLnsgSKiDWlZMYU9qJehqA1EdwOnEvvOwhcwckJ5/BoeQ0qDvDaYZ1Jfzkcv5sqOYKd749TJ8wsoTDubT/bLv+BwBiXura1mBZlOIE9zB5XwJVedWWzi6dGDG8LRRKh1XjuyD6V92G596xYsb5b8EJJ8AkgsC/R+fLeN/FIZBlq/Vepg+1dwkLlCCtp8nZWBjsRDQWNrG6Vyk5TF2RzI62WrwKfWfNWXtC5wjkJE5IJzUFlj/B/UhCzB8=");
//SciChartSurface.SetRuntimeLicenseKey("e41PBy3F+6CYUmKsD0et09JuQ2ozGaZr8G8w5F0XkCoL1Hj/3o7wjMPkF7qbRHubQz0WZMECsBCMyWI2IW4GsIgaJ8vz8Fv8KomnX419tAErZAwBF3ld6GabG6Sk2g2nlzmO7A6Kv2bCbgudqxZxnalZMbB1PrPeo+c/Mve4weHPMBZpXiZkvMBpsrEWUbDgbjKHUAMyHyihfwFO4WlK+WF6aixbr3/r2KyTgn9DLCpf944CfziAVggPNx3fdIKvdyFfZ3KnFjbMR9/nSXXFV84+rocDwFgjzUrsHoBpSOL3hmgHF4F6XP2OMJOnlHuo0/Z3jqgddawZDpoXxPU6wLQkR5JH8Vy12Pl8/CwE9LV1Qlk+XVXurNkBaazcfcER4Sx1VBarSdEhr9lMrc4u6TW67L0oS51N8yM+hfBORzCVJLpA9P9SibBoB5/lFtPEnKfctOyLUIVNGQglpha9CAMcyqVZWgL6KI2xasw9wk4f1t0CshRoqUbnhzd3nFYvDiYvM9pQigw5F144VZfED2crA05qGtDAbmWGrRc955QqKcPCVTu+C71T+pYVZteCuLe6pK87UdgDRaxQ4yKfVuKL/Q4=");
Initialize();
}
protected override void Configure()
{
container = new SimpleContainer();
container.Singleton<IEventAggregator, EventAggregator>();
container.Singleton<IWindowManager, WindowManager>();
//container.Singleton<IPublisher, Publisher>();
container.PerRequest<MainViewModel>();
}
protected override object GetInstance(Type service, string key)
{
return container.GetInstance(service, key);
}
protected override IEnumerable<object> GetAllInstances(Type service)
{
return container.GetAllInstances(service);
}
protected override void BuildUp(object instance)
{
container.BuildUp(instance);
}
}
}