コード例 #1
0
        private void ButtonEdit_Click(object sender, RoutedEventArgs e)
        {
            UserStation Station = dataGrid.SelectedItem as UserStation;

            if (Station != null)
            {
                AddFavoriteWindow window = new AddFavoriteWindow(Station, this)
                {
                    Owner = this
                };
                if (window.ShowDialog() == true)
                {
                    dataGrid.ItemsSource = null;
                    dataGrid.ItemsSource = owner.CurrentUser.FavoriteStations;
                }
            }
            else
            {
                MessageBox.Show("Choose station!", "Attention");
            }
        }
コード例 #2
0
 private void ButtonAddFavorite_Click(object sender, RoutedEventArgs e)
 {
     if (CurStation.Name != AllStations.First().Name)
     {
         if (CurrentUser.FavoriteStations.Find(st => st.StationId == CurStation.Id) != null)
         {
             MessageBox.Show("The station has already been in favorites!");
         }
         else
         {
             AddFavoriteWindow window = new AddFavoriteWindow(this)
             {
                 Owner = this
             };
             window.ShowDialog();
         }
     }
     else
     {
         MessageBox.Show("Choose a station!", "Attention");
     }
 }