本文整理汇总了C#中ApiClient.Disconnect方法的典型用法代码示例。如果您正苦于以下问题:C# ApiClient.Disconnect方法的具体用法?C# ApiClient.Disconnect怎么用?C# ApiClient.Disconnect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApiClient
的用法示例。
在下文中一共展示了ApiClient.Disconnect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Stop
// Stop the server
public void Stop()
{
// Stop the server and release resources
_closed = true;
try
{
_tcp.Server.Close();
_tcp.Stop();
}
catch (Exception)
{
if (Debugger.IsAttached) Debugger.Break();
}
try { _broadcaster.StopBroadcasting(); }
catch (Exception) { }
// Submit end game report
try
{
var c = new ApiClient();
var dcUsers = State.Instance.DcUsers.ToArray();
var req = new PutGameCompleteReq(State.Instance.Engine.ApiKey, State.Instance.Engine.Game.Id.ToString(), dcUsers);
c.CompleteGameHistory(req);
}
catch (Exception e)
{
Log.Error("Disconnect Error reporting disconnect", e);
}
// Close all open connections
foreach (var c in State.Instance.Clients)
{
try
{
c.Disconnect(false);
}
catch { }
}
State.Instance.RemoveAllClients();
try
{
if (OnStop != null)
OnStop.Invoke(this, null);
}
catch { }
}