Exemplo n.º 1
0
 /// <summary>
 /// Method runs traverse from main directory to subdirectories
 /// </summary>
 /// <param name="strPathToDirectory">Path to root directory</param>
 /// <returns></returns>
 private Task <List <FileInfo> > WalkDirectoryTree(string strPathToDirectory)
 {
     return(Task.Run(() =>
     {
         List <FileInfo> retList = new List <FileInfo>();
         try
         {
             FileOperator.WalkDirectoryTree(new DirectoryInfo(strPathToDirectory), retList);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
         return retList;
     }));
 }
 // 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);
 }