public void AddWantedSystem(string sysName) { if (wanted == null) { PopulateLocalWantedSystems(); } else { // there can be multiple instances tied to the history form so this might already exist... List <WantedSystemClass> dbCheck = WantedSystemClass.GetAllWantedSystems(); if (dbCheck != null && dbCheck.Where(s => s.system == sysName).Any()) // if we have wanted systems in the DB... and its there.. { return; } } WantedSystemClass entry = wanted.Where(x => x.system == sysName).FirstOrDefault(); //duplicate? if (entry == null) { WantedSystemClass toAdd = new WantedSystemClass(sysName); // make one.. toAdd.Add(); // add to db. wanted.Add(toAdd); ISystem star = SystemCache.FindSystem(sysName); if (star == null) { star = new SystemClass(sysName); } var index = dataGridViewClosestSystems.Rows.Add("Local"); dataGridViewClosestSystems[1, index].Value = sysName; dataGridViewClosestSystems[1, index].Tag = star; } }
private void PopulateLocalWantedSystems() { wanted = WantedSystemClass.GetAllWantedSystems(); if (wanted != null && wanted.Any()) { foreach (WantedSystemClass sys in wanted) { SystemClass star = SystemClassDB.GetSystem(sys.system); if (star == null) { star = new SystemClassDB(sys.system); } var index = dataGridViewClosestSystems.Rows.Add("Local"); dataGridViewClosestSystems[1, index].Value = sys.system; dataGridViewClosestSystems[1, index].Tag = star; } } else { wanted = new List <WantedSystemClass>(); } }
private void PopulateLocalWantedSystems() { wanted = WantedSystemClass.GetAllWantedSystems(); if (wanted != null && wanted.Any()) { foreach (WantedSystemClass sys in wanted) { ISystem star = discoveryform.history.FindSystem(sys.system, discoveryform.galacticMapping, false); if (star == null) { star = new SystemClass(sys.system); } var index = dataGridViewClosestSystems.Rows.Add("Local"); dataGridViewClosestSystems[1, index].Value = sys.system; dataGridViewClosestSystems[1, index].Tag = star; } } else { wanted = new List <WantedSystemClass>(); } }