コード例 #1
0
        private void buttonImport_Click(object sender, EventArgs e)
        {
            try
            {
                if (textBoxFilePath.Text == "")
                    throw new FileNotFoundException("No file chosen. Enter file name into the text box.");

                var graphMaker = new GraphMaker();
                var graph = graphMaker.CreateGraphFromXml(textBoxFilePath.Text);
                richTextBoxXml.Text = graphMaker.ModelChildrenNode.ToString();

                var patternFinder = new PatternFinder();
                string patterns = patternFinder.FindAllPatterns(graph);
                richTextBoxPatterns.Text = patterns;
                PatternString = patterns;
            }
            catch (FileNotFoundException ex)
            {
                MessageBox.Show(ex.Message, "ERROR", MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Cannot find patterns in the submitted file.", "ERROR", MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
            }
        }