示例#1
0
        public void ShowView(string p_Name)
        {
            if (m_CurrentView != null && (m_CurrentView.GetName() == p_Name))  //点击的是当前的,不做处理
            {
                return;
            }

            if (m_RegisteredView != null)
            {
                frmMessageBox frmMessageBox = new frmMessageBox(System.Windows.MessageBoxButton.OK, "请先点击右下方的确定或者取消按钮,才能进行其他操作。");
                frmMessageBox.ShowDialog();
                return;
            }

            bool isneedactive = false;

            IView view = FindView(p_Name);

            switch (p_Name)
            {
            case "开桌":
            {
                if (view == null)
                {
                    view = new Desk();
                    m_ViewList.Add(view);
                }
                else
                {
                    isneedactive = true;
                }
            }
            break;

            case "点菜":
            {
                if (m_CurrentView.GetName() == "开桌")
                {
                    if (string.IsNullOrEmpty(PassValue.consumptionid))
                    {
                        Messagebox mb = new Messagebox();
                        PassValue.MessageInfor = "请先选择已开台的桌子!";
                        mb.Show();
                    }
                    else
                    {
                        view         = new frmOrder(PassValue.consumptionid);
                        isneedactive = true;
                    }
                }
            }
            break;

            case "收银":
            {
                view         = new frmCashier(PassValue.consumptionid);
                isneedactive = true;
            }
            break;

            case "预定":
            {
                view = new frmReserveDishes();
            }
            break;

            case "会员":
            {
                if (view == null)
                {
                    view = new MemberSystem();
                }
            }
            break;

            case "交接班":
            {
                view = new Transfer();
            }
            break;

            case "历史查询":
            {
                view         = new frmQuery(PassValue.consumptionid);
                isneedactive = true;
            }
            break;

            case "菜品":
            {
                if (view == null)
                {
                    view = new frmWebDishes();
                    m_ViewList.Add(view);
                }
            }
            break;

            case "库管":
            {
                if (view == null)
                {
                    view = new frmWebWarehouse();
                    m_ViewList.Add(view);
                }
            }
            break;

            case "设置":
            {
                History hs = new History();
                hs.ShowDialog();
            }
            break;

            case "报表":
            {
                if (view == null)
                {
                    view = new frmWebReport();
                    m_ViewList.Add(view);
                }
            }
            break;

            case "TT100":
            {
                if (view == null)
                {
                    view = new frmWebTT100();
                    m_ViewList.Add(view);
                }
            }
            break;

            case "锁屏":
            {
                LockWindows lw = new LockWindows();
                lw.ShowDialog();
            }
            break;
            }

            if (view == null)    //前面没有生成view
            {
            }
            else
            {
                //先关闭之前的view
                if (m_CurrentView != null && FindView(m_CurrentView.GetName()) == null)
                {
                    Form frm = m_CurrentView as Form;
                    frm.Close();
                }

                //显示现在的view
                Form form = view as Form;
                form.Owner    = this;
                form.TopLevel = false;
                form.Dock     = DockStyle.Fill;
                this.panelMain.Controls.Clear();
                this.panelMain.Controls.Add(form);
                form.Show();

                if (isneedactive)
                {
                    view.Active();
                }

                m_CurrentView = view;

                //设置按钮状态
                SetButtonActived(p_Name);
            }
        }
示例#2
0
        public void ShowView(string p_Name)
        {
            if (m_CurrentView !=null && (m_CurrentView.GetName() == p_Name))  //点击的是当前的,不做处理
            {
                return;
            }

            if (m_RegisteredView != null)
            {
                frmMessageBox frmMessageBox = new frmMessageBox(System.Windows.MessageBoxButton.OK, "请先点击右下方的确定或者取消按钮,才能进行其他操作。");
                frmMessageBox.ShowDialog();
                return;
            }

            bool isneedactive = false;

            IView view= FindView(p_Name);
            switch (p_Name)
            {
                case "开桌":
                    {
                        if (view == null)
                        {
                            view = new Desk();
                            m_ViewList.Add(view);
                        }
                        else
                        {
                            isneedactive = true;
                        }
                    }
                    break;

                case "点菜":
                    {
                        if (m_CurrentView.GetName() == "开桌")
                        {
                            if (string.IsNullOrEmpty(PassValue.consumptionid))
                            {
                                Messagebox mb = new Messagebox();
                                PassValue.MessageInfor = "请先选择已开台的桌子!";
                                mb.Show();
                            }
                            else
                            {
                                view = new frmOrder(PassValue.consumptionid);
                                isneedactive = true;
                            }
                        }
                    }
                    break;

                case "收银":
                    {
                        view = new frmCashier(PassValue.consumptionid);
                        isneedactive = true;
                    }
                    break;

                case "预定":
                    {
                        view = new frmReserveDishes();
                    }
                    break;

                case "会员":
                    {
                        if (view == null)
                        {
                            view = new MemberSystem();
                        }
                    }
                    break;

                case "交接班":
                    {
                        view = new Transfer();
                    }
                    break;

                case "历史查询":
                    {
                        view = new frmQuery(PassValue.consumptionid);
                        isneedactive = true;
                    }
                    break;

                case "菜品":
                    {
                        if (view == null)
                        {
                            view = new frmWebDishes();
                            m_ViewList.Add(view);
                        }
                    }
                    break;

                case "库管":
                    {
                        if (view == null)
                        {
                            view = new frmWebWarehouse();
                            m_ViewList.Add(view);
                        }
                    }
                    break;

                case "设置":
                    {
                        History hs  = new History();
                        hs.ShowDialog();
                    }
                    break;

                case "报表":
                    {
                        if (view == null)
                        {
                            view = new frmWebReport();
                            m_ViewList.Add(view);
                        }
                    }
                    break;

                case "TT100":
                    {
                        if (view == null)
                        {
                            view = new frmWebTT100();
                            m_ViewList.Add(view);
                        }
                    }
                    break;
                case "锁屏":
                    {
                        LockWindows lw = new LockWindows();
                        lw.ShowDialog();
                    }
                    break;
            }

            if (view == null)    //前面没有生成view
            {

            }
            else
            {
                //先关闭之前的view
                if (m_CurrentView != null && FindView(m_CurrentView.GetName()) == null)
                {
                    Form frm = m_CurrentView as Form;
                    frm.Close();
                }

                //显示现在的view
                Form form = view as Form;
                form.Owner = this;
                form.TopLevel = false;
                form.Dock = DockStyle.Fill;
                this.panelMain.Controls.Clear();
                this.panelMain.Controls.Add(form);
                form.Show();

                if (isneedactive)
                {
                    view.Active();
                }

                m_CurrentView = view;

                //设置按钮状态
                SetButtonActived(p_Name);
            }
        }