Пример #1
0
 public void Clear()
 {
     if (Count > 0)
     {
         _stack.Clear();
         HasItemsChanged?.Invoke(this, new EventArgs());
     }
 }
Пример #2
0
 public void Push(T item)
 {
     _stack.Push(item);
     if (_stack.Count == 1)
     {
         HasItemsChanged?.Invoke(this, new EventArgs());
     }
 }
Пример #3
0
 public void Clear()
 {
     if (Count > 0)
     {
         items = new T[items.Length];
         top   = 0;
         Count = 0;
         HasItemsChanged?.Invoke(this, new EventArgs());
     }
 }
Пример #4
0
        public T Pop()
        {
            var item = _stack.Pop();

            if (_stack.Count == 0)
            {
                HasItemsChanged?.Invoke(this, new EventArgs());
            }
            return(item);
        }
Пример #5
0
        public T Pop()
        {
            top = (items.Length + top - 1) % items.Length;
            Count--;

            if (Count == 0)
            {
                HasItemsChanged?.Invoke(this, new EventArgs());
            }

            return(items[top]);
        }
Пример #6
0
        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);
        }
Пример #7
0
        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());
            }
        }
Пример #8
0
        /// <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);
                }
            }
        }
Пример #9
0
        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);
            }
        }
Пример #10
0
 protected void InvokeHasItemsChanged()
 {
     HasItemsChanged?.Invoke(this, new EventArgs());
 }
Пример #11
0
 public void Copy(IEnumerable <IEntityViewModel> entities)
 {
     clearClipboard();
     _clipboardData.AddRange(entities);
     HasItemsChanged?.Invoke(this, EventArgs.Empty);
 }
Пример #12
0
 public void Dispose()
 {
     clearClipboard();
     HasItemsChanged?.Invoke(this, EventArgs.Empty);
 }