Пример #1
0
        public void ShowUserInfo(User u)
        {
            btnJoin.Hide();
            btnSighIn.Hide();
            if (u.picture != null)
            {
                userImage.Image = byteArrayToImage(u.picture);
                userImage.Show();
            }
            btnLogout.Visible   = true;
            tabProfile          = new TabPage();
            tabProfile.Location = new System.Drawing.Point(4, 44);
            tabProfile.Name     = "tabProfile";
            tabProfile.Size     = new System.Drawing.Size(886, 473);
            tabProfile.TabIndex = 4;
            tabProfile.Text     = "My Profile";

            this.tabControl.Controls.Add(tabProfile);
            ProfilePage pp = new ProfilePage(u);

            StarterForm.browserBackList.Add(pp);
            StarterForm.browseBackTabList.Add(tabProfile);
            tabProfile.Controls.Add(pp);

            if (StarterForm.isAdmin == true)
            {
                AdminBookStore bookAdd = new AdminBookStore();
                StarterForm.browserBackList.Add(bookAdd);
                StarterForm.browseBackTabList.Add(tabMyBook);
                tabMyBook.Controls.Clear();
                this.tabMyBook.Controls.Add(bookAdd);
            }
            else
            {
                CategoryDisplay cd = new CategoryDisplay();
                if (cd.ShowUserBook(StarterForm.loggedInUser.id, this, tabMyBook))
                {
                    StarterForm.browserBackList.Add(cd);
                    StarterForm.browseBackTabList.Add(tabMyBook);
                    tabMyBook.Controls.Clear();
                    tabMyBook.Controls.Add(cd);
                }
            }
        }
Пример #2
0
 private void tabControl_Selected(object sender, TabControlEventArgs e)
 {
     if (e.TabPage == tabHome)
     {
         CategoryDisplay cd = new CategoryDisplay();
         cd.HomePage(this, tabHome);
         StarterForm.browserBackList.Add(cd);
         StarterForm.browseBackTabList.Add(tabHome);
         tabHome.Controls.Clear();
         tabHome.Controls.Add(cd);
     }
     else if (e.TabPage == tabMyBook)
     {
         if (StarterForm.loggedStatus == true)
         {
             if (StarterForm.isAdmin == true)
             {
                 AdminBookStore bookAdd = new AdminBookStore();
                 StarterForm.browserBackList.Add(bookAdd);
                 StarterForm.browseBackTabList.Add(tabMyBook);
                 tabMyBook.Controls.Clear();
                 this.tabMyBook.Controls.Add(bookAdd);
             }
             else
             {
                 CategoryDisplay cd = new CategoryDisplay();
                 if (cd.ShowUserBook(StarterForm.loggedInUser.id, this, tabMyBook))
                 {
                     StarterForm.browserBackList.Add(cd);
                     StarterForm.browseBackTabList.Add(tabMyBook);
                     tabMyBook.Controls.Clear();
                     tabMyBook.Controls.Add(cd);
                 }
             }
         }
         else
         {
             MetroFramework.MetroMessageBox.Show(this, "Join Us to get access.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
             tabControl.SelectedIndex = 0;
         }
     }
     else if (e.TabPage == tabBrowse)
     {
         BrowseControl bc = new BrowseControl(tabBrowse);
         bc.ShowCategoryListEvent += ShowCategoryDisplay;
         StarterForm.browserBackList.Add(bc);
         StarterForm.browseBackTabList.Add(tabBrowse);
         tabBrowse.Controls.Clear();
         tabBrowse.Controls.Add(bc);
     }
     else if (e.TabPage == tabSearch)
     {
         SearchControl sc = new SearchControl(tabSearch);
         StarterForm.browserBackList.Add(sc);
         StarterForm.browseBackTabList.Add(tabSearch);
         tabSearch.Controls.Clear();
         tabSearch.Controls.Add(sc);
     }
     else if (e.TabPage == tabProfile)
     {
         if (StarterForm.loggedStatus == true)
         {
         }
         else
         {
         }
     }
 }