public void OnStartup(IAgUiPluginSite PluginSite) { m_pSite = PluginSite; //Get the AgStkObjectRoot IAgUiApplication AgUiApp = m_pSite.Application; m_root = AgUiApp.Personality2 as AgStkObjectRootClass; }
public void OnStartup(IAgUiPluginSite PluginSite) { //Get the AgStkObjectRoot m_pSite = PluginSite; IAgUiApplication AgUiApp = m_pSite.Application; m_root = AgUiApp.Personality2 as AgStkObjectRootClass; m_root.Isolate(); m_root.UnitPreferences.ResetUnits(); CoverageClass.root = m_root; }
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"); } }