/// <summary> /// Save the current file. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SaveClick(object sender, EventArgs e) { // If there is MdiChildren. if (this.MdiChildren.Length > 0) { // If the child is notepad negative. if (this.ActiveMdiChild.GetType() == typeof(formNotepadNegative)) { // Call the SaveClick function. formNotepadNegative notepadNegativeInstance = (formNotepadNegative)this.ActiveMdiChild; notepadNegativeInstance.SaveClick(sender, e); } // If the child is Customer Entry. else if (this.ActiveMdiChild.GetType() == typeof(formCustomerEntry)) { // Call the ButtonSaveClick function. formCustomerEntry customerEntryInstance = (formCustomerEntry)this.ActiveMdiChild; customerEntryInstance.ButtonSaveClick(sender, e); } else { // Show a message box if the form is not supported in the current window. MessageBox.Show("The 'Save' operation is not supported by the current selected windows.", "Operation Not Supported"); } } else { // Show a message box if there is no form open. MessageBox.Show("You must open a form in order to use the 'Save' operation.", "Operation Not Supported"); } }
/// <summary> /// Opens a new NotepadNegative child. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void WindowNewNotepadNegative(object sender, EventArgs e) { // Create a new notepad negative instance. formNotepadNegative notepadNegativeInstance = new formNotepadNegative(); // Set the forms parent to the master form. notepadNegativeInstance.MdiParent = this; // Show the notepad negative form. notepadNegativeInstance.Show(); }
/// <summary> /// Open a file. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OpenFile(object sender, EventArgs e) { // If there is MdiChildren. if (this.MdiChildren.Length > 0) { // If the child is notepad negative. if (this.ActiveMdiChild.GetType() == typeof(formNotepadNegative)) { // Call the OpenFile function. formNotepadNegative notepadNegativeInstance = (formNotepadNegative)this.ActiveMdiChild; notepadNegativeInstance.OpenFile(sender, e); } else { // Show a message box if the form is not supported in the current window. MessageBox.Show("The 'Open' operation is not supported by the current selected windows.", "Operation Not Supported"); } } else { // Show a message box if there is no form open. MessageBox.Show("You must open NotepadNegative in order to use the 'Open' operation.", "Operation Not Supported"); } }