// method for adding drive to list public void CheckAddedUsb(object sender, UsbEventArgs eventArgs) { try { DriveInfo driveInfo = null; driveInfo = FileOperator.GetDriveInfoAddUsb(_listOfDriveInfo); if (driveInfo != null) { DialogResult dialogResult = System.Windows.Forms.MessageBox.Show( @"USB device was added. Name:" + driveInfo.Name + @". To start scanning your device press button Start Scan!", @"USB", MessageBoxButtons.OK); Properties.Settings.Default.FlashDrive = driveInfo.Name; } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } }
/// <summary> /// Event for removing drive from list /// </summary> /// <param name="sender"></param> /// <param name="eventArgs"></param> public void CheckRemovedUsb(object sender, UsbEventArgs eventArgs) { Properties.Settings.Default.FlashDrive = string.Empty; _listOfDriveInfo = FileOperator.SetDriveInfoRemoveUsb(_listOfDriveInfo); }