Exemple #1
0
        private void TradePickerNewTradeTextBox_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter && !String.IsNullOrEmpty(TradePickerNewTradeTextBox.Text))
            {
                var selectedOrder = (Order)OrdersGrid.SelectedItem;
                var newTrade      = new Trade {
                    Name = TradePickerNewTradeTextBox.Text, Open = true
                };
                Context.Trades.Add(newTrade);
                newTrade.Tags = new List <Tag>();

                Task.Run(() =>
                {
                    TradesRepository.AddOrder(newTrade, selectedOrder);
                    TradesRepository.Save();
                });
                TradePickerNewTradeTextBox.Text   = "";
                OrdersGridTradePickerPopup.IsOpen = false;
                OrdersGrid.CommitEdit();
            }
        }