public ValueTask DisposeAsync() { ReturnAction?.Invoke(Object); if (ReturnTask != null) { return(new ValueTask(ReturnTask(Object))); } return(new ValueTask(Task.FromResult <object>(null))); }
private void ExecuteResultAction(string buttomParameter) { if (buttomParameter.Equals("Repetir")) { RedoAction?.Invoke(); } else if (buttomParameter.Equals("Retornar")) { ReturnAction?.Invoke(); } }
public bool KeyDown(Key key) { if (listBox?.KeyDown(key) == true) { return(true); } // Note: Key may remove inputs or close the popup. for (int i = inputs.Count - 1; i >= 0; --i) { if (i >= inputs.Count) { continue; } if (inputs[i].KeyDown(key)) { return(true); } } if (scrollbar != null && !scrollbar.Disabled) { int scrollOffset = scrollbar.ScrollOffset; switch (key) { case Key.Up: if (scrollOffset > 0) { ScrollTo(scrollOffset - 1); } return(true); case Key.Down: if (scrollOffset < scrollbar.ScrollRange) { ScrollTo(scrollOffset + 1); } return(true); case Key.PageUp: if (scrollOffset > 0) { ScrollTo(Math.Max(0, scrollOffset - 5)); } return(true); case Key.PageDown: if (scrollOffset < scrollbar.ScrollRange) { ScrollTo(Math.Min(scrollbar.ScrollRange, scrollOffset + 5)); } return(true); case Key.Home: ScrollTo(0); return(true); case Key.End: ScrollTo(scrollbar.ScrollRange); return(true); } } if (key == Key.Return && ReturnAction != null) { ReturnAction?.Invoke(); return(true); } if (key == Key.Escape && CanAbort) { game.ClosePopup(); return(true); } if (key == Key.Up || key == Key.PageUp || key == Key.Home) { var upButton = buttons.FirstOrDefault(button => button.ButtonType == Data.Enumerations.ButtonType.MoveUp); if (upButton != null) { upButton.PressImmediately(game, key == Key.PageUp || key == Key.Home); return(true); } } if (key == Key.Down || key == Key.PageDown || key == Key.End) { var downButton = buttons.FirstOrDefault(button => button.ButtonType == Data.Enumerations.ButtonType.MoveDown); if (downButton != null) { downButton.PressImmediately(game, key == Key.PageDown || key == Key.End); return(true); } } return(false); }
public void Dispose() { ReturnAction?.Invoke(Object); ReturnTask?.Invoke(Object).Wait(); }
private void OnPostNewOpinion() { (App.Current as App).PopNavigation(); ReturnAction?.Invoke(NewOpinion); }