private void Delete_Click(object sender, RoutedEventArgs e) { var model = new TrackViewModel { Track = LvTracks.SelectedItem as Track }; model.TrackDao.Remove(model.Track); if (ItemSourceIsNull()) MainPage.MainFrame.Navigate(typeof(EmptyTrack)); else { ListAll(); } }
private async void ItemSourceIsNull() { TrackViewModel model = new TrackViewModel(); var tracks = await model.TrackDao.GetAll(); MainContent.Navigate(tracks.Count > 0 ? typeof (Home) : typeof (EmptyTrack)); }
private async void Save(object sender, RoutedEventArgs e) { var m = new MessageDialog("Track"); var viewModel = new TrackViewModel { Track = { Descricao = txtDescricao.Text, TrackCode = txtCodigoRastreio.Text } }; if (ValidateBean(viewModel.Track).Length == 0) { m.Content = viewModel.TrackDao.Save(viewModel.Track) ? "Item adicionado com sucesso!" : "Ocorreu um erro ao adicionar!"; Clear(); } else { m.Content = ValidateBean(viewModel.Track); } await m.ShowAsync(); }