Example #1
0
        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());
        }
Example #2
0
 public void UpdateProgress(string message, int progressBarValue)
 {
     this.InvokeExt(_ =>
     {
         DisplayText.Text += message + General.NewLine;
         DisplayText.MoveCursorToEnd();
         ProgressBar.Value = progressBarValue;
     });
 }