private void UpdateStatus(FocuserStatusUpdatedMessage action) { // This is a registered message handler. It could be called from a worker thread // and we need to be sure that the work is done on the U/I thread. Task.Factory.StartNew(() => { Status = action.Status; IsConnected = Status.Connected; }, CancellationToken.None, TaskCreationOptions.None, Globals.UISyncContext); }
private void UpdateStatus(FocuserStatusUpdatedMessage action) { // This is a registered message handler. It could be called from a worker thread // and we need to be sure that the work is done on the U/I thread. Task.Factory.StartNew(() => { if (Status == null) { // This should happen once, after connection. TargetPosition = action.Status.Position.ToString(); TemperatureOffset = Globals.FocuserTemperatureOffset; } Status = action.Status; }, CancellationToken.None, TaskCreationOptions.None, Globals.UISyncContext); }