Exemplo n.º 1
0
        private void CloseSTK()
        {
            DialogResult dialogResult = MessageBox.Show("Do you want to close STK?", "Close STK", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                try
                {
                    m_stkRoot.CloseScenario();
                    m_stkApplication.Quit();
                    Marshal.FinalReleaseComObject(m_stkApplication);
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message);
                    // STK is already closed
                }
            }
        }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            AgUiApplication uiApplication = new AgUiApplication();

            uiApplication.LoadPersonality("STK");
            uiApplication.Visible = false;
            IAgStkObjectRoot root = uiApplication.Personality2 as IAgStkObjectRoot;

            root.NewScenario("scenario");
            IAgStar star = root.CurrentScenario.Children.New(AgESTKObjectType.eStar, "MyStar") as IAgStar;

            //wait();

            run();

            //wait();

            AgFacility facility = root.CurrentScenario.Children.New(AgESTKObjectType.eFacility, "MyFacility") as AgFacility;

            button1.Text = root.CurrentScenario.Children.Count.ToString();
            uiApplication.Quit();
        }