コード例 #1
0
ファイル: ConsoleForm.cs プロジェクト: abhishek-kumar/AIGA
 private void FillListItems(SpecialParentNode spn)
 {
     //fill the list with child items based on what type of node was passed in
     if (spn.NodeType == SpecialParentNodeType.Users)
     {
         FillUsersList();
     }
     else if (spn.NodeType == SpecialParentNodeType.Groups)
     {
         FillGroupsList();
     }
     else if (spn.NodeType == SpecialParentNodeType.Permissions)
     {
         FillPermissionsList();
     }
     else if (spn.NodeType == SpecialParentNodeType.Applications)
     {
         FillThreadsList(spn);
     }
     else if (spn.NodeType == SpecialParentNodeType.Executors)
     {
         FillExecutorsList();
     }
     else
     {
         //dunno what kind of node this is.
         //no nodes are meant to be shown here.
         //so just clear the list
         lv.Items.Clear();
     }
 }
コード例 #2
0
ファイル: ConsoleForm.cs プロジェクト: abhishek-kumar/AIGA
        private void FillThreadsList(SpecialParentNode appNode)
        {
            if (connected && !filling)
            {
                try
                {
                    SetFilling(true);
                    ApplicationTreeNode appTreeNode = (ApplicationTreeNode)appNode;
                    string appId = (appTreeNode).AlchemiApplication.ApplicationId;
                    //get jobs
                    ThreadStorageView[] threads = console.Manager.Admon_GetThreadList(console.Credentials, appId);
                    int iterations = 0;
                    lv.Items.Clear();

                    foreach (ThreadStorageView thread in threads)
                    {
                        ThreadItem thrItem = new ThreadItem(thread.ThreadId.ToString());
                        thrItem.ImageIndex = 11;
                        thrItem.AlchemiThread =  thread;

                        lv.Items.Add(thrItem);
                        iterations++;

                        //this is there to make the app more responsive as a GUI to the user,
                        //in case there are lots and lots of threads.
                        if (iterations >= MAGIC_ITEM_NUMBER)
                        {
                            iterations = 0;
                            Application.DoEvents();
                        }

                        if (stopFillingRequest)
                        {
                            break; //To make sure we dont get stuck in this loop when asked to stop.
                        }
                    }
                }
                catch (Exception ex)
                {
                    if (ex is AuthorizationException)
                    {
                        MessageBox.Show("Access denied. You do not have adequate permissions for this operation.","Authorization Error",MessageBoxButtons.OK,  MessageBoxIcon.Error);
                    }
                    else
                    {
                        logger.Error("Could not get list of applications. Error: "+ex.Message, ex);
                        MessageBox.Show("Couldnot get list of applications. Error: "+ex.StackTrace,"Console Error",MessageBoxButtons.OK,MessageBoxIcon.Error );
                        sbar.Text = "Couldnot get list of applications. Error: " + ex.Message;
                    }
                }
                finally
                {
                    SetFilling(false);
                }
            }
            else
            {
                ShowDisconnectedMessage();
            }
            RefreshUI();
        }
コード例 #3
0
ファイル: ConsoleForm.cs プロジェクト: abhishek-kumar/AIGA
        private void InitTreeView()
        {
            tv.Nodes.Clear();
            if (connected)
            {
                //Add Console Root
                TreeNode root = new TreeNode("Console Root", 4, 4);

                userParentNode = new SpecialParentNode("Users", 1, 1);
                userParentNode.NodeType = SpecialParentNodeType.Users;

                grpParentNode = new SpecialParentNode("Groups", 1, 1);
                grpParentNode.NodeType = SpecialParentNodeType.Groups;

                prmParentNode = new SpecialParentNode("Permissions", 1, 1);
                prmParentNode.NodeType = SpecialParentNodeType.Permissions;

                authParentNode = new SpecialParentNode("Users and Groups", 8, 8);
                authParentNode.NodeType = SpecialParentNodeType.Auth;
                authParentNode.Nodes.Add(userParentNode);
                authParentNode.Nodes.Add(grpParentNode);
                authParentNode.Nodes.Add(prmParentNode);
                root.Nodes.Add(authParentNode);

                execParentNode = new SpecialParentNode("Executors", 9, 9);
                execParentNode.NodeType = SpecialParentNodeType.Executors;
                root.Nodes.Add(execParentNode);

                appParentNode = new SpecialParentNode("Applications", 10, 10);
                appParentNode.NodeType = SpecialParentNodeType.AllApps;
                appParentNode.Nodes.Add(new DummyTreeNode("", 999, 999));
                root.Nodes.Add(appParentNode);

                tv.Nodes.Add(root);
                tv.Refresh();

                lv.Items.Clear();
                lv.Refresh();
            }
            else
            {
                ShowDisconnectedMessage();
            }
            RefreshUI();
        }