private void OpenProject(string path) { try { bool projectAlreadyOpen = childForms.Exists(childForm => childForm is ProjectForm && ((ProjectForm)childForm).Path == path); if (projectAlreadyOpen) { MessageBox.Show(Properties.Resources.ProjectOpenAlreadyText, Properties.Resources.ProjectOpenAlreadyTitle, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { ProjectForm projectForm = (ProjectForm)CreateChildForm(typeof(ProjectForm), DockState.Document); try { projectForm.LoadProject(path); AddRecentlyOpenedProject(path); } catch { projectForm.Close(); throw; } } } catch (Exception ex) { ApplicationState.Default.RaiseNotification(new NotificationEventArgs(NotificationType.Error, string.Format(Properties.Resources.ProjectOpenFailed, ex.Message), ex)); } }
private void OpenProject(Project project) { try { ProjectForm projectForm = (ProjectForm)CreateChildForm(typeof(ProjectForm), DockState.Document); try { projectForm.LoadProject(project); } catch { projectForm.Close(); throw; } } catch (Exception ex) { ApplicationState.Default.RaiseNotification(new NotificationEventArgs(NotificationType.Error, string.Format(Properties.Resources.ProjectOpenFailed, ex.Message), ex)); } }