public void TestPush() { _testStack.Push(1); Assert.IsTrue(_hasItemsChangedFiredCount == 1); _hasItemsChangedFiredCount = 0; _testStack.Push(2); Assert.IsFalse(_hasItemsChangedFiredCount == 1); }
public void ClickEnd() { IWorldCommand cmd = currentMode.ClickEnd(Input.mousePosition); IWorldCommand invCmd = cmd.Excecute(); inverseCommands.Push(invCmd); }
public void Undo() { var action = undoStack.Pop(); if (action == null) { return; } redoStack.Push(action); action.Undo(); }
public void Start() { Console.WriteLine("===========DropoutStack Demo=========="); int stackCapacity = 5; int inputCount = 4; DropoutStack <int> stack = new DropoutStack <int>(stackCapacity); for (int i = 0; i < inputCount; i++) { stack.Push(i); } while (stack.Count > 0) { Console.WriteLine(stack.Pop()); } }
/// <summary> /// Creates a command with arguments /// </summary> /// <param name="query"></param> /// <param name="arguments"></param> /// <returns></returns> public async Task <MySqlCommand> CreateCommand(string query) { //Validate the query if (string.IsNullOrWhiteSpace(query)) { throw new ArgumentNullException("query"); } //Try connect if (!await OpenAsync()) { return(null); } //Wait for the semephore Logger.Log("Creating Command, Waiting Semaphore.. {0}", _semaphore.CurrentCount); await _semaphore.WaitAsync(); Logger.Log("[+] {0}", query.Substring(0, Math.Min(query.Length, 50))); //Validate the command is empty if (_command != null) { throw new Exception("Attempted to create a new command, but the previous one hasn't been released."); } //Push the query _previousQueries.Push(new PreviousQuery() { query = query, thread = Thread.CurrentThread.ManagedThreadId }); //Update the timer and prepare the query LastStatementPreparedAt = DateTime.Now; query = query.Replace("!", Settings.Prefix); _command = new MySqlCommand(query, _connection); if (_command == null) { ReleaseCommand(); return(null); } return(_command); }
public override Task <bool> HandleMessage(Message msg) { //Add the logs to the stack _stack.Push(msg.ToString()); return(Task.FromResult(false)); }
public void PushAction(IAction action) { undoStack.Push(action); redoStack.Clear(); }
private void RegisterOriginalImageSourceUpdated(object source, ImageSourceChangedEventArgs args) { bitmapsBuffer.Push(args.OldImageSource); SetUndoVisibility(); SetToDefaultVisibility(); }