private void PauseThenClose() { BtnAction.Visible = true; BtnAction.Text = @"OK"; BtnAction.Refresh(); new Timer(_ => Close(), null, CloseAfterWorkCompletedTimeMilliSec, Timeout.Infinite); }
public override sealed void Subscribe() { Mediator.ViewModel.Update = () => { viewModelBindingSource.CurrencyManager.Refresh(); DisplayText.MoveCursorToEnd(); }; BtnAction.GetClick() .Where(_ => BtnAction.Visible) .Where(_ => Mediator.BackgroundWorkerEndingState == BackgroundWorkerEndingState.NotSet) .Subscribe(_ => Mediator.Cancel()); BtnAction.GetClick() .Where(_ => Mediator.BackgroundWorkerEndingState != BackgroundWorkerEndingState.NotSet) .Subscribe(_ => Close()); this.GetVisibleChanged() .Where(_ => Visible) .Subscribe(_ => Mediator.Execute()); Mediator.BackgroundWorkFinishedToken = new MessageToken(); Messenger.Instance().OfType <StringMessage>() .Where(sp => sp.Token == Mediator.BackgroundWorkFinishedToken) .Subscribe(sp => PauseThenClose()); }
public Btn(Rectangle dst, Element ele, BtnAction action, Color[] colours) { this.DstRect = UsefulTools.GridToPixel(Game1.TILE_SIZE, dst); this.Element = ele; this.Action = action; this.StateColours = colours; this.DrawText = false; }
public Btn(int x, int y, int w, int h, Element ele, BtnAction action, Color[] colours) : this(new Rectangle(x, y, w, h), ele, action, colours) { }
public ButtonActionsPress(Hand hand, BtnAction button, bool pressed) { this.hand = hand; this.button = button; this.pressed = pressed; }