diff --git a/PokemonGo/RocketAPI/Window/PokeUi.Designer.cs b/PokemonGo/RocketAPI/Window/PokeUi.Designer.cs
index fbf9fac..e47c24b 100644
--- a/PokemonGo/RocketAPI/Window/PokeUi.Designer.cs
+++ b/PokemonGo/RocketAPI/Window/PokeUi.Designer.cs
@@ -28,94 +28,104 @@
/// </summary>
private void InitializeComponent()
{
- this.components = new System.ComponentModel.Container();
- System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PokeUi));
- this.listView1 = new System.Windows.Forms.ListView();
- this.button1 = new System.Windows.Forms.Button();
- this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
- this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
- this.label1 = new System.Windows.Forms.Label();
- this.lblPokemonsCount = new System.Windows.Forms.Label();
- this.contextMenuStrip1.SuspendLayout();
- this.SuspendLayout();
- //
- // listView1
- //
- this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
+ this.components = new System.ComponentModel.Container();
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PokeUi));
+ this.listView1 = new System.Windows.Forms.ListView();
+ this.button1 = new System.Windows.Forms.Button();
+ this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
+ this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+ this.button2 = new System.Windows.Forms.Button();
+ this.button3 = new System.Windows.Forms.Button();
+ this.contextMenuStrip1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // listView1
+ //
+ this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
- this.listView1.Location = new System.Drawing.Point(16, 50);
- this.listView1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
- this.listView1.Name = "listView1";
- this.listView1.Size = new System.Drawing.Size(547, 418);
- this.listView1.TabIndex = 0;
- this.listView1.UseCompatibleStateImageBehavior = false;
- this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
- this.listView1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.listView1_MouseClick);
- //
- // button1
- //
- this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ this.listView1.Location = new System.Drawing.Point(18, 18);
+ this.listView1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
+ this.listView1.Name = "listView1";
+ this.listView1.Size = new System.Drawing.Size(614, 521);
+ this.listView1.TabIndex = 0;
+ this.listView1.UseCompatibleStateImageBehavior = false;
+ this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
+ this.listView1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.listView1_MouseClick);
+ //
+ // button1
+ //
+ this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
- this.button1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
- this.button1.Location = new System.Drawing.Point(16, 476);
- this.button1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(548, 32);
- this.button1.TabIndex = 3;
- this.button1.Text = "Reload";
- this.button1.UseVisualStyleBackColor = true;
- this.button1.Click += new System.EventHandler(this.button1_Click);
- //
- // contextMenuStrip1
- //
- this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
- this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.button1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.button1.Location = new System.Drawing.Point(17, 566);
+ this.button1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
+ this.button1.Name = "button1";
+ this.button1.Size = new System.Drawing.Size(616, 40);
+ this.button1.TabIndex = 3;
+ this.button1.Text = "Reload";
+ this.button1.UseVisualStyleBackColor = true;
+ this.button1.Click += new System.EventHandler(this.button1_Click);
+ //
+ // contextMenuStrip1
+ //
+ this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
+ this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItem1});
- this.contextMenuStrip1.Name = "contextMenuStrip1";
- this.contextMenuStrip1.Size = new System.Drawing.Size(131, 28);
- //
- // toolStripMenuItem1
- //
- this.toolStripMenuItem1.Name = "toolStripMenuItem1";
- this.toolStripMenuItem1.Size = new System.Drawing.Size(130, 24);
- this.toolStripMenuItem1.Text = "Transfer";
- this.toolStripMenuItem1.Click += new System.EventHandler(this.toolStripMenuItem1_Click);
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(13, 19);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(75, 17);
- this.label1.TabIndex = 4;
- this.label1.Text = "Pokemon: ";
- //
- // lblPokemonsCount
- //
- this.lblPokemonsCount.AutoSize = true;
- this.lblPokemonsCount.Location = new System.Drawing.Point(90, 19);
- this.lblPokemonsCount.Name = "lblPokemonsCount";
- this.lblPokemonsCount.Size = new System.Drawing.Size(0, 17);
- this.lblPokemonsCount.TabIndex = 5;
- //
- // PokeUi
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(580, 514);
- this.Controls.Add(this.lblPokemonsCount);
- this.Controls.Add(this.label1);
- this.Controls.Add(this.button1);
- this.Controls.Add(this.listView1);
- this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
- this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
- this.Name = "PokeUi";
- this.Text = "PokeUi";
- this.Load += new System.EventHandler(this.PokeUi_Load);
- this.contextMenuStrip1.ResumeLayout(false);
- this.ResumeLayout(false);
- this.PerformLayout();
+ this.contextMenuStrip1.Name = "contextMenuStrip1";
+ this.contextMenuStrip1.Size = new System.Drawing.Size(159, 34);
+ //
+ // toolStripMenuItem1
+ //
+ this.toolStripMenuItem1.Name = "toolStripMenuItem1";
+ this.toolStripMenuItem1.Size = new System.Drawing.Size(158, 30);
+ this.toolStripMenuItem1.Text = "Transfer";
+ this.toolStripMenuItem1.Click += new System.EventHandler(this.toolStripMenuItem1_Click);
+ //
+ // button2
+ //
+ this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.button2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.button2.Location = new System.Drawing.Point(16, 616);
+ this.button2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
+ this.button2.Name = "button2";
+ this.button2.Size = new System.Drawing.Size(616, 40);
+ this.button2.TabIndex = 4;
+ this.button2.Text = "Evolve Selected";
+ this.button2.UseVisualStyleBackColor = true;
+ this.button2.Click += new System.EventHandler(this.button2_Click);
+ //
+ // button3
+ //
+ this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.button3.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.button3.Location = new System.Drawing.Point(17, 666);
+ this.button3.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
+ this.button3.Name = "button3";
+ this.button3.Size = new System.Drawing.Size(616, 40);
+ this.button3.TabIndex = 5;
+ this.button3.Text = "Transfer Selected";
+ this.button3.UseVisualStyleBackColor = true;
+ this.button3.Click += new System.EventHandler(this.button3_Click);
+ //
+ // PokeUi
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(652, 731);
+ this.Controls.Add(this.button3);
+ this.Controls.Add(this.button2);
+ this.Controls.Add(this.button1);
+ this.Controls.Add(this.listView1);
+ this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
+ this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
+ this.Name = "PokeUi";
+ this.Text = "PokeUi";
+ this.Load += new System.EventHandler(this.PokeUi_Load);
+ this.contextMenuStrip1.ResumeLayout(false);
+ this.ResumeLayout(false);
}
@@ -125,7 +135,7 @@
private System.Windows.Forms.Button button1;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.Label lblPokemonsCount;
- }
+ private System.Windows.Forms.Button button2;
+ private System.Windows.Forms.Button button3;
+ }
}
\ No newline at end of file
diff --git a/PokemonGo/RocketAPI/Window/PokeUi.cs b/PokemonGo/RocketAPI/Window/PokeUi.cs
index 523b3b0..41e68b3 100644
--- a/PokemonGo/RocketAPI/Window/PokeUi.cs
+++ b/PokemonGo/RocketAPI/Window/PokeUi.cs
@@ -16,7 +16,7 @@ namespace PokemonGo.RocketAPI.Window
{
public partial class PokeUi : Form
{
- private Client client;
+ private static Client client;
public PokeUi()
{
InitializeComponent();
@@ -33,6 +33,8 @@ namespace PokemonGo.RocketAPI.Window
private async void Execute()
{
button1.Enabled = false;
+ button2.Enabled = false;
+ button3.Enabled = false;
client = new Client(ClientSettings);
@@ -61,9 +63,9 @@ namespace PokemonGo.RocketAPI.Window
.OrderByDescending(p => (int)p.FamilyId);
- lblPokemonsCount.Text = pokemons.Count().ToString();
- var imageList = new ImageList { ImageSize = new Size(50, 50) };
+
+ var imageList = new ImageList { ImageSize = new Size(50, 50) };
listView1.ShowItemToolTips = true;
foreach (var pokemon in pokemons)
@@ -88,6 +90,9 @@ namespace PokemonGo.RocketAPI.Window
//listViewItem.SubItems.Add();
listViewItem.ImageKey = pokemon.PokemonId.ToString();
+ var pokemonId2 = pokemon.PokemonId;
+ var pokemonName = pokemon.Id;
+
listViewItem.Text = string.Format("{0}\n{1} CP", pokemon.PokemonId, pokemon.Cp);
listViewItem.ToolTipText = currentCandy + " Candy\n" + currIv + "% IV";
@@ -97,6 +102,8 @@ namespace PokemonGo.RocketAPI.Window
}
button1.Enabled = true;
+ button2.Enabled = true;
+ button3.Enabled = true;
}
catch (TaskCanceledException) { Execute(); }
@@ -162,5 +169,93 @@ namespace PokemonGo.RocketAPI.Window
}
listView1.Items.Remove(listView1.SelectedItems[0]);
}
+
+ private async void button2_Click(object sender, EventArgs e)
+ {
+ var selectedItems = this.listView1.SelectedItems;
+
+ foreach (ListViewItem selectedItem in selectedItems)
+ {
+ await evolvePokemon((PokemonData)selectedItem.Tag);
+ }
+
+ this.listView1.Clear();
+ Execute();
+ }
+
+ private async void button3_Click(object sender, EventArgs e)
+ {
+ var selectedItems = this.listView1.SelectedItems;
+
+ foreach (ListViewItem selectedItem in selectedItems)
+ {
+ await transferPokemon((PokemonData)selectedItem.Tag);
+ }
+
+ this.listView1.Clear();
+ Execute();
+ }
+
+ private static async Task evolvePokemon(PokemonData pokemon)
+ {
+ try
+ {
+ var evolvePokemonResponse = await client.EvolvePokemon(pokemon.Id);
+ string message = "";
+ string caption = "";
+ MessageBoxButtons buttons = MessageBoxButtons.OK;
+ DialogResult result;
+
+ if (evolvePokemonResponse.Result == 1)
+ {
+ message = $"{pokemon.PokemonId} successfully evolved into {evolvePokemonResponse.EvolvedPokemon.PokemonType}\n{evolvePokemonResponse.ExpAwarded} experience awarded\n{evolvePokemonResponse.CandyAwarded} candy awarded";
+ caption = $"{pokemon.PokemonId} evolved into {evolvePokemonResponse.EvolvedPokemon.PokemonType}";
+ }
+ else
+ {
+ message = $"{pokemon.PokemonId} could not be evolved";
+ caption = $"Evolve {pokemon.PokemonId} failed";
+ }
+
+ result = MessageBox.Show(message, caption, buttons, MessageBoxIcon.Information);
+ }
+ catch (TaskCanceledException) { await evolvePokemon(pokemon); }
+ catch (UriFormatException) { await evolvePokemon(pokemon); }
+ catch (ArgumentOutOfRangeException) { await evolvePokemon(pokemon); }
+ catch (ArgumentNullException) { await evolvePokemon(pokemon); }
+ catch (NullReferenceException) { await evolvePokemon(pokemon); }
+ catch (Exception ex) { await evolvePokemon(pokemon); }
+ }
+
+ private static async Task transferPokemon(PokemonData pokemon)
+ {
+ try
+ {
+ var transferPokemonResponse = await client.TransferPokemon(pokemon.Id);
+ string message = "";
+ string caption = "";
+ MessageBoxButtons buttons = MessageBoxButtons.OK;
+ DialogResult result;
+
+ if (transferPokemonResponse.Status == 1)
+ {
+ message = $"{pokemon.PokemonId} was transferred\n{transferPokemonResponse.CandyAwarded} candy awarded";
+ caption = $"{pokemon.PokemonId} transferred";
+ }
+ else
+ {
+ message = $"{pokemon.PokemonId} could not be transferred";
+ caption = $"Transfer {pokemon.PokemonId} failed";
+ }
+
+ result = MessageBox.Show(message, caption, buttons, MessageBoxIcon.Information);
+ }
+ catch (TaskCanceledException) { await transferPokemon(pokemon); }
+ catch (UriFormatException) { await transferPokemon(pokemon); }
+ catch (ArgumentOutOfRangeException) { await transferPokemon(pokemon); }
+ catch (ArgumentNullException) { await transferPokemon(pokemon); }
+ catch (NullReferenceException) { await transferPokemon(pokemon); }
+ catch (Exception ex) { await transferPokemon(pokemon); }
+ }
}
}
\ No newline at end of file
You may download the files in Public Git.