public TakeoutPage()
        {
            viewModel = new TakeoutViewModel(this);

            this.BindingContext = viewModel;
            InitializeComponent();
        }
Beispiel #2
0
        public TakeoutPage()
        {
            InitializeComponent();

            TakeoutViewModel viewModel = new TakeoutViewModel(this, ctrProducts, ctrlSelected, ctrProducts.spProductType, ctrProducts.svProductList, ctrlSelected.lbList, crtlRequest.ugRequestList);

            this.DataContext = viewModel;
        }
Beispiel #3
0
        /// <summary>
        /// 初始化
        /// </summary>
        public void Init()
        {
            TakeoutViewModel viewModel = this.DataContext as TakeoutViewModel;

            viewModel.Init();


            if (!IsInitialProduct)
            {
                ctrProducts.InitialProduct();
                IsInitialProduct = true;
            }
        }
Beispiel #4
0
        public MainWindow()
        {
            InitializeComponent();



            // 显示隐藏状态更改
            this.IsVisibleChanged += (x, y) =>
            {
                lock (IsOpeningObj)
                {
                    if ((bool)y.NewValue)
                    {
                        IsOpening = true;
                    }
                    else
                    {
                        IsOpening = false;
                    }
                }
            };



            this.Activated += (x, y) =>
            {
                lock (IsOpeningObj)
                {
                    IsActiving = true;
                }
            };

            this.Deactivated += (x, y) =>
            {
                lock (IsOpeningObj)
                {
                    IsActiving = false;
                }
            };

            this.GotKeyboardFocus += (x, y) =>
            {
                lock (IsOpeningObj)
                {
                    IsFocusing = true;
                }
            };

            this.LostKeyboardFocus += (x, y) =>
            {
                lock (IsOpeningObj)
                {
                    IsFocusing = false;
                }
            };



            // 保持窗口开启事件
            System.Threading.Tasks.Task.Factory.StartNew(() =>
            {
                for (;;)
                {
                    System.Threading.Thread.Sleep(3000);
                    lock (IsOpeningObj)
                    {
                        if (IsOpening)
                        {
                            if (IsActiving && IsFocusing)
                            {
                                continue;
                            }

                            System.Threading.Tasks.Task.Factory.StartNew(() =>
                            {
                                this.Dispatcher.BeginInvoke(new Action(() =>
                                {
#if !DEBUG
                                    this.Activate();

                                    this.Topmost = true;
#endif

                                    this.Focus();
                                }));
                            });
                        }
                    }
                }
            }, TaskCreationOptions.LongRunning);

            // 貌似这个不会发生, 不用担心(因为不可点, 所以无法获取)
            this.MouseDown += (x, y) => {
                this.Close();
            };

#if !DEBUG
            this.WindowState = System.Windows.WindowState.Maximized;
            this.Topmost     = true;

            // 防止超出第一屏幕在第二屏幕边缘也显示
            this.ResizeMode = System.Windows.ResizeMode.NoResize;
#endif



            // 计算两个List的高度参数
            CalcSize();
            viewModel        = new TakeoutViewModel(this, this.ctrProducts.grdListParent, this.ctrSelected.grdListParent, this.ctrCheckout);
            this.DataContext = viewModel;

            this.Loaded += (x, y) =>
            {
                if (!IsLoadedIt)
                {
                    IsLoadedIt = true;

                    viewModel.Init();
                }
            };
        }
Beispiel #5
0
        /// <summary>
        /// 刷新客显
        /// </summary>
        public void RefreshPM()
        {
            TakeoutViewModel viewModel = this.DataContext as TakeoutViewModel;

            viewModel.RefreshPM();
        }