/// <summary> /// Function to move value from a to b /// </summary> /// <param name="moveFrom">The file from.</param> /// <param name="moveToo">The file too.</param> public void Move(string moveFrom, string moveToo) { this.tooPath = moveToo; this.fromPath = moveFrom; this.tmr.Tick += this.Tmr_Tick; this.tmr.Interval = 400; this.tmr.Start(); this.fileSystem = new FileSystem(); this.fileSystem.CopyProgress += this.FileSystem_CopyProgress; var bgw = new BackgroundWorker(); bgw.DoWork += this.Bgw_DoWork; bgw.RunWorkerCompleted += this.Bgw_RunWorkerCompleted; bgw.RunWorkerAsync(); this.dialog = new FrmMoveDialog { Too = this.tooPath, From = this.fromPath }; this.dialog.ShowDialog(); }
/// <summary> /// Handles the RunWorkerCompleted event of the bgw control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.ComponentModel.RunWorkerCompletedEventArgs"/> instance containing the event data.</param> private void Bgw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { this.tmr.Stop(); this.dialog.Close(); this.dialog = null; }