예제 #1
0
 private void ChangeLocationButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         var dialog = new MyDialog();
         if (dialog.ShowDialog() == true)
         {
             var currentSituation = new Situation().Get();
             currentSituation.CurrentLocation = dialog.ResponseText;
             currentSituation.Update();
             boardJobViewSource.Source = GenerateBoardJobs(currentSituation.CurrentLocation);
             var currentBase = AirportDatabaseFile.FindAirportInfo(currentSituation.CurrentLocation);
             CurrentLocationLabel.Content = "You are in: " + currentBase.AirportName + " (" + currentBase.ICAO + ") - " + currentBase.Country;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(this, ex.Message, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
예제 #2
0
 private void ReGenJobsButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         var currentSituation = new Situation().Get();
         if (currentSituation == null || string.IsNullOrEmpty(currentSituation.CurrentLocation))
         {
             var dialog = new MyDialog();
             if (dialog.ShowDialog() == true)
             {
                 var newSituation = new Situation() { CurrentLocation = dialog.ResponseText };
                 newSituation.Insert();
                 Base currentBase = AirportDatabaseFile.FindAirportInfo(newSituation.CurrentLocation);
                 CurrentLocationLabel.Content = "You are in: " + currentBase.AirportName + " (" + currentBase.ICAO + ") - " + currentBase.Country;
             }
         }
         else
         {
             boardJobViewSource.Source = GenerateBoardJobs(currentSituation.CurrentLocation);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(this, ex.Message, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }