Пример #1
0
        private async void SnipePokemon(ItemId pokebolaId, ItemId berryId)
        {
            if (!FieldErrorCheck("snipePokemon"))
            {
                return;
            }

            PokemonId pokemon;

            Enum.TryParse(Convert.ToString(gridPokemons.CurrentRow.Cells[cName.DisplayIndex].FormattedValue), true,
                          out pokemon);
            var cLatitudes  = Convert.ToDouble(gridPokemons.CurrentRow.Cells[cLatitude.DisplayIndex].FormattedValue);
            var cLongitudes = Convert.ToDouble(gridPokemons.CurrentRow.Cells[cLongitude.DisplayIndex].FormattedValue);

            SayLog.Info($"Capturando {pokemon} na localização {cLatitudes},{cLongitudes}. Aguarde!");
            try
            {
                if (await PogoCatchPokemon.CatchPokemon(pokemon, cLatitudes, cLongitudes, pokebolaId, berryId))
                {
                    UpdateLastPokemonCaught(false);
                }
            }
            catch (Exception e)
            {
                SayLog.Error(e.Message + e.StackTrace);
            }
        }
 private async void btnCapturar_Click(object sender, EventArgs e)
 {
     if (ContainsErrorFields())
     {
         return;
     }
     try
     {
         if (await PogoCatchPokemon.CatchPokemon(_pokemon, double.Parse(_textoFormatado[0]),
                                                 double.Parse(_textoFormatado[1]), ItemId.ItemUnknown, ItemId.ItemRazzBerry))
         {
             OnThresholdReached();
         }
     }
     catch (Exception error)
     {
         _sayLog.Error(error.Message + error.StackTrace);
     }
 }