コード例 #1
0
ファイル: MessageBoxManager.cs プロジェクト: jakesays/Glide
        /// <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;
        }
コード例 #2
0
ファイル: MessageBoxManager.cs プロジェクト: jakesays/Glide
 private void cancelBtn_TapEvent(object sender)
 {
     _result = ModalResult.Cancel;
 }
コード例 #3
0
ファイル: MessageBoxManager.cs プロジェクト: jakesays/Glide
        /// <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;
        }
コード例 #4
0
 /// <summary>
 /// Closes the modal with a default Ok result />.
 /// </summary>
 public async Task Close()
 {
     await Close(ModalResult.Ok <object>(null));
 }
コード例 #5
0
 private void Button_Click_2(object sender, RoutedEventArgs e)
 {
     modalResult = ModalResult.Debug;
     Close();
 }
コード例 #6
0
 private void btNo_Click(object sender, EventArgs e)
 {
     Result = ModalResult.No;
     Close();
 }
コード例 #7
0
        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);
        }
コード例 #8
0
ファイル: JoinTableBase.cs プロジェクト: BlazorHub/Poker
 protected void JoinTable()
 {
     BlazoredModal.Close(ModalResult.Ok(JoinTableModal.Amount));
 }
コード例 #9
0
        protected async Task Submit()
        {
            var contractId = await HttpClient.PostJsonAsync <int>("api/contract", Contract);

            await BlazoredModal.CloseAsync(ModalResult.Ok(contractId));
        }
コード例 #10
0
 private Task SubmitAsync()
 {
     return(this.BlazoredModal.CloseAsync(ModalResult.Ok(this.Item)));
 }
コード例 #11
0
        /// <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));
        }
コード例 #12
0
 private void btAll_Click(object sender, EventArgs e)
 {
     Result = ModalResult.All;
     Close();
 }
コード例 #13
0
 private void btCancel_Click(object sender, EventArgs e)
 {
     Result = ModalResult.Cancel;
     Close();
 }
コード例 #14
0
ファイル: MessageBoxManager.cs プロジェクト: jakesays/Glide
 private void noBtn_TapEvent(object sender)
 {
     _result = ModalResult.No;
 }
コード例 #15
0
ファイル: ModalViewModel.cs プロジェクト: Nementon/ck-desktop
 /// <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;
 }
コード例 #16
0
ファイル: MessageBoxManager.cs プロジェクト: jakesays/Glide
 private void retryBtn_TapEvent(object sender)
 {
     _result = ModalResult.Retry;
 }
コード例 #17
0
ファイル: ModalViewModel.cs プロジェクト: Nementon/ck-desktop
 /// <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)
 {
 }
コード例 #18
0
        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);
        }
コード例 #19
0
 public void Close()
 {
     Close(ModalResult.Cancel());
 }
コード例 #20
0
 protected virtual void Delete()
 {
     Result = ModalResult.Deleted;
     Navigator.PopModalAsync();
 }
コード例 #21
0
ファイル: ModalReference.cs プロジェクト: tomlii/Modal
 private void HandleClosed(ModalResult obj)
 {
     _ = _resultCompletion.TrySetResult(obj);
 }
コード例 #22
0
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     modalResult = ModalResult.Ignore;
     Close();
 }
コード例 #23
0
ファイル: ModalReference.cs プロジェクト: tomlii/Modal
 internal void Dismiss(ModalResult result)
 {
     Closed.Invoke(result);
 }
コード例 #24
0
 private void btnOk_Click(object sender, RoutedEventArgs e)
 {
     modalResult = ModalResult.Ok;
     Close();
 }
コード例 #25
0
 private void btYes_Click(object sender, EventArgs e)
 {
     Result = ModalResult.Yes;
     Close();
 }
コード例 #26
0
 /// <summary>
 /// Closes the modal and returns a cancelled ModalResult.
 /// </summary>
 public async Task Cancel()
 {
     await Close(ModalResult.Cancel());
 }
コード例 #27
0
 private void btNo_Click(object sender, EventArgs e)
 {
     Result = ModalResult.No;
     Close();
 }
コード例 #28
0
ファイル: MessageBoxManager.cs プロジェクト: jakesays/Glide
 private void abortBtn_TapEvent(object sender)
 {
     _result = ModalResult.Abort;
 }
コード例 #29
0
 private void btCancel_Click(object sender, EventArgs e)
 {
     Result = ModalResult.Cancel;
     Close();
 }
コード例 #30
0
ファイル: MessageBoxManager.cs プロジェクト: jakesays/Glide
 private void ignoreBtn_TapEvent(object sender)
 {
     _result = ModalResult.Ignore;
 }
コード例 #31
0
 private void btAll_Click(object sender, EventArgs e)
 {
     Result = ModalResult.All;
     Close();
 }
コード例 #32
0
ファイル: MessageBoxManager.cs プロジェクト: jakesays/Glide
 private void okBtn_TapEvent(object sender)
 {
     _result = ModalResult.Ok;
 }
コード例 #33
0
ファイル: ACBrTEFD.cs プロジェクト: mjacezar/ACBrFramework
		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;
			}
		}
コード例 #34
0
ファイル: MessageBoxManager.cs プロジェクト: jakesays/Glide
 private void yesBtn_TapEvent(object sender)
 {
     _result = ModalResult.Yes;
 }
コード例 #35
0
        internal void CancelInstance(Guid Id)
        {
            var reference = GetModalReference(Id);

            CloseInstance(reference, ModalResult.Cancel());
        }
コード例 #36
0
 /// <summary>
 /// Обрабатываем выход в систему
 /// </summary>
 /// <param name="result">Результат модального окна</param>
 private void OnLeaveToSystem(ModalResult result)
 {
     if (result == ModalResult.Ok)
     _Game.CloseGame();
       else
       {
     _CurrentDialog.OnDialogClose -= OnLeaveToSystem;
     _CurrentDialog = null;
       }
 }
コード例 #37
0
        internal Task DismissInstance(Guid Id, ModalResult result)
        {
            var reference = GetModalReference(Id);

            return(DismissInstance(reference, result));
        }
コード例 #38
0
 ////////////////////////////////////////////////////////////////////////////    
 ////////////////////////////////////////////////////////////////////////////    
 public virtual void Close(ModalResult modalResult)
 {
     ModalResult = modalResult;
       Close();
 }
コード例 #39
0
        internal void CloseInstance(Guid Id)
        {
            var reference = GetModalReference(Id);

            CloseInstance(reference, ModalResult.Ok <object>(null));
        }
コード例 #40
0
 public new void DoModal(int dwParentId)
 {
     m_bRunning = true;
     DialogModalResult = ModalResult.None;
     base.DoModal(dwParentId);
 }
コード例 #41
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     modalResult = ModalResult.Abort;
     Close();
 }
コード例 #42
0
 protected virtual void Done()
 {
     Result = ModalResult.Done;
     Navigator.PopModalAsync();
 }
コード例 #43
0
 private void btYes_Click(object sender, EventArgs e)
 {
     Result = ModalResult.Yes;
     Close();
 }