/// <summary> /// Constructeur /// </summary> public ListeViewModel(IDecisionPersister decisionsSource, IDomaineReference domaineReference) { this._decisionSource = decisionsSource; this.DomaineList = domaineReference; this.DecisionsListeViewModel = new DecisionsListViewModel(decisionsSource, domaineReference); this.SelectedDomaineChangedCommand = new BasicCommand(this.SelectedDomainChanged); this.ExportCommand = new BasicCommand(this.Export); this.RefreshCommand = new BasicCommand(this.Refresh); }
/// <summary> /// Constructeur /// </summary> public DecisionCreateViewModel(IDecisionPersister decisionsStorage, IDomaineReference domaineReference) : base(decisionsStorage, domaineReference) { this.DecisionBuilder = new InstanceProperty <DecisionBuilder> { Value = new DecisionBuilder() }; this.Register(nameof(this.DecisionBuilder), this.DecisionBuilder); this.Register(nameof(this.IsEnabled), this.IsEnabled); this.DomaineAdd += (sender, domaine) => this.DecisionBuilder.Value.Domaines.Add(domaine); this.DomaineRemoved += (sender, domaine) => this.DecisionBuilder.Value.Domaines.Remove(domaine); }
/// <summary> /// Constructeur /// </summary> public DecisionEditViewModel(IDecisionPersister decisionsStorage, IDomaineReference domaineReference, DecisionModel toEdit) : base(decisionsStorage, domaineReference) { this.EditedDecision = toEdit; this.PreviewUri = toEdit.Lien.AbsoluteUri; this._initialState = toEdit.Domaines.ToArray(); this.AjouterDomaines(this._initialState); this.DomaineAdd += (sender, domaine) => toEdit.Domaines.Add(domaine); this.DomaineRemoved += (sender, domaine) => toEdit.Domaines.Remove(domaine); this.Register(nameof(this.IsEnabled), this.IsEnabled); }
/// <summary> /// Constructeur /// </summary> public DecisionsListViewModel(IDecisionPersister storage, IDomaineReference domaineReference) { this._storage = storage; this._domaineReference = domaineReference; this.WorkInProgress = new InstanceProperty <bool>(); this.CurrentDomaine = new InstanceProperty <Domaine>(); this.CurrentDomaine.ValueChanged += async(sender, value) => await this.RefreshDecisionList(value); this.DecisionsList = new ObservableCollection <DecisionViewModel>(); this.ToggleDeleteDecisionCommand = new BasicCommand <DecisionViewModel>(async model => await this.ToggleDelete(model)); this.EditDecisionCommand = new BasicCommand <DecisionViewModel>(this.EditDecision); this.Register(nameof(this.CurrentDomaine), this.CurrentDomaine); }
/// <summary> /// Constructeur /// </summary> protected DecisionsViewModelAbstract( IDecisionPersister decisionsStorage, IDomaineReference domaineReference) { this.DecisionsStorage = decisionsStorage; this.IsEnabled = new InstanceProperty <bool> { Value = true }; this.AddSelectedDomaineList = new List <Domaine>(); this.RemoveSelectedDomaineList = new List <Domaine>(); this.IncludedDomaineList = new ObservableCollection <Domaine>(); this.ExcludedDomaineList = new ObservableCollection <Domaine>(); this._domaineReference = domaineReference; this._domaineReference.CollectionChanged += (value, args) => this.ResetDomaineList(); this.AjouterSelectedDomainesCommand = new BasicCommand(this.AjouterSelectedDomaines); this.EnleverSelectedDomainesCommand = new BasicCommand(this.EnleverSelectedDomaines); this.CommitCommand = new BasicCommand(async() => { bool oldValueOfIsEnabled = this.IsEnabled.Value; try { this.WorkInProgress.Value = true; this.IsEnabled.Value = false; await this.Commit(); } finally { this.WorkInProgress.Value = false; this.IsEnabled.Value = oldValueOfIsEnabled; } }); this.RollbackCommand = new BasicCommand(this.Rollback); this.ResetDomaineList(); this.ClickCommand = new BasicCommand(this.Clicked); this.WorkInProgress = new InstanceProperty <bool>(); }
public DecisionPersisterLogDecorator(IDecisionPersister decorated, Logger log) { this._decorated = decorated; this._log = log; }