Beispiel #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtServiceType.Text))
            {
                return;
            }
            if (string.IsNullOrEmpty(txtName.Text))
            {
                return;
            }
            if (string.IsNullOrEmpty(txtLocation.Text))
            {
                return;
            }

            var s = new Discovery.SSDP.Service();

            s.ServiceType = txtServiceType.Text;
            if (txtName.Text == "uuid:")
            {
                s.UniqueServiceName = "uuid:" + Guid.NewGuid().ToString();
            }
            else
            {
                s.UniqueServiceName = txtName.Text;
            }
            s.Location = txtLocation.Text;

            _agent.Services.Add(s);
            lbServices.Items.Add(s.ServiceType);

            txtServiceType.Text = null;
            txtName.Text        = null;
            txtLocation.Text    = null;
        }
Beispiel #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtServiceType.Text))
                return;
            if (string.IsNullOrEmpty(txtName.Text))
                return;
            if (string.IsNullOrEmpty(txtLocation.Text))
                return;

            var s = new Discovery.SSDP.Service();
            s.ServiceType = txtServiceType.Text;
            if (txtName.Text == "uuid:")
                s.UniqueServiceName = "uuid:" + Guid.NewGuid().ToString();
            else
                s.UniqueServiceName = txtName.Text;
            s.Location = txtLocation.Text;

            _agent.Services.Add(s);
            lbServices.Items.Add(s.ServiceType);

            txtServiceType.Text = null;
            txtName.Text = null;
            txtLocation.Text = null;
        }