コード例 #1
0
        private void simplified_btn_Click(object sender, EventArgs e)
        {
            //Clear Simplified Label
            truthTableSimplified_lb.Items.Clear();

            //Service Instance
            service = new Service();

            // Proposition
            string result = service.Proposition(inputBox.Text.ToLower());

            if (result == null)
            {
                MessageBox.Show("Ups, you did something wrong!");
            }
            else
            {
                try
                {
                    TruthTableStructure simplifiedTable = service.GetSimplifiedTableService();
                    truthTableSimplified_lb.Items.Add(string.Join("\t", simplifiedTable.Description));
                    foreach (TruthTableRow row in simplifiedTable.TableRows)
                    {
                        string oneRow;
                        oneRow  = string.Join("\t", row.OutputValues);
                        oneRow += $"\t{row.FinalResult}";
                        truthTableSimplified_lb.Items.Add(oneRow);
                    }
                } catch (Exception)
                {
                    MessageBox.Show("Ups, you did something wrong!");
                }
            }
        }
コード例 #2
0
        private void submit_Click(object sender, EventArgs e)
        {
            //Clear Simplified Truth Table
            truthTableSimplified_lb.Items.Clear();

            //Clear Truth Table Label
            truthTable_lb.Items.Clear();

            //Service Instance
            service = new Service();

            // Proposition
            string result = service.Proposition(inputBox.Text.ToLower());

            if (result == null)
            {
                MessageBox.Show("Ups, you did something wrong!");
            }
            else
            {
                try {
                    // Truth Table Export
                    TruthTableStructure table = service.GetTableService();

                    truthTable_lb.Items.Add(string.Join("\t", table.Description));

                    foreach (TruthTableRow row in table.TableRows)
                    {
                        string oneRow = string.Join("\t", row.OutputValues);
                        oneRow += $"\t{row.FinalResult}";
                        truthTable_lb.Items.Add(oneRow);
                    }

                    hex_box.Text = service.TruthTableHexService();

                    // Proposition Result Export
                    output_box.Text = result;

                    // Variables Export
                    variables_box.Text = string.Join(", ", service.GetVariables());

                    // Normalize Export
                    normalize_box.Text = service.GetNormalizedService();

                    //Normalize Prefix Export
                    normalize_prefix_box.Text = service.GetNomarlizedPrefixService();

                    //Normalize Simplified Export
                    normalize_simplified_box.Text = service.GetNormalizedSimplifiedService();

                    //Nandify Export
                    nandify_box.Text = service.GetNandifyService();

                    // Generate Tree
                    graph_Box.SizeMode      = PictureBoxSizeMode.CenterImage;
                    graph_Box.ImageLocation = $@"./{service.GetGraphService()}";
                }catch
                {
                    MessageBox.Show("Ups, you did something wrong!");
                }
            }
        }