コード例 #1
0
        public ProgressViewModel(IScarletCommandBuilder commandBuilder)
            : base(commandBuilder)
        {
            Maximum             = 100;
            _progress           = new DispatcherProgress <double>(Dispatcher, killTheUIWithWork, TimeSpan.FromMilliseconds(50));
            _uiBlockingProgress = new Progress <double>(killTheUIWithWork);

            /// overwhelms the dispatcher and the UI thread with property changed notifications
            void killTheUIWithWork(double i) => Dispatcher.Invoke(() => Percentage = i).ConfigureAwait(false);
        }
コード例 #2
0
        public ProgressViewModel()
            : base(ScarletCommandBuilder.Default)
        {
            Maximum   = 100;
            _progress = new DispatcherProgress <double>(Dispatcher, SetPercentage, TimeSpan.FromMilliseconds(50));

            ProgressCommand = CommandBuilder
                              .Create(DoWorkImpl, () => ProgressCommand.IsNotBusy)
                              .WithSingleExecution(nameof(ProgressCommand))
                              .WithCancellation()
                              .Build();
        }