Beispiel #1
0
 private void CreateLocationComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (CreateLocationComboBox.SelectedIndex == 0)
     {
         SearchGridBorder.Visibility  = Visibility.Visible;
         SearchResultNameTextBox.Text = "";
         SearchTextBox.Text           = "";
         SearchResultTextBlock.Text   = "";
         FoundLocation = null;
         SearchTextBox.Focus();
     }
     else if (CreateLocationComboBox.SelectedIndex == 1)
     {
         SearchGridBorder.Visibility  = Visibility.Hidden;
         SearchResultNameTextBox.Text = "";
         FoundLocation = null;
         var location        = new Location("", XManager.DefaultLocation.X, XManager.DefaultLocation.Y, false);
         var editWindow      = new EditWindow(location, XManager.AllLocations, false);
         var result          = editWindow.ShowDialog();
         var choosenLocation = editWindow.InitialLocation;
         if (result == true)
         {
             if (!AddLocation(choosenLocation))
             {
                 MessageBox.Show("Nie można zamienić domyślnej lokalizacji, zmień domyślną lokalizację a następnie zedytuj ponownie", "Błąd");
                 return;
             }
         }
         CreateLocationComboBox.SelectedIndex = -1;
         CityList.SelectedItem = choosenLocation;
     }
 }
Beispiel #2
0
        private void LocatonEditButton_Click(object sender, RoutedEventArgs e)
        {
            var editWindow = new EditWindow(SelectedLocation, XManager.AllLocations, true);
            var result     = editWindow.ShowDialog();
            var location   = editWindow.InitialLocation;

            if (result == true)
            {
                if (!ReplaceLocation(SelectedLocation, location))
                {
                    MessageBox.Show("Nie można zamienić domyślnej lokalizacji, zmień domyślną lokalizację a następnie zedytuj ponownie", "Błąd");
                }
            }
        }
Beispiel #3
0
 private void EditButton_Click(object sender, RoutedEventArgs e)
 {
     if (LocationsListBox.SelectedItem != null)
     {
         var selected   = (Location)LocationsListBox.SelectedItem;
         var editWindow = new EditWindow(selected, Locations, true);
         var result     = editWindow.ShowDialog();
         var location   = editWindow.InitialLocation;
         if (result == true)
         {
             var tempAll = Locations.ToList();
             tempAll.Remove(selected);
             if (!tempAll.Contains(location) && !tempAll.Any(x => x.Name.Trim(' ').ToLower() == location.Name.Trim(' ').ToLower()))
             {
                 if (selected == DefaultLocation)
                 {
                     DefaultLocation = location;
                 }
                 Locations[LocationsListBox.SelectedIndex] = location;
                 LocationsListBox.SelectedItem             = location;
             }
         }
     }
 }