Esempio n. 1
0
 /// <summary>
 /// Set up the hidden form.
 /// </summary>
 /// <param name="detector">DriveDetector object which will receive notification about USB drives, see WndProc</param>
 public DetectorForm(DriveDetector detector)
 {
     mDetector            = detector;
     this.MinimizeBox     = false;
     this.MaximizeBox     = false;
     this.ShowInTaskbar   = false;
     this.ShowIcon        = false;
     this.FormBorderStyle = FormBorderStyle.None;
     this.Load           += new System.EventHandler(this.Load_Form);
     this.Activated      += new EventHandler(this.Form_Activated);
 }
Esempio n. 2
0
		/// <summary>
		/// Watches a drive to detect removal.
		/// </summary>
		/// <param name="drive">The drive.</param>
		/// <remarks>Documented by Dev02, 2007-12-13</remarks>
		void driveDetector_WatchDevice(string drive)
		{
			if (driveDetector == null)
			{
				driveDetector = new DriveDetector(this);
				driveDetector.DeviceRemoved += new MLifter.Components.DriveDetectorEventHandler(driveDetector_DeviceRemoved);
				driveDetector.QueryRemove += new DriveDetectorEventHandler(driveDetector_QueryRemove);
			}
			driveDetector.EnableQueryRemove(drive);

			//prepare message (so that ressources are loaded while the stick is still plugged in)
			if (LearnLogic.Dictionary != null)
			{
				driveRemoved = new MLifter.Controls.EmulatedTaskDialog();
				driveRemoved.Title = Properties.Resources.MAINFORM_STICKREMOVED_CAPTION;
				driveRemoved.MainInstruction = Properties.Resources.MAINFORM_STICKREMOVED_MAININSTRUCTION;
				driveRemoved.Content = string.Format(Properties.Resources.MAINFORM_STICKREMOVED_DESCRIPTION, LearnLogic.Dictionary.DictionaryPath);
				driveRemoved.CommandButtons = Properties.Resources.MAINFORM_STICKREMOVED_CLOSEDIC;
				driveRemoved.Buttons = MLifter.Controls.TaskDialogButtons.None;
				driveRemoved.MainIcon = MLifter.Controls.TaskDialogIcons.Warning;
				driveRemoved.TopMost = true;
				driveRemoved.BuildForm();
			}
		}