Ignore:
Timestamp:
03/13/12 23:06:57 (3 years ago)
Author:
lowjoel
Message:

Report progress updates by pushing information to the SteppedProgressManager? instance associated with each erasure target. Furthermore, do not manipulate the state of the Task object, instead, let the Task object manage its own Progress state.

Because of this, a new property Tag is created in ProgressManagerBase?, to hold state information.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eraser6/pluginsRewrite/Eraser.DefaultPlugins/ErasureTargets/FileSystemObjectErasureTarget.cs

    r2470 r2486  
    205205            if (Progress == null) 
    206206                throw new InvalidOperationException("The Progress property must not be null."); 
    207             Task.Progress.Steps.Add(new SteppedProgressManagerStep(Progress, 
    208                 1.0f / Task.Targets.Count)); 
    209207 
    210208            //Iterate over every path, and erase the path. 
    211209            for (int i = 0; i < paths.Count; ++i) 
    212210            { 
     211                //Create a new progress manager for the file. 
    213212                ProgressManager step = new ProgressManager(); 
    214213                Progress.Steps.Add(new SteppedProgressManagerStep(step, 
    215214                    dataTotal == 0 ? 0.0f : paths[i].Length / (float)dataTotal, 
    216                     S._("Erasing files..."))); 
     215                    paths[i].FullName)); 
    217216                EraseStream(paths[i], step); 
    218                 step.MarkComplete(); 
    219217            } 
    220218        } 
     
    247245                //Update the task progress 
    248246                IErasureMethod method = EffectiveMethod; 
    249                 /*OnProgressChanged(this, new ProgressChangedEventArgs(progress, 
    250                     new TaskProgressChangedEventArgs(info.FullName, 0, method.Passes)));*/ 
    251  
     247                 
    252248                //Remove the read-only flag, if it is set. 
    253249                if (isReadOnly = info.IsReadOnly) 
     
    261257                            throw new OperationCanceledException(S._("The task was cancelled.")); 
    262258 
     259                        progress.Tag = new object[2] { currentPass, method.Passes }; 
    263260                        progress.Total = totalData; 
    264261                        progress.Completed += lastWritten; 
    265                         /*OnProgressChanged(this, new ProgressChangedEventArgs(progress, 
    266                             new TaskProgressChangedEventArgs(info.FullName, currentPass, method.Passes)));*/ 
    267262                    }; 
    268263 
Note: See TracChangeset for help on using the changeset viewer.