private async void BtnDrop_Click(object sender, RoutedEventArgs e) { var itemId = (ItemId)((Button)sender).CommandParameter; var data = DataContext as ItemsListViewModel; ItemsViewModel Item = data.Get(itemId); switch (Item.ItemId) { case ItemId.ItemLuckyEgg: { if (MessageBox.Show($"Do you want to use {Item.ItemId}", "Use item", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { //data.Drop(Item); await UseLuckyEggTask.Execute(Session); } } break; case ItemId.ItemIncenseOrdinary: { if (MessageBox.Show($"Do you want to use {Item.ItemId}", "Use item", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { //data.Drop(Item); await UseIncenseTask.Execute(Session); } } break; case ItemId.ItemMoveRerollFastAttack: Logger.Write($"{Item.ItemId} Can not be used for the moment, the bot still does not completely generate this process.", LogLevel.Warning); break; case ItemId.ItemMoveRerollSpecialAttack: Logger.Write($"{Item.ItemId} Can not be used for the moment, the bot still does not completely generate this process.", LogLevel.Warning); break; case ItemId.ItemRareCandy: Logger.Write($"{Item.ItemId} Can not be used for the moment, the bot still does not completely generate this process.", LogLevel.Warning); break; default: { if (MessageBox.Show($"Do you want to drop {Item.ItemCount - Item.SelectedValue} {Item.ItemId}", "Drop item", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { data.Drop(Item); await RecycleItemsTask.DropItem(Session, Item.ItemId, Item.ItemCount - Item.SelectedValue); } } break; } }
private async void ItemBox_ItemClick(object sender, EventArgs e) { var item = (ItemData)sender; using (var form = new ItemForm(item)) { var result = form.ShowDialog(); if (result != DialogResult.OK) { return; } SetState(false); switch (item.ItemId) { case ItemId.ItemLuckyEgg: { if (_session.Client == null) { Logger.Write($"Bot must be running first!", LogLevel.Warning); SetState(true); return; } await UseLuckyEggTask.Execute(_session); } break; case ItemId.ItemIncenseOrdinary: { if (_session.Client == null) { Logger.Write($"Bot must be running first!", LogLevel.Error); SetState(true); return; } await UseIncenseTask.Execute(_session); } break; default: { await RecycleSpecificItemTask.Execute(_session, item.ItemId, decimal.ToInt32(form.numCount.Value)); } break; } await ReloadPokemonList(); } }
private void btnDrop_Click(object sender, RoutedEventArgs e) { var itemId = (ItemId)((Button)sender).CommandParameter; var data = this.DataContext as ItemsListViewModel; ItemsViewModel Item = data.Get(itemId); switch (Item.ItemId) { case ItemId.ItemLuckyEgg: { if (MessageBox.Show($"Do you want to use {Item.ItemId}", "Use item", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { data.Drop(Item); Task.Run(async() => { await UseLuckyEggTask.Execute(Session); }); } } break; case ItemId.ItemIncenseOrdinary: { if (MessageBox.Show($"Do you want to use {Item.ItemId}", "Use item", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { data.Drop(Item); Task.Run(async() => { await UseIncenseTask.Execute(Session); }); } } break; default: { if (MessageBox.Show($"Do you want to drop {Item.ItemCount - Item.SelectedValue} {Item.ItemId}", "Drop item", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { data.Drop(Item); Task.Run(async() => { await RecycleItemsTask.DropItem(Session, Item.ItemId, Item.ItemCount - Item.SelectedValue); }); } } break; } }