Пример #1
0
        private void ChangeFiles(BackgroundWorker worker, ListView.ListViewItemCollection items, int totalFileCount, Label currentFileDisplayLabel)
        {
            int processedCount = 0;

            foreach (ListViewItem item in items)
            {
                if (worker.CancellationPending)
                {
                    return;
                }
                if (!item.Checked)
                {
                    continue;
                }
                processedCount++;
                worker.ReportProgress(processedCount * 100 / totalFileCount);

                var original    = item.SubItems[0].Text;
                var destination = item.SubItems[1].Text;

                currentFileDisplayLabel.Text = original;

                try
                {
                    Rename(original, destination);
                    items.Remove(item);
                }
                catch (Exception ex)
                {
                    item.SubItems[2].Text = ex.Message;
                }
            }
        }
Пример #2
0
 public static void RemoveWarps(LevelArea area, List <IManagedLevelscriptCommand> objList, IEnumerable <IManagedLevelscriptCommand> objs, ListView.ListViewItemCollection lvic, IEnumerable <ListViewItem> lvis, Dictionary <ListViewItem, ListViewGroup> lviGroups)
 {
     for (int i = 0, loopTo = objs.Count() - 1; i <= loopTo; i++)
     {
         area.Objects.Remove(objs.ElementAtOrDefault(i).Command);
         objList.Remove(objs.ElementAtOrDefault(i));
         lvic.Remove(lvis.ElementAtOrDefault(i));
     }
 }
Пример #3
0
 public static void RemoveObjects(LevelArea area, List <Managed3DObject> objList, IEnumerable <Managed3DObject> objs, ListView.ListViewItemCollection lvic, IEnumerable <ListViewItem> lvis)
 {
     for (int i = 0, loopTo = objs.Count() - 1; i <= loopTo; i++)
     {
         area.Objects.Remove(objs.ElementAtOrDefault(i).Command);
         objList.Remove(objs.ElementAtOrDefault(i));
         lvic.Remove(lvis.ElementAtOrDefault(i));
     }
 }
Пример #4
0
 public void RemoveItem(Alarm alarm)
 {
     if (!dic_instance_item.ContainsKey(alarm.instance))
     {
         return;
     }
     listviewitems.Remove(dic_instance_item[alarm.instance]);
     dic_instance_item.Remove(alarm.instance);
 }
Пример #5
0
 /// <summary>
 /// Filter sessions in the list view, keep only sessions that contain host name
 /// </summary>
 private void FilterSessionListByHostName(string hostName)
 {
     ListView.ListViewItemCollection lvItems = FiddlerApplication.UI.lvSessions.Items;
     foreach (ListViewItem item in lvItems)
     {
         // 3 -> index of column host name
         if (!item.SubItems[3].Text.Contains(hostName))
         {
             lvItems.Remove(item);
         }
     }
 }
Пример #6
0
        public void RemoveItem()
        {
            MainWindow form             = Program.Form;
            int        matchingTrackers = 0;

            ListView.ListViewItemCollection itemCollection = Program.Form.torrentListView.Items;
            if (itemCollection.Contains(this))
            {
                lock (form.torrentListView)
                {
                    if (itemCollection.Contains(this))
                    {
                        itemCollection.Remove(this);
                    }
                }
            }
            else
            {
                return;
            }

            if (FirstTrackerTrimmed == null)
            {
                return;
            }

            lock (Program.TorrentIndex)
            {
                foreach (KeyValuePair <string, Torrent> torrent in Program.TorrentIndex)
                {
                    if (torrent.Value.FirstTrackerTrimmed.Equals(FirstTrackerTrimmed))
                    {
                        matchingTrackers++;
                    }
                }
            }

            if (matchingTrackers <= 0)
            {
                lock (form.stateListBox)
                {
                    form.stateListBox.RemoveItem(FirstTrackerTrimmed);
                }
            }
        }
