コード例 #1
0
        public async Task StartLoading(string title = null, bool isCancelable = false)
        {
            using (await _lock.EnterAsync())
            {
                var currentCount = Interlocked.Increment(ref _loadingItems);
                if (currentCount == 1)
                {
                    await RunOnUIAsync(async() =>
                    {
                        _progressController = await ShellView.ShowChocolateyDialogAsync(title, isCancelable);
                        _progressController.SetIndeterminate();
                        if (isCancelable)
                        {
                            _cst = new CancellationTokenSource();
                            _progressController.OnCanceled += dialog =>
                            {
                                if (_cst != null)
                                {
                                    _cst.Cancel();
                                }
                            };
                        }

                        Output.Clear();

                        IsLoading = true;
                        NotifyPropertyChanged("IsLoading");
                    });
                }
            }
        }
コード例 #2
0
 public void Report(double value)
 {
     _progress = value;
     if (_progressController != null)
     {
         if (value < 0)
         {
             _progressController.SetIndeterminate();
         }
         else
         {
             _progressController.SetProgress(Math.Min((_progress) / 100.0f, 100));
         }
     }
     NotifyPropertyChanged("Progress");
 }
コード例 #3
0
        public void Report(double value)
        {
            Progress = value;

            if (_progressController != null)
            {
                if (value < 0)
                {
                    Execute.OnUIThread(() => _progressController.SetIndeterminate());
                }
                else
                {
                    Execute.OnUIThread(() => _progressController.SetProgress(Math.Min(Progress / 100.0f, 100)));
                }
            }

            NotifyPropertyChanged("Progress");
        }