private void cbOrders_CheckedChanged(object sender, EventArgs e) { try { if (cbOrders.CheckState == CheckState.Checked) { if ((_orders != null) && (_orders.Count > 0)) { _orderSubscription = new OrderSubscription(this); string[] ue = (from order in _orders where order.marketData.streamingPricesAvailable select order.marketData.epic) .Distinct().ToArray(); if (ue.Length > 0) { _orderSubscriptionStk = _igStreamApiClient.subscribeToMarketDetails( (from order in _orders where order.marketData.streamingPricesAvailable select order.marketData.epic) .Distinct().ToArray(), _orderSubscription); } else { AppendActivityMessage("These orders do not have streaming prices enabled"); } } else { AppendActivityMessage("there are no Orders to subscribe too. Either server is not responding or there are no orders."); } } else { // Unsubscribe from positions... if ((_orderSubscriptionStk != null) && (_igStreamApiClient != null)) { _igStreamApiClient.UnsubscribeTableKey(_orderSubscriptionStk); } } } catch (Exception ex) { AppendActivityMessage("Warning - problems subscribing to orders : " + ex.Message); } }