Exemple #1
0
        private async void FXTransactionsGrid_OnCellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
        {
            //here we set the trade selected in the picker popup
            if ((string)e.Column.Header == "Trade")
            {
                if (e.EditAction == DataGridEditAction.Commit)
                {
                    var fxt           = (FXTransaction)FXTransactionsGrid.SelectedItem;
                    var items         = FxGridTradePickerListBox.Items.Cast <CheckListItem <Trade> >().ToList();
                    var selectedTrade = items.FirstOrDefault(x => x.IsChecked);

                    if (selectedTrade == null)
                    {
                        await TradesRepository.RemoveFXTransaction(fxt.Trade, fxt).ConfigureAwait(true);
                    }
                    else
                    {
                        await TradesRepository.AddFXTransaction(selectedTrade.Item, fxt).ConfigureAwait(true);
                    }
                }
                await Context.SaveChangesAsync().ConfigureAwait(true);

                FxTransactionsGridTradePickerPopup.IsOpen = false;
            }
        }
Exemple #2
0
 public async Task AddFxTransactionToTrade(Trade trade, FXTransaction fxTransaction)
 {
     await TradesRepository.AddFXTransaction(trade, fxTransaction);
 }