void OnDispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) { string exceptionMessage = string.Format("A handled exception occurred: {0}", e.Exception.Message); ApplicationMessageBox.Show(exceptionMessage, "Checkbox Selection Exception", "OK"); e.Handled = true; }
private void CheckBox_ASMUnchecked(object sender, RoutedEventArgs e) { ParameterProperties.Instance.ProgrammingLanguages["ASM"] = false; try { if (C.IsChecked == false) { throw (new CheckBoxException("No checkbox was selected.")); } } catch (CheckBoxException ex) { string exceptionMessage = string.Format("A handled exception occurred: {0}", ex.Message); ApplicationMessageBox.Show(exceptionMessage, "Checkbox Selection Exception", "OK"); } }
private void TextBox_EnteredInputFileName(object sender, KeyEventArgs e) { try { if (e.Key == Key.Enter) { StreamReader fileReader = new StreamReader(file.Text); ParameterProperties.Instance.inFileName = file.Text; } } catch (IOException ex) { string exceptionMessage = string.Format("A handled exception occurred: {0}", ex.Message); ApplicationMessageBox.Show(exceptionMessage, "Input File Exception", "OK"); //MessageBox.Show(exceptionMessage, "File wasn't found", MessageBoxButton.OK, MessageBoxImage.Warning); } }
void timer_Tick() { SolutionsStackPanel.Visibility = Visibility.Visible; Stopwatch mywatch = new Stopwatch(); try { inputLoader = new DataLoader(ParameterProperties.Instance.inFileName); vectorX = new SpecifiedVector(inputLoader.VectorB.numberOfRows); solver = new MethodSolver(inputLoader.MatrixA, inputLoader.VectorB, vectorX); } catch (Exception ex) { string exceptionMessage = string.Format("A handled exception occurred: {0}", ex.Message); ApplicationMessageBox.Show(exceptionMessage, "Checkbox Selection Exception", "OK"); } try { if (ParameterProperties.Instance.ProgrammingLanguages["C++"] == true) { mywatch.Start(); lock (balanceLock) ProcessWithThreadPoolMethod(solver); mywatch.Stop(); CExecutionTime.Text = mywatch.ElapsedTicks.ToString(); mywatch.Reset(); } if (ParameterProperties.Instance.ProgrammingLanguages["ASM"] == true) { //wywolanie kodu dla ASM } } catch (Exception ex) { string exceptionMessage = string.Format("A handled exception occurred: {0}", ex.Message); ApplicationMessageBox.Show(exceptionMessage, "Checkbox Selection Exception", "OK"); } int xIndex = 1; for (int row = 0; row < inputLoader.matrixA.numberOfRows; row++) { for (int column = 0; column < inputLoader.matrixA.numberOfRows; column++) { xIndex = column + 1; if (inputLoader.matrixA.Data[row, column] >= 0 && column != 0) { Equations.Text += "+ "; } Equations.Text += inputLoader.matrixA.Data[row, column] + "x"; Equations.Text += xIndex + " "; } Equations.Text += " = " + inputLoader.vectorB.Data[row] + "\n"; } Thread.Sleep(500); SolutionSet.Text += "Solution set: \n"; for (int row = 0; row < vectorX.numberOfRows; row++) { SolutionSet.Text += "x" + xIndex + " = " + vectorX.Data[row] + "\n"; xIndex++; } }