Example #1
0
 private void RaiseCommandsChanged()
 {
     if (CommandsChanged != null)
     {
         CommandsChanged.Invoke(this, new EventArgs());
     }
 }
Example #2
0
        public async Task RedoCommands(int commandsCount)
        {
            for (var i = 0; i < commandsCount; i++)
            {
                var command = _redoStack.Pop();
                await command.Do();

                _undoStack.Push(command);
            }
            CommandsChanged?.Invoke();
        }
Example #3
0
        public void Log(string command, DateTime executionStartTimestamp, DateTime executionEndTimestamp)
        {
            lock (_logQueue)
            {
                if (_logQueue.Count >= LogLimit)
                {
                    _logQueue.Dequeue();
                }

                var commandLogEntry = new CommandLogEntry(command, executionStartTimestamp, executionEndTimestamp);
                _logQueue.Enqueue(commandLogEntry);
            }

            CommandsChanged?.Invoke(this, EventArgs.Empty);
        }
Example #4
0
        public static ProcessOperation LogProcessStart(string fileName, string arguments = "")
        {
            const int MaxEntryCount = 500;

            var entry = new CommandLogEntry(fileName, arguments, DateTime.Now, ThreadHelper.JoinableTaskContext.IsOnMainThread);

            _queue.Enqueue(entry);

            // Trim extra items
            while (_queue.Count >= MaxEntryCount)
            {
                _queue.TryDequeue(out _);
            }

            CommandsChanged?.Invoke();

            return(new ProcessOperation(entry, Stopwatch.StartNew(), () => CommandsChanged?.Invoke()));
        }
        /// <summary>
        /// Add the command to the log fifo queue
        /// </summary>
        /// <param name="command">The (Git) command to log</param>
        /// <param name="timestamp">The time for the log</param>
        /// <returns>The log entry reference, null if not added</returns>
        public CommandLogEntry LogEntry(string command, DateTime timestamp)
        {
            CommandLogEntry commandLogEntry = null;

            lock (_logQueue)
            {
                if (_logQueue.Count >= LogLimit)
                {
                    _logQueue.Dequeue();
                }

                commandLogEntry = new CommandLogEntry(command, timestamp);
                _logQueue.Enqueue(commandLogEntry);
            }

            CommandsChanged?.Invoke(this, EventArgs.Empty);
            return(commandLogEntry);
        }
Example #6
0
 public static void Clear()
 {
     _queue = new ConcurrentQueue <CommandLogEntry>();
     CommandsChanged?.Invoke();
 }
 public void LogEnd()
 {
     CommandsChanged?.Invoke(this, EventArgs.Empty);
 }
Example #8
0
 private void OnCommandsCollectionChanged(object sender,
                                          System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
 {
     CommandsChanged?.Invoke(Commands);
 }
Example #9
0
 protected virtual void OnCommandsChanged()
 {
     CommandsChanged?.Invoke(this, EventArgs.Empty);
 }
Example #10
0
        public void DisposeCommandFromStackByDependency(ICommandStackDependencySource dep)
        {
            var relatedItems = _undoStack.Where(command => command.Dependencies.Any(o => o == dep));

            CommandsChanged?.Invoke();
        }
Example #11
0
 public void AddStackingCommand(IStackingCommand newStackingCommand)
 {
     _undoStack.Push(newStackingCommand);
     _redoStack.Clear();
     CommandsChanged?.Invoke();
 }