Beispiel #1
0
        private void PopulateSubObjects()
        {
            imageList1.Images.Clear();
            string msg = null;

            foreach (var item in CommonData.Preferences.EventImageLocations)
            {
                try
                {
                    imageList1.Images.Add(Image.FromFile(item));
                }
                catch (Exception)
                {
                    msg = msg + item + "\n";
                }
            }
            if (msg != null)
            {
                MessageBox.Show(msg);
            }
            if (CommonData.CurrentEvents[CommonData.EventSelectedIndex].SubObjects.Count > 0)
            {
                foreach (var subObject in CommonData.CurrentEvents[CommonData.EventSelectedIndex].SubObjects)
                {
                    int index = GroundEventFunctions.GetSubObjectImageIndex(subObject);

                    var listItem = new ListViewItem();
                    listItem.ImageIndex       = index;
                    listItem.SubItems[0].Text = subObject.Name;
                    SubObjectList.Items.Add(listItem);
                }
            }
        }
        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();
        }
        private void PopulateSsRs()
        {
            CommonData.EventFileStr = CommonData.DirectoryStr + "\\" + "CurrentSSRs.txt";
            List <GroundEvent> fileSections = new List <GroundEvent>();

            if (File.Exists(CommonData.DirectoryStr + "\\" + "CurrentSSRs.txt"))
            {
                fileSections = ReadWrite.ReadEventFile(CommonData.EventFileStr);
            }
            imageList1.Images.Clear();
            foreach (var item in CommonData.Preferences.EventImageLocations)
            {
                try
                {
                    imageList1.Images.Add(Image.FromFile(item));
                }
                catch (Exception)
                {
                }
            }
            ListSSR.SmallImageList = imageList1;
            foreach (var item in fileSections)
            {
                if (item != null)
                {
                    CommonData.CurrentEvents.Add(item);
                    try
                    {
                        GroundEventFunctions.CreateGroundEvent(item);
                        //SSRList.Items.Add(item.ID);
                        var listItem = new ListViewItem();
                        int index    = GroundEventFunctions.GetImageIndex(item);
                        if (index != -1)
                        {
                            listItem.ImageIndex = index;
                        }
                        listItem.SubItems[0].Text = item.Id;
                        ListSSR.Items.Add(listItem);

                        if (item.SubObjects.Count > 0)
                        {
                            foreach (var subObject in item.SubObjects)
                            {
                                GroundEventFunctions.CreateSubObject(item, subObject);
                            }
                        }
                    }
                    catch (Exception)
                    {
                        string mes = "Could not load SSR: " + item.Id;
                        MessageBox.Show(mes);
                    }
                }
            }
        }
        private void NewSSR_Click(object sender, EventArgs e)
        {
            int oGnumSsr   = CommonData.CurrentEvents.Count;
            int startIndex = oGnumSsr;

            if (oGnumSsr == 0)
            {
                startIndex = 0;
            }
            CommonData.NewSsrCreated = false;
            NewGroundEventForm form = new NewGroundEventForm();

            form.ShowDialog();
            if (CommonData.NewSsrCreated == true)
            {
                imageList1.Images.Clear();
                foreach (var item in CommonData.Preferences.EventImageLocations)
                {
                    try
                    {
                        imageList1.Images.Add(Image.FromFile(item));
                    }
                    catch (Exception)
                    {
                    }
                }
                ListSSR.SmallImageList = imageList1;

                for (int j = 0; j < oGnumSsr; j++)
                {
                    int index = GroundEventFunctions.GetImageIndex(CommonData.CurrentEvents[j]);
                    if (index != -1)
                    {
                        ListSSR.Items[j].ImageIndex = index;
                    }
                }

                int newCount = CommonData.CurrentEvents.Count;
                if (newCount != oGnumSsr)
                {
                    for (int i = startIndex; i < newCount; i++)
                    {
                        var listItem = new ListViewItem();
                        int index    = GroundEventFunctions.GetImageIndex(CommonData.CurrentEvents[i]);
                        if (index != -1)
                        {
                            listItem.ImageIndex = index;
                        }
                        listItem.SubItems[0].Text = CommonData.CurrentEvents[i].Id;
                        ListSSR.Items.Add(listItem);
                    }
                }
            }
        }
        public GroundEventsPlugin()
        {
            InitializeComponent();
            CommonData.CurrentEvents = new List <GroundEvent>();
            CommonData.Preferences.SensorGraphicsDisplay = true;
            GroundEventFunctions.CreateTimeLineView();
            PopulateSsRs();
            string cmd = "VO * Declutter Enable On";

            CommonData.StkRoot.ExecuteCommand(cmd);
        }
        private void EditSSR_Click(object sender, EventArgs e)
        {
            if (ListSSR.SelectedItems != null && ListSSR.SelectedItems.Count > 0)
            {
                try
                {
                    IAgStkObject place = CommonData.StkRoot.GetObjectFromPath("Place/" + CommonData.CurrentEvents[CommonData.EventSelectedIndex].Id);
                    IAgCrdnEventIntervalGroup intervals = place.Vgt.EventIntervals;
                    intervals.Remove(CommonData.CurrentEvents[CommonData.EventSelectedIndex].Id + "-Interval");
                }
                catch (Exception)
                {
                }

                EditForm form = new EditForm();
                form.ShowDialog();
                imageList1.Images.Clear();
                foreach (var item in CommonData.Preferences.EventImageLocations)
                {
                    try
                    {
                        imageList1.Images.Add(Image.FromFile(item));
                    }
                    catch (Exception)
                    {
                    }
                }
                ListSSR.SmallImageList = imageList1;
                //var listItem = new ListViewItem();
                int index = GroundEventFunctions.GetImageIndex(CommonData.CurrentEvents[CommonData.EventSelectedIndex]);
                //listItem.ImageIndex = index;
                //listItem.SubItems[0].Text = CommonData.CurrentSSRs[CommonData.SSRSelectedIndex].ID;
                if (index != -1)
                {
                    ListSSR.Items[CommonData.EventSelectedIndex].ImageIndex = index;
                }
                ListSSR.Items[CommonData.EventSelectedIndex].SubItems[0].Text = CommonData.CurrentEvents[CommonData.EventSelectedIndex].Id;
                if (CommonData.CurrentEvents[CommonData.EventSelectedIndex].StartTime == "Unspecified" || CommonData.CurrentEvents[CommonData.EventSelectedIndex].StopTime == "Unspecified")
                {
                }
                else
                {
                    GroundEventFunctions.UpdateTimelineComponent(CommonData.CurrentEvents[CommonData.EventSelectedIndex]);
                }
                string details = ReadWrite.WriteDetails();
                SSRDetails.Text = details;
            }
        }
        private void Add_Click(object sender, EventArgs e)
        {
            SubObjectList.SmallImageList = imageList1;
            SubObject newSub = new SubObject();

            newSub.Type = "Unknown";
            if (CommonData.CurrentEvents[CommonData.EventSelectedIndex].SubObjects.Count != 0)
            {
                newSub.Name = "SubObject" + CommonData.CurrentEvents[CommonData.EventSelectedIndex].SubObjects.Count.ToString();
            }
            else
            {
                newSub.Name = "SubObject";
            }
            //Assign default values to class
            newSub.Latitude  = CommonData.CurrentEvents[CommonData.EventSelectedIndex].Latitude;
            newSub.Longitude = CommonData.CurrentEvents[CommonData.EventSelectedIndex].Longitude;
            newSub.ZoomLevel = "1000";
            CommonData.CurrentEvents[CommonData.EventSelectedIndex].SubObjects.Add(newSub);
            int index = GroundEventFunctions.GetSubObjectImageIndex(newSub);

            var listItem = new ListViewItem();

            listItem.ImageIndex       = index;
            listItem.SubItems[0].Text = newSub.Name;
            SubObjectList.Items.Add(listItem);
            SubObjectList.FocusedItem = listItem;
            CommonData.SubObjectIndex = SubObjectList.Items.Count - 1;

            SubObjectType.Enabled  = true;
            ZoomLevel.Enabled      = true;
            LatitudeValue.Enabled  = true;
            LongitudeValue.Enabled = true;
            NameValue.Enabled      = true;

            //Assign GUI values
            SubObjectType.SelectedIndex = 0;
            ZoomLevel.SelectedIndex     = 1;
            LongitudeValue.Text         = CommonData.CurrentEvents[CommonData.EventSelectedIndex].Longitude.ToString();
            LatitudeValue.Text          = CommonData.CurrentEvents[CommonData.EventSelectedIndex].Latitude.ToString();
            NameValue.Text = newSub.Name;

            //Create sub-object and change color to match higher level object
            GroundEventFunctions.CreateSubObject(CommonData.CurrentEvents[CommonData.EventSelectedIndex], newSub);
            CreatorFunctions.ChangeObjectColor("Place/" + CommonData.CurrentEvents[CommonData.EventSelectedIndex].Id + "-" + newSub.Name, (CustomUserInterface.ColorOptions)Enum.Parse(typeof(CustomUserInterface.ColorOptions), CommonData.CurrentEvents[CommonData.EventSelectedIndex].ColorOption));
        }
