本文整理汇总了C#中Client.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Client.Equals方法的具体用法?C# Client.Equals怎么用?C# Client.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Client
的用法示例。
在下文中一共展示了Client.Equals方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Contains
/// <summary>
/// Extending the Contains method
/// </summary>
/// <param name="list"></param>
/// <param name="client"></param>
/// <returns></returns>
public bool Contains(Client client)
{
bool contains = false;
foreach (Client c1 in Tamers)
if (client.Equals(c1))
{
contains = true;
break;
}
return contains;
}
示例2: GetListViewItemByClient
/// <summary>
/// Gets the Listview item which belongs to the client.
/// </summary>
/// <param name="c">The client to get the Listview item of.</param>
/// <returns>Listview item of the client.</returns>
private ListViewItem GetListViewItemByClient(Client c)
{
ListViewItem itemClient = null;
lstClients.Invoke((MethodInvoker) delegate
{
itemClient = lstClients.Items.Cast<ListViewItem>()
.FirstOrDefault(lvi => lvi != null && lvi.Tag is Client && c.Equals((Client)lvi.Tag));
});
return itemClient;
}
示例3: RemoveClientFromListview
/// <summary>
/// Removes a connected client from the Listview.
/// </summary>
/// <param name="c">The client to remove.</param>
public void RemoveClientFromListview(Client c)
{
try
{
lstClients.Invoke((MethodInvoker) delegate
{
lock (_lockClients)
{
foreach (ListViewItem lvi in lstClients.Items.Cast<ListViewItem>()
.Where(lvi => lvi != null && (lvi.Tag as Client) != null && c.Equals((Client) lvi.Tag)))
{
lvi.Remove();
ConServer.ConnectedAndAuthenticatedClients--;
break;
}
}
});
UpdateWindowTitle();
}
catch (InvalidOperationException)
{
}
}
示例4: RemoveClientFromListview
/// <summary>
/// Removes a connected client from the Listview.
/// </summary>
/// <param name="client">The client to remove.</param>
private void RemoveClientFromListview(Client client)
{
if (client == null) return;
try
{
lstClients.Invoke((MethodInvoker) delegate
{
lock (_lockClients)
{
foreach (ListViewItem lvi in lstClients.Items.Cast<ListViewItem>()
.Where(lvi => lvi != null && client.Equals(lvi.Tag)))
{
lvi.Remove();
break;
}
}
});
UpdateWindowTitle();
}
catch (InvalidOperationException)
{
}
}
示例5: GetListViewItemByClient
/// <summary>
/// Gets the Listview item which belongs to the client.
/// </summary>
/// <param name="client">The client to get the Listview item of.</param>
/// <returns>Listview item of the client.</returns>
private ListViewItem GetListViewItemByClient(Client client)
{
if (client == null) return null;
ListViewItem itemClient = null;
lstClients.Invoke((MethodInvoker) delegate
{
itemClient = lstClients.Items.Cast<ListViewItem>()
.FirstOrDefault(lvi => lvi != null && client.Equals(lvi.Tag));
});
return itemClient;
}
示例6: onAnswer
private void onAnswer(Client client)
{
string[] kpc = client.flush();
if (!this.playing)
{
client.sendMsg("X\n"); // DAMEDESU
client.NowState = Client.State.Neet;
return;
}
client.sendMsg("O\n"); // OK
client.NowState = Client.State.WORKING;
// 反映処理
client.Board.reset();
bool flg = true;
for (int i=0; (flg && i<kpc.Length); i++)
{
if (kpc[i] == "")
continue;
string[] tmp = kpc[i].Split(' ');
flg = client.Board.place(this.problem.Stones[i], (tmp[0] == "H"), int.Parse(tmp[1]), int.Parse(tmp[2]), int.Parse(tmp[3]));
}
if (!flg)
{
clientEvent("もう許さねぇからな?", client.Name);
return;
}
client.Board.Time = DateTime.Now - this.stime;
client.Board.Pass = true;
clientEvent("バァン!(回答)", client.Name);
if (this.best != null && !client.Equals(this.best) && !(client.CompareTo(this.best) < 0))
return;
this.best = client;
// 送信処理
this.tmpclient = client;
this.tmpans = kpc;
if (this.timer.Enabled)
{
this.timer.Stop();
}
this.timer.Interval = 2000;
this.timer.Start();
//postAnswerAsync(client, kpc);
}