void Refresh() { try { Engines.Clear(); foreach (var item in new EnginesRequest().Response.Engines.Data.Select(d => new Item() { Name = d["title"], Value = d["name"], Data = d })) { Engines.Add(item); } Markets.Clear(); Securities.Clear(); Boards.Clear(); Info = ""; History = new List <HistoryObject>(); FirePropertyChanged(nameof(Info)); FirePropertyChanged(nameof(History)); } catch (Exception e) { MessageBox.Show(e.Message, "Error"); } }
/// <summary> /// Clears the value of the given property. /// </summary> /// <param name="propertyName">The name of the property whose value to clear.</param> public void ClearPropertyValue(string propertyName) { switch (propertyName) { case nameof(Size): Size = Sizes.NotDefined; break; case nameof(Engines): Engines.Clear(); break; case nameof(Weapons): Weapons.Clear(); break; case nameof(Crew): Crew = CrewTypes.NotDefined; break; case nameof(Name): Name = string.Empty; break; } }
private void GetEngines() { using (var unitOfWork = new UnitOfWork()) { if (!Engines.Any()) { Engines.Clear(); Engines.Add(new Engine() { engine_designation = "" }); Engines.AddRange(unitOfWork.EngineRepository.GetAll()); } engineBindingSource.DataSource = Engines; } }