/// <summary> /// processes the <see cref="ValueSetKind"/> to set the <see cref="IsParameterOrOVerrideVisible"/> and <see cref="IsParameterSubscriptionVisible"/> properties. /// </summary> /// <param name="valueSetKind"> /// The <see cref="ValueSetKind"/> that is processed. /// </param> private void ProcessValueSetKind(ValueSetKind valueSetKind) { switch (valueSetKind) { case ValueSetKind.All: this.IsParameterOrOVerrideVisible = true; this.IsParameterSubscriptionVisible = true; break; case ValueSetKind.ParameterAndOrverride: this.IsParameterOrOVerrideVisible = true; this.IsParameterSubscriptionVisible = false; break; case ValueSetKind.ParameterSubscription: this.IsParameterOrOVerrideVisible = false; this.IsParameterSubscriptionVisible = true; break; } }
/// <summary> /// Initializes a new instance of the <see cref="SubmitConfirmationViewModel"/> class. /// </summary> /// <param name="processedValueSets"> /// The <see cref="Thing"/>s that have been changed on the workbook. /// </param> /// <param name="valueSetKind"> /// assertion that is used to determine the visibilty of the <see cref="ParameterOrOverrideBase"/> and <see cref="ParameterSubscription"/> /// </param> public SubmitConfirmationViewModel(IReadOnlyDictionary <Guid, ProcessedValueSet> processedValueSets, ValueSetKind valueSetKind) : base(processedValueSets, valueSetKind) { this.DialogTitle = "Submit Changes..."; this.SelectedParameters = new ReactiveList <SubmitParameterRowViewModel>(); this.SelectedSubscriptions = new ReactiveList <SubmitParameterRowViewModel>(); this.CancelCommand = ReactiveCommand.Create(); this.CancelCommand.Subscribe(_ => this.ExecuteCancel()); this.SelectedParameters.ChangeTrackingEnabled = true; this.SelectedParameters.CountChanged.Subscribe(_ => this.ToggleParameterSelection()); this.SelectedParameters.AddRange(this.ParameterOrOverrideSubmitParameterRowViewModels.Where(r => !r.HasValidationError)); this.SelectedSubscriptions.ChangeTrackingEnabled = true; this.SelectedSubscriptions.CountChanged.Subscribe(_ => this.ToggleSubscriptionsSelection()); this.SelectedSubscriptions.AddRange(this.ParameterSubscriptionSubmitParameterRowViewModels.Where(r => !r.HasValidationError)); var canOk = this.WhenAnyValue(vm => vm.OkCanExecute); this.OkCommand = ReactiveCommand.Create(canOk); this.OkCommand.Subscribe(_ => this.ExecuteOk()); if (this.ProcessedValueSets.Any() && this.ProcessedValueSets.Values.Any(x => x.ValidationResult != ValidationResultKind.Valid)) { this.InformationMessage = "Warning: There are invalid values found. These values will not be submitted even if selected!"; this.IsInformationMessageVisible = true; } }
/// <summary> /// Initializes a new instance of the <see cref="ValueSetDialogViewModel"/> class. /// </summary> /// <param name="processedValueSets"> /// The <see cref="ProcessedValueSet"/>s that references <see cref="Thing"/>s that have been changed on the workbook. /// </param> /// <param name="valueSetKind"> /// assertion that is used to determine the visibilty of the <see cref="ParameterOrOverrideBase"/> and <see cref="ParameterSubscription"/> /// </param> protected ValueSetDialogViewModel(IReadOnlyDictionary <Guid, ProcessedValueSet> processedValueSets, ValueSetKind valueSetKind) { this.ProcessValueSetKind(valueSetKind); this.ParameterOrOverrideSubmitParameterRowViewModels = new ReactiveList <SubmitParameterRowViewModel> { ChangeTrackingEnabled = true }; this.ParameterOrOverrideSubmitParameterRowViewModels.Changed.Subscribe(_ => this.UpdateOkCanExecute()); this.ParameterOrOverrideSubmitParameterRowViewModels.ItemChanged.Subscribe(_ => this.UpdateOkCanExecute()); this.ParameterSubscriptionSubmitParameterRowViewModels = new ReactiveList <SubmitParameterRowViewModel> { ChangeTrackingEnabled = true }; this.ParameterSubscriptionSubmitParameterRowViewModels.Changed.Subscribe(_ => this.UpdateOkCanExecute()); this.ParameterSubscriptionSubmitParameterRowViewModels.ItemChanged.Subscribe(_ => this.UpdateOkCanExecute()); this.ProcessedValueSets = processedValueSets; this.PopulateClones(); }
/// <summary> /// Initializes a new instance of the <see cref="WorkbookRebuildViewModel"/> class. /// </summary> /// <param name="processedValueSets"> /// The <see cref="Thing"/>s that have been changed on the workbook. /// </param> /// <param name="valueSetKind"> /// assertion that is used to determine the visibilty of the <see cref="ParameterOrOverrideBase"/> and <see cref="ParameterSubscription"/> /// </param> public WorkbookRebuildViewModel(IReadOnlyDictionary <Guid, ProcessedValueSet> processedValueSets, ValueSetKind valueSetKind) : base(processedValueSets, valueSetKind) { this.DialogTitle = "Rebuild Workbook..."; this.CancelCommand = ReactiveCommand.Create(); this.CancelCommand.Subscribe(_ => this.ExecuteCancel()); this.OkCommand = ReactiveCommand.Create(); this.OkCommand.Subscribe(_ => this.ExecuteOk()); }