public override void Execute(object parameter) { var selectedItems = GetSelectedItems(); if (selectedItems.Count == 0) { return; } GetUpdateItems(selectedItems); var logWindow = new ProjectLogWindow { Maximum = updateItems.Count }; logWindow.AutoStart = delegate { var iterator = new ElementIterator <UpdateItem>(updateItems); iterator.Process = delegate(UpdateItem element) { var projectItem = element.ProjectItem; projectItem.Update(delegate(object sender, ProcessedEventArgs args) { if (!args.Ignore) { logWindow.Write(projectItem.Path, args.Text, args.Comment); } logWindow.Increment(); iterator.Next(); }); }; iterator.Finish = delegate { logWindow.Write(Resources.Finished, string.Empty, string.Empty); logWindow.Finish(); }; iterator.Start(); }; AppHost.Shell.ShowDialog(logWindow); SaveProjects(); }
private void Download([NotNull] List <ProjectItem> projectItems) { Debug.ArgumentNotNull(projectItems, nameof(projectItems)); var logWindow = new ProjectLogWindow { Maximum = projectItems.Count }; logWindow.AutoStart = delegate { var iterator = new ElementIterator <ProjectItem>(projectItems); iterator.Process = delegate(ProjectItem element) { element.Revert(delegate(object sender, ProcessedEventArgs args) { if (!args.Ignore) { if (args.Text == @"reverted") { args.Text = @"checked out"; } logWindow.Write(element.Path, args.Text, args.Comment); } logWindow.Increment(); iterator.Next(); }); }; iterator.Finish = delegate { logWindow.Write(@"Finished", string.Empty, string.Empty); logWindow.Finish(); }; iterator.Start(); }; AppHost.Shell.ShowDialog(logWindow); }