Пример #7
0
        internal void BindData(ref ListView.ListViewItemCollection lvic)
        {
            listView1.Items.Clear();
            foreach (ListViewItem item in lvic)
            {
                if ((item.Tag as SRRC_ResourceEntity).Dtype != 1)//不为图片
                {
                    lvic.Remove(item);
                    continue;
                }
                ListViewItem lvi = item.Clone() as ListViewItem;
                lvi.Name = item.Name;
                listView1.Items.Add(lvi);
            }
            ListViewItem i = listView1.Items.Find(SROperation2.Instance.BrowserPicId.ToString(), true)[0];

            SetSelectedState(i.Index);
        }
Пример #8
0
        public Boolean Remove(GenericListViewItem <T> item)
        {
            if (item is null)
            {
                throw new ArgumentNullException(nameof(item));
            }

            if (!Contains(item))
            {
                return(false);
            }

            _items.Remove(item);
            OnRemove?.Invoke(ref item);
            ItemsChanged?.Invoke();

            return(true);
        }
Пример #9
0
 private void RefreshPrenotazioni(object sender, EventArgs e)
 {
     //prima soluzione di refresh, un po' barbara ma fa il suo dovere
     ListView.ListViewItemCollection lista = _target.PrenotazioniListView.Items;
     if (lista.Count != 0)
     {
         foreach (ListViewItem i in lista)
         {
             lista.Remove(i);
         }
     }
     foreach (Prenotazione p in _localeRistorazione.ListaPrenotazioni)
     {
         ListViewItem lv = new ListViewItem();
         lv.Tag  = p;
         lv.Text = p.ToString();
         lista.Add(lv);
     }
 }
Пример #10
0
        private void RefreshTavoli(object sender, EventArgs e)
        {
            ListView.ListViewItemCollection lista = _target.TavoliListView.Items;

            if (lista.Count != 0)
            {
                foreach (ListViewItem l in lista)
                {
                    lista.Remove(l);
                }
            }

            foreach (Tavolo t in _localeRistorazione.Tavoli)
            {
                t.Numero = _localeRistorazione.Tavoli.IndexOf(t) + 1;
                ListViewItem lv = new ListViewItem();
                lv.ForeColor = (t.Stato.Equals(StatoTavolo.Occupato)) ? System.Drawing.Color.Red : System.Drawing.Color.Green;
                lv.Tag       = t;
                lv.Text      = t.ToString();
                lista.Add(lv);
            }
        }
 public bool Remove(ListViewItem item)
 {
     _collection.Remove(item);
     return(true);
 }
