public void Show(UIActionSheetResponse responseCallBack, string title, string subtitle, string acknowledgeButtonTitle) { if (_view.Visible) { return; } _prompt = null; _callback = responseCallBack; if (_titleLabel != null) { _titleLabel.Text = title; } if (_subtitleLabel != null) { _subtitleLabel.Text = subtitle; } _buttonList.ClearList(); _buttonKeyNames.Clear(); var index = _buttonList.AddItem(acknowledgeButtonTitle, UIActionSheetResponseType.Acknowledged); _buttonKeyNames[index] = "Acknowledge"; _buttons = new ButtonCollection(); foreach (var button in _buttonList) { _buttons.Add(button.Index, button); } _view.Show(); }
public void Show(UserPrompt prompt) { _prompt = prompt; _timeOutTime = 0; _callback = null; if (_titleLabel != null) { _titleLabel.Text = prompt.Title; } if (_subtitleLabel != null) { _subtitleLabel.Text = prompt.SubTitle; } _buttonList.ClearList(); foreach (var action in prompt.Actions) { var i = _buttonList.AddItem(action.ActionName, action); switch (action.ActionType) { case PromptActionType.Acknowledge: ((UIActionSheetButtonListItem)_buttonList[i]).ButtonMode = AcknowledgeButtonMode; break; case PromptActionType.Cancel: ((UIActionSheetButtonListItem)_buttonList[i]).ButtonMode = CancelButtonMode; break; case PromptActionType.Reject: ((UIActionSheetButtonListItem)_buttonList[i]).ButtonMode = UIActionSheetButtonMode.Red; break; case PromptActionType.Answer: ((UIActionSheetButtonListItem)_buttonList[i]).ButtonMode = UIActionSheetButtonMode.Green; break; } } _buttons = new ButtonCollection(); foreach (var button in _buttonList) { _buttons.Add(button.Index, button); } _prompt.StateChanged += (userPrompt, state) => { if (state != PromptState.Shown) { _view.Hide(); } }; _view.Show(); }
/// <summary> /// The default Constructor. /// </summary> public UIKeypad(SmartObject smartObject) { CloudLog.Debug("{0}.ctor for SmartObject ID: {1}", GetType(), smartObject.ID); _buttons = new ButtonCollection { { 0, new UIButton(smartObject, 10) } }; for (uint cueIndex = 1; cueIndex <= 9; cueIndex++) { _buttons.Add(cueIndex, new UIButton(smartObject, cueIndex)); } _buttons.Add(10, new UIButton(smartObject, 11)); _buttons.Add(11, new UIButton(smartObject, 12)); foreach (var button in _buttons) { button.HoldTime = TimeSpan.FromSeconds(1); } }
public void Show(UIActionSheetResponse responseCallBack, string title, string subtitle, string cancelButtonTitle, params string[] otherButtons) { if (_view.Visible) { return; } _prompt = null; _callback = responseCallBack; if (_titleLabel != null) { _titleLabel.Text = title; } if (_subtitleLabel != null) { _subtitleLabel.Text = subtitle; } _buttonList.ClearList(); _buttonKeyNames.Clear(); uint i; foreach (var otherButton in otherButtons) { i = _buttonList.AddItem(otherButton, null); ((UIActionSheetButtonListItem)_buttonList[i]).ButtonMode = AcknowledgeButtonMode; _buttonKeyNames[i] = otherButton; } i = _buttonList.AddItem(cancelButtonTitle, UIActionSheetResponseType.Cancelled); ((UIActionSheetButtonListItem)_buttonList[i]).ButtonMode = CancelButtonMode; _buttonKeyNames[i] = "Cancel"; _buttons = new ButtonCollection(); foreach (var button in _buttonList) { _buttons.Add(button.Index, button); } _view.Show(); }
/// <summary> /// Create a UIController instance /// </summary> /// <param name="system">The base system</param> /// <param name="device">The UI device used for the UIController</param> /// <param name="defaultRoom">The default room for the UI</param> protected UIController(SystemBase system, BasicTriList device, RoomBase defaultRoom) { _idCount++; Id = _idCount; _system = system; _system.SystemStartupProgressChange += OnSystemStartupProgressChange; Device = device; DefaultRoom = defaultRoom; CloudLog.Debug("Creating {0} for device: {1} ({2}) with ID 0x{3:X2}", GetType().Name, device.GetType().Name, device.Name, device.ID); try { device.IpInformationChange += DeviceOnIpInformationChange; _isEthernetDevice = true; } catch { CloudLog.Debug("{0} is not Ethernet Device", device.ToString()); } device.OnlineStatusChange += DeviceOnOnlineStatusChange; device.SigChange += OnSigChange; var tswFt5Button = device as TswFt5Button; if (tswFt5Button != null) { tswFt5Button.ExtenderEthernetReservedSigs.Use(); tswFt5Button.ExtenderEthernetReservedSigs.DeviceExtenderSigChange += ExtenderEthernetReservedSigsOnDeviceExtenderSigChange; } var tswx52ButtonVoiceControl = device as Tswx52ButtonVoiceControl; if (tswx52ButtonVoiceControl != null) { tswx52ButtonVoiceControl.ExtenderSystemReservedSigs.Use(); tswx52ButtonVoiceControl.ExtenderAutoUpdateReservedSigs.Use(); tswx52ButtonVoiceControl.ExtenderAutoUpdateReservedSigs.DeviceExtenderSigChange += ExtenderAutoUpdateReservedSigsOnDeviceExtenderSigChange; } var tswX60BaseClass = device as TswX60BaseClass; if (tswX60BaseClass != null) { tswX60BaseClass.ExtenderHardButtonReservedSigs.Use(); Debug.WriteInfo("Setting up hard buttons for TswX60BaseClass device"); _hardButtons = new ButtonCollection(); for (uint b = 1; b <= 5; b++) { var extender = tswX60BaseClass.ExtenderHardButtonReservedSigs; var t = extender.GetType().GetCType(); var offMethod = t.GetMethod(string.Format("TurnButton{0}BackLightOff", b)); var onMethod = t.GetMethod(string.Format("TurnButton{0}BackLightOn", b)); var delType = typeof(HardKeyBackLightMethod).GetCType(); var offDel = (HardKeyBackLightMethod)CDelegate.CreateDelegate(delType, extender, offMethod); var onDel = (HardKeyBackLightMethod)CDelegate.CreateDelegate(delType, extender, onMethod); var button = new UIHardButton(this, b, onDel, offDel); _hardButtons.Add(b, button); } } else if (device is Tswx52ButtonVoiceControl) { Debug.WriteInfo("Setting up hard buttons for Tswx52ButtonVoiceControl device"); _hardButtons = new ButtonCollection(); for (uint b = 1; b <= 5; b++) { var button = new UIHardButton(this, b); _hardButtons.Add(b, button); } } _system.UIControllers.Add(this); }