private void UpdateGridDictLists(STKObject thisListObject, object accesshandler, implem_Classes AccessClass, List <string> parents)
 {
     ListChildren.Add(thisListObject);
     GridDict.Add(rowCount, thisListObject);
     AccessObject.Add(rowCount, accesshandler);
     AccessClassName.Add(rowCount, AccessClass);
     parentsHeirarchy.Add(rowCount, parents);
     rowCount++;
 }
        public void readAllAttributes()
        {
            int Child_count = Scenario.Children.Count;

            // Note: IAgStkObject is instance of the object
            allChildren = Scenario.Children;
            makeChildrenList(allChildren);

            for (int i = 0; i < Child_count; i++)
            {
                List <string> localParent = new List <string>();
                if (allChildren[i].ClassName == "Satellite")
                {
                    string propName = getPropagator(allChildren[i]);

                    STKObject list0 = new STKObject(allChildren[i].InstanceName, allChildren[i].ClassName, propName, allChildren[i]);

                    UpdateGridDictLists(list0, null, implem_Classes.NULL, localParent);
                    localParent.Add(list0.m_ObjName);


                    //Jx Propagator
                    if (propName == "ePropagatorJ2Perturbation" || propName == "ePropagatorJ4Perturbation" || propName == "ePropagatorTwoBody")
                    {
                        #region Orbit Section
                        STKObject listHeader = new STKObject("Orbit", "IAgOrbitState"); //subcomp passed like this for ui
                        UpdateGridDictLists(listHeader, null, implem_Classes.NULL, localParent);
                        List <string> localParent_Orbit = Extensions.Clone <string>(localParent);
                        localParent_Orbit.Add(listHeader.m_ObjName);


                        Satellite_OrbitData SatOrbitData = list0.m_OrbitData;
                        var Times = new List <string> {
                            SatOrbitData.m_ObjectTimes.FindStartTime(), SatOrbitData.m_ObjectTimes.FindStopTime()
                        };
                        dictObjectTimes.Add(i, Times);

                        //Add List of Orbital Parameters
                        STKObject list1 = new STKObject(nameof(SatOrbitData.Step_Size), SatOrbitData.Step_Size, Units.u_Time);
                        UpdateGridDictLists(list1, SatOrbitData.m_ultimateObject, implem_Classes.Satellite_OrbitData, localParent_Orbit);
                        list1 = new STKObject(nameof(SatOrbitData.SemiMajorAxis), SatOrbitData.SemiMajorAxis, Units.u_Distance);
                        UpdateGridDictLists(list1, SatOrbitData.m_ultimateObject, implem_Classes.Satellite_OrbitData, localParent_Orbit);
                        list1 = new STKObject(nameof(SatOrbitData.Eccentricity), SatOrbitData.Eccentricity, Units.u_Null);
                        UpdateGridDictLists(list1, SatOrbitData.m_ultimateObject, implem_Classes.Satellite_OrbitData, localParent_Orbit);
                        list1 = new STKObject(nameof(SatOrbitData.Inclination), SatOrbitData.Inclination, Units.u_Angle);
                        UpdateGridDictLists(list1, SatOrbitData.m_ultimateObject, implem_Classes.Satellite_OrbitData, localParent_Orbit);
                        list1 = new STKObject(nameof(SatOrbitData.RAAN), SatOrbitData.RAAN, Units.u_Angle);
                        UpdateGridDictLists(list1, SatOrbitData.m_ultimateObject, implem_Classes.Satellite_OrbitData, localParent_Orbit);
                        list1 = new STKObject(nameof(SatOrbitData.ArgOfPerigee), SatOrbitData.ArgOfPerigee, Units.u_Angle);
                        UpdateGridDictLists(list1, SatOrbitData.m_ultimateObject, implem_Classes.Satellite_OrbitData, localParent_Orbit);
                        list1 = new STKObject(nameof(SatOrbitData.TrueAnomaly), SatOrbitData.TrueAnomaly, Units.u_Angle);
                        UpdateGridDictLists(list1, SatOrbitData.m_ultimateObject, implem_Classes.Satellite_OrbitData, localParent_Orbit);
                        #endregion

                        #region Mass Properties Section
                        listHeader = new STKObject("Mass", "IAgVeMassProperties"); //subcomp passed like this for ui
                        UpdateGridDictLists(listHeader, null, implem_Classes.NULL, localParent);
                        var localParent_Mass = Extensions.Clone <string>(localParent);
                        localParent_Mass.Add(listHeader.m_ObjName);

                        Satellite_MassData SatMassData = list0.m_MassData;
                        STKObject          list2       = new STKObject(nameof(SatMassData.Mass), SatMassData.Mass, Units.u_Mass); UpdateGridDictLists(list2, SatMassData.m_ultimateObject, implem_Classes.Satellite_MassData, localParent_Mass);
                        list2 = new STKObject(nameof(SatMassData.Ixx), SatMassData.Ixx, Units.u_Inertia); UpdateGridDictLists(list2, SatMassData.m_ultimateObject, implem_Classes.Satellite_MassData, localParent_Mass);
                        list2 = new STKObject(nameof(SatMassData.Iyy), SatMassData.Iyy, Units.u_Inertia); UpdateGridDictLists(list2, SatMassData.m_ultimateObject, implem_Classes.Satellite_MassData, localParent_Mass);
                        list2 = new STKObject(nameof(SatMassData.Izz), SatMassData.Izz, Units.u_Inertia); UpdateGridDictLists(list2, SatMassData.m_ultimateObject, implem_Classes.Satellite_MassData, localParent_Mass);
                        list2 = new STKObject(nameof(SatMassData.Ixy), SatMassData.Ixy, Units.u_Inertia); UpdateGridDictLists(list2, SatMassData.m_ultimateObject, implem_Classes.Satellite_MassData, localParent_Mass);
                        list2 = new STKObject(nameof(SatMassData.Ixz), SatMassData.Ixz, Units.u_Inertia); UpdateGridDictLists(list2, SatMassData.m_ultimateObject, implem_Classes.Satellite_MassData, localParent_Mass);
                        list2 = new STKObject(nameof(SatMassData.Iyz), SatMassData.Iyz, Units.u_Inertia); UpdateGridDictLists(list2, SatMassData.m_ultimateObject, implem_Classes.Satellite_MassData, localParent_Mass);

                        #endregion
                    }

                    //Astrogator
                    else if (propName == "ePropagatorAstrogator")
                    {
                        IAgSatellite satellite = allChildren[i] as IAgSatellite;

                        #region Orbit Section
                        STKObject listHeader = new STKObject("Orbit: Astrogator", "IAgVAMCSDriver", 2); //subcomp passed like this for ui
                        UpdateGridDictLists(listHeader, null, implem_Classes.NULL, localParent);
                        var localParent_Orbit = Extensions.Clone <string>(localParent);
                        localParent_Orbit.Add(listHeader.m_ObjName);
                        //get all sequences
                        MCS_Segments ListSegments = new MCS_Segments(satellite);
                        dictObjectTimes.Add(i, ListSegments.objectTimes);
                        STKObject AstgList = new STKObject();

                        for (int k = 0; k < ListSegments.SegmentDataList.Count; k++)
                        {
                            for (int j = 0; j < ListSegments.SegmentDataList[k].l_Names.Count; j++)
                            {
                                if (!ListSegments.SegmentDataList[k].l_isQuantity[j])
                                {
                                    AstgList = new STKObject(ListSegments.SegmentDataList[k].l_Names[j], ListSegments.SegmentDataList[k].l_types[j], Math.Min(5, (3 + ListSegments.SegmentDataList[k].l_depth[j])));
                                    var thislocalParent = Extensions.Clone <string>(localParent_Orbit);
                                    thislocalParent.AddRange(ListSegments.SegmentDataList[k].l_localParents[j]);
                                    UpdateGridDictLists(AstgList, null, implem_Classes.NULL, thislocalParent);
                                }
                                else
                                {
                                    var AccessObj       = (ListSegments.SegmentDataList[k].l_SegObj[j]);
                                    var AccessObjType   = (ListSegments.SegmentDataList[k].l_implemClass[j]);
                                    var thislocalParent = Extensions.Clone <string>(localParent_Orbit); thislocalParent.AddRange(ListSegments.SegmentDataList[k].l_localParents[j]);

                                    localParent_Orbit.AddRange(ListSegments.SegmentDataList[k].l_localParents[j]);
                                    AstgList = new STKObject(ListSegments.SegmentDataList[k].l_Names[j], ListSegments.SegmentDataList[k].l_Values[j], ListSegments.SegmentDataList[k].l_unit[j]);
                                    UpdateGridDictLists(AstgList, AccessObj, AccessObjType, thislocalParent);
                                    //ADD ULTIMATE ACCESS HANDLER HEREEEEEE.
                                }
                            }
                        }
                        #endregion

                        #region Mass Properties Section

                        #endregion
                    }
                }
                else if (allChildren[i].ClassName == "Facility")
                {
                    Facility_Data thisFacility = new Facility_Data(allChildren[i]);
                    STKObject     list0        = new STKObject(allChildren[i].InstanceName, allChildren[i].ClassName, allChildren[i]);
                    UpdateGridDictLists(list0, null, implem_Classes.NULL, localParent);
                    localParent.Add(allChildren[i].InstanceName);
                    for (int ii = 0; ii < thisFacility.l_Names.Count; ii++)
                    {
                        if (!thisFacility.l_isQuantity[ii])
                        {
                            var facilityList = new STKObject(thisFacility.l_Names[ii], thisFacility.l_types[ii], (1 + thisFacility.l_depth[ii])); UpdateGridDictLists(facilityList, null, implem_Classes.NULL, localParent);
                        }
                        else
                        {
                            var accessObj    = thisFacility.l_SegObj[ii];
                            var accessType   = thisFacility.l_implemClass[ii];
                            var facilityList = new STKObject(thisFacility.l_Names[ii], thisFacility.l_Values[ii], thisFacility.l_unit[ii]);

                            UpdateGridDictLists(facilityList, null, implem_Classes.Facility_Location, localParent);
                        }
                    }
                }
                else
                {
                    STKObject list0 = new STKObject(allChildren[i].InstanceName, allChildren[i].ClassName, allChildren[i]);
                    UpdateGridDictLists(list0, null, implem_Classes.NULL, localParent);
                }
            }
            /// File Load Last used project name
            if (projInfoFile.hasInfo["Project Name"])
            {
                var projName = (string)(projInfoFile.getInfo("Project Name"));

                StatusBox.Text        = "Project Loaded: \" " + projName + " \" . Press 'Refresh Valispace Data' ";
                thisProjectLabel.Text = "Project :  " + projName + " (Refresh)";

                LoadProject_Msg.Visibility = Visibility.Hidden;
                //loadLastProjectName();
            }
        }