void SubscribeAdd() { MessagingCenter.Subscribe <DetailViewModel>(this, "AddMsg", (sender) => { Tarefas = new ObservableCollection <Tarefa>(connection.GetT() as List <Tarefa>); MessagingCenter.Unsubscribe <DetailViewModel>(this, "AddMsg"); }); }
public DetailViewModel(Tarefa tarefa = null) { tarefa = new Tarefa(); connection = new LocalDB(); Tarefas = new ObservableCollection <Tarefa>(connection.GetT()); FrameCommand = new Command(FrameAction); AdicionarCommand = new Command(AdicionarAction); EditarCommand = new Command(EditarAction); ExcluirCommand = new Command(ExcluirAction); RealizeCommand = new Command(RealizeAction); this.messageService = DependencyService.Get <Services.IMessageService>(); this.navigationService = DependencyService.Get <Services.INavigationService>(); }