public void BuildComponentInfoTab(ComponentQuestionInfoData info, CSET_Context controlContext)
        {
            try
            {
                IsComponent = true;
                ShowRequirementFrameworkTitle = false;
                NEW_QUESTION question = BuildFromNewQuestion(info, info.Set, controlContext);
                ComponentVisibility = true;
                // Build multiServiceComponent types list if any
                ComponentTypes.Clear();
                int salLevel = controlContext.UNIVERSAL_SAL_LEVEL.Where(x => x.Universal_Sal_Level1 == question.Universal_Sal_Level).First().Sal_Level_Order;

                List <ComponentOverrideLinkInfo> tmpList = new List <ComponentOverrideLinkInfo>();

                foreach (COMPONENT_QUESTIONS componentType in question.COMPONENT_QUESTIONS)
                {
                    bool enabled = info.HasComponentsForTypeAtSal(componentType.Component_Type, salLevel);
                    SymbolComponentInfoData componentTypeData = info.DictionaryComponentInfo[componentType.Component_Type];
                    tmpList.Add(new ComponentOverrideLinkInfo()
                    {
                        TypeComponetXML = componentTypeData.XMLName,
                        Type            = componentTypeData.DisplayName,
                        Enabled         = enabled
                    });
                }
                ComponentTypes = tmpList.OrderByDescending(x => x.Enabled).ThenBy(x => x.Type).ToList();
            }
            catch (Exception ex)
            {
                //CSETLogger.Fatal("Failed to get component information tab data.", ex);
            }
        }
示例#2
0
        public void BuildComponentInfoTab(ComponentQuestionInfoData info, CSET_Context controlContext)
        {
            try
            {
                IsComponent = true;
                ShowRequirementFrameworkTitle  = false;
                this.RequirementFrameworkTitle = "Components";
                NEW_QUESTION question = BuildFromNewQuestion(info, info.Set, controlContext);
                ComponentVisibility = true;
                // Build multiServiceComponent types list if any
                ComponentTypes.Clear();
                int salLevel = controlContext.UNIVERSAL_SAL_LEVEL.Where(x => x.Universal_Sal_Level1 == question.Universal_Sal_Level).First().Sal_Level_Order;

                List <ComponentOverrideLinkInfo> tmpList = new List <ComponentOverrideLinkInfo>();


                foreach (COMPONENT_QUESTIONS componentType in controlContext.COMPONENT_QUESTIONS.Where(x => x.Question_Id == info.QuestionID))
                {
                    bool enabled = info.HasComponentsForTypeAtSal(componentType.Component_Symbol_Id, salLevel);
                    COMPONENT_SYMBOLS componentTypeData = info.DictionaryComponentInfo[componentType.Component_Symbol_Id];
                    tmpList.Add(new ComponentOverrideLinkInfo()
                    {
                        Component_Symbol_Id = componentTypeData.Component_Symbol_Id,
                        Symbol_Name         = componentTypeData.Symbol_Name,
                        Enabled             = enabled
                    });
                }
                ComponentTypes = tmpList.OrderByDescending(x => x.Enabled).ThenBy(x => x.Symbol_Name).ToList();
                var reqid = controlContext.REQUIREMENT_QUESTIONS.Where(x => x.Question_Id == info.QuestionID).First().Requirement_Id;
                BuildDocuments(reqid, controlContext);
                var requirement = controlContext.NEW_REQUIREMENT.Where(x => x.Requirement_Id == reqid).Select(t => new
                {
                    Question_or_Requirement_Id = t.Requirement_Id,
                    Text             = FormatRequirementText(t.Requirement_Text),
                    SupplementalInfo = FormatSupplementalInfo(t.Supplemental_Info)
                }).FirstOrDefault();
                if (requirement != null)
                {
                    RequirementsData = new RequirementTabData()
                    {
                        RequirementID    = requirement.Question_or_Requirement_Id,
                        Text             = requirement.Text,
                        SupplementalInfo = FormatSupplementalInfo(requirement.SupplementalInfo),
                    };
                    QuestionsVisible = false;
                    ShowSALLevel     = true;
                }
            }
            catch (Exception ex)
            {
                //CSETLogger.Fatal("Failed to get component information tab data.", ex);
            }
        }
示例#3
0
        public void Connect()
        {
            if (_model.EngineEmbedControl == null)
            {
                Logger.Log("MInt Error: must set AppControl to embed");
                return;
            }

            Thread thread = new Thread(new ThreadStart(_model.T_EngineThread));

            thread.Start();
            Thread.Sleep(10);
            while (Engine.getInstance().GetIsInited() == false)
            {
                Thread.Sleep(1);
            }

            //prep engine for editor mode
            Engine.getInstance().RegisterEditorMode();
            //EditorSubsystemManaged.getInstance().RegisterTick();

            _model.EngineEmbedControl.Recreate();

            //generate component type list
            ComponentTypes.Clear();
            var lListOfBs = (from lAssembly in AppDomain.CurrentDomain.GetAssemblies()
                             from lType in lAssembly.GetTypes()
                             where typeof(MochaInterface.Component).IsAssignableFrom(lType)
                             select lType).ToList();

            foreach (Type t in lListOfBs)
            {
                if (t != typeof(MochaInterface.Component))
                {
                    ComponentTypes.Add(t.Name);
                }
            }

            //run roaster
            Thread roasterThread = new Thread(new ThreadStart(() =>
            {
                while (true)
                {
                    if (EngineManagerViewModel.instance.BusyMessage == null)    //don't run roaster if another operation is pending
                    {
                        //start up the roaster, wait for it to idle, output it's info to the log
                        ProcessStartInfo startInfo       = new ProcessStartInfo();
                        startInfo.FileName               = "Roaster.exe";
                        startInfo.WindowStyle            = ProcessWindowStyle.Hidden;
                        startInfo.CreateNoWindow         = true;
                        startInfo.UseShellExecute        = false;
                        startInfo.RedirectStandardOutput = true;
                        try
                        {
                            using (Process roastProc = System.Diagnostics.Process.Start(startInfo))
                            {
                                Thread.Sleep(1000);
                                if (roastProc.HasExited == false)
                                {
                                    EngineManagerViewModel.instance.BusyMessage = "... Roasting New Assets ...";
                                    roastProc.WaitForExit();
                                    EngineManagerViewModel.instance.BusyMessage = null;
                                }
                                using (StreamReader reader = roastProc.StandardOutput)
                                {
                                    string result = reader.ReadToEnd();
                                    if (!String.IsNullOrWhiteSpace(result))
                                    {
                                        Logger.Log(result);
                                    }
                                }
                            }
                        }
                        catch (Win32Exception)
                        {
                            //roaster was not found
                            Console.WriteLine("Roaster.exe not found - assets will not be reloaded.");
                            Thread.CurrentThread.Abort();
                        }
                    }
                    Thread.Sleep(ROASTERINTERVAL);
                }
            }));

            roasterThread.Start();

            IsConnected = true;
        }