private void NewoutProgressBar(object sender, ProgressEventArgs s) { if (!Dispatcher.CheckAccess()) { Dispatcher.BeginInvoke(new Action(() => NewoutProgressBar(sender, s))); } else { // Find the task or the collection!!! ForTreeView theEntityOnWhichToUpdateLabel = dynamicTasksObservableCollection.First(b => b.Id.Equals(s.nestedIDs[0])); foreach (var hm in s.nestedIDs.Skip(1)) { try { theEntityOnWhichToUpdateLabel = theEntityOnWhichToUpdateLabel.Children.First(b => b.Id.Equals(hm)); } catch { theEntityOnWhichToUpdateLabel.Children.Add(new CollectionForTreeView(hm, hm)); theEntityOnWhichToUpdateLabel = theEntityOnWhichToUpdateLabel.Children.First(b => b.Id.Equals(hm)); } } theEntityOnWhichToUpdateLabel.Status = s.v; theEntityOnWhichToUpdateLabel.IsIndeterminate = false; theEntityOnWhichToUpdateLabel.Progress = s.new_progress; } }
private void NewCollectionHandler(object sender, StringEventArgs s) { if (!Dispatcher.CheckAccess()) { Dispatcher.BeginInvoke(new Action(() => NewCollectionHandler(sender, s))); } else { // Find the task or the collection!!! ForTreeView theEntityOnWhichToUpdateLabel = dynamicTasksObservableCollection.First(b => b.Id.Equals(s.nestedIDs[0])); for (int i = 1; i < s.nestedIDs.Count - 1; i++) { var hm = s.nestedIDs[i]; try { theEntityOnWhichToUpdateLabel = theEntityOnWhichToUpdateLabel.Children.First(b => b.Id.Equals(hm)); } catch { theEntityOnWhichToUpdateLabel.Children.Add(new CollectionForTreeView(hm, hm)); theEntityOnWhichToUpdateLabel = theEntityOnWhichToUpdateLabel.Children.First(b => b.Id.Equals(hm)); } } theEntityOnWhichToUpdateLabel.Children.Add(new CollectionForTreeView(s.S, s.nestedIDs.Last())); } }
private void NewSuccessfullyFinishedWritingFile(object sender, SingleFileEventArgs v) { if (!Dispatcher.CheckAccess()) { Dispatcher.BeginInvoke(new Action(() => NewSuccessfullyFinishedWritingFile(sender, v))); } else { ForTreeView AddWrittenFileToThisOne = dynamicTasksObservableCollection.First(b => b.Id.Equals(v.nestedIDs[0])); foreach (var hm in v.nestedIDs.Skip(1)) { try { AddWrittenFileToThisOne = AddWrittenFileToThisOne.Children.First(b => b.Id.Equals(hm)); } catch { } } AddWrittenFileToThisOne.Children.Add(new OutputFileForTreeView(v.writtenFile, Path.GetFileName(v.writtenFile))); } }