public DecoratorService(IEquipmentProvider equipmentProvider, IAwardProvider awardProvider, IHeroProvider heroProvider) { this._equipmentProvider = equipmentProvider; this._awardProvider = awardProvider; this._heroProvider = heroProvider; }
public ReportsViewModel(IDialogService dialogService, IEquipmentProvider equipmentProvider, IAwardProvider awardProvider, IHeroProvider heroProvider) : base(2, dialogService) { this._equipmentProvider = equipmentProvider; this._awardProvider = awardProvider; this._heroProvider = heroProvider; DisplayName = ScreenName; }
/// <summary> /// Initializes a new instance of the <see cref="ReportDecorator" /> class. /// </summary> /// <param name="report">The <see cref="Report" /> this decorater wraps.</param> /// <param name="unit">The <see cref="Unit" /> the report is for.</param> /// <param name="equipmentProvider">The equipment provider.</param> /// <param name="awardProvider">The award provider.</param> /// <param name="heroProvider">The hero provider.</param> /// <exception cref="ArgumentNullException"><paramref name="report" /> or <paramref name="unit" /> is a null reference.</exception> public ReportDecorator(Report report, Unit unit, IEquipmentProvider equipmentProvider, IAwardProvider awardProvider, IHeroProvider heroProvider) { Contract.Requires <ArgumentNullException>(report != null); Contract.Requires <ArgumentException>(report.Equipment != null); Contract.Requires <ArgumentException>(report.LandTransport != null); Contract.Requires <ArgumentNullException>(unit != null); // Copy data from undecorated report. ScenarioName = report.ScenarioName; // Find the correct land transport. if (report.LandTransportId < 0 || (report.LandTransport.Equals(Equipment.None.ShortName))) { LandTransport = equipmentProvider.Find(report.LandTransport, unit.Nationality, UnitType.LandTransport); } else { LandTransport = equipmentProvider.Find(report.LandTransportId); } // Find the correct equipment. if (report.EquipmentId < 0 || (report.Equipment.Equals(Equipment.None.ShortName))) { Equipment = equipmentProvider.Find(report.Equipment, unit.Nationality, unit.Type); } else { Equipment = equipmentProvider.Find(report.EquipmentId); } Award highestAward = awardProvider.Find(report.HighestAward); HighestAward = new KeyValuePair <string, Award>(highestAward.DisplayName, highestAward); Experience = report.Experience; Kills = report.Kills; Losses = report.Losses; Hero firstHero = heroProvider.Find(report.FirstHero); Hero secondHero = heroProvider.Find(report.SecondHero); Hero thirdHero = heroProvider.Find(report.ThirdHero); FirstHero = new KeyValuePair <string, Hero>(firstHero.DisplayName, firstHero); SecondHero = new KeyValuePair <string, Hero>(secondHero.DisplayName, secondHero); ThirdHero = new KeyValuePair <string, Hero>(thirdHero.DisplayName, thirdHero); }