Пример #1
0
        private void radioButton2_CheckedChanged(object sender, System.EventArgs e)
        {
            if (radioButton2.Checked)
            {
                lbllist.Text = "List of Service";
                lblname.Text = "Service Name";
                lbltype.Text = "Service Type";

                serviceStatusTextBox.Visible = true;
                lblstatus.Visible            = true;
                if (clientListBox.SelectedIndex >= 0)
                {
                    //clientInfo client = (clientInfo) clientInformation[clientListBox.SelectedIndex];
                    //serviceListBox.DataSource = client.ServiceList;
                    //serviceListBox.DisplayMember = "DisplayName";
                    serviceListBox.Items.Clear();
                    IEnumerator en = selectedClient.ServiceList.GetEnumerator();

                    while (en.MoveNext())
                    {
                        ServiceObject serviceObject = (ServiceObject)en.Current;
                        serviceListBox.Items.Add(serviceObject.DisplayName);
                    }
                }
            }
        }
Пример #2
0
        private void clientListBox_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            selectedClient          = (clientInfo)clientInformation[clientListBox.SelectedIndex];
            machineNameTextBox.Text = selectedClient.MachineName;
            userNameTextBox.Text    = selectedClient.UserName;
            ipAddressTextBox.Text   = selectedClient.IpAddress;
            portTextBox.Text        = selectedClient.PortNumber.ToString();
            protocolTextBox.Text    = selectedClient.ConnectedSocket.ProtocolType.ToString();

            if (radioButton1.Checked)
            {
                serviceListBox.Items.Clear();
                IEnumerator en = selectedClient.ProcessList.GetEnumerator();

                while (en.MoveNext())
                {
                    ProcessObject processObject = (ProcessObject)en.Current;
                    serviceListBox.Items.Add(processObject.ProcessName);
                }
            }
            else if (radioButton2.Checked)
            {
                serviceListBox.Items.Clear();
                IEnumerator en = selectedClient.ServiceList.GetEnumerator();

                while (en.MoveNext())
                {
                    ServiceObject serviceObject = (ServiceObject)en.Current;
                    serviceListBox.Items.Add(serviceObject.DisplayName);
                }
            }
        }
Пример #3
0
        public void getServiceList()
        {
            string servicelist = "<command type=\"Service_List\">";

            servicelist += "</command>$";


            byte[] buffer = new byte[3000];
            buffer = Encoding.ASCII.GetBytes(servicelist);
            connectedSocket.Send(buffer);


            connectedSocket.Receive(buffer);
            string s = Encoding.ASCII.GetString(buffer);

            while (connectedSocket.Available > 0)
            {
                connectedSocket.Receive(buffer);
                s += Encoding.ASCII.GetString(buffer);
            }

            string resultXML = s.Substring(0, s.IndexOf('$'));

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(resultXML);

            XmlNode node = doc.FirstChild;

            if (node.Attributes.GetNamedItem("type").Value == "Service_List")
            {
                XmlNodeList nodeList = node.ChildNodes;
                IEnumerator en       = nodeList.GetEnumerator();

                while (en.MoveNext())
                {
                    XmlNode       childNode     = (XmlNode)en.Current;
                    string        sname         = childNode.Attributes.GetNamedItem("name").Value;
                    string        stype         = childNode.Attributes.GetNamedItem("type").Value;
                    string        sstatus       = childNode.Attributes.GetNamedItem("status").Value;
                    ServiceObject serviceObject = new ServiceObject(sname, stype, sstatus);
                    serviceList.Add(serviceObject);
                }
            }
            else
            {
                throw new Exception("Wrong Packet Recieved");
            }
        }
Пример #4
0
        private void serviceListBox_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            //clientInfo client = (clientInfo) clientInformation[clientListBox.SelectedIndex];

            if (radioButton1.Checked)
            {
                selectedProcess         = (ProcessObject)selectedClient.ProcessList[serviceListBox.SelectedIndex];
                serviceNameTextBox.Text = selectedProcess.ProcessName;
                serviceTypeTextBox.Text = selectedProcess.ProcessStartTime;
            }
            else
            {
                //MessageBox.Show("Hello World");
                selectedService           = (ServiceObject)selectedClient.ServiceList [serviceListBox.SelectedIndex];
                serviceNameTextBox.Text   = selectedService.DisplayName;
                serviceTypeTextBox.Text   = selectedService.ServiceType;
                serviceStatusTextBox.Text = selectedService.Status;
            }
        }