示例#1
0
        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();
            }
        }
示例#2
0
 private async void ItemSourceIsNull()
 {
     TrackViewModel model = new TrackViewModel();
     var tracks = await model.TrackDao.GetAll();
     MainContent.Navigate(tracks.Count > 0 ? typeof (Home) : typeof (EmptyTrack));
 }
示例#3
0
        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();
        }