예제 #1
0
 /// <summary>
 /// Detect the window type,; if it supports paste, call that window's paste operation.
 /// </summary>
 private void EditPaste(object sender, EventArgs e)
 {
     // If there's at least one MdiChild.
     if (this.MdiChildren.Length > 0)
     {
         // If current window is a whiteboard window.
         if (this.ActiveMdiChild.GetType() == typeof(formWhiteboard))
         {
             // Cast the active window to a whiteboard window.
             formWhiteboard whiteboardInstance = (formWhiteboard)this.ActiveMdiChild;
             // Call the active window's paste operation.
             whiteboardInstance.EditPaste(sender, e);
         }
         // If current window is a whiteboard window.
         else if (this.ActiveMdiChild.GetType() == typeof(formTextEditor))
         {
             // Cast the active window to a whiteboard window.
             formTextEditor texteditorInstance = (formTextEditor)this.ActiveMdiChild;
             // Call the active window's paste operation.
             texteditorInstance.EditPaste(sender, e);
         }
         // The current window is not a whiteboard window. Report that.
         else
         {
             MessageBox.Show("Paste is not supported for the current active window.", "Paste Not Suported");
         }
     }
     // There is no child window. Report that.
     else
     {
         MessageBox.Show("You must select a window that allows paste to do that.", "Paste Not Supported");
     }
 }
예제 #2
0
        /// <summary>
        /// Opens a new Whiteboard window instance as a child window.
        /// </summary>
        private void WindowNewWhiteboard(object sender, EventArgs e)
        {
            formWhiteboard whiteboardInstance = new formWhiteboard();

            whiteboardInstance.MdiParent = this;
            whiteboardInstance.Show();
        }
예제 #3
0
 /// <summary>
 /// Open a save dialog and save the file to the location chosen by the user.
 /// </summary>
 private void FileSaveAs(object sender, EventArgs e)
 {
     // Check if windows are actually open.
     if (this.MdiChildren.Length > 0)
     {
         // If the selected window is a whiteboard window.
         if (this.ActiveMdiChild.GetType() == typeof(formWhiteboard))
         {
             // Call the whiteboard window's Save As function.
             formWhiteboard whiteboardInstance = (formWhiteboard)this.ActiveMdiChild;
             whiteboardInstance.FileSaveAs(sender, e);
         }
         // If the selected window is a text edtior window.
         else if (this.ActiveMdiChild.GetType() == typeof(formTextEditor))
         {
             // Cast the active window to a texteditor window.
             formTextEditor texteditorInstance = (formTextEditor)this.ActiveMdiChild;
             // Call the active window's save operation.
             texteditorInstance.FileSaveAs(sender, e);
         }
         // Otherwise, this is some other window that doesn't allow saving. Report error.
         else
         {
             MessageBox.Show("This window type does not support saving.", "Save As Not Supported");
         }
     }
     // No child windows are open. Report an error.
     else
     {
         MessageBox.Show("You need to have an open window to save.", "Save As Not Supported");
     }
 }