/// <summary> /// Requests a Warcraft 3 profile. /// </summary> /// <param name="username">The name of the user to request.</param> /// <param name="getFrozenThroneProfile"><see langword="true" /> to get the Frozen Throne profile; /// <see langword="false" /> to get the Reign of Chaos profile.</param> public virtual void RequestWarcraft3Profile(string username, bool getFrozenThroneProfile) { Product pr = getFrozenThroneProfile ? Product.Warcraft3Expansion : Product.Warcraft3Retail; int cookie = Interlocked.Increment(ref m_curProfileCookie); BncsPacket pck = new BncsPacket((byte)BncsPacketId.Profile); pck.InsertInt32(cookie); pck.InsertCString(username); WarcraftProfileEventArgs args = new WarcraftProfileEventArgs(username, pr); m_warcraftProfileRequests.Add(cookie, args); Send(pck); }
public WarcraftProfileDisplayDocument(WarcraftProfileEventArgs args) : this(args.Profile) { this.name.Text = args.Username; this.homepage.Text = args.Profile.Location; if (args.Clan != null) { foreach (var rec in args.Clan.LadderRecords) { this.clanStats.Controls.Add(new RecordDisplay(rec)); } this.clanName.Text = string.Format(CultureInfo.CurrentUICulture, "{0} ({1})", args.Clan.ClanName, args.Profile.ClanTag); this.clanRecords.BindToStats(args.Clan.RaceRecords); this.clanRank.Text = args.Clan.Rank.ToString(); this.personalStats.IsExpansion = (args.Product == Product.Warcraft3Expansion); this.clanRecords.IsExpansion = personalStats.IsExpansion; } else { clanName.Text = ""; } }
void Client_WarcraftProfileReceived(object sender, WarcraftProfileEventArgs e) { if (__warcraftProfileReceived != null) __warcraftProfileReceived.Call(_host.ClientHost, ConvObj(e)); }
/// <summary> /// Raises the WarcraftProfileReceived event. /// </summary> /// <remarks> /// <para>Only high-priority events are invoked immediately; others are deferred. For more information, see <see>WarcraftProfileReceived</see>.</para> /// </remarks> /// <param name="e">The event arguments.</param> /// <seealso cref="WarcraftProfileReceived" /> protected virtual void OnWarcraftProfileReceived(WarcraftProfileEventArgs e) { foreach (WarcraftProfileEventHandler eh in __WarcraftProfileReceived[Priority.High]) { try { eh(this, e); } catch (Exception ex) { ReportException( ex, new KeyValuePair<string, object>("delegate", eh), new KeyValuePair<string, object>("Event", "WarcraftProfileReceived"), new KeyValuePair<string, object>("param: priority", Priority.High), new KeyValuePair<string, object>("param: this", this), new KeyValuePair<string, object>("param: e", e) ); } } ThreadPool.QueueUserWorkItem((WaitCallback)delegate { foreach (WarcraftProfileEventHandler eh in __WarcraftProfileReceived[Priority.Normal]) { try { eh(this, e); } catch (Exception ex) { ReportException( ex, new KeyValuePair<string, object>("delegate", eh), new KeyValuePair<string, object>("Event", "WarcraftProfileReceived"), new KeyValuePair<string, object>("param: priority", Priority.Normal), new KeyValuePair<string, object>("param: this", this), new KeyValuePair<string, object>("param: e", e) ); } } ThreadPool.QueueUserWorkItem((WaitCallback)delegate { foreach (WarcraftProfileEventHandler eh in __WarcraftProfileReceived[Priority.Low]) { try { eh(this, e); } catch (Exception ex) { ReportException( ex, new KeyValuePair<string, object>("delegate", eh), new KeyValuePair<string, object>("Event", "WarcraftProfileReceived"), new KeyValuePair<string, object>("param: priority", Priority.Low), new KeyValuePair<string, object>("param: this", this), new KeyValuePair<string, object>("param: e", e) ); } } FreeArgumentResources(e as BaseEventArgs); }); }); }
public void OnWarcraftProfileReceived(WarcraftProfileEventArgs e) { m_host.OnWarcraftProfileReceived(e); }
private void WarcraftProfileReceived(object sender, WarcraftProfileEventArgs e) { ThreadStart ts = delegate { WarcraftProfileDisplayDocument doc = new WarcraftProfileDisplayDocument(e); doc.ShowDialog(this); }; if (InvokeRequired) BeginInvoke(ts); else ts(); }