From 674ca83ba9243a9e95a7568c797668dab6aee26a Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 10:35:25 -0300 Subject: feat: upload files --- .../ViewModels/Generic/DialogTrilhaViewModel.cs | 102 +++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 Gestor.Application/ViewModels/Generic/DialogTrilhaViewModel.cs (limited to 'Gestor.Application/ViewModels/Generic/DialogTrilhaViewModel.cs') diff --git a/Gestor.Application/ViewModels/Generic/DialogTrilhaViewModel.cs b/Gestor.Application/ViewModels/Generic/DialogTrilhaViewModel.cs new file mode 100644 index 0000000..1735419 --- /dev/null +++ b/Gestor.Application/ViewModels/Generic/DialogTrilhaViewModel.cs @@ -0,0 +1,102 @@ +using Gestor.Application.Helpers; +using Gestor.Model.Domain.Ferramentas; +using System; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Threading; + +namespace Gestor.Application.ViewModels.Generic +{ + public class DialogTrilhaViewModel : INotifyPropertyChanged + { + private Gestor.Model.Domain.Ferramentas.Trilha _trilha; + + private ObservableCollection _fases; + + private Fase _selectedFase; + + public ObservableCollection Fases + { + get + { + return this._fases; + } + set + { + this.MutateVerbose>(ref this._fases, value, this.RaisePropertyChanged(), "Fases"); + } + } + + public Fase SelectedFase + { + get + { + return this._selectedFase; + } + set + { + this.MutateVerbose(ref this._selectedFase, value, this.RaisePropertyChanged(), "SelectedFase"); + } + } + + public Gestor.Model.Domain.Ferramentas.Trilha Trilha + { + get + { + return this._trilha; + } + set + { + this.MutateVerbose(ref this._trilha, value, this.RaisePropertyChanged(), "Trilha"); + } + } + + public DialogTrilhaViewModel() + { + } + + public void AdicionarFase() + { + if (this.Fases == null) + { + this.Fases = new ObservableCollection(); + } + ObservableCollection fases = this.Fases; + Fase fase = new Fase(); + fase.set_Titulo("TÍTULO"); + fase.set_Descricao("DESCRIÇÃO"); + fases.Add(fase); + this.Fases = new ObservableCollection(this.Fases); + this.Trilha.set_Fases(this.Fases.ToList()); + } + + public void ExcluirFase(Fase fase) + { + this.Fases.RemoveAt(this.Fases.IndexOf(fase)); + this.Fases = new ObservableCollection(this.Fases); + this.Trilha.set_Fases(this.Fases.ToList()); + } + + private Action RaisePropertyChanged() + { + return (PropertyChangedEventArgs args) => { + PropertyChangedEventHandler propertyChangedEventHandler = this.PropertyChanged; + if (propertyChangedEventHandler == null) + { + return; + } + propertyChangedEventHandler(this, args); + }; + } + + public void UpdateFase(int index) + { + this.Fases[index] = this.SelectedFase; + this.Trilha.set_Fases(this.Fases.ToList()); + } + + public event PropertyChangedEventHandler PropertyChanged; + } +} \ No newline at end of file -- cgit v1.2.3