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 static void RemoveTimelineComponent(GroundEvent currentGroundEvent) { IAgStkObject place = CommonData.StkRoot.GetObjectFromPath("Place/" + currentGroundEvent.Id); IAgCrdnEventIntervalGroup intervals = place.Vgt.EventIntervals; if (!intervals.Contains(currentGroundEvent.Id + "-Interval")) { return; } try { intervals.Remove(currentGroundEvent.Id + "-Interval"); } catch (Exception) { // ignored } }
public static void UpdateTimelineComponent(GroundEvent currentGroundEvent) { IAgStkObject place = CommonData.StkRoot.GetObjectFromPath("Place/" + currentGroundEvent.Id); IAgCrdnEventIntervalGroup intervals = place.Vgt.EventIntervals; IAgCrdnEventInterval interval; if (!place.Vgt.EventIntervals.Contains(currentGroundEvent.Id + "-Interval")) { interval = place.Vgt.EventIntervals.Factory.CreateEventIntervalFixed(currentGroundEvent.Id + "-Interval", ""); } else { interval = intervals[currentGroundEvent.Id + "-Interval"]; } IAgCrdnEventIntervalFixed fixedInterval = (IAgCrdnEventIntervalFixed)interval; fixedInterval.SetInterval(currentGroundEvent.StartTime, currentGroundEvent.StopTime); string cmd = "Timeline * TimeComponent Add ContentView \"Event_Timeline\" DisplayName \"" + currentGroundEvent.Id + "-Interval\"" + " \"Place/" + currentGroundEvent.Id + " " + currentGroundEvent.Id + "-Interval Interval\""; CommonData.StkRoot.ExecuteCommand(cmd); CommonData.StkRoot.ExecuteCommand("Timeline * Refresh"); }