private void UpdateSyncStatusFeedback(uint inputNumber) { var item = _inputList.Cast <RoutingListItem>().FirstOrDefault(i => i.Number == inputNumber); if (item != null) { item.Active = _switcher.Chassis.Inputs[inputNumber].VideoDetectedFeedback.BoolValue; } }
private object UpdateFeedbackProcess(object userSpecific) { CloudLog.Notice("Started " + Thread.CurrentThread.Name); var feedback = true; var itemStates = new Dictionary <RoutingListItem, ItemState>(); while (RequestedVisibleState && !_programStopping && _switcher.Chassis.IsOnline) { if (_selectedInput != null) { _routedOutputsForSelectedInput = new List <DMOutput>(); foreach ( var output in _switcher.Chassis.Outputs.Values.Where( o => o.VideoOutFeedback != null && o.VideoOutFeedback == _selectedInput)) { _routedOutputsForSelectedInput.Add(output); } foreach (var item in _outputList.Cast <RoutingListItem>().TakeWhile(item => item.LinkedObject != null)) { var output = (DMOutput)item.LinkedObject; var alreadyRouted = _routedOutputsForSelectedInput.Contains(output); var willChange = _outputsToChange.Keys.Contains(output); itemStates[item] = new ItemState { Color = RoutingItemListColor.Blue, Feedback = false }; if (alreadyRouted && willChange) { itemStates[item].Color = RoutingItemListColor.Red; itemStates[item].Feedback = feedback; } else if (willChange && _outputsToChange[output] == _selectedInput) { itemStates[item].Color = RoutingItemListColor.Green; itemStates[item].Feedback = feedback; } else if (alreadyRouted) { itemStates[item].Feedback = true; } } } else { foreach (var item in _outputList.Cast <RoutingListItem>().TakeWhile(item => item.LinkedObject != null)) { itemStates[item] = new ItemState { Color = RoutingItemListColor.Blue, Feedback = false }; } } foreach (var itemState in itemStates) { itemState.Key.Feedback = itemState.Value.Feedback; itemState.Key.Color = itemState.Value.Color; } _cancelButton.Enabled = _outputsToChange.Count > 0 || _selectedInput != null; _takeButton.Enabled = _outputsToChange.Count > 0; if (_updateFeedbackEvent.Wait(500)) { feedback = true; } else { feedback = !feedback; } } if (RequestedVisibleState) { Debug.WriteInfo("Showing DM offline prompt on " + UIController.ToString()); ((BaseUIController)UIController).ActionSheetDefault.Show((type, args) => { }, "Switcher Offline", "The DM Switcher is offline", "OK"); } CloudLog.Notice("Exiting " + Thread.CurrentThread.Name); return(null); }