コード例 #1
0
ファイル: FileMonitor.cs プロジェクト: jeffj900/FolderMonitor
        void MoveContent(object sender, ElapsedEventArgs e)
        {
            timer.Enabled = false;
            timer.Stop();
            string d = "";

            caller.Dispatcher.Invoke(new Action(delegate
            {
                try
                {
                    FileMover fm = new FileMover();
                    foreach (string dir in directoriesToMove)
                    {
                        d = dir;
                        fm.Copy(dir, DestinationFolder, caller);
                    }
                    directoriesToMove.Clear();
                }
                catch (Exception ex)
                {
                    caller.Dispatcher.Invoke(new Action(() =>
                                                        Globals.Errors.Add(new Error
                    {
                        Description = ex.Message,
                        Dest        = DestinationFolder,
                        Source      = d
                    })));
                }
            }));
        }
コード例 #2
0
 void MoveContent(object sender, ElapsedEventArgs e)
 {
     timer.Enabled = false;
     timer.Stop();
     string d = "";
     caller.Dispatcher.Invoke(new Action(delegate
     {
         try
         {
             FileMover fm = new FileMover();
             foreach (string dir in directoriesToMove)
             {
                 d = dir;
                 fm.Copy(dir, DestinationFolder, caller);
             }
             directoriesToMove.Clear();
         }
         catch (Exception ex)
         {
             caller.Dispatcher.Invoke(new Action(() =>
                                                 Globals.Errors.Add(new Error
                                                                        {
                                                                            Description = ex.Message,
                                                                            Dest = DestinationFolder,
                                                                            Source = d
                                                                        })));
         }
     }));
 }
コード例 #3
0
 private void RetryAction(object sender, MouseButtonEventArgs e)
 {
     Dispatcher.Invoke(new Action(delegate
     {
         try
         {
             FileMover fm = new FileMover();
             Error er     = Errors[ErrorList.SelectedIndex];
             fm.Copy(er.Source, er.Dest, this);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message + "\n" + ex.StackTrace, "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }));
 }
コード例 #4
0
 private void RetryAction(object sender, MouseButtonEventArgs e)
 {
     Dispatcher.Invoke(new Action(delegate
     {
         try
         {
             FileMover fm = new FileMover();
             Error er = Errors[ErrorList.SelectedIndex];
             fm.Copy(er.Source, er.Dest, this);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message + "\n" + ex.StackTrace, "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }));
 }