private void buttonLoadFileNext_Click(object sender, EventArgs e) { try { createTrainLinesFromFiles(); prepareListViewListOfLines(); selectTab(tabPageListOfLines); } catch (IOException ioException) { ErrorMessageBoxUtil.ShowError(ioException); } catch (ArgumentException) { ErrorMessageBoxUtil.ShowError("Invalid format of input data."); } catch (FormatException) { ErrorMessageBoxUtil.ShowError("Invalid format of input data."); } catch (Exception) { ErrorMessageBoxUtil.ShowError("Could not load data from input files."); } }
private void backgroundWorkerTG_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { // First, handle the case where an exception was thrown. if (e.Error != null) { if (e.Error is PropagationException) { ErrorMessageBoxUtil.ShowError(e.Error); } else if (e.Error is SearchException) { ErrorMessageBoxUtil.ShowError(e.Error); } else { ErrorMessageBoxUtil.ShowError("Unexpected algorithm error."); } MessageBox.Show(e.Error.Message); } else { this.progressBarGT.Value = this.progressBarGT.Maximum; prepareListViewGeneratingTimetable(); } // enable buttons this.buttonNextGeneratingTimtables.Enabled = true; this.buttonStartGeneration.Enabled = true; // disable buttons this.buttonCompleteAndStop.Enabled = false; this.buttonAbortGeneration.Enabled = false; }
//-------------------------------------------- // button NEXT list of train lines //-------------------------------------------- private void buttonListOfLinesNext_Click(object sender, EventArgs e) { try { prepareListViewListOfStations(); prepareComboBoxListOfLines(listViewListOfLines); } catch { ErrorMessageBoxUtil.ShowError("Could not prepare the list of stations."); return; } selectTab(tabPageListOfStations); }
//-------------------------------------------- // button NEXT list of connection //-------------------------------------------- private void buttonListOfConncetionsNext_Click(object sender, EventArgs e) { buttonNextStarted(); //TODO: check the generation try { prepareListViewListOfGroupsOfConnections(); } catch { ErrorMessageBoxUtil.ShowError("Error in groupping connections process."); buttonNextEnded(); return; } buttonNextEnded(); selectTab(tabPageListOfRoutes); }
private void buttonListOfGroupsOfConnectionsNext_Click(object sender, EventArgs e) { buttonNextStarted(); //TODO: check generation try { FinalInput.getInstance().createTransfers(); prepareListViewListOfTransfers(); } catch { ErrorMessageBoxUtil.ShowError("Could not extract transfers from the given list of connections."); buttonNextEnded(); return; } buttonNextEnded(); selectTab(tabPageListOfTransfers); }
public void generateTimetables() { // disable button this.buttonStartGeneration.Enabled = false; this.buttonNextGeneratingTimtables.Enabled = false; // enable butttons this.buttonAbortGeneration.Enabled = true; this.buttonCompleteAndStop.Enabled = true; this.CurrentGenerationAlgorithm.IsCancelled = false; // TODO: select howMany timetables you want // start asynchronous operation try { this.backgroundWorkerTG.RunWorkerAsync(CurrentGenerationAlgorithm); } catch { ErrorMessageBoxUtil.ShowError("Unexpected algorithm error."); } }
//-------------------------------------------- // button NEXT list of station //-------------------------------------------- private void buttonListOfStationNext_Click(object sender, EventArgs e) { buttonNextStarted(); ShortestPathAlgoritm shortestPathAlgorithm; try { // activate algorithm shortestPathAlgorithm = ShortestPathAlgoritm.getInstance(); shortestPathAlgorithm.calculateShortestPath(); } catch { ErrorMessageBoxUtil.ShowError("Error in the shortest path algorithm processing."); buttonNextEnded(); return; } try { shortestPathAlgorithm.generateAllTrainConnections(); } catch { ErrorMessageBoxUtil.ShowError("Could not generate the list of connections."); buttonNextEnded(); return; } try { // prepare list view prepareListViewListOfConnections(); } catch { ErrorMessageBoxUtil.ShowError("Could not prepare the list of connections."); buttonNextEnded(); return; } // TODO: added coz one place of processing data try { prepareListViewListOfGroupsOfConnections(); } catch { ErrorMessageBoxUtil.ShowError("Error in groupping connections process."); buttonNextEnded(); return; } // TODO: added coz one place of processing data try { FinalInput.getInstance().createTransfers(); prepareListViewListOfTransfers(); } catch { ErrorMessageBoxUtil.ShowError("Could not extract transfers from the given list of connections."); buttonNextEnded(); return; } // open particular tab selectTab(tabPageListOfConncetions); buttonNextEnded(); }