private void CreateButton_Click(object sender, EventArgs e)
        {
            if (ManualSSR.Checked)
            {
                int fieldCheck = FieldCheck();
                if (fieldCheck == 0)
                {
                    GroundEvent current = new GroundEvent();
                    current.Id = IDText.Text;
                    current.Country = CountryText.Text;
                    current.Latitude = Latitude.Text;
                    current.Longitude = Longitude.Text;
                    string start = ReadWrite.CheckTimeCell(StartTimeText.Text);
                    if (start == "Unspecified")
                    {
                        current.StartTime = "Unspecified";
                        current.MilStartTime = "Unspecified";
                    }
                    else
                    {
                        current.MilStartTime = StartTimeText.Text;
                        current.StartTime = StartTimeText.Text;
                    }

                    string stop = ReadWrite.CheckTimeCell(StopTimeText.Text);
                    if (stop == "Unspecified")
                    {
                        current.StopTime = "Unspecified";
                        current.MilStopTime = "Unspecified";
                    }
                    else
                    {
                        current.MilStopTime = StopTimeText.Text;
                        current.StopTime = StopTimeText.Text;
                    }
                    current.Description = DesciptionText.Text;
                    current.SsrType = TypeSelect.Text;

                    CommonData.CurrentEvents.Add(current);
                    GroundEventFunctions.CreateGroundEvent(current);
                    ReadWrite.WriteEventFile(CommonData.EventFileStr);
                }
                CommonData.NewSsrCreated = true;
            }
            else if(SSRFromFile.Checked)
            {
                int importOption = 0;
                if (ImportAll.Checked)
                {
                    importOption = 1;
                }
                ReadWrite.ImportEventSheet(FileText.Text, importOption);
                CommonData.NewSsrCreated = true;
            }
            this.Close();
        }
Exemple #2
0
        private void CreateButton_Click(object sender, EventArgs e)
        {
            if (ManualSSR.Checked)
            {
                int fieldCheck = FieldCheck();
                if (fieldCheck == 0)
                {
                    GroundEvent current = new GroundEvent();
                    current.Id        = Regex.Replace(IDText.Text, @"[^0-9a-zA-Z_]+", "");
                    current.Country   = CountryText.Text;
                    current.Latitude  = Latitude.Text;
                    current.Longitude = Longitude.Text;
                    string start = ReadWrite.CheckTimeCell(StartTimeText.Text);
                    if (start == "Unspecified")
                    {
                        current.StartTime    = "Unspecified";
                        current.MilStartTime = "Unspecified";
                    }
                    else
                    {
                        current.MilStartTime = StartTimeText.Text;
                        current.StartTime    = StartTimeText.Text;
                    }

                    string stop = ReadWrite.CheckTimeCell(StopTimeText.Text);
                    if (stop == "Unspecified")
                    {
                        current.StopTime    = "Unspecified";
                        current.MilStopTime = "Unspecified";
                    }
                    else
                    {
                        current.MilStopTime = StopTimeText.Text;
                        current.StopTime    = StopTimeText.Text;
                    }
                    current.Description = DesciptionText.Text;
                    current.SsrType     = TypeSelect.Text;

                    if (!String.IsNullOrEmpty(_contactEvent.Poc))
                    {
                        current.Poc = _contactEvent.Poc;
                    }
                    if (!String.IsNullOrEmpty(_contactEvent.PocPhone))
                    {
                        current.PocPhone = _contactEvent.PocPhone;
                    }
                    if (!String.IsNullOrEmpty(_contactEvent.PocEmail))
                    {
                        current.PocEmail = _contactEvent.PocEmail;
                    }

                    current.ColorOption = ColorSelection.Text;
                    CommonData.CurrentEvents.Add(current);

                    GroundEventFunctions.CreateGroundEvent(current);
                    CreatorFunctions.ChangeObjectColor("Place/" + current.Id, (CustomUserInterface.ColorOptions)Enum.Parse(typeof(CustomUserInterface.ColorOptions), ColorSelection.Text));

                    ReadWrite.WriteEventFile(CommonData.EventFileStr);
                }
                CommonData.NewSsrCreated = true;
            }
            else if (SSRFromFile.Checked)
            {
                int importOption = 0;
                if (ImportAll.Checked)
                {
                    importOption = 1;
                }
                ReadWrite.ImportEventSheet(FileText.Text, importOption, SheetColor.Text);
                CommonData.NewSsrCreated = true;
            }
            this.Close();
        }
