Ejemplo n.º 1
0
        public List <string> GetAvailableDataProviders(string stkObjectPath)
        {
            List <string> dataProviders = new List <string>();

            if (stkObjectPath.StartsWith("Access: "))
            {
                string[]     objects    = stkObjectPath.Substring(8).Split(',');
                IAgStkObject stkObject1 = root.GetObjectFromPath((string)objects.GetValue(0));
                IAgStkAccess access     = stkObject1.GetAccess((string)objects.GetValue(1));

                for (int i = 0; i < access.DataProviders.Count; ++i)
                {
                    dataProviders.Add(access.DataProviders[i].Name);
                }
            }
            else
            {
                IAgStkObject stkObject = root.GetObjectFromPath(stkObjectPath);

                for (int i = 0; i < stkObject.DataProviders.Count; ++i)
                {
                    dataProviders.Add(stkObject.DataProviders[i].Name);
                }
            }
            return(dataProviders);
        }
Ejemplo n.º 2
0
        private void RadioButtonOpen_CheckedChanged(object sender, EventArgs e)
        {
            if (radioButtonOpen.Checked.Equals(true))
            {
                try
                {
                    if (comboBoxSatellite.SelectedItem == null)
                    {
                        throw new Exception("No satellite selected.");
                    }
                    if (comboBoxFacility.SelectedItem == null)
                    {
                        throw new Exception("No facility selected.");
                    }

                    // Disable combo boxes for now
                    comboBoxSatellite.Enabled = false;
                    comboBoxFacility.Enabled  = false;

                    // Disable any previous events initialized
                    try
                    {
                        m_root.OnAnimUpdate -= new IAgStkObjectRootEvents_OnAnimUpdateEventHandler(Root_OnAnimUpdate);
                    }
                    catch { }

                    // Compute access
                    IAgStkObject accessObject = m_root.GetObjectFromPath("Facility/" + comboBoxFacility.SelectedItem.ToString());
                    m_access = accessObject.GetAccess("Satellite/" + comboBoxSatellite.SelectedItem.ToString());
                    m_access.ComputeAccess();

                    // Get AER data provider
                    m_accessProviderIntervals = m_access.DataProviders.GetDataPrvTimeVarFromPath("AER Data/Default");

                    // Add the event handler we will need
                    m_root.OnAnimUpdate += new IAgStkObjectRootEvents_OnAnimUpdateEventHandler(Root_OnAnimUpdate);
                }
                catch (Exception exception)
                {
                    radioButtonOpen.Checked = false;
                    MessageBox.Show(exception.Message, "Error");
                }
            }
        }