Ejemplo n.º 1
0
        private void RequestAnswerer_UpdateList()
        {
            RequestAnswerer_ListBox.Enabled = RequestAnswerer_Listener.IsActive;

            PeerConnection[] l1, l2;

            l1 = RequestAnswerer_Listener.GetPendingRequests();
            List<PeerConnection> l1l = new List<PeerConnection>(l1);
            ListBox.ObjectCollection l2r = RequestAnswerer_ListBox.Items;
            l2 = new PeerConnection[l2r.Count];

            // Copy l2r to l2.
            for (int i = 0; i < l2r.Count; i++)
                l2[i] = (PeerConnection)l2r[i];

            // Remove
            foreach (PeerConnection item in l2)
                if (!l1l.Contains(item))
                    l2r.Remove(item);

            // Add
            for (int i = 0; i < l1l.Count; i++)
            {
                PeerConnection l1o = l1[i];
                PeerConnection l2o = i <= l2.GetUpperBound(0) ? l2[i] : null;
                if (l1o.GreetingReceived && (l2o == null || l1o != l2o))
                {
                    l2r.Add(l1o);
                    if (i == l1l.Count - 1)
                        RequestAnswerer_ListBox.SelectedItem = l1o;
                }
            }
        }
        public void clear_items_from_listbox(ListBox.ObjectCollection files, StringBuilder error_message)
        {
            List <string> files_to_be_deleted = new List <string>();/**get_items_from_list_box(files);**/

            foreach (string file in files)
            {
                try
                {
                    File.SetAttributes(file, FileAttributes.Normal);
                    File.Delete(file);
                    files_to_be_deleted.Add(file);
                }
                catch
                {
                    error_message.Append($"\n {file}");
                }
            }

            foreach (string file in files_to_be_deleted)
            {
                files.Remove(file);
            }

            if (!String.IsNullOrWhiteSpace(error_message.ToString()))
            {
                MessageBox.Show(error_message.ToString());
            }
        }
Ejemplo n.º 3
0
 private void removeResults_Click(object sender, EventArgs e)
 {
     ListBox.ObjectCollection         items         = this.resultsLST.Items;
     ListBox.SelectedObjectCollection selectedItems = this.resultsLST.SelectedItems;
     object[] itemsToRemove = new object[selectedItems.Count];
     selectedItems.CopyTo(itemsToRemove, 0);
     for (int i = itemsToRemove.Length - 1; i >= 0; i--)
     {
         items.Remove(itemsToRemove[i]);
     }
 }
Ejemplo n.º 4
0
        public static void RemoveAll(this ListBox.ObjectCollection coll, Func <object, bool> removeIt)
        {
            HashSet <object> RemovableItems = new HashSet <object>();

            foreach (object item in coll)
            {
                if (removeIt(item))
                {
                    RemovableItems.Add(item);
                }
            }
            foreach (object item in RemovableItems)
            {
                coll.Remove(item);
            }
        }
Ejemplo n.º 5
0
 // Token: 0x0600018F RID: 399 RVA: 0x00002B56 File Offset: 0x00000D56
 static void smethod_12(ListBox.ObjectCollection objectCollection_0, object object_0)
 {
     objectCollection_0.Remove(object_0);
 }