public PityTimer(PackTracker.History History, PityTimerRepository PityTimers) { InitializeComponent(); _pityTimers = PityTimers; dd_Packs.SelectionChanged += (sender, e) => { if (e.AddedItems.Count == 1) { Ep_Prev.DataContext = Ep_Label.DataContext = _pityTimers.GetPityTimer((int)e.AddedItems[0], Rarity.EPIC, false, true); Leg_Prev.DataContext = Leg_Label.DataContext = _pityTimers.GetPityTimer((int)e.AddedItems[0], Rarity.LEGENDARY, false, true); } }; Loaded += (sender, e) => dd_Packs.DataContext = History; }
public PityTimerOverlay(PackTracker.History History, PityTimerRepository PityTimers) { InitializeComponent(); DataContext = this; if (History.Count > 0) { _packId = History.Last().Id; Chart_Epic.DataContext = PityTimers.GetPityTimer((int)_packId, Rarity.EPIC, false, true); Chart_Leg.DataContext = PityTimers.GetPityTimer((int)_packId, Rarity.LEGENDARY, false, true); } History.CollectionChanged += (sender, e) => { foreach (Pack Pack in e.NewItems) { Chart_Epic.DataContext = PityTimers.GetPityTimer(Pack.Id, Rarity.EPIC, false, true); Chart_Leg.DataContext = PityTimers.GetPityTimer(Pack.Id, Rarity.LEGENDARY, false, true); _packId = Pack.Id; } OnPropertyChanged("PackId"); }; }