private void InitializeAfterShown() { WaitPopup.Message = Messages.Message_InitializingResources; WaitPopup.UpdateProgress(0, 0); Application.DoEvents(); var documentPanels = DockPanelControl.Contents.OfType <ProjectDocumentPanel>().ToList(); foreach (var documentPanel in documentPanels) { documentPanel.Enabled = true; documentPanel.DefferedInitialization(); } if (!UIRenderHelper.LoadFreetype6()) { MessageBoxEX.Show(this, Messages.Message_CouldNotLoadFreetype6, Messages.Caption_UnexpectedError, MessageBoxButtons.OK, MessageBoxIcon.Warning); } Task.Factory.StartNew(() => { ViewportPanel.InitGlResourcesAsync(); BeginInvoke(new MethodInvoker(OnInitializationFinished)); }); }
private void CheckCanRecoverProject() { SettingsManager.CleanUpFilesHistory(); if (SettingsManager.Current.OpenedProjects.Count > 0) { bool projectWasLoaded = false; foreach (var fileInfo in SettingsManager.Current.OpenedProjects.ToArray()) { //project was not correctly closed if (File.Exists(fileInfo.TemporaryPath)) { if (projectWasLoaded) { continue; } if (MultiInstanceManager.InstanceCount > 1) { bool isOpenInOtherInstance = MultiInstanceManager.CheckFileIsOpen(fileInfo.TemporaryPath); if (isOpenInOtherInstance) { return; } } bool projectRestored = false; if (MessageBoxEX.Show(this, Messages.Message_RecoverProject, Messages.Caption_RecoverLastProject, MessageBoxButtons.YesNo) == DialogResult.Yes) { PartProject loadedProject = null; try { loadedProject = PartProject.Open(fileInfo.TemporaryPath); loadedProject.ProjectPath = fileInfo.ProjectFile; if (LoadPartProject(loadedProject, fileInfo.TemporaryPath)) { projectRestored = true; projectWasLoaded = true; } } catch (Exception ex) { MessageBoxEX.ShowDetails(this, Messages.Error_OpeningProject, Messages.Caption_OpeningProject, ex.ToString()); //exceptionThrown = true; } } if (!projectRestored) { ProjectManager.DeleteTemporaryProject(fileInfo.TemporaryPath); } break; } } } }