Exemple #1
0
        private void PopulateObjectRow(ObjectData data)
        {
            ObjectGrid.Rows.Add();

            DataGridViewCheckBoxCell cell = ObjectGrid[0, ObjectGrid.Rows.Count - 1] as DataGridViewCheckBoxCell;

            if (data.ModifyLeadTrail)
            {
                cell.Value = true;
            }
            else
            {
                cell.Value = false;
            }

            DataGridViewTextBoxCell name = ObjectGrid[1, ObjectGrid.Rows.Count - 1] as DataGridViewTextBoxCell;

            name.Style.ForeColor = Color.White;
            name.Style.BackColor = Color.DimGray;
            name.Value           = data.SimpleName;
            name.ReadOnly        = true;

            //Lead Types
            DataGridViewComboBoxCell comboCell = ObjectGrid[2, ObjectGrid.Rows.Count - 1] as DataGridViewComboBoxCell;

            comboCell.Style.ForeColor = Color.White;
            comboCell.Style.BackColor = Color.DimGray;

            PopulateLeadOptions(comboCell, data);
            if (comboCell.Items.Contains(SmartViewFunctions.GetLeadTrailString(data.LeadSetting3D)))
            {
                comboCell.Value = comboCell.Items[comboCell.Items.IndexOf(SmartViewFunctions.GetLeadTrailString(data.LeadSetting3D))];
            }
            else
            {
                comboCell.Value = comboCell.Items[0];
            }

            //Trail Types
            comboCell = ObjectGrid[3, ObjectGrid.Rows.Count - 1] as DataGridViewComboBoxCell;
            comboCell.Style.ForeColor = Color.White;
            comboCell.Style.BackColor = Color.DimGray;

            PopulateTrailOptions(comboCell, data);
            if (comboCell.Items.Contains(SmartViewFunctions.GetLeadTrailString(data.TrailSetting3D)))
            {
                comboCell.Value = comboCell.Items[comboCell.Items.IndexOf(SmartViewFunctions.GetLeadTrailString(data.TrailSetting3D))];
            }
            else
            {
                comboCell.Value = comboCell.Items[0];
            }

            if (data.SimplePath.Contains("Satellite"))
            {
                //VVLH reference options
                comboCell = ObjectGrid[5, ObjectGrid.Rows.Count - 1] as DataGridViewComboBoxCell;
                comboCell.Style.ForeColor = Color.White;
                comboCell.Style.BackColor = Color.DimGray;
                PopulateVvlhObjects(comboCell, data);
                for (int i = 0; i < comboCell.Items.Count; i++)
                {
                    if (data.CoordSys.Contains((string)comboCell.Items[i]))
                    {
                        comboCell.Value = comboCell.Items[i];
                        break;
                    }
                    if (i == comboCell.Items.Count - 1)
                    {
                        comboCell.Value = comboCell.Items[0];
                    }
                }
                //Frame
                comboCell = ObjectGrid[4, ObjectGrid.Rows.Count - 1] as DataGridViewComboBoxCell;
                comboCell.Style.ForeColor = Color.White;
                comboCell.Style.BackColor = Color.DimGray;
                PopulateFrameOptions(comboCell, data);
                if (data.CoordSys.Contains("Inertial"))
                {
                    comboCell.Value = comboCell.Items[0];
                }
                else if (data.CoordSys.Contains("Fixed"))
                {
                    comboCell.Value = comboCell.Items[1];
                }
                else if (data.CoordSys.Contains("VVLH"))
                {
                    comboCell.Value = comboCell.Items[2];
                }
            }
            else
            {
                //ObjectGrid[5, ObjectGrid.Rows.Count - 1].ReadOnly = true;
                //ObjectGrid[4, ObjectGrid.Rows.Count - 1].ReadOnly = true;
            }
        }