private void watcher_Renamed(object sender, RenamedEventArgs e) { ListViewControl.BeginUpdate(); bool selected = false; foreach (ColumnListViewItem i in ListViewControl.Items) { if (i.Text != e.OldName) { continue; } selected = i.Selected; i.Remove(); break; } ColumnListViewItem item = getExistingItem(e.FullPath); item.Selected = true; ListViewControl.Items.Add(item); ListViewControl.Sort(); ListViewControl.EndUpdate(); OnLoadingCompleted(); }
public async void LoadItems() { if (IsBusy) { return; } ShowError = false; HeaderText = ""; ListViewControl.Items.Clear(); try { cancellation = new CancellationTokenSource(); List <ColumnListViewItem> result = await Task <List <ColumnListViewItem> > .Run(() => { return(loadData(cancellation.Token)); }); HeaderText = GetHeaderText(); ListViewControl.BeginUpdate(); ListViewControl.Items.AddRange(result.ToArray()); ListViewControl.Sort(); ListViewControl.EndUpdate(); UpdateColumnWidth(); } catch (OperationCanceledException) { // Do nothing } catch (ShowErrorException ex) { ShowError = true; ErrorText = ex.Message; } IsBusy = false; OnLoadingCompleted(); }
private void watcher_Created(object sender, FileSystemEventArgs e) { ColumnListViewItem item = getExistingItem(e.FullPath); ListViewControl.Items.Add(item); ListViewControl.Sort(); if (item.Text.StartsWith("New ")) { ListViewControl.SelectedItems.Clear(); item.Selected = true; item.EnsureVisible(); item.BeginEdit(); } OnLoadingCompleted(); }