Beispiel #8
0
        private void Add_Click(object sender, EventArgs e)
        {
            SubObjectList.SmallImageList = imageList1;
            SubObject newSub = new SubObject();

            newSub.Type = "Unknown";
            if (CommonData.CurrentEvents[CommonData.EventSelectedIndex].SubObjects.Count != 0)
            {
                newSub.Name = "SubObject" + CommonData.CurrentEvents[CommonData.EventSelectedIndex].SubObjects.Count.ToString();
            }
            else
            {
                newSub.Name = "SubObject";
            }
            //Assign default values to class
            newSub.Latitude  = CommonData.CurrentEvents[CommonData.EventSelectedIndex].Latitude;
            newSub.Longitude = CommonData.CurrentEvents[CommonData.EventSelectedIndex].Longitude;
            newSub.ZoomLevel = "1000";
            CommonData.CurrentEvents[CommonData.EventSelectedIndex].SubObjects.Add(newSub);
            int index = GroundEventFunctions.GetSubObjectImageIndex(newSub);

            var listItem = new ListViewItem();

            listItem.ImageIndex       = index;
            listItem.SubItems[0].Text = newSub.Name;
            SubObjectList.Items.Add(listItem);
            SubObjectList.FocusedItem = listItem;
            CommonData.SubObjectIndex = SubObjectList.Items.Count - 1;

            SubObjectType.Enabled  = true;
            ZoomLevel.Enabled      = true;
            LatitudeValue.Enabled  = true;
            LongitudeValue.Enabled = true;
            NameValue.Enabled      = true;

            //Assign GUI values
            SubObjectType.SelectedIndex = 0;
            ZoomLevel.SelectedIndex     = 1;
            LongitudeValue.Text         = CommonData.CurrentEvents[CommonData.EventSelectedIndex].Longitude.ToString();
            LatitudeValue.Text          = CommonData.CurrentEvents[CommonData.EventSelectedIndex].Latitude.ToString();
            NameValue.Text = newSub.Name;

            //Create sub-object
            GroundEventFunctions.CreateSubObject(CommonData.CurrentEvents[CommonData.EventSelectedIndex], newSub);
        }
