コード例 #1
0
        /// <summary>
        /// On Product_Panel.Click display the selected item in StorePanels descriptionPanel.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ProductPanel_Click(object sender, EventArgs e)
        {
            TableLayoutPanel productPanelRef;
            Product          productRef;

            if (sender.GetType() == typeof(TableLayoutPanel))
            {
                productPanelRef = (TableLayoutPanel)sender;
                productRef      = (Product)productPanelRef.Tag;
                this.Hide();
                storePanelRef.Show();
                storePanelRef.OnClickedHomePanelProduct(productPanelRef, productRef);
            }
            else if (sender.GetType() == typeof(PictureBox))
            {
                PictureBox p = (PictureBox)sender;
                productPanelRef = (TableLayoutPanel)p.Parent;
                productRef      = (Product)productPanelRef.Tag;
                this.Hide();
                storePanelRef.Show();
                storePanelRef.OnClickedHomePanelProduct(productPanelRef, productRef);
            }
            else if (sender.GetType() == typeof(Label))
            {
                Label l = (Label)sender;
                productPanelRef = (TableLayoutPanel)l.Parent;
                productRef      = (Product)productPanelRef.Tag;
                this.Hide();
                storePanelRef.Show();
                storePanelRef.OnClickedHomePanelProduct(productPanelRef, productRef);
            }
        }
コード例 #2
0
 private void ViewChangedButton_Click(object sender, EventArgs e)
 {
     if ((sender as Button).Name == "Store")
     {
         cart.Hide();
         home.Hide();
         store.Show();
         ActiveControl = null;
     }
     else if ((sender as Button).Name == "Cart")
     {
         store.Hide();
         home.Hide();
         cart.Show();
         ActiveControl = null;
     }
 }