Пример #1
0
        //public event BackButton BackButtonEvent;
        public MainControl()
        {
            InitializeComponent();
            //BrowseControl bc = new BrowseControl();
            //CategoryDisplayEvent += ShowCategoryDisplay;
            //BrowseControl bc = new BrowseControl(tabBrowse);
            //bc.ShowCategoryListEvent += ShowCategoryDisplay;
            StarterForm.BackButtonEvent            += implementBack;
            IndividualBook.IndividualBookShowEvent += BookDescriptionShow;
            //Form2.Back(bc);
            //tabBrowse.Controls.Add(bc);
            //SearchControl sc = new SearchControl(tabSearch);
            //sc.SeachEvent += SearchDisplay();
            //tabSearch.Controls.Add(sc);
            //tabHome.Controls.Add(new CategoryDisplay("Educational"));
            CategoryDisplay cd = new CategoryDisplay();

            cd.HomePage(this, tabHome);
            StarterForm.browserBackList.Add(cd);
            StarterForm.browseBackTabList.Add(tabHome);
            tabHome.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
         {
         }
     }
 }