private void statusTimer_Tick(object sender, EventArgs e) { _taskRunner.Post((IUpdateApi api) => { // call Prosoft API function // perform a UI update // use InvokeAsync(), because all UI calls must happen on the UI thread Dispatcher.InvokeAsync(new Action(() => { buyStopLabel_value.Content = api.GetCountOrder(OP_BUYSTOP); buyLimitLabel_value.Content = api.GetCountOrder(OP_BUYLIMIT); sellStopLabel_value.Content = api.GetCountOrder(OP_SELLSTOP); sellLimitLabel_value.Content = api.GetCountOrder(OP_SELLLIMIT); })); }); }