Exemplo n.º 1
0
 public OutputWindow(DFABuilder dfaBuilder, bool stepByStepMode)
 {
     InitializeComponent();
     _dfa = dfaBuilder.Dfa;
     if (_dfa.States.Count >= 25)
     {
         MessageBox.Show("Warning! There are more than 25 states generated. The proper working of the application is not guaranteed.");
     }
     _mainViewModel = new MainViewModel();
     _dfaBuilder = dfaBuilder;
     this.DataContext = _mainViewModel;
     _steps = dfaBuilder.Steps;
     if (stepByStepMode)
     {
         btnNextStep.IsEnabled = true;
     }
     else
     {
         btnNextStep.IsEnabled = false;
         generateContentDot(_steps.Count);
         BitmapImage bmp = dot2bmp(_beginDot + _contentDot + _endDot);
         imgGraph.Source = bmp;
         foreach (Transition t in _dfa.Transitions)
         {
             _mainViewModel.Transitions.Add(t);
         }
         foreach (State s in _dfa.States)
         {
             _mainViewModel.Labels.Add(Tuple.Create(s.QLabel, s.RegexLabel));
         }
     }
 }
Exemplo n.º 2
0
 public SimulationWindow(DFABuilder dfaBuilder)
 {
     InitializeComponent();
     _dfaBuilder = dfaBuilder;
     _dfa = _dfaBuilder.Dfa;
     _steps = _dfaBuilder.Steps;
     this.DataContext = new MainViewModel(_dfa);
 }
Exemplo n.º 3
0
 private void btnGenerate_Click(object sender, RoutedEventArgs e)
 {
     string regex = txtInput.Text;
     DFABuilder dfaBuilder = new DFABuilder();
     dfaBuilder.buildDFA(regex);
     if (_outputWindow != null)
     {
         _outputWindow.Close();
     }
     if ((bool)radioImmediate.IsChecked)
     {
         _outputWindow = new OutputWindow(dfaBuilder, false);
     }
     else if ((bool)radioStep.IsChecked)
     {
         _outputWindow = new OutputWindow(dfaBuilder, true);
     }
     _outputWindow.Show();
 }