private void DeviceList_ItemsAdding(object sender, ItemsAddingEventArgs e) { if (DeviceList.Items.Count >= 8 && !ResizeDone) { olvColumn7.MaximumWidth = 83; olvColumn7.MinimumWidth = 83; olvColumn7.Width = 83; ResizeDone = true; } //Notifications are not suppressed if (WindowState == FormWindowState.Minimized && Properties.Settings.Default.SuppressNotifications == 2) { var Ad = e.ObjectsToAdd.Cast <Device>().ToList(); if (Ad.Count > 0) { Device Device = Ad[0]; ToastAPI.ShowPrompt(string.Format("{0}\nIP:{1}\nMAC:{2}", Properties.Resources.NewTargetNotificationPrompt, Device.IP, Device.MAC), NotificationPurpose.TargetDiscovery, Device.IP.ToString(), Device.MAC.ToString()); } } }
private void ListView_ItemsAdding(object sender, ItemsAddingEventArgs e) { foreach (var o in e.ObjectsToAdd) { SourceObjects.Add(o); } }
/// <summary> /// Add the given collection of model objects to this control. /// </summary> /// <param name="modelObjects">A collection of model objects</param> /// <remarks> /// <para>The added objects will appear in their correct sort position, if sorting /// is active. Otherwise, they will appear at the end of the list.</para> /// <para>No check is performed to see if any of the objects are already in the ListView.</para> /// <para>Null objects are silently ignored.</para> /// </remarks> public override void AddObjects(ICollection modelObjects) { if (this.DataSource == null) { return; } // Give the world a chance to cancel or change the added objects ItemsAddingEventArgs args = new ItemsAddingEventArgs(modelObjects); this.OnItemsAdding(args); if (args.Canceled) { return; } this.ClearCachedInfo(); this.DataSource.AddObjects(args.ObjectsToAdd); this.Sort(); this.UpdateVirtualListSize(); }
private void FastObjectListView1_ItemsAdding(object sender, ItemsAddingEventArgs e) { if (fastObjectListView1.Items.Count >= 8 && !ResizeDone) { olvColumn7.MaximumWidth = 83; olvColumn7.MinimumWidth = 83; olvColumn7.Width = 83; ResizeDone = true; } if (WindowState == FormWindowState.Minimized && Properties.Settings.Default.SuppressN == "False") { var Ad = e.ObjectsToAdd.Cast <Device>().ToList(); if (Ad.Count > 0) { Device Device = Ad[0]; NotificationAPI Napi = new NotificationAPI(Device, this); Napi.CreateNotification(); Napi.AttachHandlers(); Napi.ShowToast(); } } }
private void lvSelectedOrder_ItemsAdding(object sender, ItemsAddingEventArgs e) { }
/// <summary> /// Add the given collection of model objects to this control. /// </summary> /// <param name="modelObjects">A collection of model objects</param> /// <remarks> /// <para>The added objects will appear in their correct sort position, if sorting /// is active. Otherwise, they will appear at the end of the list.</para> /// <para>No check is performed to see if any of the objects are already in the ListView.</para> /// <para>Null objects are silently ignored.</para> /// </remarks> public override void AddObjects(ICollection modelObjects) { if (this.DataSource == null) return; // Give the world a chance to cancel or change the added objects ItemsAddingEventArgs args = new ItemsAddingEventArgs(modelObjects); this.OnItemsAdding(args); if (args.Canceled) return; this.ClearCachedInfo(); this.DataSource.AddObjects(args.ObjectsToAdd); this.Sort(); this.UpdateVirtualListSize(); }