/// <summary> /// Raises the Load event for the specified file /// </summary> /// <param name="filename">The filename to open.</param> /// <param name="saveExistingChanges"> /// If set to true, prompts to save any existing changes /// in current document before opening new one. /// </param> /// <returns>True if successful</returns> public bool Open(string filename, bool saveExistingChanges) { // abort if changes made and the user doesn't want to continue if (saveExistingChanges && !ConfirmDocumentClose()) { return(false); } // raise 'load' event var e = new FileMenuControllerEventArgs(filename); if (LoadDocument != null) { LoadDocument(this, e); } // abort if load canceled if (e.Cancel) { RemoveFromRecentFiles(filename); return(false); } // update status _filename = filename; _isNew = false; _isModified = false; UpdateTitle(); AddToRecentFiles(); StartFileWatcher(); return(true); }
/// <summary> /// Raises the 'New' event for the default document type /// </summary> /// <returns>True if successful</returns> public bool New(string filename) { // abort if changes made and the user doesn't want to continue if (!ConfirmDocumentClose()) { return(false); } // raise 'new' event var e = new FileMenuControllerEventArgs(filename); if (NewDocument != null) { NewDocument(this, e); } // abort if new canceled if (e.Cancel) { return(false); } // update status _filename = filename; _isNew = true; _isModified = false; _modifiedExternally = false; UpdateTitle(); fileSystemWatcher.EnableRaisingEvents = false; return(true); }
/// <summary> /// Raises the Save event for the specified file /// </summary> /// <param name="filename">The file to save to.</param> /// <returns>True if successful</returns> public bool Save(string filename) { // disable watching for external file modification fileSystemWatcher.EnableRaisingEvents = false; // raise 'save' event var e = new FileMenuControllerEventArgs(filename); if (SaveDocument != null) { SaveDocument(this, e); } // abort if save canceled if (e.Cancel) { // if not new, resume watching file if (!_isNew) { fileSystemWatcher.EnableRaisingEvents = true; } return(false); } // update status _filename = filename; if (_isNew) { // if new, start watching newly saved file StartFileWatcher(); } else { // otherwise resume watching file for external changes fileSystemWatcher.EnableRaisingEvents = true; } _isNew = false; _isModified = false; UpdateTitle(); AddToRecentFiles(); return(true); }
private void fileMenuController_NewDocument(object sender, FileMenuControllerEventArgs e) { PausePlayers(); ModulePlayer.CreateModule(); BindData(); }
private void fileMenuController_LoadDocument(object sender, FileMenuControllerEventArgs e) { PausePlayers(); ModulePlayer.LoadModule(e.FileName); BindData(); }
private void fileMenuController_SaveDocument(object sender, FileMenuControllerEventArgs e) { samplesControl.ModulePlayer.SaveModule(e.FileName); }
/// <summary> /// Handles the SaveDocument event of the fileMenuController control. /// </summary> private void fileMenuController_SaveDocument(object sender, FileMenuControllerEventArgs e) { playlistControl.SavePlaylist(e.FileName); }
/// <summary> /// Handles the LoadDocument event of the fileMenuController control. /// </summary> private void fileMenuController_LoadDocument(object sender, FileMenuControllerEventArgs e) { playlistControl.OpenPlaylist(e.FileName); }
/// <summary> /// Raises the Load event for the specified file /// </summary> /// <param name="filename">The filename to open.</param> /// <param name="saveExistingChanges"> /// If set to true, prompts to save any existing changes /// in current document before opening new one. /// </param> /// <returns>True if successful</returns> public bool Open(string filename, bool saveExistingChanges) { // abort if changes made and the user doesn't want to continue if (saveExistingChanges && !ConfirmDocumentClose()) { return false; } // raise 'load' event FileMenuControllerEventArgs e = new FileMenuControllerEventArgs(filename); if (LoadDocument != null) { LoadDocument(this, e); } // abort if load canceled if (e.Cancel) { RemoveFromRecentFiles(filename); return false; } // update status _filename = filename; _isNew = false; _isModified = false; UpdateTitle(); AddToRecentFiles(); StartFileWatcher(); return true; }
/// <summary> /// Raises the Save event for the specified file /// </summary> /// <param name="filename">The file to save to.</param> /// <returns>True if successful</returns> public bool Save(string filename) { // disable watching for external file modification fileSystemWatcher.EnableRaisingEvents = false; // raise 'save' event FileMenuControllerEventArgs e = new FileMenuControllerEventArgs(filename); if (SaveDocument != null) { SaveDocument(this, e); } // abort if save canceled if (e.Cancel) { // if not new, resume watching file if (!_isNew) { fileSystemWatcher.EnableRaisingEvents = true; } return false; } // update status _filename = filename; if (_isNew) { // if new, start watching newly saved file StartFileWatcher(); } else { // otherwise resume watching file for external changes fileSystemWatcher.EnableRaisingEvents = true; } _isNew = false; _isModified = false; UpdateTitle(); AddToRecentFiles(); return true; }
/// <summary> /// Raises the 'New' event for the default document type /// </summary> /// <returns>True if successful</returns> public bool New(string filename) { // abort if changes made and the user doesn't want to continue if (!ConfirmDocumentClose()) { return false; } // raise 'new' event FileMenuControllerEventArgs e = new FileMenuControllerEventArgs(filename); if (NewDocument != null) { NewDocument(this, e); } // abort if new canceled if (e.Cancel) { return false; } // update status _filename = filename; _isNew = true; _isModified = false; _modifiedExternally = false; UpdateTitle(); fileSystemWatcher.EnableRaisingEvents = false; return true; }