本文整理匯總了C#中System.ServiceModel.InstanceContext.Open方法的典型用法代碼示例。如果您正苦於以下問題:C# InstanceContext.Open方法的具體用法?C# InstanceContext.Open怎麽用?C# InstanceContext.Open使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.ServiceModel.InstanceContext
的用法示例。
在下文中一共展示了InstanceContext.Open方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Form1
public Form1()
{
ServerCallback = new AnhCallback();
InitializeComponent();
ServerCallback.MessageReceived += new EventHandler<MessageEventArgs>(ServerCallback_MessageReceived);
ServerCallback.AvailableServerListReceived += new EventHandler<AvailableServerEventArgs>(ServerCallback_AvailableServerListReceived);
ServerCallback.StatusReceived += new EventHandler<ServerStatusEventArgs>(ServerCallback_StatusReceived);
ic = new InstanceContext(ServerCallback);
client = new AnhServiceClient(ic);
ic.Faulted += new EventHandler(ic_Faulted);
ic.Open();
Servers s = new Servers(ServerType.ConnectionServer, "");
comboBox1.Items.Add(s);
s = new Servers(ServerType.ChatServer, "");
comboBox1.Items.Add(s);
s = new Servers(ServerType.LoginServer, "");
comboBox1.Items.Add(s);
s = new Servers(ServerType.PingServer, "");
comboBox1.Items.Add(s);
s = new Servers(ServerType.ZoneServer, "tutorial");
comboBox1.Items.Add(s);
s = new Servers(ServerType.ZoneServer, "tatooine");
comboBox1.Items.Add(s);
comboBox1.SelectedIndex = 0;
}
示例2: ic_Faulted
void ic_Faulted(object sender, EventArgs e)
{
ic.Abort();
ic = new InstanceContext(ServerCallback);
ic.Open();
listBox1.Items.Add("Channel Fault repaired");
}
示例3: EnsureInstanceContextOpen
void EnsureInstanceContextOpen (InstanceContext ictx)
{
if (ictx.State != CommunicationState.Opened)
ictx.Open ();
}