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"); }); } } }
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"); }
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"); }