Exemple #1
0
 private void buttonOK_Click(object sender, System.EventArgs e)
 {
     foreach (Win32Util.Win32Window window in Win32Util.Win32Window.ApplicationWindows)
     {
         if (window.Text == (string)comboBoxApplication.SelectedItem)
         {
             applicationWindow = window;
             this.Close();
         }
     }
 }
 private void buttonOK_Click(object sender, System.EventArgs e)
 {
     foreach (Win32Util.Win32Window window in Win32Util.Win32Window.ApplicationWindows)
     {
         if (window.Text == (string)comboBoxApplication.SelectedItem)
         {
             applicationWindow = window;
             this.Close();
         }
     }
 }
 /// <summary>
 /// Menu item miInsertSnapshot_Click event handler. This event allows user
 /// to take a snapshot from the menu.
 /// </summary>
 /// <param name="sender">The event sender object</param>
 /// <param name="e">The event arguments</param>
 private void miInsertSnapshot_Click(object sender, System.EventArgs e)
 {
     if (isAppSelected())
     {
         // Take a snapshot
         window = applicationWindow;
         InsertSnapshot();
     } 
     else
     {
         RtlAwareMessageBox.Show(this, Strings.YouMustFirstSelectAScreenShot, Strings.ScreenShotInformation, 
             MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, 
             (MessageBoxOptions)0);
     }
 }
        /// <summary>
        /// ctxtMenuSnapshotApps event handler that will be when an item of 
        /// the drop-down menu related to the snapshot button is clicked.
        /// </summary>
        /// <param name="sender">The event sender object</param>
        /// <param name="e">The event arguments</param>
        private void OnctxtMenuSnapshotAppsClick(object sender, System.EventArgs e)
        {
            MenuItem mi = (MenuItem)sender;
            applicationWindow = (Win32Util.Win32Window)windowsInMenu[mi];

            // Enable the menu "Insert Screen Shot"
            // Note: this menu is disabled by default (design time)
            miInsertSnapshot.Enabled = true;

            // Take the 1st snapshot directly
            window = applicationWindow;
            InsertSnapshot();
        }
        // Pri1: Cleaning Snapshot code
        // - window and applicationWindow variables: changed internal to 
        // private or maybe public for test automation
        // - Get rid of buttonSnapshot event handler
        // - Get rid of FSelectApplication.cs

        /// <summary>
        /// Handle the InsertSlides toolbar event. This toolbar conatins
        /// a button to insert blank slide and a button to insert a snapshot
        /// </summary>
        /// <param name="sender">The event sender object</param>
        /// <param name="e">The event arguments</param>
        private void tbInsertSlides_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
        {
            if (e.Button == tbbSnapshot)
            {
                if (isAppSelected())
                {
                    // Take a snapshot
                    window = applicationWindow;
                    InsertSnapshot();
                } 
                else
                {
                    // Display the drop down list to allow user to select an app for the snashop
                    // Pri2: Investigate if there is an easier way to position the menu
                    ctxtMenuSnapshotApps.Show(
                        tbInsertSlides,
                        new Point(tbInsertSlides.Location.X + (int) (imageListSlides.ImageSize.Width * 1.5f), 
                        tbInsertSlides.Location.X + imageListSlides.ImageSize.Height));
                }
            }
            else if (e.Button == tbbInsertSlide)
            {
                InsertWhiteboard();
            }
        }
 /// <summary>
 /// Menu item miInsertSnapshot_Click event handler. This event allows user
 /// to take a snapshot from the menu.
 /// </summary>
 /// <param name="sender">The event sender object</param>
 /// <param name="e">The event arguments</param>
 private void miInsertSnapshot_Click(object sender, System.EventArgs e)
 {
     if (isAppSelected())
     {
         // Take a snapshot
         window = applicationWindow;
         InsertSnapshot();
     }
     else
     {
         MessageBox.Show(
             this,
             "You must first select a screen shot by clicking Select Screen Shot on the Slide menu, and then clicking the screen shot you want.",
             "Screen Shot Information",
             MessageBoxButtons.OK,
             MessageBoxIcon.Information);
     }
 }