Esempio n. 1
0
        private void Login()
        {
            try
            {
                Window1 LoginWin = new Window1();
                LoginWin.ShowDialog();
                username = LoginWin.GetName();

                //InstanceContext ins = new InstanceContext(this);
                //proxy = new QQProxy(ins);

                //IAsyncResult iar = proxy.BeginJoin(username, new AsyncCallback(OnEndJoin), null);

                AnnouncementService announcementService = new AnnouncementService();
                announcementService.OnlineAnnouncementReceived += (sender, e) =>
                {
                    string contractTypes = string.Empty;
                    ShowTextBox.AppendText("Receive Service Online Announcement.");
                    ShowTextBox.AppendText(string.Format("\tAddress: {0}", e.EndpointDiscoveryMetadata.Address.Uri));
                    ShowTextBox.AppendText(string.Format("\tContract: {0}", e.EndpointDiscoveryMetadata.ContractTypeNames[0]));
                };

                announcementService.OfflineAnnouncementReceived += (sender, e) =>
                {
                    string contractTypes = string.Empty;
                    ShowTextBox.AppendText("Receive Service Offline Announcement.");
                    ShowTextBox.AppendText(string.Format("\tAddress: {0}", e.EndpointDiscoveryMetadata.Address.Uri));
                    ShowTextBox.AppendText(string.Format("\tContract: {0}", e.EndpointDiscoveryMetadata.ContractTypeNames[0]));
                };

                using (ServiceHost host = new ServiceHost(announcementService))
                {
                    host.Open();
                    Console.Read();
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Esempio n. 2
0
 public void UserLeave(string name)
 {
     ShowTextBox.AppendText("User " + name + " --------exit---------" + DateTime.Now.ToString() + Environment.NewLine);
     FriendListListView.Items.Remove(name);
 }
Esempio n. 3
0
 public void ReceiveWhisper(string name, string message)
 {
     ShowTextBox.AppendText(DateTime.Now.ToString() + Environment.NewLine + "    " + name + " Whisper to you: " + Environment.NewLine);
     ShowTextBox.AppendText(message + Environment.NewLine);
 }
Esempio n. 4
0
 public void UserEnter(string name)
 {
     ShowTextBox.AppendText("User " + name + " --------login---------" + DateTime.Now.ToString() + Environment.NewLine);
     FriendListListView.Items.Add(name);
 }