コード例 #1
0
 /// <summary>
 /// The constructor for this Controller class.
 /// </summary>
 /// <param name="mainController">A reference to the Main_Window_Frame's controller</param>
 /// <param name="searchPane">A reference to the Search_Pane creating an object of this class</param>
 public Search_Pane_Controller(Main_Window_Frame.Main_Window_Control mainController, Search_Pane searchPane)
     : base(mainController)
 {
     this.searchPane = searchPane;
 } // End Search_Pane_Controller Constructor
コード例 #2
0
        } // End InitializeLoginWindow

        /// <summary>
        /// Used to created all the User/Admin GUI content after they have logged in.  Creates all the tabs and pages that is used within the program.
        /// Content created depends on if the user is a regular user or an Admin.
        /// </summary>
        /// <param name="isAdmin">A boolean value that determines if the GUI generated is for a regular user or an Admin.</param>
        private void InitializeUserWindows(bool isAdmin)
        {
            isLoggedIn = true;
            Controls.Remove(loginContainer);
            this.isAdmin = isAdmin;
            // Set up the Tab Content Controller
            main      = new TabControl();
            main.Dock = DockStyle.Fill;
            int numberOfPanesToAdd = 0;

            // Determine how many panes will be adding based on the logged in role
            if (isAdmin)
            {
                panes = new Form[5];
                tabs  = new TabPage[5];
                numberOfPanesToAdd = 5;
            }
            else
            {
                panes = new Form[2];
                tabs  = new TabPage[2];
                numberOfPanesToAdd = 2;
            }

            // Add the reference for panes to tabs, add the tabs to the TabController
            for (int i = 0; i < numberOfPanesToAdd; ++i)
            {
                tabs[i] = new TabPage();
            }

            // Common panes between both user and admin
            panes[0]       = new Search_Pane(controller);
            tabs[0].Text   = "Search";
            tabs[0].Enter += ((Search_Pane)panes[0]).getController().refreshScreen;

            panes[1]     = new Tutorial_Pane(isAdmin);
            tabs[1].Text = "Tutorial";

            // add admin stuff now
            if (isAdmin)
            {
                panes[2]       = new User_Pane(controller);
                tabs[2].Text   = "Users";
                tabs[2].Enter += ((User_Pane)panes[2]).getController().populateUserList;

                panes[3]       = new Resource_Pane(controller);
                tabs[3].Text   = "Resources";
                tabs[3].Enter += ((Resource_Pane)panes[3]).getController().refreshScreen;

                panes[4]       = new Attribute_Pane(controller);
                tabs[4].Text   = "Attributes";
                tabs[4].Enter += ((Attribute_Pane)panes[4]).getController().refreshScreen;
            }


            Controls.Add(main);
            for (int i = 0; i < panes.Length; ++i)
            {
                tabs[i].Controls.Add(panes[i]);
                main.Controls.Add(tabs[i]);
                panes[i].Show();
            }
            main.Show();
            Show();
        } // End InitializeUserWindows