/// <summary> /// Count mp3 files in directory and inner directories. /// </summary> /// <param name="directory">Path.</param> /// <param name="recursive">Flag.</param> /// <returns>Number of files.</returns> public int Sum(string directory, bool recursive) { if (directory == null) { throw new ArgumentException(); } Counter = 0; var sum = (recursive) ? RecursiveSum(directory) : Sum(directory); if (Finished != null) { Finished.BeginInvoke(Counter, null, null); } return(sum); }
private void add(TraceEffect sender) { traces.Add(new Trace(sender)); if (traces.GroupBy(i => i.Index).All(i => i.Last().Released)) { if (Async) { Finished?.BeginInvoke(this, new TraceEventArgs { Traces = traces }, null, null); } else { Finished?.Invoke(this, new TraceEventArgs { Traces = traces }); } traces = new List <ITrace>(); } }
private void Finish() { Debug.WriteLine("ProgressDialogHandler:Finish"); _progressDialog.ForceClose(); _progressDialog = null; if (Finished != null) { Finished.BeginInvoke(this, null, null, null); //jh changed this from Invoke() // Finished.Invoke(this, null);//jh changed this from Invoke() } /* if (ParentFormIsClosing) * { * _parentForm.Close(); * } * else */ { _currentCommand.Enabled = true; } }