void view_OpenProject(object sender, ProjectWithFileNameEventArgs e) { Stream stream = new FileStream(e.ProjectFileName, FileMode.Open, FileAccess.Read, FileShare.Read); try { IFormatter formatter = new BinaryFormatter(); ps = (ProjectSetting)formatter.Deserialize(stream); // wire events again ps.OpenProject(); View.PS = ps; if (ps.WatermarkCollection != null && ps.WatermarkCollection.Count > 0) { View.SelectedWatermarkIndex = 0; } else { View.ClearWatermarkArea(); } this.currentProjectFile = e.ProjectFileName; } catch (Exception ex) { SetErrorMessage(ex); } finally { stream.Close(); this.processing = false; } }
private void newProject() { ProjectWithFileNameEventHandler handlers = NewProjectCreated; if (handlers != null) { ProjectWithFileNameEventArgs args = new ProjectWithFileNameEventArgs(res.LanguageContent.Label_UntitledProjectName); handlers(this, args); //this.currentProjectFile = "Untitled.hsbip"; OnProjectFileNameObtained(); } }
void view_NewProjectCreated(object sender, ProjectWithFileNameEventArgs e) { ps = new ProjectSetting(); ps.NewProject(); View.PS = ps; View.ClearWatermarkArea(); View.SelectedWatermarkIndex = 0; //this.currentProjectFile = "Untitled.hsbip"; this.currentProjectFile = e.ProjectFileName; this.processing = false; }
private void OpenProjectFile(string projectFileName) { ProjectWithFileNameEventArgs args = new ProjectWithFileNameEventArgs(projectFileName); ProjectWithFileNameEventHandler handlers = OpenProject; if (handlers != null) { handlers(this, args); } //this.currentProjectFile = projectFileName; OnProjectFileNameObtained(); }
private void saveProject() { if (File.Exists(this.presenter.CurrentProjectFile)) { // project file already created ProjectWithFileNameEventArgs args = new ProjectWithFileNameEventArgs(this.presenter.CurrentProjectFile); ProjectWithFileNameEventHandler handlers = SaveProject; if (handlers != null) { handlers(this, args); } OnProjectFileNameObtained(); } else { saveProjectAs(); } }
private void saveProjectAs() { SaveFileDialog saveFile = new SaveFileDialog(); saveFile.Filter = res.LanguageContent.Label_AllProjects + " (*.hsbip)|*.hsbip;"; if (saveFile.ShowDialog() == DialogResult.OK) { string projectFileName = saveFile.FileName; if (!string.IsNullOrEmpty(projectFileName)) { ProjectWithFileNameEventArgs args = new ProjectWithFileNameEventArgs(projectFileName); ProjectWithFileNameEventHandler handlers = SaveProjectAs; if (handlers != null) { handlers(this, args); } //this.currentProjectFile = projectFileName; OnProjectFileNameObtained(); } } }
void view_SaveProject(object sender, ProjectWithFileNameEventArgs e) { saveProject(e.ProjectFileName); }