private void OnInventoryUpdate(object sender, Core.Events.InventoryUpdatedEventArgs e) { Dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(() => { sEquippedAmmo ammo = Context.EquippedAmmo; sAmmo ammoInfo = Context.Ammos.ElementAtOrDefault(ammo.index); TotalAmmoCounter = ammo.ItemId == 137 ? double.PositiveInfinity : ammoInfo.Total; CalculateCrafting(ammo.ItemId); })); }
private void OnAmmoCountChange(object source, HeavyBowgunEventArgs args) { Dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(() => { sEquippedAmmo ammo = args.EquippedAmmo; sAmmo ammoInfo = args.Ammos.ElementAtOrDefault(ammo.index); AmmoText = $"{ammoInfo.Ammo}/{ammoInfo.Maximum}"; AmmoPercentage = (double)ammoInfo.Ammo / (double)ammoInfo.Maximum; TotalAmmoCounter = ammo.ItemId == 137 ? double.PositiveInfinity : ammoInfo.Total; CalculateCrafting(ammo.ItemId); })); }