Beispiel #1
0
        void m_root_OnStkObjectDeleted(object Sender)
        {
            string objectPath = Sender.ToString();
            string longName   = m_stkObjectsLibrary.SimplifiedObjectPath(objectPath);
            string simpleName = m_stkObjectsLibrary.ObjectName(longName);

            cbStkObjects.Items.Remove(simpleName);
        }
Beispiel #2
0
        private void cbStkObjects_SelectedIndexChanged(object sender, EventArgs e)
        {
            string simpleName;
            string className;

            Events.Items.Clear();
            //Change options in Events box
            StringCollection objectPaths = m_stkObjectsLibrary.GetObjectPathListFromInstanceNamesXml(CommonData.StkRoot.AllInstanceNamesToXML(), "");

            simpleName = cbStkObjects.Text;

            foreach (string path in objectPaths)
            {
                string objectName = m_stkObjectsLibrary.ObjectName(path);
                className = m_stkObjectsLibrary.ClassNameFromObjectPath(path);
                if (objectName == simpleName && className != "Scenario")
                {
                    className = m_stkObjectsLibrary.ClassNameFromObjectPath(path);
                    string       objectPath = className + "/" + simpleName;
                    IAgStkObject obj        = CommonData.StkRoot.GetObjectFromPath(objectPath);

                    events = obj.Vgt.Events;
                    int eventCount = obj.Vgt.Events.Count;

                    for (int i = 0; i < eventCount; i++)
                    {
                        IAgCrdn currentEvent = (IAgCrdn)events[i];
                        Events.Items.Add(currentEvent.Name);
                    }
                }
            }
            if (cbStkObjects.Text.Contains("Access"))
            {
                IAgScenario scenario = CommonData.StkRoot.CurrentScenario as IAgScenario;
                Array       accesses = scenario.GetExistingAccesses();

                int numAccesses = accesses.GetLength(0);
                for (int i = 0; i < numAccesses; i++)
                {
                    string object1      = accesses.GetValue(i, 0).ToString();
                    string shortobject1 = object1.Substring(object1.IndexOf('/') + 1);
                    string object2      = accesses.GetValue(i, 1).ToString();
                    string shortobject2 = object2.Substring(object2.IndexOf('/') + 1);

                    if (cbStkObjects.Text.Contains(shortobject1) && cbStkObjects.Text.Contains(shortobject2))
                    {
                        IAgStkAccess access = scenario.GetAccessBetweenObjectsByPath(object1, object2);
                        accessEvents = access.Vgt.Events;
                        for (int j = 0; j < accessEvents.Count; j++)
                        {
                            IAgCrdn currentEvent = (IAgCrdn)accessEvents[j];
                            Events.Items.Add(currentEvent.Name);
                        }
                    }
                }
            }
        }