private bool saveProject(string projectFileName) { Stream stream = new FileStream(projectFileName, FileMode.Create, FileAccess.Write, FileShare.None); try { IFormatter formatter = new BinaryFormatter(); formatter.Serialize(stream, ps); // reset is dirty flag ps.SaveProject(); this.currentProjectFile = projectFileName; return(true); } catch (Exception ex) { SetErrorMessage(ex); return(false); } finally { stream.Close(); } }