コード例 #1
0
        /// <summary>
        /// A switch based on the Page Enum returns the selected Form
        /// </summary>
        /// <param name="page"></param>
        /// <seealso cref="Page"/>
        /// <returns>The chosen Form</returns>
        private static Form GetForm(FORMS.FormMain.Page page)
        {
            switch (page)
            {
            case FormMain.Page.Chat:
                ChatAvailable();
                return(new FORMS.COMPONENTS.MAINPANEL.Chat(_client.Groups[_listBoxGroups.SelectedIndex].Chats[0], _client));

            case FORMS.FormMain.Page.Profile:
                _listBoxGroups.SelectedIndex = -1;
                _openGroup = new GROUP.Data();
                return(new FORMS.COMPONENTS.MAINPANEL.ProfileShow(_selectedUser, _client));

            case FORMS.FormMain.Page.ProfileEdit:
                return(new FORMS.COMPONENTS.MAINPANEL.ProfileEdit(_selectedUser));

            case FORMS.FormMain.Page.ProfileCreate:
                return(new FORMS.COMPONENTS.MAINPANEL.ProfileCreate());

            case FORMS.FormMain.Page.GroupSelector:
                return(new FORMS.COMPONENTS.MAINPANEL.GroupSelector(_client));

            default:
                return(new FORMS.COMPONENTS.MAINPANEL.ProfileShow(_selectedUser, _client));
            }
        }
コード例 #2
0
 /// <summary>
 /// Changes the current pages that should be put in de Panels
 /// </summary>
 /// <param name="page"></param>
 /// <seealso cref="Page"/>
 public static void ChangePanels(FORMS.FormMain.Page page, GROUP.Data selectedGroup)
 {
     if (selectedGroup.GroupId != _openGroup.GroupId)
     {
         ChangePanels(page);
         _openGroup = selectedGroup;
     }
 }
コード例 #3
0
        /// <summary>
        /// A switch based on the Page Enum returns the selected Form if the choice uses the SidePanel
        /// if not it returns a blank Form
        /// </summary>
        /// <param name="page"></param>
        /// <seealso cref="Page"/>
        /// <returns></returns>
        private static Form GetSideForm(FORMS.FormMain.Page page)
        {
            switch (page)
            {
            case FORMS.FormMain.Page.Chat:
                return(new FORMS.COMPONENTS.SIDEPANEL.ListChannelsSidePanel((GROUP.Data)_listBoxGroups.SelectedItem));

            case FORMS.FormMain.Page.Profile:
                return(new ListUsersSidePanel(DATABASE.DbConnect.GetAllUsers(_client.UserId), _client));

            default:
                return(new FORMS.COMPONENTS.SIDEPANEL.Blank());
            }
        }
コード例 #4
0
        /// <summary>
        /// Changes the current pages that should be put in de Panels
        /// </summary>
        /// <param name="page"></param>
        /// <seealso cref="Page"/>
        public static void ChangePanels(FORMS.FormMain.Page page)
        {
            //  Checks if all items are loaded proparly
            if (_allItemsLoaded)
            {
                //  checks if the panels are filled, if so they are emtied
                if (!MainPanelAvailable())
                {
                    _mainPanel.Controls.Clear();
                }
                if (!SidePanelAvailable())
                {
                    _sidePanel.Controls.Clear();
                }

                /// <seealso cref="GetForm"/>
                Form mainForm = GetForm(page);
                /// <seealso cref="GetSideForm"/>
                Form sideForm = GetSideForm(page);

                //  Set the properties of form that is inserted into the main panel
                mainForm.TopLevel   = false;
                mainForm.AutoScroll = false;
                _mainPanel.Controls.Add(mainForm);
                mainForm.Show();

                //  Set the properties of form that is inserted into the side panel
                sideForm.TopLevel   = false;
                sideForm.AutoScroll = true;
                _sidePanel.Controls.Add(sideForm);
                sideForm.Show();

                _currentPage = page;
                LoadUserInformation();
            }
            else
            {
                Console.WriteLine("Controller hasn`t been started yet");
            }
        }
コード例 #5
0
 /// <summary>
 /// Changes the current pages that should be put in de Panels
 /// </summary>
 /// <param name="page"></param>
 /// <seealso cref="Page"/>
 public static void ChangePanels(FORMS.FormMain.Page page, USER.Data selectedUser)
 {
     _selectedUser = selectedUser;
     ChangePanels(page);
 }