Beispiel #1
0
 private void CreateCommands(Window window)
 {
     Cancel      = new ContactCancelCommand(window, this);
     Save        = new ContactSaveCommand(window, this);
     Search      = new PersonSearchCommand(window, this);
     Delete      = new PersonDeleteCommand(window, this);
     InvoiceOpen = new InvoiceOpenCommand(window, this);
     InvoiceNew  = new InvoiceNewCommand(window, this);
 }
Beispiel #2
0
        public SearchViewModel(Window window)
        {
            Window        = window as MainWindow;
            Search        = new MainSearchCommand(window, this);
            Open          = new MainOpenCommand(window, this);
            New           = new MainNewCommand(window, this);
            InvoiceSearch = new InvoiceSearchCommand(window, this);
            InvoiceOpen   = new InvoiceOpenCommand(window, this);

            Window.dgrdSearchResult.MouseDoubleClick += (object sender, MouseButtonEventArgs e) => {
                // variables
                DependencyObject source = (DependencyObject)e.OriginalSource;
                DataGridRow      rows   = UIHelper.TryFindParent <DataGridRow>(source);

                // check rows
                if (rows == null)
                {
                    return;
                }

                // try casting to row
                Open.Execute(rows.Item);

                e.Handled = true;
            };

            Window.dgrdInvoiceSearchResult.MouseDoubleClick += (object sender, MouseButtonEventArgs e) => {
                // variables
                DependencyObject source = (DependencyObject)e.OriginalSource;
                DataGridRow      rows   = UIHelper.TryFindParent <DataGridRow>(source);

                // check rows
                if (rows == null)
                {
                    return;
                }

                // try casting to row
                InvoiceOpen.Execute(rows.Item);

                e.Handled = true;
            };
        }