private void RemoveItem(ListViewItem selectedItem) { var index = selectedItem.Index; selectedItem.Remove(); if (index < listViewChain.Items.Count) { listViewChain.Items[index].Selected = true; } else if (listViewChain.Items.Count > 0) { listViewChain.Items[listViewChain.Items.Count - 1].Selected = true; } ResizeLists(); UpdateButtons(); }
void DeleteMail(ListViewItem item) { if (mailView.InvokeRequired) { mailView.Invoke(new DeleteMailsDelegate(DeleteMail), new object[] { item }); } else { item.Remove(); } }
public void UpdateFileListItem(AccountFileStates newFileState, ListViewItem fileItem) { if ((newFileState & AccountFileStates.Deleted) != 0) { fileItem.Remove(); return; } if ((newFileState & AccountFileStates.New) != 0) { fileItem.ForeColor = Color.Blue; } if ((newFileState & AccountFileStates.UnsyncronizedWithAllDrives) != 0) { fileItem.ForeColor = Color.Red; } if ((newFileState & AccountFileStates.UnsyncronizedWithStorage) != 0) { fileItem.Font = UnsyncronizedFileItemFont; } if ((newFileState & AccountFileStates.SyncronizedWithDrive) != 0) { fileItem.ForeColor = SystemColors.ControlText; } if ((newFileState & AccountFileStates.SyncronizedWithStorage) != 0) { fileItem.Font = Font; } if ((newFileState & AccountFileStates.Error) != 0) { fileItem.BackColor = Color.Red; fileItem.ForeColor = Color.White; } if ((newFileState & AccountFileStates.PlacedOnlyDrive) != 0) { fileItem.BackColor = Color.LightGreen; } if ((newFileState & AccountFileStates.PlacedOnlyStorage) != 0) { fileItem.ForeColor = Color.Green; } }
private void removeItem(ListViewItem li) { if (lstSchedule.InvokeRequired) { lstSchedule.Invoke(new intFunctionDelegateList(removeItem), li); return; } if (li.Text.ToLower() == "wake up from sleep") { ((WakeUP)li.Tag).CancelWakeUp(); } else { ((System.Threading.Timer)li.Tag).Dispose(); } li.Remove(); }
public void RemoveActiveScript(ListViewItem lvw) { if (this.InvokeRequired) { MethodInvoker del = delegate { RemoveActiveScript(lvw); }; this.Invoke(del); } else { if (lvw != null) { lvw.Remove(); tbpScripts.Text = StringValue.ActiveScripts + " (" + lvwActiveScripts.Items.Count.ToString() + ")"; } } }
private void updateListViewItem(ListViewItem lvi) { iFolderObject ifolderObject = (iFolderObject)lvi.Tag; iFolderWeb ifolder = ifolderObject.iFolderWeb; if (ifolder.State.Equals("Available") && (ifWebService.GetiFolder(ifolder.CollectionID) != null)) { lock (ht) { ht.Remove(ifolder.ID); } lvi.Remove(); } else { int imageIndex; lvi.SubItems[0].Text = ifolder.Name; lvi.SubItems[1].Text = ifolder.IsSubscription ? "" : ifolder.UnManagedPath; lvi.SubItems[2].Text = stateToString(ifolderObject, out imageIndex); lvi.ImageIndex = imageIndex; if (lvi.Selected && (iFolderView.SelectedItems.Count == 1)) { updateMenus(ifolder); } } }
private void AddControloAut(object Sender, ListViewItem ListViewItem) { GISADataset.IndexFRDCARow IndexFRDCARow = null; IndexFRDCARow = (GISADataset.IndexFRDCARow)ListViewItem.Tag; if (ListViewItem.ListView == lstVwSubTipoInformacional) IndexFRDCARow.Selector = 1; else if (ListViewItem.ListView == lstVwTipoInformacional) IndexFRDCARow.Selector = -1; ListViewItem.SubItems.Add(TranslationHelper.FormatBoolean(IndexFRDCARow.ControloAutRow.Autorizado)); ListViewItem.SubItems.Add(TranslationHelper.FormatBoolean(IndexFRDCARow.ControloAutRow.Completo)); // se se tratar de uma tipologia informacional garantir que existe apenas um item if (ListViewItem.ListView == lstVwTipoInformacional) { if (lstVwTipoInformacional.Items.Count > 1) { GISADataset.IndexFRDCARow idxCARow = null; switch (MessageBox.Show("Não pode existir mais que uma tipologia informacional. Deseja substituir a existente?", "Tipologia informacional", MessageBoxButtons.OKCancel, MessageBoxIcon.Question)) { case DialogResult.OK: // eliminar todos as tipologias informacionais excepto a que acaba de ser adicionada foreach (ListViewItem item in lstVwTipoInformacional.Items) { if (!(item == ListViewItem)) { idxCARow = (GISADataset.IndexFRDCARow)item.Tag; item.Remove(); idxCARow.Delete(); } } break; case DialogResult.Cancel: // eliminar a tipologia informacional que acaba de ser adicionada idxCARow = (GISADataset.IndexFRDCARow)ListViewItem.Tag; ListViewItem.Remove(); idxCARow.Delete(); break; } } // Mandar actualizar o PanelConteudoInformacional this.TheGenericDelegate.Invoke(); } }
private void RemoveListViewItem(ListViewItem listViewItem) { if (listViewItem == null) throw new ArgumentNullException(); IRun run = listViewItem.Tag as IRun; if (run != null) { itemListViewItemMapping[run].Remove(listViewItem); if (itemListViewItemMapping[run].Count == 0) { DeregisterItemEvents(run); itemListViewItemMapping.Remove(run); } } listViewItem.Remove(); }
public void DisplayOutput(String output, ListViewItem lvw, bool clicked, bool cancelled = false) { if (this.InvokeRequired) { MethodInvoker del = delegate { DisplayOutput(output, lvw, clicked, cancelled); }; this.Invoke(del); } else { if ((txtPShellOutput.Text.Length + output.Length + (Environment.NewLine + "psf > ").Length) > txtPShellOutput.MaxLength) { txtPShellOutput.Text = txtPShellOutput.Text.Substring(output.Length + 500, txtPShellOutput.Text.Length - (output.Length + 500)); } txtPShellOutput.AppendText(output); txtPShellOutput.AppendText(Environment.NewLine + "psf > "); mincurpos = txtPShellOutput.Text.Length; txtPShellOutput.SelectionStart = mincurpos; if (clicked || cancelled) { //Not sure why this happens, but if you type the command the scroll to caret isn't needed. //If you initiate a script or command by double clicking, or you abort the thread, you do. txtPShellOutput.ScrollToCaret(); } txtPShellOutput.ReadOnly = false; if (lvw != null) { lvw.Remove(); tbpScripts.Text = "Active Scripts (" + lvwActiveScripts.Items.Count.ToString() + ")"; } } }
private void Trocar(ListViewItem pri, ListViewItem seg) { lock (this) { int i = pri.Index; pri.Remove(); seg.Remove(); lstFuncionários.Items.Insert(i - 1, pri); lstFuncionários.Items.Insert(i, seg); } }
private void remove(ListViewItem i) { if (lvPC.SelectedItems.Count > 0) { try { string nome, endereco; nome = i.SubItems[0].Text; endereco = i.SubItems[1].Text; i.Remove(); log("Removido PC " + nome + " - " + endereco + " à lista de execução em lotes."); //savelist(); } catch (Exception ex) { log("Exception encontrada: " + ex.Message); } } else { MessageBox.Show("ERRO: Selecione um item para ser excluido!"); } }
private void listViewFormats_KeyDown(object sender, KeyEventArgs e) { switch (e.KeyCode) { case Keys.Insert: { CUEToolsFormat format; if (_config.formats.TryGetValue("new", out format)) return; format = new CUEToolsFormat("new", CUEToolsTagger.TagLibSharp, true, true, false, false, false, null, null, null); _config.formats.Add("new", format); ListViewItem item = new ListViewItem(format.extension, "." + format.extension); item.Tag = format; listViewFormats.Items.Add(item); comboBoxEncoderExtension.Items.Add(format.extension); comboBoxDecoderExtension.Items.Add(format.extension); item.BeginEdit(); break; } case Keys.Delete: { if (listViewFormats.SelectedItems.Count <= 0) return; CUEToolsFormat format = (CUEToolsFormat)listViewFormats.SelectedItems[0].Tag; if (format.builtin) return; List<string> decodersToRemove = new List<string>(); foreach (KeyValuePair<string, CUEToolsUDC> decoder in _config.decoders) if (decoder.Value.extension == format.extension) decodersToRemove.Add(decoder.Key); foreach (string decoder in decodersToRemove) { _config.decoders.Remove(decoder); foreach (ListViewItem item in listViewDecoders.Items) if (item.Text == decoder) { item.Remove(); break; } } List<string> encodersToRemove = new List<string>(); foreach (CUEToolsUDC encoder in _config.encoders) if (encoder.extension == format.extension) encodersToRemove.Add(encoder.name); foreach (string encoder in encodersToRemove) _config.encoders.Remove(_config.encoders[encoder]); comboBoxEncoderExtension.Items.Remove(format.extension); comboBoxDecoderExtension.Items.Remove(format.extension); _config.formats.Remove(format.extension); listViewFormats.SelectedItems[0].Remove(); break; } } }
// Remove selected item private void removeAttendee(ListViewItem lvi) { int guestID = Convert.ToInt32(lvi.SubItems[2].Text); lvi.Remove(); // find row in Datatable using GUEST_ID DataRow[] removeRow = AttendeeDT.Select("GUEST_ID = " + guestID.ToString()); if (removeRow.Length > 0) { int SelectedIndex = AttendeeDT.Rows.IndexOf(removeRow[0]); AttendeeDT.Rows.RemoveAt(SelectedIndex); updateGuestCount(); } CheckGuestCount(); }
/// <summary> /// If the list view is filtered to display only budgeted part, in case the user un-budget a part /// (i.e. delete its budget), we need to make it disapear from the list of item and place it in the /// not budgeted part temporary list /// </summary> /// <param name="unbudgetedItem">The item whose budget was removed</param> private void updateFilterForUnbudgetingPart(ListViewItem unbudgetedItem) { if (Budget.Budget.Instance.ShouldShowOnlyBudgetedParts) { // search in the item list and in the filtered list (but this last case should never happe // as the item must be in the list to be un-bugeted, otherwise the user cannot edit its buget) if (this.Items.Contains(unbudgetedItem)) { unbudgetedItem.Remove(); // then add it to the list of unbugeted items mNotBudgetedItems.Add(unbudgetedItem); } else if (this.mFilteredItems.Contains(unbudgetedItem)) { this.mFilteredItems.Remove(unbudgetedItem); // then add it to the list of unbugeted items mNotBudgetedItems.Add(unbudgetedItem); } } }