本文整理汇总了C#中Proxy.Close方法的典型用法代码示例。如果您正苦于以下问题:C# Proxy.Close方法的具体用法?C# Proxy.Close怎么用?C# Proxy.Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Proxy
的用法示例。
在下文中一共展示了Proxy.Close方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Stats
public Stats()
{
InitializeComponent();
if (!getWorlds())
{
string proxySaved = CnfLocalSettings.Instance.Proxy;
if (proxySaved == "" || !CanPing(proxySaved))
{
Proxy p = new Proxy();
if (p.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string proxy = p.Value;
p.Close();
p.Dispose();
if (CanPing(proxy))
{
CnfLocalSettings.Instance.Proxy = proxy;
optionalProxy = proxy;
if (!getWorlds())
{
MessageBox.Show(CnfLocalSettings.Instance.GetString("noProxy"));
this.Close();
}
}
else
{
MessageBox.Show(CnfLocalSettings.Instance.GetString("noProxy"));
this.Close();
}
}
}
else
{
optionalProxy = proxySaved;
if (!getWorlds())
{
MessageBox.Show(CnfLocalSettings.Instance.GetString("noProxy"));
this.Close();
}
}
}
}
示例2: Main
internal static void Main(string[] args)
{
Console.WriteLine("===CLIENT===");
Console.WriteLine("Waiting until server is running");
Thread.Sleep(3000);
Console.WriteLine("Client is trying to connect");
var callback = new ContractCallback();
var binding = new NetTcpBinding();
var client = new Proxy(callback, binding, new EndpointAddress(LocalSettings.URI));
var proxy = client.ChannelFactory.CreateChannel();
Console.WriteLine("Connection OPENED");
proxy.Foo();
client.Close();
Console.WriteLine("Connection CLOSED");
Console.WriteLine("DONE");
Console.Read();
}