Пример #1
0
        private frmErrList GetErrorWindow(string programName)
        {
            if (errorWindows_.Keys.Contains(programName))
            {
                return(errorWindows_[programName]);
            }

            frmErrList errors = new frmErrList();

            errors.MdiParent = this;
            errors.Show();
            errors.Left = this.Width - errors.Width - 35;
            errors.Top  = this.Height - errors.Height - 115;
            errors.Initialize(programName);
            errorWindows_.Add(programName, errors);
            errors.FormClosed += new FormClosedEventHandler(errors_FormClosed);
            return(errors);
        }
Пример #2
0
 public void ExecuteProgram(SIL_Program program, frmErrList errList)
 {
     this.Text = "Output - " + program.Name;
     try
     {
         program.Parse();
         program.Execute();
     }
     catch (Exception e)
     {
         string[] err = e.Message.Split('%');
         if (err.Length > 1)
         {
             errList.AddError(err[0], int.Parse(err[1]));
         }
         else
         {
             errList.AddError(err[0], 0);
         }
     }
 }
Пример #3
0
        /// <summary>
        /// Runs the program in the active editor window
        /// </summary>
        private void Run()
        {
            if (activeEditor_ == null)
            {
                MessageBox.Show("No active editor found!", "SIL Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            SIL_Program program = new SIL_Program();

            program.Name = activeEditor_.ProgramName;
            program.Text = activeEditor_.ProgramText;

            //Get output and error windows
            frmOutput output = GetOutputWindow(program.Name);

            output.Clear();
            frmErrList errors = GetErrorWindow(program.Name);

            errors.Clear();

            //Execute the program in these widnows
            output.ExecuteProgram(program, errors);
        }