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(); }
public void Show(UIActionSheetResponse responseCallBack, string title, string subtitle, string[] buttonTitles) { var dict = new Dictionary <string, string>(); foreach (var buttonTitle in buttonTitles) { dict[buttonTitle] = buttonTitle; } Show(responseCallBack, title, subtitle, dict); }
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(); }