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); } } } }
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; } }
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; }