예제 #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
#if !DEBUG
            this.DispatcherUnhandledException          += App_DispatcherUnhandledException;
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
#endif
            Logger.Default.Trace("程序启动。");

            base.OnStartup(e);

            LocalizationManager.Manager = new TelerikLocalizationManager();

            //判断是否设置过数据服务IP地址。
            //if (!File.Exists("cctvexe.dat"))
            //{
            //    AppDomain domain = AppDomain.CreateDomain("SettingDomain");
            //    domain.ExecuteAssembly("ConfSetting.exe");
            //    AppDomain.Unload(domain);
            //}

            UIService.PrepareApp();

            var    window  = new MainWindow();
            string appName = getAppName();
            if (appName != null)
            {
                window.Header = appName;
            }
            window.Loaded        += (_s, _e) => UIService.InitWindow(window);
            window.PreviewClosed += (_s, _e) => _e.Cancel = UIService.ExistsOpposerForExit();
            window.Closed        += (_s, _e) => UIService.OnClosed();
            window.Show();
        }