コード例 #1
0
ファイル: MainDLG.cs プロジェクト: VulpesSARL/Fox-SDC
        private void deletePolicyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            bool  valid = false;
            Int64?PolID = GroupFolders.GetSelectedPolicyID(treeAction.SelectedNode, out valid);

            if (valid == false)
            {
                return;
            }

            PolicyObject obj = Program.net.GetPolicyObject(PolID.Value);

            if (obj == null)
            {
                return;
            }

            if (MessageBox.Show(this, "Do you want to delete the policy " + obj.Name + "?", Program.Title, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2) != System.Windows.Forms.DialogResult.Yes)
            {
                return;
            }

            if (Program.net.DeletePolicy(obj.ID) == false)
            {
                MessageBox.Show(this, "Cannot delete policy: " + Program.net.GetLastError(), Program.Title, MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            treeAction.SelectedNode.Parent.Nodes.Remove(treeAction.SelectedNode);
        }
コード例 #2
0
ファイル: MainDLG.cs プロジェクト: VulpesSARL/Fox-SDC
        private void lowLevelEditPolicyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            bool  valid = false;
            Int64?PolID = GroupFolders.GetSelectedPolicyID(treeAction.SelectedNode, out valid);

            if (valid == false)
            {
                policyEnabledToolStripMenuItem.Enabled = false;
            }
            else
            {
                PolicyObject obj = Program.net.GetPolicyObject(PolID.Value);
                if (obj == null)
                {
                    return;
                }
                frmLowLevelEdit frm = new frmLowLevelEdit(obj);
                frm.ShowDialog(this);
            }
        }
コード例 #3
0
ファイル: MainDLG.cs プロジェクト: VulpesSARL/Fox-SDC
        private void policyEnabledToolStripMenuItem_Click(object sender, EventArgs e)
        {
            bool  valid = false;
            Int64?PolID = GroupFolders.GetSelectedPolicyID(treeAction.SelectedNode, out valid);

            if (valid == false)
            {
                return;
            }

            PolicyObject obj = Program.net.GetPolicyObject(PolID.Value);

            if (obj == null)
            {
                return;
            }

            if (Program.net.EnableDisablePolicy(obj.ID, !obj.Enabled) == false)
            {
                MessageBox.Show(this, "Cannot enable/disable policy: " + Program.net.GetLastError(), Program.Title, MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            treeAction.SelectedNode.Text = obj.Name + (obj.Enabled == false ? "" : " [disabled]");
        }
コード例 #4
0
ファイル: MainDLG.cs プロジェクト: VulpesSARL/Fox-SDC
        private void contextMenuStrip1_Opening(object sender, CancelEventArgs e)
        {
            createGroupToolStripMenuItem.Enabled        = false;
            deleteGroupToolStripMenuItem.Enabled        = false;
            refreshGroupToolStripMenuItem.Enabled       = false;
            renameGroupToolStripMenuItem.Enabled        = false;
            createpolicyToolStripMenuItem.Enabled       = false;
            deletePolicyToolStripMenuItem.Enabled       = false;
            policyEnabledToolStripMenuItem.Enabled      = false;
            lowLevelEditPolicyToolStripMenuItem.Enabled = false;
            policyEnabledToolStripMenuItem.Text         = "Enable/Disable polic&y";

            if (treeAction.SelectedNode == null)
            {
                return;
            }

            if (treeAction.SelectedNode.Name.StartsWith("grp:") == true)
            {
                createpolicyToolStripMenuItem.Enabled = true;
                createGroupToolStripMenuItem.Enabled  = true;
                refreshGroupToolStripMenuItem.Enabled = true;
                if (treeAction.SelectedNode.Name.StartsWith("grp:root") == false)
                {
                    deleteGroupToolStripMenuItem.Enabled = true;
                    renameGroupToolStripMenuItem.Enabled = true;
                    createsimpleTasksInThisGroupToolStripMenuItem.Enabled = true;
                }
                else
                {
                    deleteGroupToolStripMenuItem.Enabled = false;
                    renameGroupToolStripMenuItem.Enabled = false;
                    createsimpleTasksInThisGroupToolStripMenuItem.Enabled = false;
                }
            }
            else
            {
                createsimpleTasksInThisGroupToolStripMenuItem.Enabled = false;
                createGroupToolStripMenuItem.Enabled  = false;
                deleteGroupToolStripMenuItem.Enabled  = false;
                refreshGroupToolStripMenuItem.Enabled = false;
                renameGroupToolStripMenuItem.Enabled  = false;
            }

            if (treeAction.SelectedNode.Name.StartsWith("pol:") == true)
            {
                deletePolicyToolStripMenuItem.Enabled  = true;
                policyEnabledToolStripMenuItem.Enabled = true;
                if (Settings.Default.EnableDebug == true)
                {
                    lowLevelEditPolicyToolStripMenuItem.Visible = true;
                    lowLevelEditPolicyToolStripMenuItem.Enabled = true;
                }
                else
                {
                    lowLevelEditPolicyToolStripMenuItem.Visible = false;
                    lowLevelEditPolicyToolStripMenuItem.Enabled = false;
                }
                bool  valid = false;
                Int64?PolID = GroupFolders.GetSelectedPolicyID(treeAction.SelectedNode, out valid);
                if (valid == false)
                {
                    policyEnabledToolStripMenuItem.Enabled = false;
                }
                else
                {
                    PolicyObject obj = Program.net.GetPolicyObject(PolID.Value);
                    if (obj == null)
                    {
                        policyEnabledToolStripMenuItem.Enabled = false;
                    }
                    else
                    {
                        policyEnabledToolStripMenuItem.Enabled = true;
                        policyEnabledToolStripMenuItem.Text    = obj.Enabled == true ? "Disable polic&y" : "Enable polic&y";
                    }
                }
            }
        }