Exemplo n.º 1
0
        public List <string> GetAvailableStkAccesses()
        {
            List <string> accesses       = new List <string>();
            string        scenarioString = "/Application/STK/Scenario/" + ((IAgStkObject)scen).InstanceName;

            AGI.STKUtil.IAgExecCmdResult result = root.ExecuteCommand("GetAccesses /");
            foreach (string item in result)
            {
                string[] lineElements = item.Split(' ');
                accesses.Add(lineElements[0].Replace(scenarioString, "*") + "," + lineElements[2].Replace(scenarioString, "*"));
            }

            return(accesses);
        }
Exemplo n.º 2
0
        private bool Licensing(string licenseSearch)
        {
            bool hasLicense = false;

            AGI.STKUtil.IAgExecCmdResult result = m_root.ExecuteCommand("GetLicenses /");
            foreach (string license in result)
            {
                string[] licenseData = license.Split(',');
                if (licenseData[0].Contains(licenseSearch) & !licenseData[1].Contains("No License"))
                {
                    hasLicense = true;
                }
            }
            return(hasLicense);
        }
Exemplo n.º 3
0
        public void Initialize()
        {
            if (m_pSite != null)
            {
                Image menuImage = null;

                Assembly currentAssembly = Assembly.GetExecutingAssembly();
                menuImage = Image.FromStream(currentAssembly.GetManifestResourceStream(m_imageResource));
                m_picture = OlePictureHelper.OlePictureFromImage(menuImage);
                IAgUiApplication AgUiApp = m_pSite.Application;

                // Set STK Root object
                CommonData.StkRoot = (AgStkObjectRoot)AgUiApp.Personality2;

                // Read preference file
                AGI.STKUtil.IAgExecCmdResult cmdResult = CommonData.StkRoot.ExecuteCommand("GetDirectory / DefaultUser");
                string userPath = cmdResult[0].ToString();
                m_prefPath = Path.Combine(userPath, m_configPath);
                if (File.Exists(m_prefPath))
                {
                    using (StreamReader streamReader = new StreamReader(m_prefPath))
                    {
                        m_stringValue = streamReader.ReadLine();
                        m_doubleValue = Double.Parse(streamReader.ReadLine());
                        streamReader.Close();
                    }
                }
                else
                {
                    m_stringValue = "";
                    m_doubleValue = 0.0;
                }
            }
            else
            {
                MessageBox.Show("Error: Couldn't aquire STK Root Object");
            }
        }
Exemplo n.º 4
0
        public void Initialize()
        {
            if (m_pSite != null)
            {
                Image menuImage = null;

                Assembly currentAssembly = Assembly.GetExecutingAssembly();
                menuImage = Image.FromStream(currentAssembly.GetManifestResourceStream(m_imageResource));
                m_picture = OlePictureHelper.OlePictureFromImage(menuImage);
                object AgUiApp = m_pSite.Application;
                m_root = (AgStkObjectRootClass)Marshal.CreateWrapperOfType(AgUiApp.GetType().InvokeMember("Personality2", System.Reflection.BindingFlags.GetProperty, null, AgUiApp, null), typeof(AgStkObjectRootClass));

                //read preference file
                AGI.STKUtil.IAgExecCmdResult cmdResult = m_root.ExecuteCommand("GetDirectory / DefaultUser");
                string userPath = cmdResult[0].ToString();
                m_prefPath = Path.Combine(userPath, m_configPath);
                if (File.Exists(m_prefPath))
                {
                    using (StreamReader streamReader = new StreamReader(m_prefPath))
                    {
                        m_stringValue = streamReader.ReadLine();
                        m_doubleValue = Double.Parse(streamReader.ReadLine());
                        streamReader.Close();
                    }
                }
                else
                {
                    m_stringValue = "";
                    m_doubleValue = 0.0;
                }
            }
            else
            {
                MessageBox.Show("Error: Couldn't aquire STK Root Object");
            }
        }
Exemplo n.º 5
0
 public Directions(AgStkObjectRoot root)
 {
     m_root = root;
     AGI.STKUtil.IAgExecCmdResult result = m_root.ExecuteCommand("GetDirectory / STKHome");
     installDir = result[0];
 }