Beispiel #1
0
        private void Item_Delete_Click(object sender, RoutedEventArgs e)
        {
            BusTagVM bt = (sender as MenuItem).DataContext as BusTagVM;

            DataService.DeleteBus(bt);
            DataContext = new KeyedBusTagVM();
        }
Beispiel #2
0
        private void ApplicationBarIconButton_Click(object sender, EventArgs e)
        {
            BusDir dir = (tbDir.Text == "往↓" ? BusDir.go : BusDir.back);

            try
            {
                BusTagVM bt = DataService.BusTags.First(x
                                                        => x.busName == tbBusName.Text &&
                                                        x.station == tbStation.Text &&
                                                        x.dir == dir &&
                                                        x.tag == m_orig_tag);

                bool bRemoveSuccess = DataService.BusTags.Remove(bt);
                Log.Debug("bRemoveSuccess=" + bRemoveSuccess);
                NavigationService.GoBack();
            }
            catch (Exception ex)
            {
                Log.Error("{0} {1} {2} {3} cannot be found!".Fmt(tbBusName.Text, tbStation.Text, dir, m_orig_tag));
                Log.Error("BusTags={" + ",".Joyn(DataService.BusTags.Select(x => x.ToString())) + "}");
                Log.Error("ex=" + ex.DumpStr());
            }
        }
Beispiel #3
0
        public static void DeleteBus(BusTagVM item)
        {
            bool removeSuccess = m_busTags.Remove(item);

            Log.Debug("removeSuccess=" + removeSuccess);
        }
Beispiel #4
0
 void GotoDetailsPage(BusTagVM bt)
 {
     NavigationService.Navigate(new Uri(
                                    "/BusStationDetails.xaml?busName={0}&station={1}&dir={2}&tag={3}"
                                    .Fmt(bt.busName, bt.station, bt.dir, bt.tag), UriKind.Relative));
 }