/// <summary> /// Used to dispose of resources in use by the <see cref="AdminViewModel{TViewModel, TModel, TModelSearcher}"/> /// </summary> /// <param name="disposing"></param> protected override void Dispose(bool disposing) { if (!_disposedValue) { if (disposing) { ApplicationRestrictor.RequestUnlock(_adminToken); FamilialLocker.RequestUnlock(_adminToken); CriticalOperationType = CriticalOperationType.None; if (ModelSearcher != null) { ModelSearcher.SelectedItems.CollectionChanged -= SelectedItems_CollectionChanged; ModelSearcher.ExportId -= ModelSearcher_ExportId; ModelSearcher.Cleared -= ModelSearcher_Cleared; ModelSearcher.RequestEnable(_adminToken); } Model.ErrorsChanged -= Model_ErrorsChanged; Model.Dispose(); _newEnableCallback = null; _duplicateEnableCallback = null; _modifyEnableCallback = null; _backEnableCallback = null; _forwardEnableCallback = null; _performDeleteOnRecordEnableCallback = null; _backForwardNavigator.CurrentItemChangedCallback = null; _backForwardNavigator?.Dispose(); Navigation.Dispose(); RecordChangeLocker.Dispose(); ConfirmCancelLocker.Dispose(); NewRecordCancelLocker.Dispose(); NavigationalOverride.Dispose(); OutsideModificationLocker.Dispose(); DefaultModelCallback = null; Locators.ForEach(locator => { locator.SearchToBegin -= Locator_SearchToBegin; locator.SearchComplete -= Locator_SearchComplete; locator.RecordRequested -= Locator_RecordRequested; locator.RequestEnable(_adminToken); }); Locators.Clear(); } _disposedValue = true; } base.Dispose(disposing); }
/// <summary> /// The default enable for the Confirm Command. /// </summary> /// <returns>True enables button. False is a disable.</returns> protected virtual bool ConfirmEnable() => HasErrors == false && Modifying && ConfirmCancelLocker.IsFree() && NavigationalOverride.IsFree();
/// <summary> /// The default enable for the Cancel Command. /// </summary> /// <returns>True enables button. False is a disable.</returns> protected virtual bool CancelEnable() => Modifying && ConfirmCancelLocker.IsFree() && (NewRecordCancelLocker.IsFree() || CriticalOperationType != CriticalOperationType.AddingNewRecord) && NavigationalOverride.IsFree();
/// <summary> /// The default enable for the ReloadCurrent Command. /// </summary> /// <returns>True enables button. False is a disable.</returns> protected virtual bool ReloadCurrentEnable() => this.ModelValidEnable() && this.StateNotCriticalEnable() && NavigationalOverride.IsFree();
/// <summary> /// The default enable for the Forward Command. /// </summary> /// <returns>True enables button. False is a disable.</returns> protected virtual bool ForwardEnable() => _backForwardNavigator.CanNavigateForward() && this.StateNotCriticalEnable() && RecordChangeLocker.IsFree() && NavigationalOverride.IsFree();
/// <summary> /// The default enable for the Modify Command. /// </summary> /// <returns>True enables button. False is a disable.</returns> protected virtual bool ModifyEnable() => this.ModelValidEnable() && this.StateNotCriticalEnable() && this.StateNotRestrictedEnable() && NavigationalOverride.IsFree();
/// <summary> /// The default enable for the Duplicate command; /// </summary> /// <returns>True enables button. False is a disable.</returns> protected virtual bool DuplicateEnable() => this.ModelValidEnable() && this.StateNotCriticalEnable() && this.StateNotRestrictedEnable() && RecordChangeLocker.IsFree() && NavigationalOverride.IsFree();