private void historyBackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (!e.Cancelled && IsHandleCreated) { historyListView.BeginUpdate(); if (e.Error != null || e.Result is Exception) { historyHeader_Refresh(0L); var exc = (e.Result as Exception) ?? e.Error; if (exc != null && ShowErrors) { MessageBox.Show(this, string.Format(EditorProperties.Resources.Error_CannotRetrieveHistory, exc.Message), EditorProperties.Resources.TaskSchedulerName, MessageBoxButtons.OK, MessageBoxIcon.Error); } } else if (e.Result == null) { historyListView.Items.Clear(); historyListView.VirtualMode = true; long vlogCount = vlog.Count; historyListView.VirtualListSize = (int)Math.Min(Int32.MaxValue, vlogCount); historyHeader_Refresh(vlogCount); vcache = new SparseArray <ListViewItem>(); vevEnum = vlog.GetEnumerator(lvwColumnSorter.Order == SortOrder.Ascending); } else { historyListView.VirtualMode = false; vevEnum = null; var list = e.Result as List <ListViewItem>; vcache = list; historyListView.Items.Clear(); historyListView.Items.AddRange(list.ToArray()); historyHeader_Refresh(historyListView.Items.Count); if (lvwColumnSorter.Group) { SetupGroups(); } else { historyListView.ShowGroups = false; } } historyListView.EndUpdate(); } historyListView.Cursor = Cursors.Default; historyListView.Focus(); }
/// <summary> /// Initializes the dialog with the specified task event. /// </summary> /// <param name="taskEvent">The <see cref="TaskEvent"/> to show initially.</param> /// <param name="log">The <see cref="TaskEventLog"/> for the task.</param> public void Initialize(TaskEvent taskEvent, TaskEventLog log = null) { if (taskEvent == null) { throw new ArgumentNullException("taskEvent"); } if (log != null) { eventEnum = log.GetEnumerator() as TaskEventEnumerator; eventEnum.Seek(CurrentEvent.EventRecord.Bookmark); } else { eventEnum = null; } CurrentEvent = taskEvent; }