/// <summary> /// Déclenche l'événement <see cref="IsBusyChanged"/> /// </summary> protected virtual void OnIsBusyChanged() { IsBusyChanged?.Invoke(this, EventArgs.Empty); // Refresh Commands RefreshCommand.RaiseCanExecuteChanged(); }
/// <summary> /// Called to begin a work load block. Manages the <see cref="IsBusy"/> property and <see cref="IsBusyChanged"/> event. /// </summary> protected void BeginBusy() { _busyCount++; if (_busyCount == 1) { IsBusyChanged?.Invoke(this, EventArgs.Empty); } }
protected virtual void OnIsBusyChanged(bool value) { IsBusyChanged?.Invoke(this, new IsBusyEventArgs() { IsBusy = value } ); }
private void SetIsBusy(bool isBusy) { if (_isBusy != isBusy) { _isBusy = isBusy; IsBusyChanged?.Invoke(this, new IsBusyEventArgs { IsBusy = isBusy }); } }
/// <summary> /// Called to end a work load block. Manages the <see cref="IsBusy"/> property and <see cref="IsBusyChanged"/> event. /// </summary> protected void EndBusy() { if (_busyCount == 0) { return; } _busyCount--; if (_busyCount == 0) { IsBusyChanged?.Invoke(this, EventArgs.Empty); } }
private async Task DoWork(Func <Task> work) { try { IsBusy = true; IsBusyChanged?.Invoke(this, EventArgs.Empty); await work(); } finally { IsBusy = false; IsBusyChanged?.Invoke(this, EventArgs.Empty); } }
/// <summary> /// Other viewmodels can override this if something should be done when busy /// </summary> protected virtual void OnIsBusyChanged() { IsBusyChanged?.Invoke(this, EventArgs.Empty); }
protected virtual void OnIsBusyChanged(bool oldValue, bool newValue) { IsBusyChanged?.Invoke(this, EventArgs.Empty); }
protected void OnBusyChanged(bool state) { IsBusyChanged?.Invoke(state); }
protected static void OnIsBusyChanged(EventArgs e) { IsBusyChanged?.Invoke(null, e); }
protected virtual void OnIsBusyChanged(EventArgs e) => IsBusyChanged?.Invoke(this, e);