Esempio n. 1
0
        private void cmdOK_Click(object sender, EventArgs e)
        {
            if (txtName.Text.Trim() == "")
            {
                MessageBox.Show(this, "Enter a name.", Program.Title, MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (lstPolicies.SelectedIndex == -1)
            {
                MessageBox.Show(this, "Select the policy item you want to create.", Program.Title, MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            PolicyListElement ele = (PolicyListElement)lstPolicies.SelectedItem;
            NewPolicyReq      req = new NewPolicyReq();

            req.Data      = "";
            req.Grouping  = GroupID;
            req.MachineID = MachineID;
            req.Name      = txtName.Text.Trim();
            req.Type      = ele.TypeID;
            Int64?newID = Program.net.CreatePolicy(req);

            if (newID == null)
            {
                MessageBox.Show(this, "Creating new policy failed: " + Program.net.GetLastError(), Program.Title, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            NEWID = newID.Value;

            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();
        }
Esempio n. 2
0
        private void lstPolicies_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lstPolicies.SelectedIndex == -1)
            {
                return;
            }
            PolicyListElement ele = (PolicyListElement)lstPolicies.SelectedItem;

            txtDesc.Text = ele.Description;
        }