Permalink
Browse files

- Fix.

  • Loading branch information...
1 parent 667e27a commit c567f9ffe57fed1bad908538af7c123a6374b2f8 TOM_RUS committed Jan 15, 2012
Showing with 93 additions and 9 deletions.
  1. +3 −0 WCPAPI/ApiClient.cs
  2. +63 −3 WowArenaLadder/MainForm.Designer.cs
  3. +27 −6 WowArenaLadder/MainForm.cs
View
3 WCPAPI/ApiClient.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Web;
namespace WCPAPI
{
@@ -39,6 +40,8 @@ public Item GetItem(int id, Locale? locale = null)
public ArenaLadder GetArenaLadder(string bg, string size, int count = 0, Locale? locale = null)
{
+ bg = HttpUtility.UrlEncode(bg);
+
if (count != 0)
{
var parameters = new Dictionary<string, string> { { "size", count.ToString() } };
View
66 WowArenaLadder/MainForm.Designer.cs
@@ -37,6 +37,11 @@ private void InitializeComponent()
this.v3ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.v5ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.battlegroupToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.regionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.eUToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.uSToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.tWToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.kRToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ladderView = new WowArenaLadder.ListViewEx();
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
@@ -78,7 +83,8 @@ private void InitializeComponent()
//
this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.teamSizeToolStripMenuItem,
- this.battlegroupToolStripMenuItem});
+ this.battlegroupToolStripMenuItem,
+ this.regionToolStripMenuItem});
this.editToolStripMenuItem.Name = "editToolStripMenuItem";
this.editToolStripMenuItem.Size = new System.Drawing.Size(39, 20);
this.editToolStripMenuItem.Text = "Edit";
@@ -90,7 +96,7 @@ private void InitializeComponent()
this.v3ToolStripMenuItem,
this.v5ToolStripMenuItem});
this.teamSizeToolStripMenuItem.Name = "teamSizeToolStripMenuItem";
- this.teamSizeToolStripMenuItem.Size = new System.Drawing.Size(136, 22);
+ this.teamSizeToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.teamSizeToolStripMenuItem.Text = "Team Size";
//
// v2ToolStripMenuItem
@@ -122,9 +128,58 @@ private void InitializeComponent()
// battlegroupToolStripMenuItem
//
this.battlegroupToolStripMenuItem.Name = "battlegroupToolStripMenuItem";
- this.battlegroupToolStripMenuItem.Size = new System.Drawing.Size(136, 22);
+ this.battlegroupToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.battlegroupToolStripMenuItem.Text = "Battlegroup";
//
+ // regionToolStripMenuItem
+ //
+ this.regionToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.eUToolStripMenuItem,
+ this.uSToolStripMenuItem,
+ this.tWToolStripMenuItem,
+ this.kRToolStripMenuItem});
+ this.regionToolStripMenuItem.Name = "regionToolStripMenuItem";
+ this.regionToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.regionToolStripMenuItem.Text = "Region";
+ //
+ // eUToolStripMenuItem
+ //
+ this.eUToolStripMenuItem.Checked = true;
+ this.eUToolStripMenuItem.CheckOnClick = true;
+ this.eUToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
+ this.eUToolStripMenuItem.Name = "eUToolStripMenuItem";
+ this.eUToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.eUToolStripMenuItem.Tag = "eu";
+ this.eUToolStripMenuItem.Text = "EU";
+ this.eUToolStripMenuItem.Click += new System.EventHandler(this.regionToolStripMenuItem_Click);
+ //
+ // uSToolStripMenuItem
+ //
+ this.uSToolStripMenuItem.CheckOnClick = true;
+ this.uSToolStripMenuItem.Name = "uSToolStripMenuItem";
+ this.uSToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.uSToolStripMenuItem.Tag = "us";
+ this.uSToolStripMenuItem.Text = "US";
+ this.uSToolStripMenuItem.Click += new System.EventHandler(this.regionToolStripMenuItem_Click);
+ //
+ // tWToolStripMenuItem
+ //
+ this.tWToolStripMenuItem.CheckOnClick = true;
+ this.tWToolStripMenuItem.Name = "tWToolStripMenuItem";
+ this.tWToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.tWToolStripMenuItem.Tag = "tw";
+ this.tWToolStripMenuItem.Text = "TW";
+ this.tWToolStripMenuItem.Click += new System.EventHandler(this.regionToolStripMenuItem_Click);
+ //
+ // kRToolStripMenuItem
+ //
+ this.kRToolStripMenuItem.CheckOnClick = true;
+ this.kRToolStripMenuItem.Name = "kRToolStripMenuItem";
+ this.kRToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.kRToolStripMenuItem.Tag = "kr";
+ this.kRToolStripMenuItem.Text = "KR";
+ this.kRToolStripMenuItem.Click += new System.EventHandler(this.regionToolStripMenuItem_Click);
+ //
// ladderView
//
this.ladderView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@@ -222,6 +277,11 @@ private void InitializeComponent()
private System.Windows.Forms.ColumnHeader columnHeader6;
private System.Windows.Forms.ColumnHeader columnHeader7;
private System.Windows.Forms.ToolStripMenuItem battlegroupToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem regionToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem eUToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem uSToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem tWToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem kRToolStripMenuItem;
}
}
View
33 WowArenaLadder/MainForm.cs
@@ -40,6 +40,8 @@ private void Form1_Load(object sender, EventArgs e)
private void QueryBGs()
{
+ battlegroupToolStripMenuItem.DropDownItems.Clear();
+
var bgs = m_client.GetBattlegroups().BGs;
if (bgs.Length == 0)
@@ -102,11 +104,13 @@ private ListViewItem CreateListViewItemFromTeam(ArenaTeam team)
private void teamSizeToolStripMenuItem_Click(object sender, EventArgs e)
{
- foreach (ToolStripMenuItem region in teamSizeToolStripMenuItem.DropDownItems)
- if (region != sender)
- region.Checked = false;
-
- m_size = (sender as ToolStripMenuItem).Text;
+ foreach (ToolStripMenuItem teamsize in teamSizeToolStripMenuItem.DropDownItems)
+ {
+ if (teamsize != sender)
+ teamsize.Checked = false;
+ else
+ m_size = teamsize.Text;
+ }
QueryData();
}
@@ -116,7 +120,10 @@ private void QueryData()
var ladder = m_client.GetArenaLadder(m_battlegroup, m_size, 2000);
if (ladder.ArenaTeams == null)
+ {
+ ladderView.Items.Clear();
return;
+ }
ladderView.BeginUpdate();
@@ -188,8 +195,22 @@ private void ladderView_MouseDoubleClick(object sender, MouseEventArgs e)
{
var team = item.Tag as ArenaTeam;
- Process.Start(String.Format("http://eu.battle.net/wow/en/arena/{0}/{1}v{1}/{2}/", team.Realm, team.TeamSize, team.Name));
+ Process.Start(String.Format("http://{0}.battle.net/wow/en/arena/{1}/{2}v{2}/{3}/", m_client.Region, team.Realm, team.TeamSize, team.Name));
+ }
+ }
+
+ private void regionToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ foreach (ToolStripMenuItem region in regionToolStripMenuItem.DropDownItems)
+ {
+ if (region != sender)
+ region.Checked = false;
+ else
+ m_client.Region = (string)region.Tag;
}
+
+ QueryBGs();
+ QueryData();
}
}
}

0 comments on commit c567f9f

Please sign in to comment.