示例#1
0
        private async void Update_Click(Object sender, RoutedEventArgs e)
        {
            FrameworkElement fe = sender as FrameworkElement;

            if (fe != null)
            {
                Transaction t = fe.DataContext as Transaction;
                if (t != null)
                {
                    TransactionViewModel.transaction = t;
                    UpdateTransactionDialog tm = new UpdateTransactionDialog(TransactionViewModel);
                    await tm.ShowAsync();
                }
            }
        }
        private void UpdateTransactionButton_Click(object sender, RoutedEventArgs e)
        {
            if (TransactionListView.SelectedItem == null)
            {
                return;
            }

            long     ID                = ((Transactions)TransactionListView.SelectedItem).lID;
            long     updateCounter     = ((Transactions)TransactionListView.SelectedItem).lUpdateCounter;
            string   name              = ((Transactions)TransactionListView.SelectedItem).szName;
            double   amount            = ((Transactions)TransactionListView.SelectedItem).dAmount;
            DateTime date              = ((Transactions)TransactionListView.SelectedItem).TransactionDate;
            long     transactionTypeID = ((Transactions)TransactionListView.SelectedItem).lTransactionTypeID;
            long     accountID         = ((Transactions)TransactionListView.SelectedItem).lAccountID;
            long     projectID         = ((Transactions)TransactionListView.SelectedItem).lProjectID;

            Transactions newTransaction = new Transactions((int)ID, (int)updateCounter, name, (int)transactionTypeID,
                                                           (int)accountID, amount, date, (int)projectID);

            UpdateTransactionDialog updateTransaction = new UpdateTransactionDialog(newTransaction);

            updateTransaction.ShowAsync();
        }