Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- Fix.

  • Loading branch information...
commit 7fade3ed6c48e55bfad5fc57e08df9f9de0adc3e 1 parent 333140d
TOM_RUS authored
View
124 WowArenaLadder/FilterForm.Designer.cs
@@ -0,0 +1,124 @@
+namespace WowArenaLadder
+{
+ partial class FilterForm
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.label1 = new System.Windows.Forms.Label();
+ this.textBox1 = new System.Windows.Forms.TextBox();
+ this.button1 = new System.Windows.Forms.Button();
+ this.label2 = new System.Windows.Forms.Label();
+ this.comboBox1 = new System.Windows.Forms.ComboBox();
+ this.checkBox1 = new System.Windows.Forms.CheckBox();
+ this.SuspendLayout();
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(12, 9);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(64, 13);
+ this.label1.TabIndex = 0;
+ this.label1.Text = "Min. Rating:";
+ //
+ // textBox1
+ //
+ this.textBox1.Location = new System.Drawing.Point(82, 6);
+ this.textBox1.Name = "textBox1";
+ this.textBox1.Size = new System.Drawing.Size(121, 20);
+ this.textBox1.TabIndex = 1;
+ //
+ // button1
+ //
+ this.button1.Location = new System.Drawing.Point(82, 207);
+ this.button1.Name = "button1";
+ this.button1.Size = new System.Drawing.Size(75, 23);
+ this.button1.TabIndex = 2;
+ this.button1.Text = "Apply";
+ this.button1.UseVisualStyleBackColor = true;
+ this.button1.Click += new System.EventHandler(this.button1_Click);
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(12, 35);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(40, 13);
+ this.label2.TabIndex = 3;
+ this.label2.Text = "Realm:";
+ //
+ // comboBox1
+ //
+ this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.comboBox1.FormattingEnabled = true;
+ this.comboBox1.Location = new System.Drawing.Point(82, 32);
+ this.comboBox1.Name = "comboBox1";
+ this.comboBox1.Size = new System.Drawing.Size(121, 21);
+ this.comboBox1.Sorted = true;
+ this.comboBox1.TabIndex = 4;
+ //
+ // checkBox1
+ //
+ this.checkBox1.AutoSize = true;
+ this.checkBox1.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
+ this.checkBox1.Location = new System.Drawing.Point(12, 59);
+ this.checkBox1.Name = "checkBox1";
+ this.checkBox1.Size = new System.Drawing.Size(113, 17);
+ this.checkBox1.TabIndex = 5;
+ this.checkBox1.Text = "Incomplete Teams";
+ this.checkBox1.UseVisualStyleBackColor = true;
+ //
+ // FilterForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(230, 242);
+ this.Controls.Add(this.checkBox1);
+ this.Controls.Add(this.comboBox1);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.button1);
+ this.Controls.Add(this.textBox1);
+ this.Controls.Add(this.label1);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
+ this.Name = "FilterForm";
+ this.Text = "Filter";
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FilterForm_FormClosing);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.TextBox textBox1;
+ private System.Windows.Forms.Button button1;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.ComboBox comboBox1;
+ private System.Windows.Forms.CheckBox checkBox1;
+ }
+}
View
47 WowArenaLadder/FilterForm.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Linq;
+using System.Windows.Forms;
+using WCPAPI;
+
+namespace WowArenaLadder
+{
+ public partial class FilterForm : Form
+ {
+ public FilterForm()
+ {
+ InitializeComponent();
+ }
+
+ private void button1_Click(object sender, EventArgs e)
+ {
+ MainForm mf = Owner as MainForm;
+
+ int minRating;
+
+ int.TryParse(textBox1.Text, out minRating);
+
+ mf.ApplyFilter(minRating, (string)comboBox1.SelectedItem, checkBox1.Checked);
+ }
+
+ private void FilterForm_FormClosing(object sender, FormClosingEventArgs e)
+ {
+ if (e.CloseReason != CloseReason.UserClosing)
+ return;
+
+ e.Cancel = true;
+ Hide();
+ }
+
+ public void FillComboBox(ArenaLadder ladder)
+ {
+ if (ladder.ArenaTeams == null)
+ return;
+
+ var realms = ladder.ArenaTeams.Select(team => team.Realm).Distinct().ToArray();
+
+ comboBox1.Items.Clear();
+ comboBox1.Items.Insert(0, "");
+ comboBox1.Items.AddRange(realms);
+ }
+ }
+}
View
120 WowArenaLadder/FilterForm.resx
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
View
38 WowArenaLadder/MainForm.Designer.cs
@@ -1,6 +1,6 @@
namespace WowArenaLadder
{
- partial class Form1
+ partial class MainForm
{
/// <summary>
/// Required designer variable.
@@ -50,6 +50,8 @@ private void InitializeComponent()
this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader6 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader7 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.filterToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
@@ -57,7 +59,8 @@ private void InitializeComponent()
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem,
- this.editToolStripMenuItem});
+ this.editToolStripMenuItem,
+ this.viewToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(678, 24);
@@ -104,21 +107,21 @@ private void InitializeComponent()
this.v2ToolStripMenuItem.Checked = true;
this.v2ToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.v2ToolStripMenuItem.Name = "v2ToolStripMenuItem";
- this.v2ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.v2ToolStripMenuItem.Size = new System.Drawing.Size(92, 22);
this.v2ToolStripMenuItem.Text = "2v2";
this.v2ToolStripMenuItem.Click += new System.EventHandler(this.teamSizeToolStripMenuItem_Click);
//
// v3ToolStripMenuItem
//
this.v3ToolStripMenuItem.Name = "v3ToolStripMenuItem";
- this.v3ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.v3ToolStripMenuItem.Size = new System.Drawing.Size(92, 22);
this.v3ToolStripMenuItem.Text = "3v3";
this.v3ToolStripMenuItem.Click += new System.EventHandler(this.teamSizeToolStripMenuItem_Click);
//
// v5ToolStripMenuItem
//
this.v5ToolStripMenuItem.Name = "v5ToolStripMenuItem";
- this.v5ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.v5ToolStripMenuItem.Size = new System.Drawing.Size(92, 22);
this.v5ToolStripMenuItem.Text = "5v5";
this.v5ToolStripMenuItem.Click += new System.EventHandler(this.teamSizeToolStripMenuItem_Click);
//
@@ -144,7 +147,7 @@ private void InitializeComponent()
this.eUToolStripMenuItem.Checked = true;
this.eUToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.eUToolStripMenuItem.Name = "eUToolStripMenuItem";
- this.eUToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.eUToolStripMenuItem.Size = new System.Drawing.Size(92, 22);
this.eUToolStripMenuItem.Tag = "eu";
this.eUToolStripMenuItem.Text = "EU";
this.eUToolStripMenuItem.Click += new System.EventHandler(this.regionToolStripMenuItem_Click);
@@ -152,7 +155,7 @@ private void InitializeComponent()
// uSToolStripMenuItem
//
this.uSToolStripMenuItem.Name = "uSToolStripMenuItem";
- this.uSToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.uSToolStripMenuItem.Size = new System.Drawing.Size(92, 22);
this.uSToolStripMenuItem.Tag = "us";
this.uSToolStripMenuItem.Text = "US";
this.uSToolStripMenuItem.Click += new System.EventHandler(this.regionToolStripMenuItem_Click);
@@ -160,7 +163,7 @@ private void InitializeComponent()
// tWToolStripMenuItem
//
this.tWToolStripMenuItem.Name = "tWToolStripMenuItem";
- this.tWToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.tWToolStripMenuItem.Size = new System.Drawing.Size(92, 22);
this.tWToolStripMenuItem.Tag = "tw";
this.tWToolStripMenuItem.Text = "TW";
this.tWToolStripMenuItem.Click += new System.EventHandler(this.regionToolStripMenuItem_Click);
@@ -168,7 +171,7 @@ private void InitializeComponent()
// kRToolStripMenuItem
//
this.kRToolStripMenuItem.Name = "kRToolStripMenuItem";
- this.kRToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.kRToolStripMenuItem.Size = new System.Drawing.Size(92, 22);
this.kRToolStripMenuItem.Tag = "kr";
this.kRToolStripMenuItem.Text = "KR";
this.kRToolStripMenuItem.Click += new System.EventHandler(this.regionToolStripMenuItem_Click);
@@ -233,6 +236,21 @@ private void InitializeComponent()
//
this.columnHeader7.Text = "Rating";
//
+ // viewToolStripMenuItem
+ //
+ this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.filterToolStripMenuItem});
+ this.viewToolStripMenuItem.Name = "viewToolStripMenuItem";
+ this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
+ this.viewToolStripMenuItem.Text = "View";
+ //
+ // filterToolStripMenuItem
+ //
+ this.filterToolStripMenuItem.Name = "filterToolStripMenuItem";
+ this.filterToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.filterToolStripMenuItem.Text = "Filter";
+ this.filterToolStripMenuItem.Click += new System.EventHandler(this.filterToolStripMenuItem_Click);
+ //
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -275,6 +293,8 @@ private void InitializeComponent()
private System.Windows.Forms.ToolStripMenuItem uSToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem tWToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem kRToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem viewToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem filterToolStripMenuItem;
}
}
View
49 WowArenaLadder/MainForm.cs
@@ -8,14 +8,17 @@
namespace WowArenaLadder
{
- public partial class Form1 : Form
+ public partial class MainForm : Form
{
private ListViewColumnSorter columnSorter;
private ApiClient m_client;
- private string m_battlegroup;
+ private string m_battlegroupSlug;
+ private string m_battlegroupName;
private string m_size = "2v2";
+ private FilterForm m_filterForm = new FilterForm();
+ public ArenaLadder Ladder { get; private set; }
- public Form1()
+ public MainForm()
{
InitializeComponent();
@@ -51,7 +54,8 @@ private void QueryBGs()
return;
}
- m_battlegroup = bgs[0].Slug;
+ m_battlegroupSlug = bgs[0].Slug;
+ m_battlegroupName = bgs[0].Name;
foreach (var bg in bgs)
{
@@ -72,7 +76,8 @@ void bgToolStripItem_Click(object sender, EventArgs e)
else
{
bg.Checked = true;
- m_battlegroup = (string)bg.Tag;
+ m_battlegroupSlug = (string)bg.Tag;
+ m_battlegroupName = (string)bg.Text;
}
}
@@ -122,11 +127,14 @@ private void teamSizeToolStripMenuItem_Click(object sender, EventArgs e)
private void QueryData()
{
- var ladder = m_client.GetArenaLadder(m_battlegroup, m_size, 2000);
+ Ladder = m_client.GetArenaLadder(m_battlegroupSlug, m_size, 2000);
- if (ladder.ArenaTeams == null)
+ m_filterForm.FillComboBox(Ladder);
+
+ if (Ladder.ArenaTeams == null)
{
ladderView.Items.Clear();
+ Text = String.Format("WoW Arena Ladder - {0}-{1}: 0 of 0 teams displayed", m_battlegroupName, m_client.Region.ToUpper());
return;
}
@@ -134,10 +142,12 @@ private void QueryData()
ladderView.Items.Clear();
- foreach (var team in ladder.ArenaTeams)
+ foreach (var team in Ladder.ArenaTeams)
ladderView.Items.Add(CreateListViewItemFromTeam(team));
ladderView.EndUpdate();
+
+ Text = String.Format("WoW Arena Ladder -{0}-{1}: {2} of {3} teams displayed", m_battlegroupName, m_client.Region.ToUpper(), ladderView.Items.Count, Ladder.ArenaTeams.Length);
}
private void ladderView_DrawColumnHeader(object sender, DrawListViewColumnHeaderEventArgs e)
@@ -220,5 +230,28 @@ private void regionToolStripMenuItem_Click(object sender, EventArgs e)
QueryBGs();
QueryData();
}
+
+ private void filterToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ m_filterForm.Show(this);
+ }
+
+ public void ApplyFilter(int minRating, string realm, bool incomplete)
+ {
+ if (Ladder.ArenaTeams == null)
+ return;
+
+ ladderView.BeginUpdate();
+
+ ladderView.Items.Clear();
+
+ foreach (var team in Ladder.ArenaTeams)
+ if (team.Rating >= minRating && (string.IsNullOrEmpty(realm) || team.Realm == realm) && (!incomplete || team.Members.Length >= team.TeamSize))
+ ladderView.Items.Add(CreateListViewItemFromTeam(team));
+
+ ladderView.EndUpdate();
+
+ Text = String.Format("WoW Arena Ladder - {0}-{1}: {2} of {3} teams displayed", m_battlegroupName, m_client.Region.ToUpper(), ladderView.Items.Count, Ladder.ArenaTeams.Length);
+ }
}
}
View
2  WowArenaLadder/Program.cs
@@ -15,7 +15,7 @@ static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
- Application.Run(new Form1());
+ Application.Run(new MainForm());
}
}
}
View
9 WowArenaLadder/WowArenaLadder.csproj
@@ -48,6 +48,12 @@
</ItemGroup>
<ItemGroup>
<Compile Include="ColumnSorter.cs" />
+ <Compile Include="FilterForm.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="FilterForm.Designer.cs">
+ <DependentUpon>FilterForm.cs</DependentUpon>
+ </Compile>
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
@@ -59,6 +65,9 @@
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
+ <EmbeddedResource Include="FilterForm.resx">
+ <DependentUpon>FilterForm.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
Please sign in to comment.
Something went wrong with that request. Please try again.