Esempio n. 1
0
        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;
        }
Esempio n. 2
0
 void ic_Faulted(object sender, EventArgs e)
 {
     ic.Abort();
     ic = new InstanceContext(ServerCallback);
     ic.Open();
     listBox1.Items.Add("Channel Fault repaired");
 }
		void EnsureInstanceContextOpen (InstanceContext ictx)
		{
			if (ictx.State != CommunicationState.Opened)
				ictx.Open ();
		}