Пример #12
0
 private void btnRefresh_Click(object sender, EventArgs e)
 {
     try
     {
         btnRefresh.Enabled = false;
         btnRefresh.Cursor  = Cursors.WaitCursor;
         List <Device> device = UsbDevice.GetDevice();
         ListView.ListViewItemCollection items = devicelist.Items;
         foreach (string str in FlashingDevice.flashDeviceList.Where(d => d.IsDone.Value).Select(d => d.Name).ToList())
         {
             foreach (Device flashDevice in FlashingDevice.flashDeviceList)
             {
                 if (flashDevice.Name == str.ToString())
                 {
                     FlashingDevice.flashDeviceList.Remove(flashDevice);
                     break;
                 }
             }
             foreach (ListViewItem listViewItem in items)
             {
                 if (listViewItem.SubItems[1].Text == str.ToString())
                 {
                     items.Remove(listViewItem);
                     break;
                 }
             }
             foreach (Control control in (ArrangedElementCollection)devicelist.Controls)
             {
                 if (control.Name == str.ToString() + "progressbar")
                 {
                     devicelist.Controls.Remove(control);
                     break;
                 }
             }
         }
         using (List <Device> .Enumerator enumerator = device.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 Device d = enumerator.Current;
                 if (FlashingDevice.flashDeviceList.Where(fd => fd.Name == d.Name).Select(fd => fd.Name).Count() == 0)
                 {
                     int          num1         = devicelist.Items.Count + 1;
                     ListViewItem listViewItem = new ListViewItem(new string[6]
                     {
                         num1.ToString(),
                         d.Name,
                         "",
                         "0s",
                         "",
                         ""
                     });
                     devicelist.Items.Add(listViewItem);
                     d.ID       = num1;
                     d.Progress = 0.0f;
                     d.IsDone   = new bool?();
                     FlashingDevice.flashDeviceList.Add(d);
                     float       num2        = 0.0f;
                     Rectangle   rectangle   = new Rectangle();
                     ProgressBar progressBar = new ProgressBar();
                     rectangle          = listViewItem.SubItems[2].Bounds;
                     rectangle.Width    = devicelist.Columns[2].Width;
                     progressBar.Parent = devicelist;
                     progressBar.SetBounds(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
                     progressBar.Value   = (int)num2;
                     progressBar.Visible = true;
                     progressBar.Name    = d.Name + "progressbar";
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Log.w(ex.Message);
         int num = (int)MessageBox.Show(ex.Message);
     }
     finally
     {
         btnRefresh.Enabled = true;
         btnRefresh.Cursor  = Cursors.Default;
     }
 }
Пример #13
0
 private void RemoveListViewItem(ListView.ListViewItemCollection lvic, ListViewItem lvi)
 {
     lvic.Remove(lvi);
 }
Пример #14
0
        public void Render()
        {
            listView.BeginUpdate();
            try {
                ListView.ListViewItemCollection viewItems = listView.Items;
                var exist       = currentMark++;
                var justcreated = currentMark++;
                lock (Controller.InConnectionsLock) {
                    foreach (var conn in Controller.InConnections.Values)
                    {
                        if (shownItems.TryGetValue(conn.Id, out var item) == false)
                        {
                            item = new Item {
                                id = conn.Id, conn = conn, mark = justcreated
                            };
                            queue.Add(item);
                            //shownItems.Add(item.id, item);
                        }
                        else
                        {
                            item.mark = exist;
                        }
                    }
                }
                queue.Sort((a, b) => a.id - b.id);
                foreach (var item in queue)
                {
                    var conn = item.conn;
                    shownItems.Add(item.id, item);
                    var vItem = item.viewItem = new ListViewItem();
                    vItem.Tag = item;
                    for (int i = 0; i < listView.Columns.Count; i++)
                    {
                        vItem.SubItems.Add(new ListViewItem.ListViewSubItem());
                    }
                    vItem.SubItems[0].Text = conn.Id.ToString();
                    viewItems.Add(vItem);
                }
                queue.Clear();
                foreach (var item in shownItems.Values)
                {
                    if (item.mark != exist && item.mark != justcreated)
                    {
                        queue.Add(item);
                        continue;
                    }
                    var vItem = item.viewItem;
                    var conn  = item.conn;
                    var ctr   = conn.BytesCountersRW.TotalValue;
                    if (item.mark == justcreated)
                    {
                        vItem.BackColor = Color.FromArgb(unchecked ((int)0xffccffcc));
                    }
                    else
                    {
                        if (ctr.Packets != item.lastPackets)
                        {
                            vItem.BackColor = Color.FromArgb(unchecked ((int)0xffbbddff));
                        }
                        else if (vItem.BackColor != Color.Transparent)
                        {
                            vItem.BackColor = Color.Transparent;
                        }
                    }
                    item.speed       = (int)(ctr.Bytes - item.lastBytes);
                    item.lastPackets = ctr.Packets;
                    item.lastBytes   = ctr.Bytes;

                    UpdateViewItem(item, conn);
                }
                foreach (var item in queue)
                {
                    shownItems.Remove(item.id);
                    viewItems.Remove(item.viewItem);
                }
                queue.Clear();
            } finally {
                listView.EndUpdate();
            }
        }