Beispiel #9
0
        private void SubObjectList_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (SubObjectList.SelectedItems != null && SubObjectList.SelectedItems.Count > 0)
            {
                CommonData.SubObjectIndex = SubObjectList.FocusedItem.Index;
                if (SubObjectList.FocusedItem.Index != -1 && SubObjectList.FocusedItem != null)
                {
                    SubObjectType.SelectedIndex = GroundEventFunctions.GetSubObjectImageIndex(CommonData.CurrentEvents[CommonData.EventSelectedIndex].SubObjects[CommonData.SubObjectIndex]);
                    ZoomLevel.SelectedIndex     = GetIndexFromZoom();
                    LongitudeValue.Text         = CommonData.CurrentEvents[CommonData.EventSelectedIndex].SubObjects[CommonData.SubObjectIndex].Longitude;
                    LatitudeValue.Text          = CommonData.CurrentEvents[CommonData.EventSelectedIndex].SubObjects[CommonData.SubObjectIndex].Latitude;
                    NameValue.Text = CommonData.CurrentEvents[CommonData.EventSelectedIndex].SubObjects[CommonData.SubObjectIndex].Name;

                    SubObjectType.Enabled  = true;
                    ZoomLevel.Enabled      = true;
                    LatitudeValue.Enabled  = true;
                    LongitudeValue.Enabled = true;
                    NameValue.Enabled      = true;
                }
            }
        }
Beispiel #10
0
        public EditForm()
        {
            InitializeComponent();

            IDText.Text        = CommonData.CurrentEvents[CommonData.EventSelectedIndex].Id;
            CountryText.Text   = CommonData.CurrentEvents[CommonData.EventSelectedIndex].Country;
            Latitude.Text      = CommonData.CurrentEvents[CommonData.EventSelectedIndex].Latitude;
            Longitude.Text     = CommonData.CurrentEvents[CommonData.EventSelectedIndex].Longitude;
            StartTimeText.Text = CommonData.CurrentEvents[CommonData.EventSelectedIndex].StartTime;
            StopTimeText.Text  = CommonData.CurrentEvents[CommonData.EventSelectedIndex].StopTime;
            //Populate description if not null
            if (CommonData.CurrentEvents[CommonData.EventSelectedIndex].Description != null)
            {
                DesciptionText.Text = CommonData.CurrentEvents[CommonData.EventSelectedIndex].Description;
            }
            //Select correct index for Type ComboBox
            foreach (var type in CommonData.Preferences.EventTypeList)
            {
                TypeSelect.Items.Add(type);
            }
            int index = GroundEventFunctions.GetImageIndex(CommonData.CurrentEvents[CommonData.EventSelectedIndex]);

            TypeSelect.SelectedIndex = index;
        }
