/// <summary> /// Creates a new MessageBoxManager. /// </summary> public MessageBoxManager() { _msgBox = new MessageBox("msgBox", 255, 0, 0, (int)(Glide.LCD.Width * 0.80), 0); _canvas = new Canvas(); _canvas.DrawRectangle(0, 0, 0, 0, Glide.LCD.Width, Glide.LCD.Height, 0, 0, Colors.DarkGray, 0, 0, 0, 0, 0, 125); _result = ModalResult.None; }
private void cancelBtn_TapEvent(object sender) { _result = ModalResult.Cancel; }
/// <summary> /// Shows a MessageBox on screen. /// </summary> /// <param name="message">Message</param> /// <param name="title">Title</param> /// <param name="buttons">MessageBoxButtons constant.</param> /// <returns></returns> public ModalResult Show(string message, string title, ModalButtons buttons) { _window = Glide.MainWindow; _result = ModalResult.None; _resetEvent = new ManualResetEvent(false); while (_msgBox.NumChildren > 0) _msgBox.RemoveChildAt(0); Update(message, title); Button abortBtn, okBtn, cancelBtn, retryBtn, ignoreBtn, yesBtn, noBtn; int startX; int buttonY = _msgBox.Height - 32 - 10; switch (buttons) { case ModalButtons.Ok: okBtn = new Button("okBtn", 255, (_msgBox.Width - 50) / 2, buttonY, 50, 32); okBtn.Text = "Ok"; okBtn.Font = FontManager.GetFont(FontManager.FontType.droid_reg11); okBtn.TapEvent += new OnTap(okBtn_TapEvent); _msgBox.AddChild(okBtn); break; case ModalButtons.OkCancel: startX = (_msgBox.Width - (50 + 5 + 70)) / 2; okBtn = new Button("okBtn", 255, startX, buttonY, 50, 32); okBtn.Text = "Ok"; okBtn.Font = FontManager.GetFont(FontManager.FontType.droid_reg11); okBtn.TapEvent += new OnTap(okBtn_TapEvent); _msgBox.AddChild(okBtn); cancelBtn = new Button("cancelBtn", 255, okBtn.X + okBtn.Width + 5, buttonY, 70, 32); cancelBtn.Text = "Cancel"; cancelBtn.Font = FontManager.GetFont(FontManager.FontType.droid_reg11); cancelBtn.TapEvent += new OnTap(cancelBtn_TapEvent); _msgBox.AddChild(cancelBtn); break; case ModalButtons.RetryCancel: startX = (_msgBox.Width - (60 + 5 + 70)) / 2; retryBtn = new Button("retryBtn", 255, startX, buttonY, 60, 32); retryBtn.Text = "Retry"; retryBtn.Font = FontManager.GetFont(FontManager.FontType.droid_reg11); retryBtn.TapEvent += new OnTap(retryBtn_TapEvent); _msgBox.AddChild(retryBtn); cancelBtn = new Button("cancelBtn", 255, retryBtn.X + retryBtn.Width + 5, buttonY, 70, 32); cancelBtn.Text = "Cancel"; cancelBtn.Font = FontManager.GetFont(FontManager.FontType.droid_reg11); cancelBtn.TapEvent += new OnTap(cancelBtn_TapEvent); _msgBox.AddChild(cancelBtn); break; case ModalButtons.AbortRetryIgnore: startX = (_msgBox.Width - (60 + 5 + 60 + 5 + 70)) / 2; abortBtn = new Button("abortBtn", 255, startX, buttonY, 60, 32); abortBtn.Text = "Abort"; abortBtn.Font = FontManager.GetFont(FontManager.FontType.droid_reg11); abortBtn.TapEvent += new OnTap(abortBtn_TapEvent); _msgBox.AddChild(abortBtn); retryBtn = new Button("retryBtn", 255, abortBtn.X + abortBtn.Width + 5, buttonY, 60, 32); retryBtn.Text = "Retry"; retryBtn.Font = FontManager.GetFont(FontManager.FontType.droid_reg11); retryBtn.TapEvent += new OnTap(retryBtn_TapEvent); _msgBox.AddChild(retryBtn); ignoreBtn = new Button("ignoreBtn", 255, retryBtn.X + retryBtn.Width + 5, buttonY, 70, 32); ignoreBtn.Text = "Ignore"; ignoreBtn.Font = FontManager.GetFont(FontManager.FontType.droid_reg11); ignoreBtn.TapEvent += new OnTap(ignoreBtn_TapEvent); _msgBox.AddChild(ignoreBtn); break; case ModalButtons.YesNo: startX = (_msgBox.Width - (55 + 5 + 60)) / 2; yesBtn = new Button("yesBtn", 255, startX, buttonY, 55, 32); yesBtn.Text = "Yes"; yesBtn.Font = FontManager.GetFont(FontManager.FontType.droid_reg11); yesBtn.TapEvent += new OnTap(yesBtn_TapEvent); _msgBox.AddChild(yesBtn); noBtn = new Button("noBtn", 255, yesBtn.X + yesBtn.Width + 5, buttonY, 50, 32); noBtn.Text = "No"; noBtn.Font = FontManager.GetFont(FontManager.FontType.droid_reg11); noBtn.TapEvent += new OnTap(noBtn_TapEvent); _msgBox.AddChild(noBtn); break; case ModalButtons.YesNoCancel: startX = (_msgBox.Width - (55 + 5 + 50 + 5 + 70)) / 2; yesBtn = new Button("yesBtn", 255, startX, buttonY, 55, 32); yesBtn.Text = "Yes"; yesBtn.Font = FontManager.GetFont(FontManager.FontType.droid_reg11); yesBtn.TapEvent += new OnTap(yesBtn_TapEvent); _msgBox.AddChild(yesBtn); noBtn = new Button("noBtn", 255, yesBtn.X + yesBtn.Width + 5, buttonY, 50, 32); noBtn.Text = "No"; noBtn.Font = FontManager.GetFont(FontManager.FontType.droid_reg11); noBtn.TapEvent += new OnTap(noBtn_TapEvent); _msgBox.AddChild(noBtn); cancelBtn = new Button("cancelBtn", 255, noBtn.X + noBtn.Width + 5, buttonY, 70, 32); cancelBtn.Text = "Cancel"; cancelBtn.Font = FontManager.GetFont(FontManager.FontType.droid_reg11); cancelBtn.TapEvent += new OnTap(cancelBtn_TapEvent); _msgBox.AddChild(cancelBtn); break; } _forceClose = false; _touchThread = new Thread(TouchThread); _touchThread.Priority = ThreadPriority.AboveNormal; _touchThread.Start(); Open(); _resetEvent.WaitOne(); Close(); return _result; }
/// <summary> /// Closes the modal with a default Ok result />. /// </summary> public async Task Close() { await Close(ModalResult.Ok <object>(null)); }
private void Button_Click_2(object sender, RoutedEventArgs e) { modalResult = ModalResult.Debug; Close(); }
private void btNo_Click(object sender, EventArgs e) { Result = ModalResult.No; Close(); }
protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType) { if (control == btnOK) { DialogModalResult = ModalResult.OK; Close(); } if (control == btnCancel) { DialogModalResult = ModalResult.Cancel; Close(); } if (control == SelectionList && actionType == MediaPortal.GUI.Library.Action.ActionType.ACTION_SELECT_ITEM) { if (SelectionList.SelectedListItem != null) { SelectionList.SelectedListItem.Selected = !SelectionList.SelectedListItem.Selected; return; } } base.OnClicked(controlId, control, actionType); }
protected void JoinTable() { BlazoredModal.Close(ModalResult.Ok(JoinTableModal.Amount)); }
protected async Task Submit() { var contractId = await HttpClient.PostJsonAsync <int>("api/contract", Contract); await BlazoredModal.CloseAsync(ModalResult.Ok(contractId)); }
private Task SubmitAsync() { return(this.BlazoredModal.CloseAsync(ModalResult.Ok(this.Item))); }
/// <summary> /// Handles the touch up event. /// </summary> /// <param name="e">Touch event arguments.</param> /// <returns>Touch event arguments.</returns> public override TouchEventArgs OnTouchUp(TouchEventArgs e) { if (_calibrating) { Settings.CX[_currentCalPoint] = (short)e.Point.X; Settings.CY[_currentCalPoint] = (short)e.Point.Y; if (_currentCalPoint == Settings.Points.Length - 1) { _calibrating = false; _canvas.Clear(); Invalidate(); _text1.FontColor = TinyCLR.Glide.Ext.Colors.Blue; _text1.Visible = true; Thread.Sleep(250); //Touch.ActiveTouchPanel.SetCalibration(Settings.Points.Length, Settings.SX, Settings.SY, Settings.CX, Settings.CY); GlideTouch.Calibrated = true; _thread = new Thread(Countdown); _thread.Priority = ThreadPriority.AboveNormal; _thread.Start(); _exitBtn.Visible = true; _startBtn.Visible = true; ModalResult result = ModalResult.Yes; //Glide.MessageBoxManager.Show(String.Empty, "Calibration Complete", ModalButtons.YesNo); try { _thread.Suspend(); _thread = null; } catch { } if (result == ModalResult.Yes) { if (_autoSave) { GlideTouch.SaveCalibration(Settings); _text1.Text = "Calibration set and saved."; } else { _text1.Text = "Calibration set but not saved."; } Thread.Sleep(1000); TriggerCloseEvent(this); } else { if (GlideTouch.CalSettings != null) { //Touch.ActiveTouchPanel.SetCalibration(Settings.Points.Length, Settings.SX, Settings.SY, Settings.CX, Settings.CY); _text1.Text = "Calibration reverted to previous settings."; } else { _text1.Text = "Calibration remains set. Cannot revert; previous settings do not exist."; } } FillRect(_text1.Rect); _text1.Invalidate(); } else { _currentCalPoint++; DrawCrossHair(Settings.Points[_currentCalPoint].X, Settings.Points[_currentCalPoint].Y); } } return(base.OnTouchUp(e)); }
private void btAll_Click(object sender, EventArgs e) { Result = ModalResult.All; Close(); }
private void btCancel_Click(object sender, EventArgs e) { Result = ModalResult.Cancel; Close(); }
private void noBtn_TapEvent(object sender) { _result = ModalResult.No; }
/// <summary> /// Constructor of a Button that should be added to a <see cref="CK.Windows.App.ModalViewModel"/> to specifiy the button to show on the Modal window /// </summary> /// <param name="holder">The <see cref="CK.Windows.App.ModalViewModel"/> which contains this button</param> /// <param name="label">What will be written on the button</param> /// <param name="method">The action when the user clicks on the button - can be null</param> /// <param name="innerValue">The value returned to the <see cref="CK.Windows.App.ModalViewModel"/> when the user chooses this button</param> public ModalButton( ModalViewModel holder, string label, Action method, ModalResult innerValue ) { InnerValue = innerValue; Holder = holder; Method = method; Label = label; }
private void retryBtn_TapEvent(object sender) { _result = ModalResult.Retry; }
/// <summary> /// Constructor of a Button that should be added to a <see cref="CK.Windows.App.ModalViewModel"/> to specifiy the button to show on the Modal window /// </summary> /// <param name="holder">The <see cref="CK.Windows.App.ModalViewModel"/> which contains this button</param> /// <param name="label">What will be written on the button</param> /// <param name="innerValue">The value returned to the <see cref="CK.Windows.App.ModalViewModel"/> when the user chooses this button</param> public ModalButton( ModalViewModel holder, string label, ModalResult innerValue ) :this(holder, label, null, innerValue) { }
protected override void OnClicked(int controlId, GUIControl control, MediaPortal.GUI.Library.Action.ActionType actionType) { if (control == btnOK) { DialogModalResult = ModalResult.OK; Close(); } if (control == btnCancel) { DialogModalResult = ModalResult.Cancel; Close(); } if (control == SelectionList && actionType == MediaPortal.GUI.Library.Action.ActionType.ACTION_SELECT_ITEM) { if (SelectionList.SelectedListItem != null) { SelectionList.SelectedListItem.Selected = !SelectionList.SelectedListItem.Selected; // check if item is a toggle button and change label accordingly if (SelectionList.SelectedListItem.TVTag is bool) { if ((bool)SelectionList.SelectedListItem.TVTag) { string currentStateLabel = SelectionList.SelectedListItem.Label2; SelectionList.SelectedListItem.Label2 = currentStateLabel == Translation.Yes ? Translation.No : Translation.Yes; } } return; } } base.OnClicked(controlId, control, actionType); }
public void Close() { Close(ModalResult.Cancel()); }
protected virtual void Delete() { Result = ModalResult.Deleted; Navigator.PopModalAsync(); }
private void HandleClosed(ModalResult obj) { _ = _resultCompletion.TrySetResult(obj); }
private void Button_Click_1(object sender, RoutedEventArgs e) { modalResult = ModalResult.Ignore; Close(); }
internal void Dismiss(ModalResult result) { Closed.Invoke(result); }
private void btnOk_Click(object sender, RoutedEventArgs e) { modalResult = ModalResult.Ok; Close(); }
private void btYes_Click(object sender, EventArgs e) { Result = ModalResult.Yes; Close(); }
/// <summary> /// Closes the modal and returns a cancelled ModalResult. /// </summary> public async Task Cancel() { await Close(ModalResult.Cancel()); }
private void abortBtn_TapEvent(object sender) { _result = ModalResult.Abort; }
private void ignoreBtn_TapEvent(object sender) { _result = ModalResult.Ignore; }
private void okBtn_TapEvent(object sender) { _result = ModalResult.Ok; }
private void OnExibeMensagemCallback(int Operacao, string Mensagem, ref ModalResult AModalResult) { if (onExibeMensagem.IsAssigned) { ExibeMensagemEventArgs e = new ExibeMensagemEventArgs((OperacaoMensagem)Operacao, FromUTF8(Mensagem)); onExibeMensagem.Raise(e); AModalResult = e.ModalResult; } }
private void yesBtn_TapEvent(object sender) { _result = ModalResult.Yes; }
internal void CancelInstance(Guid Id) { var reference = GetModalReference(Id); CloseInstance(reference, ModalResult.Cancel()); }
/// <summary> /// Обрабатываем выход в систему /// </summary> /// <param name="result">Результат модального окна</param> private void OnLeaveToSystem(ModalResult result) { if (result == ModalResult.Ok) _Game.CloseGame(); else { _CurrentDialog.OnDialogClose -= OnLeaveToSystem; _CurrentDialog = null; } }
internal Task DismissInstance(Guid Id, ModalResult result) { var reference = GetModalReference(Id); return(DismissInstance(reference, result)); }
//////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// public virtual void Close(ModalResult modalResult) { ModalResult = modalResult; Close(); }
internal void CloseInstance(Guid Id) { var reference = GetModalReference(Id); CloseInstance(reference, ModalResult.Ok <object>(null)); }
public new void DoModal(int dwParentId) { m_bRunning = true; DialogModalResult = ModalResult.None; base.DoModal(dwParentId); }
private void Button_Click(object sender, RoutedEventArgs e) { modalResult = ModalResult.Abort; Close(); }
protected virtual void Done() { Result = ModalResult.Done; Navigator.PopModalAsync(); }