Пример #1
0
        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);
            }
        }
Пример #2
0
        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);
        }