Exemplo n.º 1
0
 private void CancelAll(object param)
 {
     try
     {
         IsCancellAllVisible = false;
         Parallel.ForEach(Orders, async order => { var result = await ExchangeService.CancelOrderAsync(Account.AccountInfo.User, order.Symbol, order.Id, null, 0, ordersCancellationTokenSource.Token); });
         Orders.Clear();
         IsCancellAllVisible = true;
     }
     catch (Exception ex)
     {
         OnException("OrdersViewModel.CancelAll", ex);
     }
 }
Exemplo n.º 2
0
        private async void Cancel(object param)
        {
            try
            {
                var orderId = long.Parse(param.ToString());
                var order   = orders.Single(o => o.Id == orderId);
                order.IsVisible = false;
                var result = await ExchangeService.CancelOrderAsync(Account.AccountInfo.User, order.Symbol, order.Id, null, 0, ordersCancellationTokenSource.Token);

                Orders.Remove(order);
            }
            catch (Exception ex)
            {
                OnException("OrdersViewModel.Cancel", ex);
            }
        }
Exemplo n.º 3
0
        private async Task Cancel(string orderId)
        {
            try
            {
                var order = orders.Single(o => o.Id == orderId);
                order.IsVisible = false;
                var result = await ExchangeService.CancelOrderAsync(Account.AccountInfo.User.Exchange, Account.AccountInfo.User, order.Symbol, order.Id, null, 0, ordersCancellationTokenSource.Token);

                lock (lockOrders)
                {
                    Orders.Remove(order);
                }
            }
            catch (Exception ex)
            {
                OnException("OrdersViewModel.Cancel", ex);
            }
        }
Exemplo n.º 4
0
        private void CancelAll(object param)
        {
            try
            {
                IsCancellAllVisible = false;
                Parallel.ForEach(Orders, async order =>
                {
                    var result = await ExchangeService.CancelOrderAsync(Account.AccountInfo.User.Exchange, Account.AccountInfo.User, order.Symbol, order.Id, null, 0, ordersCancellationTokenSource.Token).ConfigureAwait(false);
                });

                lock (lockOrders)
                {
                    Orders.Clear();
                }

                IsCancellAllVisible = true;
            }
            catch (Exception ex)
            {
                OnException($"{typeof(OrdersViewModel).Name}.{nameof(CancelAll)}", ex);
            }
        }