Exemple #3
0
        private void Apply_Click(object sender, EventArgs e)
        {
            CommonData.TypeChanged = false;
            int check = FieldCheck();

            if (check == 0)
            {
                string path = "*/Place/" + CommonData.CurrentEvents[CommonData.EventSelectedIndex].Id;
                GroundEventFunctions.RemoveTimelineComponent(CommonData.CurrentEvents[CommonData.EventSelectedIndex]);
                CommonData.CurrentEvents[CommonData.EventSelectedIndex].Id        = IDText.Text;
                CommonData.CurrentEvents[CommonData.EventSelectedIndex].Country   = CountryText.Text;
                CommonData.CurrentEvents[CommonData.EventSelectedIndex].Latitude  = Latitude.Text;
                CommonData.CurrentEvents[CommonData.EventSelectedIndex].Longitude = Longitude.Text;
                string start = GroundEventFunctions.ConvertMilTime(StartTimeText.Text);
                if (start == "Unspecified")
                {
                    CommonData.CurrentEvents[CommonData.EventSelectedIndex].StartTime    = "Unspecified";
                    CommonData.CurrentEvents[CommonData.EventSelectedIndex].MilStartTime = "Unspecified";
                }
                else
                {
                    CommonData.CurrentEvents[CommonData.EventSelectedIndex].MilStartTime = StartTimeText.Text;
                    CommonData.CurrentEvents[CommonData.EventSelectedIndex].StartTime    = StartTimeText.Text;
                }

                string stop = ReadWrite.CheckTimeCell(StopTimeText.Text);
                if (stop == "Unspecified")
                {
                    CommonData.CurrentEvents[CommonData.EventSelectedIndex].StopTime    = "Unspecified";
                    CommonData.CurrentEvents[CommonData.EventSelectedIndex].MilStopTime = "Unspecified";
                }
                else
                {
                    CommonData.CurrentEvents[CommonData.EventSelectedIndex].MilStopTime = StopTimeText.Text;
                    CommonData.CurrentEvents[CommonData.EventSelectedIndex].StopTime    = StopTimeText.Text;
                }
                CommonData.CurrentEvents[CommonData.EventSelectedIndex].Description = DesciptionText.Text;

                //Rename Object/sub-objects
                string cmd = "Rename " + path + " " + CommonData.CurrentEvents[CommonData.EventSelectedIndex].Id;
                CommonData.StkRoot.ExecuteCommand(cmd);
                if (CommonData.CurrentEvents[CommonData.EventSelectedIndex].SubObjects != null)
                {
                    foreach (SubObject item in CommonData.CurrentEvents[CommonData.EventSelectedIndex].SubObjects)
                    {
                        cmd = "Rename " + path + "-" + item.Name + " " + CommonData.CurrentEvents[CommonData.EventSelectedIndex].Id + "-" + item.Name;
                        CommonData.StkRoot.ExecuteCommand(cmd);
                    }
                }


                //Reassign position
                path = "Place/" + CommonData.CurrentEvents[CommonData.EventSelectedIndex].Id;
                IAgPlace place = CommonData.StkRoot.GetObjectFromPath(path) as IAgPlace;
                place.Position.AssignGeodetic(Double.Parse(Latitude.Text), Double.Parse(Longitude.Text), 0);

                //Change object marker if type changed
                string currentType = CommonData.CurrentEvents[CommonData.EventSelectedIndex].SsrType;
                if (currentType != TypeSelect.Text)
                {
                    CommonData.CurrentEvents[CommonData.EventSelectedIndex].SsrType = TypeSelect.Text;
                    CommonData.TypeChanged = true;

                    string filePath = GroundEventFunctions.GetImagePath(CommonData.CurrentEvents[CommonData.EventSelectedIndex].SsrType);

                    cmd = "VO */Place/" + CommonData.CurrentEvents[CommonData.EventSelectedIndex].Id + " marker show on markertype imagefile imagefile \"" + filePath + "\" Size 32";
                    CommonData.StkRoot.ExecuteCommand(cmd);
                }
                else
                {
                    CommonData.CurrentEvents[CommonData.EventSelectedIndex].SsrType = TypeSelect.Text;
                }
                ReadWrite.WriteEventFile(CommonData.EventFileStr);
                this.Close();
            }
        }