コード例 #1
0
        public static SystemCoordinates ParseCoordinateValues(string coords)
        {
            // Remove '(' and ')'
            if (coords.StartsWith("("))
            {
                coords = coords.Substring(1);
            }
            if (coords.EndsWith(")"))
            {
                coords = coords.Substring(0,coords.Length-1);
            }

            string[] split = coords.Split(new char[] { ',' });
            if (split.Length != 3)
            {
                return new SystemCoordinates();
            }
            SystemCoordinates sc = new SystemCoordinates();
            if (!double.TryParse(split[0], out sc.X) ||
                 !double.TryParse(split[1], out sc.Y) ||
                 !double.TryParse(split[2], out sc.Z))
            {
                return new SystemCoordinates();
            }
            return sc;
        }
コード例 #2
0
        internal void ResetControls(TransferItem[] data)
        {
            SystemCoordinates sc = new SystemCoordinates();
            dataGridEdit.Rows.Clear();
            bool skippedHeadline = false;
            for (int i = 0; i < data.Length; i++)
            {
                if (IsStandardProperty(data[i].Name))
                {
                    AddItemToGrid(data[i]);
                }
                else if (data[i].Name == WellKnownItems.Headline && skippedHeadline)
                {
                    AddItemToGrid(data[i]);
                }
                else if (data[i].Name == WellKnownItems.Headline)
                {
                    skippedHeadline = true;
                }
                else if (data[i].Name == WellKnownItems.System && data[i].Values.Count > 0)
                {
                    textSystem.Text = data[i].Values[0].Text;
                }
                else if (data[i].Name == WellKnownItems.BodyCode && data[i].Values.Count > 0)
                {
                    textBody.Text = data[i].Values[0].Text;
                }
                else if (data[i].Name == WellKnownItems.GalCoordX && data[i].Values.Count > 0)
                {
                    sc.X = data[i].Values[0].Value;
                }
                else if (data[i].Name == WellKnownItems.GalCoordY && data[i].Values.Count > 0)
                {
                    sc.Y = data[i].Values[0].Value;
                }
                else if (data[i].Name == WellKnownItems.GalCoordZ && data[i].Values.Count > 0)
                {
                    sc.Z = data[i].Values[0].Value;
                }
                else if (data[i].Name == WellKnownItems.CustomCategory && data[i].Values.Count > 0)
                {
                    textCategories.Text = data[i].Values[0].Text.Replace(";", Environment.NewLine);
                }
                else if (data[i].Name == WellKnownItems.CustomDescription && data[i].Values.Count > 0)
                {
                    textDescription.Text = data[i].Values[0].Text;
                }
                else if (data[i].Name == WellKnownItems.Description && data[i].Values.Count > 0)
                {
                    for (int j = 0; j < comboType.Items.Count; j++)
                    {
                        if (descriptionConfig[j].Name.ToLower() == data[i].Values[0].Text.ToLower())
                        {
                            comboType.SelectedIndex = j;
                            break;
                        }
                    }
                }
            }

            textCoords.Text = sc.ToString();
        }