private void NewMasterInterpreterImplementationFull(MgaFCO currentobj)
        {
            this.GMEConsole.Clear();
            System.Windows.Forms.Application.DoEvents();

            this.GMEConsole.Info.WriteLine("Running Master Interpreter 2.0");

            if (currentobj == null)
            {
                GMEConsole.Error.WriteLine("Context is invalid. This component can be executed only if a valid context is open in the main editor e.g. Test Bench.");
                return;
            }

            var masterInterpreter = new CyPhyMasterInterpreter.CyPhyMasterInterpreterAPI();
            masterInterpreter.IsInteractive = this.InteractiveMode;

            IEnumerable<CyPhyMasterInterpreter.Rules.ContextCheckerResult> contextCheckerResults = null;

            // check context
            var checkerSuccess = masterInterpreter.TryCheckContext(currentobj as MgaModel, out contextCheckerResults);

            List<CyPhyMasterInterpreter.Rules.ContextCheckerResult> sortedResults = contextCheckerResults.ToList();

            // sort results Passed, Failed, then alphabetically based on message.
            sortedResults.Sort((x, y) => { return x.Success == y.Success ? x.Message.CompareTo(y.Message) : y.Success.CompareTo(x.Success); });

            // print out nicely in the GME console
            MgaGateway.PerformInTransaction(() =>
            {
                foreach (var result in sortedResults)
                {
                    TextWriter tw = null;
                    StringBuilder sb = new StringBuilder();
                    if (result.Success)
                    {
                        sb.Append("[<b style=\"color:darkgreen\">Passed</b>]");
                        tw = GMEConsole.Info;
                    }
                    else
                    {
                        sb.Append("[<b style=\"color:red\">Failed</b>]");
                        tw = GMEConsole.Error;
                    }

                    sb.AppendFormat(" <i><a href=\"mga:{0}\">{1}</a></i> ", result.Subject.ID, result.Subject.Name);

                    sb.Append(result.Message);

                    tw.WriteLine(sb);
                }
            });

            if (sortedResults.Any(x => x.Success == false))
            {
                GMEConsole.Error.WriteLine("Context is invalid see messeges above. Please fix the problems.");
                return;
            }

            // context is valid
            // show GUI for the user
            CyPhyMasterInterpreter.ConfigurationSelection selection = null;

            try
            {
                selection = masterInterpreter.ShowConfigurationSelectionForm(currentobj as MgaModel);
            }
            catch (CyPhyMasterInterpreter.ExecutionCanceledByUserException ex)
            {
                GMEConsole.Warning.WriteLine("Operation was canceled by user. {0}", ex.Message);
                return;
            }

            CyPhyMasterInterpreter.MasterInterpreterResult[] miResults = null;

            // Get a progress dialog
            using (var progressDialog = new CyPhyMasterInterpreter.ProgressDialog())
            {
                masterInterpreter.MultipleConfigurationProgress += progressDialog.MultipleConfigurationProgressHandler;
                masterInterpreter.SingleConfigurationProgress += progressDialog.SingleConfigurationProgressHandler;

                if (masterInterpreter.IsInteractive)
                {
                    progressDialog.ShowWithDisabledMainWindow();
                }

                try
                {
                    miResults = masterInterpreter.RunInTransaction(selection);
                }
                catch (CyPhyMasterInterpreter.AnalysisModelInterpreterConfigurationFailedException ex)
                {
                    GMEConsole.Warning.WriteLine("Operation was canceled by user. {0}", ex.Message);
                }
                catch (CyPhyMasterInterpreter.ExecutionCanceledByUserException ex)
                {
                    GMEConsole.Warning.WriteLine("Operation was canceled by user. {0}", ex.Message);
                }

            }

            if (selection.OpenDashboard)
            {
                masterInterpreter.OpenDashboardWithChrome();
            }


            GMEConsole.Info.WriteLine(" === Summary === ");
            MgaGateway.PerformInTransaction(() =>
            {
                // print failure/success statistics
                // user master interpreter's result set in case user canceled the execution
                foreach (var result in masterInterpreter.Results)
                {
                    TextWriter tw = null;
                    StringBuilder sb = new StringBuilder();
                    if (result.Success)
                    {
                        sb.Append("[<b style=\"color:darkgreen\">Passed</b>]");
                        tw = GMEConsole.Info;
                    }
                    else
                    {
                        sb.Append("[<b style=\"color:red\">Failed</b>]");
                        tw = GMEConsole.Error;
                    }

                    sb.AppendFormat(" <i>{0}</i> {1} ", result.Context.Name, result.Configuration.Name);

                    sb.Append(result.Message);

                    tw.WriteLine(sb);
                }
            });


            this.GMEConsole.Info.WriteLine("Done Master Interpreter 2.0");
        }
        private void NewMasterInterpreterImplementationFull(MgaFCO currentobj)
        {
            this.GMEConsole.Clear();
            System.Windows.Forms.Application.DoEvents();

            this.GMEConsole.Info.WriteLine("Running Master Interpreter 2.0");

            if (currentobj == null)
            {
                GMEConsole.Error.WriteLine("Context is invalid. This component can be executed only if a valid context is open in the main editor e.g. Test Bench.");
                return;
            }

            var masterInterpreter = new CyPhyMasterInterpreter.CyPhyMasterInterpreterAPI();

            masterInterpreter.IsInteractive = this.InteractiveMode;

            IEnumerable <CyPhyMasterInterpreter.Rules.ContextCheckerResult> contextCheckerResults = null;

            // check context
            var checkerSuccess = masterInterpreter.TryCheckContext(currentobj as MgaModel, out contextCheckerResults);

            List <CyPhyMasterInterpreter.Rules.ContextCheckerResult> sortedResults = contextCheckerResults.ToList();

            // sort results Passed, Failed, then alphabetically based on message.
            sortedResults.Sort((x, y) => { return(x.Success == y.Success ? x.Message.CompareTo(y.Message) : y.Success.CompareTo(x.Success)); });

            // print out nicely in the GME console
            MgaGateway.PerformInTransaction(() =>
            {
                foreach (var result in sortedResults)
                {
                    TextWriter tw    = null;
                    StringBuilder sb = new StringBuilder();
                    if (result.Success)
                    {
                        sb.Append("[<b style=\"color:darkgreen\">Passed</b>]");
                        tw = GMEConsole.Info;
                    }
                    else
                    {
                        sb.Append("[<b style=\"color:red\">Failed</b>]");
                        tw = GMEConsole.Error;
                    }

                    sb.AppendFormat(" <i><a href=\"mga:{0}\">{1}</a></i> ", result.Subject.ID, result.Subject.Name);

                    sb.Append(result.Message);

                    tw.WriteLine(sb);
                }
            });

            if (sortedResults.Any(x => x.Success == false))
            {
                GMEConsole.Error.WriteLine("Context is invalid see messeges above. Please fix the problems.");
                return;
            }

            // context is valid
            // show GUI for the user
            CyPhyMasterInterpreter.ConfigurationSelection selection = null;

            try
            {
                selection = masterInterpreter.ShowConfigurationSelectionForm(currentobj as MgaModel);
            }
            catch (CyPhyMasterInterpreter.ExecutionCanceledByUserException ex)
            {
                GMEConsole.Warning.WriteLine("Operation was canceled by user. {0}", ex.Message);
                return;
            }

            CyPhyMasterInterpreter.MasterInterpreterResult[] miResults = null;

            // Get a progress dialog
            using (var progressDialog = new CyPhyMasterInterpreter.ProgressDialog())
            {
                masterInterpreter.MultipleConfigurationProgress += progressDialog.MultipleConfigurationProgressHandler;
                masterInterpreter.SingleConfigurationProgress   += progressDialog.SingleConfigurationProgressHandler;

                if (masterInterpreter.IsInteractive)
                {
                    progressDialog.ShowWithDisabledMainWindow();
                }

                try
                {
                    miResults = masterInterpreter.RunInTransaction(selection);
                }
                catch (CyPhyMasterInterpreter.AnalysisModelInterpreterConfigurationFailedException ex)
                {
                    GMEConsole.Warning.WriteLine("Operation was canceled by user. {0}", ex.Message);
                }
                catch (CyPhyMasterInterpreter.ExecutionCanceledByUserException ex)
                {
                    GMEConsole.Warning.WriteLine("Operation was canceled by user. {0}", ex.Message);
                }
            }

            if (selection.OpenDashboard)
            {
                masterInterpreter.OpenDashboardWithChrome();
            }


            GMEConsole.Info.WriteLine(" === Summary === ");
            MgaGateway.PerformInTransaction(() =>
            {
                // print failure/success statistics
                // user master interpreter's result set in case user canceled the execution
                foreach (var result in masterInterpreter.Results)
                {
                    TextWriter tw    = null;
                    StringBuilder sb = new StringBuilder();
                    if (result.Success)
                    {
                        sb.Append("[<b style=\"color:darkgreen\">Passed</b>]");
                        tw = GMEConsole.Info;
                    }
                    else
                    {
                        sb.Append("[<b style=\"color:red\">Failed</b>]");
                        tw = GMEConsole.Error;
                    }

                    sb.AppendFormat(" <i>{0}</i> {1} ", result.Context.Name, result.Configuration.Name);

                    sb.Append(result.Message);

                    tw.WriteLine(sb);
                }
            });


            this.GMEConsole.Info.WriteLine("Done Master Interpreter 2.0");
        }