private void AddCommand_Executed(object o, ExecutedRoutedEventArgs args) { var view = new AddFunctionView { Owner = this }; if (view.ShowDialog() == true) { try { var userFunc = processor.Parse(view.FunctionName) as UserFunction; if (userFunc == null) { MessageBox.Show(this, Resource.AddFuncError, Resource.ErrorHeader, MessageBoxButton.OK, MessageBoxImage.Warning); return; } var func = processor.Parse(view.Function); processor.Parameters.Functions.Add(userFunc, func); RefreshList(); } catch (TokenizeException mle) { MessageBox.Show(this, mle.Message, Resource.ErrorHeader, MessageBoxButton.OK, MessageBoxImage.Warning); } catch (ParseException mpe) { MessageBox.Show(this, mpe.Message, Resource.ErrorHeader, MessageBoxButton.OK, MessageBoxImage.Warning); } catch (ParameterIsReadOnlyException mpiroe) { MessageBox.Show(this, mpiroe.Message, Resource.ErrorHeader, MessageBoxButton.OK, MessageBoxImage.Warning); } catch (BinaryParameterTypeMismatchException bptme) { MessageBox.Show(this, bptme.Message, Resource.ErrorHeader, MessageBoxButton.OK, MessageBoxImage.Warning); } catch (DifferentParameterTypeMismatchException dptme) { MessageBox.Show(this, dptme.Message, Resource.ErrorHeader, MessageBoxButton.OK, MessageBoxImage.Warning); } catch (ParameterTypeMismatchException ptme) { MessageBox.Show(this, ptme.Message, Resource.ErrorHeader, MessageBoxButton.OK, MessageBoxImage.Warning); } catch (ArgumentNullException ane) { MessageBox.Show(this, ane.Message, Resource.ErrorHeader, MessageBoxButton.OK, MessageBoxImage.Warning); } catch (ArgumentException ae) { MessageBox.Show(this, ae.Message, Resource.ErrorHeader, MessageBoxButton.OK, MessageBoxImage.Warning); } } }
private void AddCommand_Executed(object o, ExecutedRoutedEventArgs args) { var view = new AddFunctionView { Owner = this }; if (view.ShowDialog() == true) { try { var userFunc = processor.Parse(view.FunctionName) as UserFunction; if (userFunc == null) { MessageBox.Show(this, Resource.AddFuncError, Resource.ErrorHeader, MessageBoxButton.OK, MessageBoxImage.Warning); return; } var func = processor.Parse(view.Function); processor.Parameters.Functions.Add(userFunc, func); RefreshList(); } catch (LexerException mle) { MessageBox.Show(this, mle.Message, Resource.ErrorHeader, MessageBoxButton.OK, MessageBoxImage.Warning); } catch (ParserException mpe) { MessageBox.Show(this, mpe.Message, Resource.ErrorHeader, MessageBoxButton.OK, MessageBoxImage.Warning); } catch (ParameterIsReadOnlyException mpiroe) { MessageBox.Show(this, mpiroe.Message, Resource.ErrorHeader, MessageBoxButton.OK, MessageBoxImage.Warning); } catch (ParameterTypeMismatchException ptme) { MessageBox.Show(this, ptme.Message, Resource.ErrorHeader, MessageBoxButton.OK, MessageBoxImage.Warning); } catch (ArgumentNullException ane) { MessageBox.Show(this, ane.Message, Resource.ErrorHeader, MessageBoxButton.OK, MessageBoxImage.Warning); } catch (ArgumentException ae) { MessageBox.Show(this, ae.Message, Resource.ErrorHeader, MessageBoxButton.OK, MessageBoxImage.Warning); } } }
private void EditCommand_Executed(object o, ExecutedRoutedEventArgs args) { var selectedItem = funcList.SelectedItem as FunctionViewModel; var view = new AddFunctionView(selectedItem) { Owner = this }; if (view.ShowDialog() == true) { try { var userFunc = ((FunctionViewModel)funcList.SelectedItem).Function; var func = processor.Parse(view.Function); processor.Parameters.Functions[userFunc] = func; RefreshList(); } catch (TokenizeException mle) { MessageBox.Show(this, mle.Message, Resource.ErrorHeader, MessageBoxButton.OK, MessageBoxImage.Warning); } catch (ParseException mpe) { MessageBox.Show(this, mpe.Message, Resource.ErrorHeader, MessageBoxButton.OK, MessageBoxImage.Warning); } catch (ParameterIsReadOnlyException mpiroe) { MessageBox.Show(this, mpiroe.Message, Resource.ErrorHeader, MessageBoxButton.OK, MessageBoxImage.Warning); } catch (ParameterTypeMismatchException ptme) { MessageBox.Show(this, ptme.Message, Resource.ErrorHeader, MessageBoxButton.OK, MessageBoxImage.Warning); } catch (ArgumentNullException ane) { MessageBox.Show(this, ane.Message, Resource.ErrorHeader, MessageBoxButton.OK, MessageBoxImage.Warning); } catch (ArgumentException ae) { MessageBox.Show(this, ae.Message, Resource.ErrorHeader, MessageBoxButton.OK, MessageBoxImage.Warning); } } }
private void EditCommand_Executed(object o, ExecutedRoutedEventArgs args) { var selectedItem = funcList.SelectedItem as FunctionViewModel; AddFunctionView view = new AddFunctionView(selectedItem) { Owner = this }; if (view.ShowDialog() == true) { try { var userFunc = (funcList.SelectedItem as FunctionViewModel).Function; var func = processor.Parse(view.Function); processor.UserFunctions[userFunc] = func; RefreshList(); } catch (LexerException mle) { MessageBox.Show(this, mle.Message, Resource.ErrorHeader, MessageBoxButton.OK, MessageBoxImage.Warning); } catch (ParserException mpe) { MessageBox.Show(this, mpe.Message, Resource.ErrorHeader, MessageBoxButton.OK, MessageBoxImage.Warning); } catch (ParameterIsReadOnlyException mpiroe) { MessageBox.Show(this, mpiroe.Message, Resource.ErrorHeader, MessageBoxButton.OK, MessageBoxImage.Warning); } catch (ArgumentNullException ane) { MessageBox.Show(this, ane.Message, Resource.ErrorHeader, MessageBoxButton.OK, MessageBoxImage.Warning); } catch (ArgumentException ae) { MessageBox.Show(this, ae.Message, Resource.ErrorHeader, MessageBoxButton.OK, MessageBoxImage.Warning); } } }