/// <summary> /// The list's window procedure. /// </summary> /// <param name="m">A Windows Message Object.</param> protected override void WndProc(ref Message m) { if (m.Msg == LB_ADDSTRING || m.Msg == LB_INSERTSTRING || m.Msg == LB_DELETESTRING || m.Msg == LB_RESETCONTENT) { ItemsChanged?.Invoke(this, new EventArgs()); } // if the message indicates that the TopIndex property of the list box might have changed, raise the VScrollChanged event.. if (m.Msg == WM_VSCROLL || m.Msg == WM_MOUSEWHEEL || m.Msg == WM_KEYDOWN) { // ..if not denied and the TopIndex property was actually changed.. if (lastTopIndex != this.TopIndex) { lastTopIndex = TopIndex; // save the top index so it's changes can be monitored.. // if the VScrollChanged event is subscribed the raise the event with (FromControl = true).. VScrollChanged?.Invoke(this, new VScrollChangedEventArgs() { Minimum = 0, Maximum = Items.Count, Value = VScrollPosition, FromControl = true }); } } base.WndProc(ref m); }
public new TValue this[TKey key] { get { return(base[key]); } set { Boolean succesfull = TryGetValue(key, out TValue val); if (succesfull && val?.Equals(value) == true) { return; } base[key] = value; if (succesfull) { OnChange?.Invoke(key, value); } else { OnAdd?.Invoke(key, value); } OnSet?.Invoke(key, value); ItemsChanged?.Invoke(); } }
protected override void WndProc(ref Message m) { base.WndProc(ref m); switch (m.Msg) { case 0x1007: ItemsChanged?.Invoke(); break; case 0x104D: ItemsChanged?.Invoke(); break; case 0x1008: ItemsChanged?.Invoke(); break; case 0x1009: ItemsChanged?.Invoke(); break; default: break; } }
/// <summary> /// /// </summary> protected virtual void OnItemsChanged() { OnPropertyChanged("Count"); IsEmpty = Count == 0; ItemsChanged?.Invoke(this, new EventArgs()); }
public new void Add(TKey key, TValue value) { base.Add(key, value); OnAdd?.Invoke(key, value); OnSet?.Invoke(key, value); ItemsChanged?.Invoke(); }
internal void FireContentChanged() { if (ItemsChanged != null) { ItemsChanged.Invoke(this, EventArgs.Empty); } }
public new void Insert(Int32 index, T item) { base.Insert(index, item); OnAdd?.Invoke(ref item); OnInsert?.Invoke(index, ref item); ItemsChanged?.Invoke(); }
public MenuItem <T> Add(string text, T value = default(T)) { MenuItem <T> menuItem = MenuItem <T> .Create(text, value); _menuItems.Add(menuItem); ItemsChanged?.Invoke(this, EventArgs.Empty); return(menuItem); }
public void RemoveItem(Item item) { _itemsInventory.Remove(item); _audioSource.PlayOneShot(_selectClip); ItemsChanged?.Invoke(); }
private void Start() { if (_startItems) { Items = _startItems.GetItemDictionary(); } ItemsChanged.Invoke(); }
public MaterialsToStudentViewModel(IEnumerable <MaterialSelectorItem> materials) { Materials = new ObservableCollection <MaterialSelectorItem>(materials); Apply = new DelegateCommand(() => { ItemsChanged?.Invoke(this, EventArgs.Empty); ViewService.Message("Материалы прикрепленны"); }); }
public void Clear() { InvokeIfRequired(() => { Control.Items.Clear(); ItemsChanged?.Invoke(this, new GenericEventArgs <string[]>(Items)); }); }
protected override void OnItemsChanged(object e) { base.OnItemsChanged(e); ItemsChanged?.Invoke(this, new MessagesViewItemsChangedArgs() { Items = Items }); }
public new void RemoveAt(Int32 index) { T item = this[index]; base.RemoveAt(index); OnRemove?.Invoke(item); ItemsChanged?.Invoke(); }
public async Task DeleteItemByKey(Guid ID) { var item = await this[ID]; await _companyCollection.FindOneAndUpdateAsync(e => e.ID == item.CompanyID, Builders <Company> .Update.Pull(e => e.Employees, item)); ItemsChanged?.Invoke(this, new RepositoryChangeEventArgs <Employee>(OperationType.Delete, item)); }
public bool Remove(Item item) { var success = items.Remove(item); ItemsChanged?.Invoke(); return(success); }
/// <summary> /// 触发集合更改事件 /// </summary> /// <param name="change"></param> /// <param name="index"></param> void RaiseVectorChanged(CollectionChange change, int index) { if (_updating <= 0 && ItemsChanged != null) { // 符合更新条件,触发基类事件,否则延迟更新 ItemsChanged.Invoke(this, new ItemListChangedArgs(change, index)); } }
public void AddRange(string[] items) { InvokeIfRequired(() => { Control.Items.AddRange(items); ItemsChanged?.Invoke(this, new GenericEventArgs <string[]>(Items)); }); }
public void Remove(string item) { InvokeIfRequired(() => { Control.Items.Remove(item); ItemsChanged?.Invoke(this, new GenericEventArgs <string[]>(Items)); }); }
private void button2_Click(object sender, EventArgs e) { while (listBox1.SelectedIndices.Count > 0) { listBox1.Items.RemoveAt(listBox1.SelectedIndices[0]); } ItemsChanged?.Invoke(this, EventArgs.Empty); }
public new int RemoveAll(Predicate <T> match) { int removedCount = base.RemoveAll(match); ItemRemoved?.Invoke(); ItemsChanged?.Invoke(); return(removedCount); }
public void AddItem() { _items.Add(new Item { Title = $"Item {_items.Count}" }); ItemsChanged?.Invoke(this, EventArgs.Empty); }
public void ReplaceItems(IEnumerable <MenuItemUserModel> userItems) { var newItems = userItems.ToList(); _items.Clear(); RegisterModel(newItems, _items); ItemsChanged?.Invoke(newItems); }
void Item_Interact(object sender, EventArgs e) { foreach (IItem item in Parent.Controls) { item.Snap(); } ItemsChanged?.Invoke(); }
public virtual async Task RemoveItemAsync(IItem item) { _items.Remove(item); if (ItemsChanged != null) { await ItemsChanged.Invoke(this, Items); } }
protected override void OnPreviewMouseMove(MouseEventArgs e) { base.OnPreviewMouseMove(e); e.Handled = true; if (!_mouseLeftButtonDown) { return; } Point cursorScreenPosition = OpenControls.Wpf.DockManager.Controls.Utilities.GetCursorPosition(); int selectedIndex = GetListBoxItemIndex(cursorScreenPosition); if ((selectedIndex < 0) || (selectedIndex >= Items.Count) || (selectedIndex == _dragIndex)) { Point topLeftPoint = PointToScreen(new Point(0, 0)); if ( (cursorScreenPosition.Y < (topLeftPoint.Y - 30)) || (cursorScreenPosition.Y > (topLeftPoint.Y + ActualHeight + 15)) || (cursorScreenPosition.X < (topLeftPoint.X - 30)) || (cursorScreenPosition.X > (topLeftPoint.X + ActualWidth + 15)) ) { // Cancel further drag processing until we get the next mouse left button down _mouseLeftButtonDown = false; System.Windows.Input.Mouse.Capture(this, CaptureMode.None); System.Diagnostics.Debug.WriteLine("FloatTabRequest: count = " + Items.Count); FloatTabRequest?.Invoke(this, null); } return; } Rect rectSelectedItem = GetListBoxItemBounds(selectedIndex); Rect rectDragItem = GetListBoxItemBounds(_dragIndex); double selectedWidth = rectSelectedItem.Width; double currentWidth = rectDragItem.Width; if (_dragIndex > SelectedIndex) { selectedWidth = -selectedWidth; } rectDragItem.Offset(selectedWidth, 0); if (!rectDragItem.Contains(cursorScreenPosition)) { return; } // Move the item along to the new index var item = Items[_dragIndex]; Items.Remove(item); Items.Insert(selectedIndex, item); _dragIndex = selectedIndex; SelectedIndex = selectedIndex; ItemsChanged?.Invoke(this, null); }
private void rebuildProxies() { proxyList.Clear(); foreach (TOriginal original in originalList) { proxyList.Add(converterMethod(original)); } ItemsChanged?.Invoke(); }
public new void AddRange(IEnumerable <T> collection) { base.AddRange(collection); if (collection.Count() > 0) { ItemAdded?.Invoke(); ItemsChanged?.Invoke(); } }
public new void InsertRange(int index, IEnumerable <T> collection) { base.InsertRange(index, collection); if (collection.Count() > 0) { ItemAdded?.Invoke(); ItemsChanged?.Invoke(); } }
public void Clear() { if (listBox1.Items.Count > 0) { listBox1.Items.Clear(); button2.Enabled = false; ItemsChanged?.Invoke(this, EventArgs.Empty); } }