コード例 #1
0
 void DisconnectUser()
 {
     if (isConnected)
     {
         client.Disconnect(ID);
         client             = null;
         tbPCName.IsEnabled = true;
         btnConnect.Content = "Connect";
         isConnected        = false;
     }
 }
コード例 #2
0
        void ConnectUser()
        {
            if (!isConnected)
            {
                client             = new ServiceManager.ServiceManagerClient(new System.ServiceModel.InstanceContext(this));
                ID                 = client.Connect(tbPCName.Text);
                tbPCName.IsEnabled = false;
                btnConnect.Content = "Disconnect";
                isConnected        = true;

                serviceMessages = new List <ServiceData>();
                scServices      = ServiceController.GetServices();
                client.SendMsg("Подключен к серверу ", ID);
                client.SendServices(ServiceData.ParseServiceControllerToMessage(scServices), ID);
            }
        }