void Provider_FetchRevisionHistoryCompleteEvent(object sender, RevisionHistoryFetchCompletedEventArgs args) { BusyIndicator.Visibility = Visibility.Collapsed; IsEnabled = true; Cursor = Cursors.Arrow; TaskItem lastTaskItem = null; stkRevision.Children.Clear(); var headerItem = new RevisionHistoryItem {Header = true}; stkRevision.Children.Add(headerItem); foreach (TaskItem revision in args.History.TaskVersions) { var item = new RevisionHistoryItem { Margin = new Thickness(0, 0, 0, 10), Changes = GetRevisionChanges(lastTaskItem, revision) }; stkRevision.Children.Insert(1, item); lastTaskItem = revision; } }
private void LongOperationToFetchRevisionHistory(object param) { Thread.Sleep(2000); if (FetchRevisionHistoryCompleteEvent != null) { RevisionHistoryFetchCompletedEventArgs args; try { args = new RevisionHistoryFetchCompletedEventArgs(); args.History = new RevisionHistory(); int count = 5; while (count > 0) { RevisionHistory history = new RevisionHistory(); /* * fill in other properties here */ count--; } } catch (Exception ex) { args = new RevisionHistoryFetchCompletedEventArgs (ex, true, null); args.History= new RevisionHistory();//return an empty collection nevertheless } Deployment.Current.Dispatcher.BeginInvoke(delegate() { FetchRevisionHistoryCompleteEvent(this, args); }); } }
void omdQuery_QueryVersionsCompleted(object sender, QueryVersionsCompletedEventArgs e) { List<TaskItem> items = TaskItemFactory.ConvertTasksFromOMD(e.Result.rows); ArchiveHelper.ProcessMessage(e.Result.message); RevisionHistoryFetchCompletedEventArgs args = new RevisionHistoryFetchCompletedEventArgs(); RevisionHistory history = new RevisionHistory(); foreach (TaskItem item in items) { history.TaskVersions.Add(item); } args.History = history; if (FetchRevisionHistoryCompleteEvent != null) FetchRevisionHistoryCompleteEvent(this, args); }