示例#1
0
 private void InfToPostButton_Click(object sender, EventArgs e)
 {
     PostfixNotationExpression postExp = new PostfixNotationExpression();
     try
     {
         string[] str = postExp.ConvertToPostfixNotation(this.InfToPostTextBox.Text);
         this.PostToInfTextBox.Clear();
         for (int i = 0; i < str.Length; i++)
         {
             this.PostToInfTextBox.Text += str[i] + "\r\n";
         }
     }
     catch (NotMatchedBracketsException ex)
     {
         const string caption = "Ошибка в выражении!";
         var result = MessageBox.Show(ex.ToString(), caption,
                                  MessageBoxButtons.OK,
                                  MessageBoxIcon.Question);
     }
 }
示例#2
0
        private void InfToPostButton_Click(object sender, EventArgs e)
        {
            PostfixNotationExpression postExp = new PostfixNotationExpression();

            try
            {
                string[] str = postExp.ConvertToPostfixNotation(this.InfToPostTextBox.Text);
                this.PostToInfTextBox.Clear();
                for (int i = 0; i < str.Length; i++)
                {
                    this.PostToInfTextBox.Text += str[i] + "\r\n";
                }
            }
            catch (NotMatchedBracketsException ex)
            {
                const string caption = "Ошибка в выражении!";
                var          result  = MessageBox.Show(ex.ToString(), caption,
                                                       MessageBoxButtons.OK,
                                                       MessageBoxIcon.Question);
            }
        }