public void Clear() { if (Count > 0) { _stack.Clear(); HasItemsChanged?.Invoke(this, new EventArgs()); } }
public void Push(T item) { _stack.Push(item); if (_stack.Count == 1) { HasItemsChanged?.Invoke(this, new EventArgs()); } }
public void Clear() { if (Count > 0) { items = new T[items.Length]; top = 0; Count = 0; HasItemsChanged?.Invoke(this, new EventArgs()); } }
public T Pop() { var item = _stack.Pop(); if (_stack.Count == 0) { HasItemsChanged?.Invoke(this, new EventArgs()); } return(item); }
public T Pop() { top = (items.Length + top - 1) % items.Length; Count--; if (Count == 0) { HasItemsChanged?.Invoke(this, new EventArgs()); } return(items[top]); }
public void Cut(IEnumerable <IEntityViewModel> entities) { clearClipboard(); _isCutOperation = true; foreach (var entity in entities) { _clipboardData.Add(entity); entity.IsCut = true; } HasItemsChanged?.Invoke(this, EventArgs.Empty); }
public void Push(T item) { items[top] = item; top = (top + 1) % items.Length; if (Count < items.Length) { Count++; } if (Count == 1) { HasItemsChanged?.Invoke(this, new EventArgs()); } }
/// <summary> /// Called when the parent item's state is updated in order to propagate those state changes /// across relations to any materialized items, recursively. /// </summary> public void OnStateUpdated() { if (_isMaterialized) { int beforeCount = 0; int afterCount = 0; foreach (AggregateContainsRelationCollectionSpan span in _spans) { beforeCount += span.Items?.Count ?? 0; span.BaseIndex = afterCount; span.Relation.UpdateContainsCollection(parent: _item, span); afterCount += span.Items?.Count ?? 0; } if ((beforeCount == 0) != (afterCount == 0)) { HasItemsChanged?.Invoke(this, EventArgs.Empty); } } }
public void Paste(IDirectoryViewModel directory) { var entities = _clipboardData.ToList(); var isCutOperation = _isCutOperation; if (_isCutOperation) { clearClipboard();//allow continue copying as many times as user wants } _isCutOperation = false; HasItemsChanged?.Invoke(this, EventArgs.Empty); try { foreach (var entityInfo in entities) { performOperation(entityInfo, directory, isCutOperation); } } catch (Exception e) { _windowsManager.ReportError("Paste error", e); } }
protected void InvokeHasItemsChanged() { HasItemsChanged?.Invoke(this, new EventArgs()); }
public void Copy(IEnumerable <IEntityViewModel> entities) { clearClipboard(); _clipboardData.AddRange(entities); HasItemsChanged?.Invoke(this, EventArgs.Empty); }
public void Dispose() { clearClipboard(); HasItemsChanged?.Invoke(this, EventArgs.Empty); }