/// <summary> /// Create window for the specified project /// </summary> /// <param name="project">Project to create window for</param> private void CreateWindowForProject(Project project) { var form = new ProjectForm(project); form.MdiParent = this; form.Show(); form.WindowState = FormWindowState.Maximized; windowsTabs.RegisterWindow(form); }
/// <summary> /// Push specified project to history list /// </summary> /// <param name="curProject">Project to push to list</param> private void PushIntoHistory(Project curProject) { recentProjects.Add(curProject); if (HistoryChanged != null) HistoryChanged(this, EventArgs.Empty); }
/// <summary> /// Ask user for file name and open project from the specified file. /// Current project will be closed. /// </summary> public Project OpenProject() { // ask user for file name var fileName = ""; var dialog = new OpenFileDialog(); dialog.Filter = "Clever merge project (*.cmp)|*.cmp"; dialog.CheckFileExists = true; var result = dialog.ShowDialog(); if (result == DialogResult.OK) fileName = dialog.FileName; else return null; // load project Project bufProj = null; try { bufProj = SerializationUtility.DeserializeFromFile<Project>(fileName); } catch (SerializationException /*ex*/) { MessageBox.Show("File has wrong format"); return null; } curProject = bufProj; curProject.Path = fileName; PushIntoHistory(curProject); return curProject; }
/// <summary> /// Create new two-side comparison project. Current project will be closed. /// </summary> public Project CreateTwoWayProject() { if (curProject != null) SaveProject(); curProject = new TwoWayProject { Path = "NewTwoSideProject" }; PushIntoHistory(curProject); return curProject; }
/// <summary> /// Close current project. Asks user if project must be saved /// </summary> public void CloseProject() { if (curProject.IsDirty) SaveProject(); curProject = null; }
public TwoSideComparison(Project project) : base(project) { InitializeComponent(); }