예제 #1
0
        private void btnPdaClear_Click(object sender, RoutedEventArgs e)
        {
            if (canvasMain.Children.Count == 0)
            {
                return;
            }
            else
            {
                if (MessageBox.Show("Are you sure to clear the Page", "Clear?", MessageBoxButton.YesNo) == MessageBoxResult.No)
                {
                    return;
                }
            }

            grpPdaStateOptions.IsEnabled = false;
            btnPdaInitial.IsChecked      = btnPdaFinal.IsChecked = false;

            Pda newPda = null;

            switch (pdaType)
            {
            case pdaTypes.DPDA:
                newPda = new DPda();
                break;

            case pdaTypes.NDPDA:
                newPda = new NDPda();
                break;
            }

            if (newPda != null)
            {
                newPda.inputs       = pda.inputs;
                newPda.stackSymbols = pda.stackSymbols;

                canvasMain.Children.Clear();
                newPda.setCanvas(canvasMain, btnDelSelection, btnInitial, btnFinal);
                pda = newPda;
                pda.addNewRow();
            }
        }
예제 #2
0
        private void menuDPda_Click(object sender, RoutedEventArgs e)
        {
            e.Handled = true;

            if (saveOnNewOrExit() == MessageBoxResult.Cancel)
            {
                return;
            }

            fileStatus.isEdited = false;
            loadedFilePath      = "";

            mode    = modes.Pda;
            pdaType = pdaTypes.DPDA;
            action  = actions.none;

            pda = new DPda();

            Application.Current.MainWindow.Title = "Push Down Automata";

            ribbonMain.Visibility = Visibility.Visible;

            setInterfaceOnNewPda();
        }