Beispiel #11
0
        private void Apply_Click(object sender, EventArgs e)
        {
            int fieldCheck = FieldCheck();

            if (fieldCheck == 0)
            {
                //Assign new data
                string placeName = CommonData.CurrentEvents[CommonData.EventSelectedIndex].Id + "-" + CommonData.CurrentEvents[CommonData.EventSelectedIndex].SubObjects[CommonData.SubObjectIndex].Name;

                string path        = "*/Place/" + placeName;
                string currentType = CommonData.CurrentEvents[CommonData.EventSelectedIndex].SubObjects[CommonData.SubObjectIndex].Type;
                SubObjectList.SmallImageList = imageList1;

                CommonData.CurrentEvents[CommonData.EventSelectedIndex].SubObjects[CommonData.SubObjectIndex].Latitude  = LatitudeValue.Text;
                CommonData.CurrentEvents[CommonData.EventSelectedIndex].SubObjects[CommonData.SubObjectIndex].Longitude = LongitudeValue.Text;
                CommonData.CurrentEvents[CommonData.EventSelectedIndex].SubObjects[CommonData.SubObjectIndex].Name      = NameValue.Text;
                CommonData.CurrentEvents[CommonData.EventSelectedIndex].SubObjects[CommonData.SubObjectIndex].ZoomLevel = GetZoomLevelFromIndex();
                CommonData.CurrentEvents[CommonData.EventSelectedIndex].SubObjects[CommonData.SubObjectIndex].Type      = SubObjectType.Text;
                //Set interface values
                int index = GroundEventFunctions.GetSubObjectImageIndex(CommonData.CurrentEvents[CommonData.EventSelectedIndex].SubObjects[CommonData.SubObjectIndex]);
                SubObjectList.Items[CommonData.SubObjectIndex].ImageIndex       = index;
                SubObjectList.Items[CommonData.SubObjectIndex].SubItems[0].Text = NameValue.Text;
                SubObjectList.Refresh();
                //Rename STK object
                string cmd;
                try
                {
                    cmd = "Rename " + path + " " + CommonData.CurrentEvents[CommonData.EventSelectedIndex].Id + "-" + NameValue.Text;
                    CommonData.StkRoot.ExecuteCommand(cmd);
                }
                catch (Exception)
                {
                    //MessageBox.Show("Error renaming object");
                }

                //Reassign position. Check is for when the renaming is not successful
                placeName = CommonData.CurrentEvents[CommonData.EventSelectedIndex].Id + "-" + CommonData.CurrentEvents[CommonData.EventSelectedIndex].SubObjects[CommonData.SubObjectIndex].Name;
                path      = "Place/" + placeName;
                if (CommonData.StkRoot.ObjectExists(path))
                {
                    IAgPlace place = CommonData.StkRoot.GetObjectFromPath(path) as IAgPlace;
                    place.Position.AssignGeodetic(Double.Parse(LatitudeValue.Text), Double.Parse(LongitudeValue.Text), 0);
                }

                //Change object marker if type changed
                if (currentType != SubObjectType.Text)
                {
                    string filePath = GroundEventFunctions.GetImagePath(CommonData.CurrentEvents[CommonData.EventSelectedIndex].SubObjects[CommonData.SubObjectIndex].Type);
                    try
                    {
                        cmd = "VO */Place/" + placeName + " marker show on markertype imagefile imagefile \"" + filePath + "\" Size 32";
                        CommonData.StkRoot.ExecuteCommand(cmd);
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    CommonData.CurrentEvents[CommonData.EventSelectedIndex].SubObjects[CommonData.SubObjectIndex].Type = SubObjectType.Text;
                }
                //Apply zoom level
                string zoom = CommonData.CurrentEvents[CommonData.EventSelectedIndex].SubObjects[CommonData.SubObjectIndex].ZoomLevel + "000";
                try
                {
                    cmd = "VO */Place/" + placeName + " ModelDetail Set ModelLabel " + zoom + " MarkerLabel " + zoom + " Marker " + zoom + " Point " + zoom;
                    CommonData.StkRoot.ExecuteCommand(cmd);
                }
                catch (Exception)
                {
                    string mes = "Could not Modify Zoom for SubObject";
                    MessageBox.Show(mes);
                }
                //Rewrite output file to reflect changes
                ReadWrite.WriteEventFile(CommonData.EventFileStr);
            }
        }
Beispiel #12
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();
        }
Beispiel #13
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();
            }
        }