void vm_SearchProductNotice(object sender, SimpleMvvmToolkit.NotificationEventArgs <List <Core.Model.Product>, Core.Model.Product> e)
        {
            bool selected = false;
            var  vm       = new QuickSearchProductViewModel(e.Data);

            var win = new SelectProductWindow();

            win.Owner       = Application.Current.MainWindow;
            win.DataContext = vm;

            vm.CloseNotice += (ss, ee) =>
            {
                if (vm.SelectedProduct != null)
                {
                    selected = true;
                    e.Completed(vm.SelectedProduct);
                }

                win.Close();
            };

            win.txtSearch.Focus();
            win.ShowDialog();

            if (!selected)
            {
                e.Completed(null);
            }
        }
        void vm_ChangeCustomerNotice(object sender, SimpleMvvmToolkit.NotificationEventArgs <Core.Model.Order, Core.Model.Customer> e)
        {
            bool selected = false;
            var  vm       = new CustomerSearchViewModel();

            var win = new CustomerSearchView();

            win.Owner       = Application.Current.MainWindow;
            win.DataContext = vm;

            vm.CloseNotice += (ss, ee) =>
            {
                if (vm.SelectedCustomer != null)
                {
                    selected = true;
                    e.Completed(vm.SelectedCustomer);
                }

                win.Close();
            };

            win.txtSearch.Focus();
            win.ShowDialog();

            if (!selected)
            {
                e.Completed(null);
            }
        }
示例#3
0
        void vm_NewTemplateNotice(object sender, SimpleMvvmToolkit.NotificationEventArgs <bool, Core.Model.Setting> e)
        {
            bool isDone = false;
            var  vm     = new Setting();
            var  win    = new NewSettingsWindow();

            win.DataContext    = vm;
            win.btnSave.Click += (ss, ee) =>
            {
                isDone = true;
                win.Close();
                e.Completed(vm);
            };

            win.ShowDialog();

            if (!isDone)
            {
                e.Completed(null);
            }
        }
        void vm_CheckoutNotice(object sender, SimpleMvvmToolkit.NotificationEventArgs <Core.Model.Order, bool> e)
        {
            bool tmp    = false;
            var  payWin = new InvoicePaymentDialog();

            payWin.Owner = Application.Current.MainWindow;

            if (Settings.Default.AutoPrint)
            {
                payWin.paymentView.chkPrint.IsChecked = true;
            }
            else
            {
                payWin.paymentView.chkPrint.IsChecked = false;
            }

            payWin.DataContext = e.Data;
            payWin.paymentView.btnPay.Click += (s, ee) =>
            {
                tmp = true;
                bool print = payWin.paymentView.chkPrint.IsChecked.HasValue && payWin.paymentView.chkPrint.IsChecked.Value;
                payWin.Close();
                e.Completed(true);

                if (print)
                {
                    this.btnPrint.Command.Execute(null);
                }
            };
            payWin.paymentView.txtPaidAmount.Focus();
            payWin.ShowDialog();

            if (!tmp)
            {
                e.Completed(false);
            }
        }