private void RaiseCommandsChanged() { if (CommandsChanged != null) { CommandsChanged.Invoke(this, new EventArgs()); } }
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(); }
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); }
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); }
public static void Clear() { _queue = new ConcurrentQueue <CommandLogEntry>(); CommandsChanged?.Invoke(); }
public void LogEnd() { CommandsChanged?.Invoke(this, EventArgs.Empty); }
private void OnCommandsCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { CommandsChanged?.Invoke(Commands); }
protected virtual void OnCommandsChanged() { CommandsChanged?.Invoke(this, EventArgs.Empty); }
public void DisposeCommandFromStackByDependency(ICommandStackDependencySource dep) { var relatedItems = _undoStack.Where(command => command.Dependencies.Any(o => o == dep)); CommandsChanged?.Invoke(); }
public void AddStackingCommand(IStackingCommand newStackingCommand) { _undoStack.Push(newStackingCommand); _redoStack.Clear(); CommandsChanged?.Invoke(); }