예제 #1
0
        private void TVPolicies_AfterSelect(object sender, TreeViewEventArgs e)
        {
            Splitty.Panel2.Controls.Clear();
            if (TVPolicies.SelectedNode == null)
            {
                SelectedPolicy = null;
                return;
            }

            SelectedPolicy = Convert.ToInt64(e.Node.Name);

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

            if (obj == null)
            {
                MessageBox.Show(this, "Loading policy failed: " + Program.net.GetLastError(), Program.Title, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            else
            {
                PolicyElementInterface i = PolicyList.GetInstance(obj.Type);
                i.SetData(obj);
                UserControl ctl = (UserControl)i;
                ctl.Dock = DockStyle.Fill;
                Splitty.Panel2.Controls.Add(ctl);
            }
        }
예제 #2
0
 public static PolicyElementInterface GetInstance(int TypeID)
 {
     foreach (PolicyListElement ele in Elements)
     {
         if (ele.TypeID == TypeID)
         {
             PolicyElementInterface i = (PolicyElementInterface)Activator.CreateInstance(ele.UserControl);
             return(i);
         }
     }
     return(null);
 }
예제 #3
0
        private void treeAction_AfterSelect(object sender, TreeViewEventArgs e)
        {
            Splitty.Panel2.Controls.Clear();
            switch (e.Node.Name)
            {
            case "server":
            {
                ctlFirstPage ctl = new ctlFirstPage();
                ctl.Dock = DockStyle.Fill;
                Splitty.Panel2.Controls.Add(ctl);
                break;
            }

            case "unapprovcomputer":
            {
                ctlListPCs ctl = new ctlListPCs(false, null);
                ctl.Dock = DockStyle.Fill;
                Splitty.Panel2.Controls.Add(ctl);
                break;
            }

            case "allcomputers":
            {
                ctlListPCs ctl = new ctlListPCs(null, null);
                ctl.Dock = DockStyle.Fill;
                Splitty.Panel2.Controls.Add(ctl);
                break;
            }

            case "allprograms":
            {
                ctlAddRemovePrograms ctl = new ctlAddRemovePrograms("");
                ctl.Dock = DockStyle.Fill;
                Splitty.Panel2.Controls.Add(ctl);
                break;
            }

            case "alldiskdata":
            {
                ctlListDiskData ctl = new ctlListDiskData("");
                ctl.Dock = DockStyle.Fill;
                Splitty.Panel2.Controls.Add(ctl);
                break;
            }

            case "alleventlogs":
            {
                ctlEventLogs ctl = new ctlEventLogs();
                ctl.Dock = DockStyle.Fill;
                Splitty.Panel2.Controls.Add(ctl);
                break;
            }

            case "allstartup":
            {
                ctlStartupItems ctl = new ctlStartupItems("");
                ctl.Dock = DockStyle.Fill;
                Splitty.Panel2.Controls.Add(ctl);
                break;
            }

#if ENABLECHAT
            case "pendingchats":
            {
                ctlPendingChats ctl = new ctlPendingChats();
                ctl.Dock = DockStyle.Fill;
                Splitty.Panel2.Controls.Add(ctl);
                break;
            }
#endif
            case "uploaddownload":
            {
                ctlUploadDownloadStatus ctl = new ctlUploadDownloadStatus();
                ctl.Dock = DockStyle.Fill;
                Splitty.Panel2.Controls.Add(ctl);
                break;
            }

            case "simpletasks":
            {
                ctlSimpleTasks ctl = new ctlSimpleTasks("");
                ctl.Dock = DockStyle.Fill;
                Splitty.Panel2.Controls.Add(ctl);
                break;
            }
            }

            SelectedGroup  = null;
            SelectedPolicy = null;
            if (GroupFolders.AfterSelect(treeAction, e, out SelectedGroup, out SelectedPolicy) == true)
            {
                if (SelectedGroup != null)
                {
                    ctlListPCs ctl = new ctlListPCs(null, SelectedGroup);
                    ctl.Dock = DockStyle.Fill;
                    Splitty.Panel2.Controls.Add(ctl);
                }
                if (SelectedPolicy != null)
                {
                    PolicyObject obj = Program.net.GetPolicyObject(SelectedPolicy.Value);
                    if (obj == null)
                    {
                        MessageBox.Show(this, "Loading policy failed: " + Program.net.GetLastError(), Program.Title, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    }
                    else
                    {
                        PolicyElementInterface i = PolicyList.GetInstance(obj.Type);
                        i.SetData(obj);
                        UserControl ctl = (UserControl)i;
                        ctl.Dock = DockStyle.Fill;
                        Splitty.Panel2.Controls.Add(ctl);
                    }
                }
            }
        }