Esempio n. 1
0
        private void BT_ImportTLE_Click(object sender, EventArgs e)
        {
            ImportTLE     IT           = new ImportTLE();
            List <string> errorVessels = new List <string>();

            if (IT.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            string[] content = IT.TLEData.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < content.Length; i += 3)
            {
                string tname  = content[i + 0].Trim();
                string strTle = tname + '\n';
                strTle += content[i + 1] + '\n';
                strTle += content[i + 2];

                ListViewItem lvi = LV_Ships.Items.Add(tname);
                try
                {
                    OrbVessel OV = new OrbVessel("ShuttlePB", strTle.Split('\n'));
                    lvi.SubItems.Add(OV.Name);
                    lvi.SubItems.Add(OV.VesselClass);
                    lvi.SubItems.Add(strTle);
                    lvi.Tag     = OV;
                    lvi.Checked = true;
                } catch (Exception ex)
                {
                    Log.Write(string.Format("[ERROR] Could not add '{0}':", tname));
                    Log.WriteError(ex);
                    errorVessels.Add(tname);
                    lvi.Remove();
                }
            }

            MessageBox.Show("These entries could not be added:\n" + string.Join("\n", errorVessels.ToArray())
                            + "\n\nPlease check the logs.", "Error importing TLE", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
Esempio n. 2
0
 public OrbVesselContext(Dictionary <string, object> data, string[] tle, OrbVessel Vessel)
 {
     _vesselData = data;
     _tle        = tle;
     _vessel     = Vessel;
 }