/// <summary> /// Exiting the application /// </summary> /// <param name="e"></param> protected override void OnExit(ExitEventArgs e) { base.OnExit(e); LogHelper.Begin("App.OnExit"); try { //save catalog list CatalogService.Instance.SaveRepository(); //save the settings CBR.Properties.Settings.Default.CatalogSetting = WorkspaceService.Instance.Settings; CBR.Properties.Settings.Default.Save(); #if DEBUG //save the default resources that are not yet translated CultureManager.Instance.SaveResources(); #endif //save element position and size ElementStateOperations.Save(); //delete the temp folder DirectoryHelper.Cleanup(); } catch (Exception err) { LogHelper.Manage("App.OnExit", err); } LogHelper.End("App.OnExit"); }
protected override void OnExit(ExitEventArgs e) { using (Stream stream = File.Open("VirtoCommerce.xml", FileMode.Create, FileAccess.Write, FileShare.None)) { ElementStateOperations.Save(stream); } base.OnExit(e); }
protected override void OnStartup(StartupEventArgs e) { using (Stream stream = File.Open("ElementStateDemo.xml", FileMode.OpenOrCreate, FileAccess.Read, FileShare.Read)) { ElementStateOperations.Load(stream); } base.OnStartup(e); }
private void ButtonResetLayout_Click(object sender, RoutedEventArgs e) { MainViewModel mvm = this.DataContext as MainViewModel; mvm.ResetLayout(); //avalon //LoadLayout("AvalonDockBackup.config"); //fluent this.ribbonMain.ClearQuickAccessToolBar(); //grid ElementStateOperations.Reset(); }
protected override void OnStartup(StartupEventArgs e) { // Ensure the current culture passed into bindings is the OS culture. // By default, WPF uses en-US as the culture, regardless of the system settings. FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag))); using (Stream stream = File.Open("VirtoCommerce.xml", FileMode.OpenOrCreate, FileAccess.Read, FileShare.Read)) { ElementStateOperations.Load(stream); } Dispatcher.UnhandledException += OnDispatcherUnhandledException; AppDomain.CurrentDomain.UnhandledException += OnDomainUnhandledException; base.OnStartup(e); var bootstrapper = new Bootstrapper(); bootstrapper.Run(); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); LogHelper.Begin("App.OnStartup"); try { // check if IE emulator is well configured if (!ProcessHelper.CheckIERegistry()) { LogHelper.Trace("IE registry is not OK !"); //ProcessHelper.RegisterIE(); } this.DispatcherUnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(App_DispatcherUnhandledException); SplashScreenManager.Splash.Message = "Process settings"; //load element position and size ElementStateOperations.Load(); //load settings from properties WorkspaceService.Instance.Settings = CBR.Properties.Settings.Default.CatalogSetting; //set the starting language from settings if different SplashScreenManager.Splash.Message = "Process cultures"; CultureManager.Instance.UICulture = CultureInfo.GetCultureInfo(WorkspaceService.Instance.Settings.StartingLanguageCode); // Create the ViewModel and expose it using the View's DataContext SplashScreenManager.Splash.Message = "Create the window"; Views.MainView view = new Views.MainView(e.Args); view.Show(); } catch (Exception err) { LogHelper.Manage("App.OnStartup", err); } LogHelper.End("App.OnStartup"); }