| | |
| | | /// 提示控件
|
| | | /// </summary>
|
| | | private Tip myTip = null;
|
| | | /// <summary>
|
| | | /// 等待时间
|
| | | /// </summary>
|
| | | private int WaitTime = -1;
|
| | |
|
| | | #endregion
|
| | |
|
| | |
| | | /// <param name="i_msg">信息</param>
|
| | | /// <param name="i_buttonOkText">确认按钮的文本</param>
|
| | | /// <param name="i_buttonCancelText">取消按钮的文本</param>
|
| | | public ShowMsgControl(ShowMsgType i_msgType, string i_msg, string i_buttonOkText = null, string i_buttonCancelText = null)
|
| | | /// <param name="i_waitTime">等待时间,单位为秒,设置确认按钮在多长时间后才能够点击</param>
|
| | | public ShowMsgControl(ShowMsgType i_msgType, string i_msg, string i_buttonOkText = null, string i_buttonCancelText = null, int i_waitTime = -1)
|
| | | {
|
| | | //确认按钮文本
|
| | | this.buttonOkText = i_buttonOkText == null ? Language.StringByID(R.MyInternationalizationString.OkMsg) : i_buttonOkText;
|
| | | this.buttonCancelText = i_buttonCancelText == null ? Language.StringByID(R.MyInternationalizationString.uCancel) : i_buttonCancelText;
|
| | | this.msgType = i_msgType;
|
| | | this.msgText = i_msg;
|
| | | this.WaitTime = i_waitTime;
|
| | |
|
| | | if (i_msgType == ShowMsgType.Tip)
|
| | | {
|
| | |
| | | this.ConfirmClickEvent = null;
|
| | | this.CancelClickEvent = null;
|
| | | };
|
| | | //开启等待时间
|
| | | this.StartWaitTime(btnConfirm);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | this.ConfirmClickEvent = null;
|
| | | };
|
| | | #endif
|
| | | //开启等待时间
|
| | | this.StartWaitTime(btnConfirm);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 开启等待时间_______________________
|
| | |
|
| | | /// <summary>
|
| | | /// 开启等待时间(此函数只用于安卓)
|
| | | /// </summary>
|
| | | /// <param name="btnConfirm">确认按钮</param>
|
| | | private void StartWaitTime(BottomRightClickButton btnConfirm)
|
| | | {
|
| | | if (this.WaitTime <= 0)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | btnConfirm.CanClick = false;
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //显示剩余等待时间
|
| | | while (btnConfirm.Parent != null && this.WaitTime >= 0)
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | btnConfirm.SetButtonText(this.buttonOkText + "(" + this.WaitTime + ")");
|
| | | }, ShowErrorMode.NO);
|
| | | System.Threading.Thread.Sleep(1000);
|
| | | this.WaitTime--;
|
| | | }
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //可以点击
|
| | | btnConfirm.SetButtonText(this.buttonOkText);
|
| | | btnConfirm.CanClick = true;
|
| | | }, ShowErrorMode.NO);
|
| | | });
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 开启等待时间
|
| | | /// </summary>
|
| | | /// <param name="btnConfirm">确认按钮</param>
|
| | | private void StartWaitTime(ButtonBase btnConfirm)
|
| | | {
|
| | | if (this.WaitTime <= 0)
|
| | | {
|
| | | return;
|
| | | }
|
| | | #if Android
|
| | | ((FrameLayoutStatuControl)btnConfirm.Parent).CanClick = false;
|
| | | #endif
|
| | | #if iOS
|
| | | btnConfirm.CanClick = false;
|
| | | #endif
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //显示剩余等待时间
|
| | | while (btnConfirm.Parent != null && this.WaitTime >= 0)
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | btnConfirm.Text = this.buttonOkText + "(" + this.WaitTime + ")";
|
| | | }, ShowErrorMode.NO);
|
| | | System.Threading.Thread.Sleep(1000);
|
| | | this.WaitTime--;
|
| | | }
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //可以点击
|
| | | btnConfirm.Text = this.buttonOkText;
|
| | | #if Android
|
| | | ((FrameLayoutStatuControl)btnConfirm.Parent).CanClick = true;
|
| | | #endif
|
| | | #if iOS
|
| | | btnConfirm.CanClick = true;
|
| | | #endif
|
| | | }, ShowErrorMode.NO);
|
| | | });
|
| | | }
|
| | |
|
| | | #endregion
|