예제 #1
0
 private void homeToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         frmDefault form = new frmDefault();
         ExtensionMethods.AddFormToPanel(form, pnlMain);
         form.Show();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #2
0
        public static void RemoveChildFormToPanel(Control parentForm, Control childFrm, Panel pnl)
        {
            if (pnl.Controls.Count > 0)
            {
                pnl.Controls.Remove(childFrm);

                if (pnl.Controls.Count > 0)
                {
                    if (parentForm != null && pnl.Controls[parentForm.Name] != null)
                    {
                        pnl.Controls[parentForm.Name].Visible = true;
                    }
                }
                else
                {
                    frmDefault dform = new frmDefault();
                    AddFormToPanel(dform, MainPanel);
                    dform.Show();
                }
            }
        }
예제 #3
0
        private void frmMainForm_Load(object sender, EventArgs e)
        {
            try
            {
                pnlMain.Dock = DockStyle.Fill;

                List <Control> allControls = ExtensionMethods.GetAllControls(this);
                allControls.ForEach(k => k.Font = new System.Drawing.Font(ExtensionMethods.FontFamily, ExtensionMethods.FontSize));


                // ToggleMenuItems(menuStrip1.Items);
                frmDefault form = new frmDefault();
                ExtensionMethods.AddFormToPanel(form, pnlMain);
                form.Show();

                StagingData.SetItemListData(applicationFacade.GetAllItemsBySearch());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #4
0
        public static void RemoveTransactionFormToPanel(Control childFrm, Panel pnl)
        {
            string[] form = childFrm.Name.Split('_');

            if (form[0] == "1")
            {
                TransactionForm tform = TransactionForms.Where(p => p.FormName == childFrm.Name).FirstOrDefault();
                TransactionForms.Remove(tform);

                pnl.Controls.Remove(childFrm);

                frmDefault dform = new frmDefault();
                AddFormToPanel(dform, MainPanel);
                dform.Show();
            }
            else
            {
                TransactionForm tform = TransactionForms.Where(p => p.FormName == childFrm.Name).FirstOrDefault();
                TransactionForms.Remove(tform);
                pnl.Controls.Remove(childFrm);

                pnl.Controls[TransactionForms.Where(p => p.FormNo == 1).FirstOrDefault().FormName].Visible = true;
            }
        }