public String GetTransEventName(String transactionID) { String query = "SELECT EventName FROM ChildcareTransaction WHERE ChildcareTransaction_ID = '" + transactionID + "';"; SQLiteCommand cmd = new SQLiteCommand(query, dbCon); String result = ""; try { dbCon.Open(); result = Convert.ToString(cmd.ExecuteScalar()); dbCon.Close(); } catch (Exception exception) { WPFMessageBox.Show(exception.Message); dbCon.Close(); } return(result); }
public static bool RegexZIP(string data) { /*ZIP: * 12345 */ Regex regex = new Regex(@"(^(\d{5})$)"); Match match = regex.Match(data); if (match.Success) { return(true); } WPFMessageBox.Show("The word " + data + " is not valid. Please re-enter. Ex: 12345"); return(false); }
public double GetTransactionTotal(String transactionID) { String query = "SELECT TransactionTotal FROM ChildcareTransaction WHERE ChildcareTransaction_ID = '" + transactionID + "';"; SQLiteCommand cmd = new SQLiteCommand(query, dbCon); double result = 0; try { dbCon.Open(); result = Convert.ToDouble(cmd.ExecuteScalar()); dbCon.Close(); } catch (Exception exception) { WPFMessageBox.Show(exception.Message); dbCon.Close(); } return(result); }
private void btnDelete_Click(object sender, RoutedEventArgs e) { CodeshareAgreementMVVM agreement = (CodeshareAgreementMVVM)((Button)sender).Tag; Airline airline = agreement.Agreement.Airline1.IsHuman ? agreement.Agreement.Airline2 : agreement.Agreement.Airline1; WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2611"), string.Format(Translator.GetInstance().GetString("MessageBox", "2611", "message"), airline.Profile.Name), WPFMessageBoxButtons.YesNo); if (result == WPFMessageBoxResult.Yes) { this.AllCodesharings.Remove(agreement); agreement.Agreement.Airline1.removeCodeshareAgreement(agreement.Agreement); agreement.Agreement.Airline2.removeCodeshareAgreement(agreement.Agreement); } }
private void btnUpgradeLicens_Click(object sender, RoutedEventArgs e) { double upgradeLicensPrice = GeneralHelpers.GetInflationPrice(1000000); Airline.AirlineLicense nextLicenseType = this.Airline.License + 1; WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2119"), string.Format(Translator.GetInstance().GetString("MessageBox", "2119", "message"), new TextUnderscoreConverter().Convert(nextLicenseType), new ValueCurrencyConverter().Convert(upgradeLicensPrice)), WPFMessageBoxButtons.YesNo); if (result == WPFMessageBoxResult.Yes) { this.Airline.License = nextLicenseType; this.Airline.Airline.License = nextLicenseType; AirlineHelpers.AddAirlineInvoice(this.Airline.Airline, GameObject.GetInstance().GameTime, Invoice.InvoiceType.Airline_Expenses, -upgradeLicensPrice); } }
private void btnSellAircraft_Click(object sender, RoutedEventArgs e) { TrainingAircraft aircraft = (TrainingAircraft)((Button)sender).Tag; var aircrafts = new List <TrainingAircraft>(this.FlightSchool.Aircrafts); aircrafts.Remove(aircraft); Dictionary <TrainingAircraftType, int> types = this.FlightSchool.Aircrafts.GroupBy(a => a.Type). Select(group => new { Type = group.Key, Count = group.Sum(g => g.Type.MaxNumberOfStudents) }).ToDictionary(g => g.Type, g => g.Count);; foreach (PilotStudent student in this.FlightSchool.Students) { var firstAircraft = student.Rating.Aircrafts.OrderBy(a => a.TypeLevel).First(a => types.ContainsKey(a) && types[a] > 0); if (types.ContainsKey(firstAircraft)) { types[firstAircraft]--; } } Boolean canSellAircraft = aircrafts.Sum(a => a.Type.MaxNumberOfStudents) >= this.FlightSchool.Students.Count && types[aircraft.Type] > 1; if (canSellAircraft) { WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2809"), Translator.GetInstance().GetString("MessageBox", "2809", "message"), WPFMessageBoxButtons.YesNo); if (result == WPFMessageBoxResult.Yes) { this.FlightSchool.removeTrainingAircraft(aircraft); double price = aircraft.Type.Price * 0.75; AirlineHelpers.AddAirlineInvoice(GameObject.GetInstance().HumanAirline, GameObject.GetInstance().GameTime, Invoice.InvoiceType.Airline_Expenses, price); } } else { WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2810"), Translator.GetInstance().GetString("MessageBox", "2810", "message"), WPFMessageBoxButtons.Ok); } }
private void btnBuyAirline_Click(object sender, RoutedEventArgs e) { double buyingPrice = this.Airline.Airline.getValue() * 1000000 * 1.10; WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2113"), string.Format(Translator.GetInstance().GetString("MessageBox", "2113", "message"), this.Airline.Airline.Profile.Name, buyingPrice), WPFMessageBoxButtons.YesNo); if (result == WPFMessageBoxResult.Yes) { result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2114"), string.Format(Translator.GetInstance().GetString("MessageBox", "2114", "message"), this.Airline.Airline.Profile.Name, buyingPrice), WPFMessageBoxButtons.YesNo); if (result == WPFMessageBoxResult.Yes) { while (this.Airline.Subsidiaries.Count > 0) { SubsidiaryAirline subAirline = this.Airline.Subsidiaries[0]; subAirline.Profile.CEO = GameObject.GetInstance().HumanAirline.Profile.CEO; subAirline.Airline = GameObject.GetInstance().HumanAirline; this.Airline.removeSubsidiaryAirline(subAirline); GameObject.GetInstance().HumanAirline.addSubsidiaryAirline(subAirline); } } else { while (this.Airline.Subsidiaries.Count > 0) { SubsidiaryAirline subAirline = this.Airline.Subsidiaries[0]; subAirline.Airline = null; this.Airline.removeSubsidiaryAirline(subAirline); } } if (this.Airline.License > GameObject.GetInstance().HumanAirline.License) { GameObject.GetInstance().HumanAirline.License = this.Airline.License; } AirlineHelpers.SwitchAirline(this.Airline.Airline, GameObject.GetInstance().HumanAirline); AirlineHelpers.AddAirlineInvoice(GameObject.GetInstance().HumanAirline, GameObject.GetInstance().GameTime, Invoice.InvoiceType.Airline_Expenses, -buyingPrice); Airlines.RemoveAirline(this.Airline.Airline); PageNavigator.NavigateTo(new PageAirline(GameObject.GetInstance().HumanAirline)); } }
public bool Clean() { var dirInfo = new DirectoryInfo("../../Database"); dirInfo.Attributes &= ~FileAttributes.ReadOnly; bool success = true; int daysToKeepRecords; try { daysToKeepRecords = Convert.ToInt32(Settings.Default.HoldExpiredRecords) * (-1); } catch (System.Data.SQLite.SQLiteException) { WPFMessageBox.Show("Could not access the setting for the amount of days to hold records. Please insure the setting is valid."); return(false); } catch (Exception) { WPFMessageBox.Show("Unable to retrieve settings data, database clean up routine failed."); return(false); } if (daysToKeepRecords == 0) { return(false); } DateTime date = DateTime.Now.AddDays(daysToKeepRecords); string expirationDate = date.ToString("yyyy-MM-dd"); success = DeleteTransactions(expirationDate); if (!success) { return(false); } success = DeleteConnections(expirationDate); if (!success) { return(false); } success = DeleteGuardians(expirationDate); if (!success) { return(false); } success = DeleteChildren(expirationDate); if (!success) { return(false); } success = DeleteEvents(expirationDate); return(success); }
private void btnSaveGame_Click(object sender, RoutedEventArgs e) { Boolean gameworkerPaused = GameObjectWorker.GetInstance().isPaused(); GameObjectWorker.GetInstance().cancel(); string name = txtName.Text.Trim(); Boolean doSave = true; if (SerializedLoadSaveHelpers.SaveGameExists(name)) { WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "1007"), Translator.GetInstance().GetString("MessageBox", "1007", "message"), WPFMessageBoxButtons.YesNo); doSave = result == WPFMessageBoxResult.Yes; if (doSave) { SerializedLoadSaveHelpers.DeleteSavedGame(name); } } if (doSave) { SplashControl scSaving = UIHelpers.FindChild <SplashControl>(this, "scSaving"); scSaving.Visibility = System.Windows.Visibility.Visible; BackgroundWorker bgWorker = new BackgroundWorker(); bgWorker.DoWork += (s, x) => { GameObject.GetInstance().Name = name; SerializedLoadSaveHelpers.SaveGame(name); }; bgWorker.RunWorkerCompleted += (s, x) => { if (!gameworkerPaused) { GameObjectWorker.GetInstance().start(); } scSaving.Visibility = System.Windows.Visibility.Collapsed; }; bgWorker.RunWorkerAsync(); } }
public void AddNewParent(string ID, string PIN, string firstName, string lastName, string phone, string email, string address, string address2, string city, string state, string zip, string photo) { try { dbCon.Open(); string sql = @"INSERT INTO Guardian(Guardian_ID, GuardianPIN, FirstName, LastName, Phone, Email, Address1, Address2, City, StateAbrv, Zip, PhotoLocation) " + "VALUES('" + ID + "', " + PIN + ", " + firstName + ", " + lastName + ", " + phone + ", " + email + ", " + address + ", " + address2 + ", " + city + ", " + state + ", " + zip + ", " + photo + ");"; SQLiteCommand mycommand = new SQLiteCommand(sql, dbCon); mycommand.ExecuteNonQuery(); dbCon.Close(); } catch (SQLiteException) { WPFMessageBox.Show("Could not add new Guardian."); dbCon.Close(); } catch (Exception) { WPFMessageBox.Show("An unknown error occured while interacting with the database. Verify that ChildcareDB.s3db is in the Database folder. If this problem persists, a reinstall may be necessary."); dbCon.Close(); } }
private void btn_Help_Click(object sender, RoutedEventArgs e) { if (File.Exists("C:/Users/Public/Documents" + "/Childcare Application/Childcare Application User Manual.pdf")) { try { System.Diagnostics.Process.Start("C:/Users/Public/Documents" + "/Childcare Application/Childcare Application User Manual.pdf"); } catch (System.IO.FileNotFoundException) { WPFMessageBox.Show("Unable to open user manual. It may not exist."); } catch (Exception) { WPFMessageBox.Show("Unable to open user manual."); } } else { WPFMessageBox.Show("Unable to open user manual."); } }
internal bool CheckIfNull() { formError = true; if (string.IsNullOrWhiteSpace(this.psw_ParentPIN1.Password) && formError) { WPFMessageBox.Show("Please enter your PIN number."); formError = false; return(true); } else if (string.IsNullOrWhiteSpace(this.psw_ParentPIN2.Password) && formError) { WPFMessageBox.Show("Please enter your PIN number a second time."); formError = false; return(true); } return(false); }
public string GetTransactionDate(string transID) { String query = "SELECT TransactionDate FROM ChildcareTransaction where ChildcareTransaction_ID = '" + transID + "';"; SQLiteCommand cmd = new SQLiteCommand(query, dbCon); string date = ""; try { dbCon.Open(); date = Convert.ToString(cmd.ExecuteScalar()); dbCon.Close(); } catch (Exception exception) { WPFMessageBox.Show(exception.Message); dbCon.Close(); } date = (date.Replace('-', '/')).Split(' ')[0]; return(ZeroFillDate(date)); }
//returns a time string in 12 hour clock form (AM/PM) public string GetTwelveHourTime(string transID, string fieldName) { String query = "SELECT " + fieldName + " FROM ChildcareTransaction where ChildcareTransaction_ID = '" + transID + "';"; SQLiteCommand cmd = new SQLiteCommand(query, dbCon); string time = ""; try { dbCon.Open(); time = Convert.ToString(cmd.ExecuteScalar()); dbCon.Close(); } catch (Exception exception) { WPFMessageBox.Show(exception.Message); dbCon.Close(); } time = AMPMFormat(time); return(time); }
public void NewTransaction(string transID, string eventName, string allowanceID, string transDate, string checkedIn, string checkedOut, string transTotal) { String query = "INSERT INTO ChildcareTransaction VALUES ('" + transID + "', '" + eventName + "', "; query += "'" + allowanceID + "', '" + transDate + "', '" + checkedIn + "', '" + checkedOut + "', "; query += "'" + transTotal + "')"; try { dbCon.Open(); SQLiteCommand cmd = new SQLiteCommand(query, dbCon); cmd.ExecuteNonQuery(); dbCon.Close(); } catch (Exception exception) { WPFMessageBox.Show(exception.Message); dbCon.Close(); } }
public static bool RegexCity(string data) { /*City: * Spokane * San Antonio */ Regex regex = new Regex(@"(^([a-zA-Z]+\s?)+$)"); Match match = regex.Match(data); if (match.Success) { return(true); } WPFMessageBox.Show("The word " + data + " is not valid. Please re-enter. EX: Spokane"); return(false); }
public static bool RegexFilePath(string data) { /*FilePath * anythingYouWant.jpg * kh_2323-^&6kh_kh.jpg */ Regex regex = new Regex(@"(^(.+)(\.jpg)$)"); Match match = regex.Match(data); if (match.Success) { return(true); } WPFMessageBox.Show("The word " + data + " is not valid. Please re-enter. EX: file_name.jpg"); return(false); }
public void UpdateTransaction(string transID, string eventName, string allowanceID, string transDate, string checkedIn, string checkedOut, string transTotal) { String query = "UPDATE ChildcareTransaction SET EventName = '" + eventName + "', Allowance_ID = '" + allowanceID + "', "; query += "TransactionDate = '" + transDate + "', CheckedIn = '" + checkedIn + "', CheckedOut = '" + checkedOut + "', "; query += "TransactionTotal = '" + transTotal + "' WHERE ChildcareTransaction_ID = '" + transID + "';"; try { dbCon.Open(); SQLiteCommand cmd = new SQLiteCommand(query, dbCon); cmd.ExecuteNonQuery(); dbCon.Close(); } catch (Exception exception) { WPFMessageBox.Show(exception.Message); dbCon.Close(); } }
/// <summary> /// Remove provider from the MarketDataProviders or from the OrderExecutionProviders collection depending on param /// </summary> private void RemoveProviderExecute(object param) { Provider selectedProvider = param.Equals("MarketDataProvider") ? (Provider)SelectedMarketDataProvider : SelectedOrderExecutionProvider; if ((System.Windows.Forms.DialogResult)WPFMessageBox.Show(MainWindow, string.Format("Remove provider {0}?", selectedProvider.ProviderName), "Question", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes) == System.Windows.Forms.DialogResult.Yes) { if (param.Equals("MarketDataProvider")) { RemoveMarketDataProvider(); } else if (param.Equals("OrderExecutionProvider")) { RemoveOrderExecutionProvider(); } } }
public void DailyPriceWeeklyOcur(String eventName, Double dailyPrice, String weekday, String oldEventName) { String query = "UPDATE EventData SET EventName = '" + eventName + "', DailyPrice = " + dailyPrice + ", "; query += "DailyDiscount = null, EventWeekday = '" + weekday + "', HourlyPrice = null,"; query += " HourlyDiscount = null, EventMonth = null, EventDay = null WHERE EventName = '" + oldEventName + "';"; try { dbCon.Open(); SQLiteCommand cmd = new SQLiteCommand(query, dbCon); cmd.ExecuteNonQuery(); dbCon.Close(); } catch (Exception exception) { WPFMessageBox.Show(exception.Message); dbCon.Close(); } }
private void btnDeleteStudent_Click(object sender, RoutedEventArgs e) { PilotStudent student = (PilotStudent)((Button)sender).Tag; WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2807"), string.Format(Translator.GetInstance().GetString("MessageBox", "2807", "message"), student.Profile.Name), WPFMessageBoxButtons.YesNo); if (result == WPFMessageBoxResult.Yes) { this.FlightSchool.removeStudent(student); student.Instructor.removeStudent(student); student.Instructor = null; showStudents(); this.ParentPage.updatePage(); } }
public void HourlyPriceSpecificDay(String eventName, Double hourlyPrice, Double hourlyDiscount, int eventMonth, int eventDay, String oldEventName) { String query = "UPDATE EventData SET EventName = '" + eventName + "', HourlyPrice = " + hourlyPrice + ", "; query += "HourlyDiscount = " + hourlyDiscount + ", EventMonth = " + eventMonth + ", EventDay = " + eventDay; query += ", DailyPrice = null, DailyDiscount = null, EventWeekday = null WHERE EventName = '" + oldEventName + "';"; try { dbCon.Open(); SQLiteCommand cmd = new SQLiteCommand(query, dbCon); cmd.ExecuteNonQuery(); dbCon.Close(); } catch (Exception exception) { WPFMessageBox.Show(exception.Message); dbCon.Close(); } }
private void ConnectMrobo(bool reconnect = false) { //Cursor = Cursors.Wait; var helloRequest = new RemoteRequest(RobotPacket.PacketID.Hello); helloRequest.ProcessSuccessfully += (data) => { Dispatcher.BeginInvoke((Action) delegate { if (!reconnect) { var title = (string)TryFindResource("ConnectToRobotSuccesfullyText"); WPFMessageBox.Show(StaticMainWindow.Window, "", title, MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK); } UnconnectedTextBox.Visibility = Visibility.Hidden; //Cursor = Cursors.Arrow; //TransformButton.ViewModel.State = RobotTransformButtonModel.ButtonState.Transform; GetListMotion(); GetState(); //GetState(NullMethod, 0); }); GlobalVariables.RoboOnline = true; }; helloRequest.ProcessError += (errorCode, msg) => { Debug.Fail(msg, Enum.GetName((typeof(RobotRequest.ErrorCode)), errorCode)); Dispatcher.BeginInvoke((Action) delegate { if (!reconnect) { var titleError = (string)TryFindResource("ConnectToRobotErrorText"); var msgError = (string)TryFindResource("CheckDefaultErrorText"); WPFMessageBox.Show(StaticMainWindow.Window, msgError, titleError, MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK); } UnconnectedTextBox.Visibility = Visibility.Visible; Cursor = Cursors.Arrow; }); }; GlobalVariables.RobotWorker.AddJob(helloRequest); }
private void btnDeleteFacility_Click(object sender, RoutedEventArgs e) { AirlineAirportFacilityMVVM facility = (AirlineAirportFacilityMVVM)((Button)sender).Tag; Boolean hasHub = this.Airport.Airport.getHubs().Count(h => h.Airline == GameObject.GetInstance().HumanAirline) > 0; Boolean hasCargoRoute = GameObject.GetInstance().HumanAirline.Routes.Exists(r => (r.Destination1 == this.Airport.Airport || r.Destination2 == this.Airport.Airport) && r.Type == Model.AirlinerModel.RouteModel.Route.RouteType.Cargo); Boolean airportHasCargoTerminal = this.Airport.Airport.getCurrentAirportFacility(null, AirportFacility.FacilityType.Cargo) != null && this.Airport.Airport.getCurrentAirportFacility(null, AirportFacility.FacilityType.Cargo).TypeLevel > 0; AirportContract contract = this.Airport.Contracts.Where(a => a.Airline == GameObject.GetInstance().HumanAirline) == null ? null :this.Airport.Contracts.Where(a => a.Airline == GameObject.GetInstance().HumanAirline).First().Contract; Boolean isMinimumServiceFacility = facility.Facility.Facility.TypeLevel == 1 && facility.Facility.Facility.Type == AirportFacility.FacilityType.Service && this.Airport.Airport.hasAsHomebase(GameObject.GetInstance().HumanAirline) && (contract == null || contract.Type != AirportContract.ContractType.Full_Service); Boolean isMinimumHubFacility = facility.Facility.Facility.Type == AirportFacility.FacilityType.Service && hasHub && facility.Facility.Facility == Hub.MinimumServiceFacility && (contract == null || contract.Type == AirportContract.ContractType.Full || contract.Type != AirportContract.ContractType.Medium_Service); Boolean isMinimumCheckinFacility = facility.Facility.Facility.Type == AirportFacility.FacilityType.CheckIn && facility.Facility.Facility.TypeLevel == 1 && contract != null && contract.Type == AirportContract.ContractType.Full; if (isMinimumCheckinFacility) { WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2230"), Translator.GetInstance().GetString("MessageBox", "2230", "message"), WPFMessageBoxButtons.Ok); } else if (isMinimumServiceFacility) { WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2203"), Translator.GetInstance().GetString("MessageBox", "2203", "message"), WPFMessageBoxButtons.Ok); } else if (isMinimumHubFacility) { WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2214"), string.Format(Translator.GetInstance().GetString("MessageBox", "2214", "message"), Hub.MinimumServiceFacility.Name), WPFMessageBoxButtons.Ok); } else if (facility.Facility.Facility.Type == AirportFacility.FacilityType.Cargo && facility.Facility.Facility.TypeLevel == 1 && hasCargoRoute && !airportHasCargoTerminal) { WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2223"), Translator.GetInstance().GetString("MessageBox", "2223", "message"), WPFMessageBoxButtons.Ok); } else { WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2204"), string.Format(Translator.GetInstance().GetString("MessageBox", "2204", "message"), facility.Facility.Facility.Name), WPFMessageBoxButtons.YesNo); if (result == WPFMessageBoxResult.Yes) { this.Airport.removeAirlineFacility(facility); if (facility.Facility.Facility.Type == AirportFacility.FacilityType.Cargo && facility.Facility.Facility.TypeLevel == 1) { GameObject.GetInstance().HumanAirline.removeAirport(this.Airport.Airport); } } } }
private void btn_ChangePicture_Click(object sender, RoutedEventArgs e) { if (lst_ChildBox.SelectedItem != null) { string imagePath = getGreatGrandParent() + @"\Pictures"; //string imagePath = "C:/Users/Public/Documents" + @"\Childcare Application\Pictures"; //TAG: pictures access imagePath = imagePath.Replace(@"/", @"\"); Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.FileName = "default"; // Default file name dlg.DefaultExt = ".jpg"; // Default file extension dlg.Filter = "Pictures (.jpg)|*.jpg"; // Filter files by extension dlg.InitialDirectory = imagePath; Nullable <bool> result = dlg.ShowDialog(); // Process open file dialog box results if (result == true) { // Open document string path = getGreatGrandParent() + "\\Pictures\\"; //string path = "C:\\Users\\Public\\Documents" + "\\Childcare Application\\Pictures\\"; //TAG: pictures access string filename = dlg.FileName; string[] words = filename.Split('\\'); path += words[words.Length - 1]; if (File.Exists(path)) { try { string imageLink = path; ImageBrush ib = new ImageBrush(); ib.ImageSource = new BitmapImage(new Uri(imageLink, UriKind.Relative)); cnv_ChildIcon.Background = ib; txt_FilePath.Text = path; } catch (Exception) { WPFMessageBox.Show("Could not change picture to" + path); } } else { WPFMessageBox.Show(@"The picture you specified is not the directory C:\Users\Public\Childcare Application\Pictures"); } } } }
private void Window_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Escape) { WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "1003"), Translator.GetInstance().GetString("MessageBox", "1003", "message"), WPFMessageBoxButtons.YesNo); if (result == WPFMessageBoxResult.Yes) { this.Close(); } } if (e.Key == Key.F8) { string text = string.Format("Gameobjectworker paused: {0}\n", GameObjectWorker.GetInstance().isPaused()); text += string.Format("Gameobjectworker finished: {0}\n", GameObjectWorker.GetInstance().IsFinish); text += string.Format("Gameobjectworker errored: {0}\n", GameObjectWorker.GetInstance().IsError); Console.WriteLine(text); WPFMessageBox.Show("Threads states", text, WPFMessageBoxButtons.Ok); } if (Keyboard.Modifiers == ModifierKeys.Control && e.Key == Key.F12) { System.IO.StreamWriter file = new System.IO.StreamWriter(AppSettings.getCommonApplicationDataPath() + "\\theairline.log"); if (Airports.Count() >= 5) { for (int i = 0; i < 5; i++) { Airport airport = Airports.GetAllAirports()[i]; file.WriteLine("Airport demand for {0} of size {1}", airport.Profile.Name, airport.Profile.Size); foreach (Airport demand in airport.getDestinationDemands()) { file.WriteLine(" Demand to {0} ({2}) is {1}", demand.Profile.Name, airport.getDestinationPassengersRate(demand, AirlinerClass.ClassType.Economy_Class), demand.Profile.Size); } } } WPFMessageBox.Show("Demand has been dumped", "The demand has been dumped to the log file", WPFMessageBoxButtons.Ok); file.Close(); } }
private void PageBottomMenu_OnTimeChanged() { if (this.IsLoaded) { if (GameObject.GetInstance().DayRoundEnabled) { txtTime.Text = GameObject.GetInstance().GameTime.ToLongDateString() + " " + GameObject.GetInstance().TimeZone.ShortDisplayName; } else { txtTime.Text = GameObject.GetInstance().GameTime.ToLongDateString() + " " + GameObject.GetInstance().GameTime.ToShortTimeString() + " " + GameObject.GetInstance().TimeZone.ShortDisplayName;//GameObject.GetInstance().GameTime.ToString("dddd MMMM dd, yyyy HH:mm", CultureInfo.CreateSpecificCulture("en-US")) + " " + GameObject.GetInstance().TimeZone.ShortDisplayName; } // txtMoney.Text = string.Format("{0:c}", GameObject.GetInstance().HumanAirline.Money); txtMoney.Text = new ValueCurrencyConverter().Convert(GameObject.GetInstance().HumanAirline.Money).ToString(); txtMoney.Foreground = new Converters.ValueIsMinusConverter().Convert(GameObject.GetInstance().HumanAirline.Money, null, null, null) as Brush; if (GameObject.GetInstance().Scenario != null && (GameObject.GetInstance().Scenario.ScenarioFailed != null || GameObject.GetInstance().Scenario.IsSuccess)) { GameObjectWorker.GetInstance().cancel(); WPFMessageBoxResult result; if (GameObject.GetInstance().Scenario.ScenarioFailed != null) { result = WPFMessageBox.Show(Translator.GetInstance().GetString("PageBottomMenu", "1001"), GameObject.GetInstance().Scenario.ScenarioFailed.FailureText, WPFMessageBoxButtons.ContinueExit); } else { result = WPFMessageBox.Show(Translator.GetInstance().GetString("PageBottomMenu", "1002"), Translator.GetInstance().GetString("PageBottomMenu", "1003"), WPFMessageBoxButtons.ContinueExit); } if (result == WPFMessageBoxResult.Continue) { GameObjectWorker.GetInstance().start(); GameObject.GetInstance().Scenario = null; } else { Setup.SetupGame(); PageNavigator.NavigateTo(new PageNewGame()); GameObject.RestartInstance(); } } } }
private void DateRangeReport() { GuardianInfoDB parentInfo = new GuardianInfoDB(); String initialFrom = Convert.ToDateTime(dte_fromDate.Text).ToString("dd/MM/yyyy"); String initialTo = Convert.ToDateTime(dte_toDate.Text).ToString("dd/MM/yyyy"); if (initialFrom.Length >= 10 && initialTo.Length >= 10) { initialFrom = initialFrom.Substring(0, 10); initialTo = initialTo.Substring(0, 10); } if (initialFrom.Length == 10 && initialTo.Length == 10) { if (txt_GuardianID.Text.Length == 6 && parentInfo.GuardianIDExists(txt_GuardianID.Text)) { String[] fromParts = initialFrom.Split('/'); String[] toParts = initialTo.Split('/'); if (fromParts.Length == 3 && toParts.Length == 3) { String fromDate = fromParts[2] + "-" + fromParts[1] + "-" + fromParts[0]; String toDate = toParts[2] + "-" + toParts[1] + "-" + toParts[0]; LoadReport(fromDate, toDate); LoadParentData(); } else { WPFMessageBox.Show("You must enter a valid date range!"); dte_fromDate.Focus(); } } else { WPFMessageBox.Show("The Parent ID you entered does not exist in the database. Please verify it is correct."); txt_GuardianID.Focus(); } } else { WPFMessageBox.Show("You must enter a valid date range!"); dte_fromDate.Focus(); } }
private void btnDelete_Click(object sender, RoutedEventArgs e) { FlightSchool fs = (FlightSchool)((Button)sender).Tag; WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2804"), string.Format(Translator.GetInstance().GetString("MessageBox", "2804", "message"), fs.Name), WPFMessageBoxButtons.YesNo); if (result == WPFMessageBoxResult.Yes) { foreach (Instructor instructor in fs.Instructors) { instructor.FlightSchool = null; } GameObject.GetInstance().HumanAirline.removeFlightSchool(fs); showFlightSchools(); } }
private void btnFirePilot_Click(object sender, RoutedEventArgs e) { Pilot pilot = (Pilot)((Button)sender).Tag; if (pilot.Airliner == null) { WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2117"), string.Format(Translator.GetInstance().GetString("MessageBox", "2117", "message"), pilot.Profile.Name), WPFMessageBoxButtons.YesNo); if (result == WPFMessageBoxResult.Yes) { this.Airline.removePilot(pilot); } } else { WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2116"), string.Format(Translator.GetInstance().GetString("MessageBox", "2116", "message"), pilot.Profile.Name), WPFMessageBoxButtons.Ok); } }