陈嘉乐
2020-06-03 f573c74a1b431a6d016d766628f2e6320fa42ff9
ZigbeeApp/Shared/Phone/Device/Logic/LogicView/TipView.cs
old mode 100755 new mode 100644
@@ -115,167 +115,167 @@
                action();
            };
        }
        /// <summary>
        /// 输入框
        /// </summary>
        /// <param name="_if">是否需要取消按钮</param>
        /// <param name="action"></param>
        public static void ShowInputTip(bool _if, Action<string> action)
        {
      /// <summary>
      /// 输入框
      /// </summary>
      /// <param name="_if">是否需要取消按钮</param>
      /// <param name="action"></param>
      public static void ShowInputTip(bool _if, Action<string> action)
      {
            ///主控件
            Dialog dialog = new Dialog();
            dialog.Show();
            ///背景的父控件
            FrameLayout fLayout = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicTranslucentColor };
            dialog.AddChidren(fLayout);
            fLayout.MouseUpEventHandler += (sender, e) =>
            {
                dialog.Close();
            };
            ///弹框父控件
            FrameLayout tipFLayout = new FrameLayout
            {
                X = Application.GetRealWidth(144),
                Y = Application.GetRealHeight(706),
                Width = Application.GetRealWidth(792),
                Height = Application.GetRealHeight(351 + 127),
                BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
                Radius = (uint)Application.GetRealHeight(17)
            };
            fLayout.AddChidren(tipFLayout);
            ///上面快的父控件
            FrameLayout topFrame = new FrameLayout
            {
                Width = Application.GetRealWidth(792),
                Height = Application.GetRealHeight(351),
            };
            tipFLayout.AddChidren(topFrame);
            ///提示控件
            Button tipBtn = new Button
            {
                Y = Application.GetRealHeight(69),
                X = Application.GetRealWidth(150),
                Height = Application.GetRealHeight(63),
                Width = Application.GetRealWidth(492),
               TextID = R.MyInternationalizationString.invalidSetting,
                TextAlignment = TextAlignment.Center,
                TextColor = ZigbeeColor.Current.LogicTipColor,
                TextSize = 16,
         ///主控件
         Dialog dialog = new Dialog();
         dialog.Show();
         ///背景的父控件
         FrameLayout fLayout = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicTranslucentColor };
         dialog.AddChidren(fLayout);
         fLayout.MouseUpEventHandler += (sender, e) =>
         {
            dialog.Close();
         };
         ///弹框父控件
         FrameLayout tipFLayout = new FrameLayout
         {
            X = Application.GetRealWidth(144),
            Y = Application.GetRealHeight(706),
            Width = Application.GetRealWidth(792),
            Height = Application.GetRealHeight(351 + 127),
            BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
            Radius = (uint)Application.GetRealHeight(17)
         };
         fLayout.AddChidren(tipFLayout);
         ///上面快的父控件
         FrameLayout topFrame = new FrameLayout
         {
            Width = Application.GetRealWidth(792),
            Height = Application.GetRealHeight(351),
         };
         tipFLayout.AddChidren(topFrame);
         ///提示控件
         Button tipBtn = new Button
         {
            Y = Application.GetRealHeight(69),
            X = Application.GetRealWidth(150),
            Height = Application.GetRealHeight(63),
            Width = Application.GetRealWidth(492),
            TextID = R.MyInternationalizationString.invalidSetting,
            TextAlignment = TextAlignment.Center,
            TextColor = ZigbeeColor.Current.LogicTipColor,
            TextSize = 16,
            };
            topFrame.AddChidren(tipBtn);
            ///文本1控件
            Button Text1Btn = new Button
            {
                Y = Application.GetRealHeight(187),
                X = Application.GetRealWidth(50),
                Height = Application.GetRealHeight(58),
                Width = Application.GetRealWidth(242 + 94),
                TextID = R.MyInternationalizationString.lockOpen,
                TextAlignment = TextAlignment.CenterRight,
                TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
                TextSize = 14,
         };
         topFrame.AddChidren(tipBtn);
         ///文本1控件
         Button Text1Btn = new Button
         {
            Y = Application.GetRealHeight(187),
            X = Application.GetRealWidth(50),
            Height = Application.GetRealHeight(58),
            Width = Application.GetRealWidth(242 + 94),
            TextID = R.MyInternationalizationString.lockOpen,
            TextAlignment = TextAlignment.CenterRight,
            TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
            TextSize = 14,
            };
            topFrame.AddChidren(Text1Btn);
            ///输入文本框
            EditText editTime = new EditText()
            {
                X = Application.GetRealWidth(409),
                Y = Application.GetRealHeight(173),
                Height = Application.GetRealHeight(81),
                Width = Application.GetRealWidth(132),
                Radius = (uint)Application.GetMinRealAverage(17),
                BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                TextAlignment = TextAlignment.Center,
                TextSize = 14,
                Text = "12",
                IsNumberKeyboardType=true,//只输入数字的属性
            };
            topFrame.AddChidren(editTime);
            ///文本2控件
            Button Text2Btn = new Button
            {
                Y = Application.GetRealHeight(187),
                X = Application.GetRealWidth(564),
                Height = Application.GetRealHeight(58),
                Width = Application.GetRealWidth(51 + 100),
                TextID = R.MyInternationalizationString.hour,
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
                TextSize = 14,
         };
         topFrame.AddChidren(Text1Btn);
         ///输入文本框
         EditText editTime = new EditText()
         {
            X = Application.GetRealWidth(409),
            Y = Application.GetRealHeight(173),
            Height = Application.GetRealHeight(81),
            Width = Application.GetRealWidth(132),
            Radius = (uint)Application.GetMinRealAverage(17),
            BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
            TextColor = ZigbeeColor.Current.LogicTextBlackColor,
            TextAlignment = TextAlignment.Center,
            TextSize = 14,
            Text = "12",
            IsNumberKeyboardType = true,//只输入数字的属性
         };
         topFrame.AddChidren(editTime);
         ///文本2控件
         Button Text2Btn = new Button
         {
            Y = Application.GetRealHeight(187),
            X = Application.GetRealWidth(564),
            Height = Application.GetRealHeight(58),
            Width = Application.GetRealWidth(51 + 100),
            TextID = R.MyInternationalizationString.hour,
            TextAlignment = TextAlignment.CenterLeft,
            TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
            TextSize = 14,
            };
            topFrame.AddChidren(Text2Btn);
         };
         topFrame.AddChidren(Text2Btn);
            ///下面快的父控件
            FrameLayout bottomFrame = new FrameLayout
            {
                Y = topFrame.Bottom,
                Width = Application.GetRealWidth(792),
                Height = Application.GetRealHeight(127),
                Gravity=Gravity.BottomCenter,
            };
            tipFLayout.AddChidren(bottomFrame);
            ///取消控件
            Button cancelBtn = new Button
            {
                TextAlignment = TextAlignment.Center,
                TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
                TextSize = 14,
                Height = bottomFrame.Height,
                Width = Application.GetRealWidth(397),
                BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
                TextID = R.MyInternationalizationString.cancel,
            };
            bottomFrame.AddChidren(cancelBtn);
            ///确认控件
            Button okBtn = new Button
            {
                TextAlignment = TextAlignment.Center,
                TextColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
                TextSize = 14,
                X = cancelBtn.Right,
                Height = bottomFrame.Height,
                Width = bottomFrame.Width - cancelBtn.Width,
                BackgroundColor = ZigbeeColor.Current.LogicBtnTypeColor,
                TextID = R.MyInternationalizationString.confrim,
            };
            bottomFrame.AddChidren(okBtn);
         ///下面快的父控件
         FrameLayout bottomFrame = new FrameLayout
         {
            Y = topFrame.Bottom,
            Width = Application.GetRealWidth(792),
            Height = Application.GetRealHeight(127),
            Gravity = Gravity.BottomCenter,
         };
         tipFLayout.AddChidren(bottomFrame);
         ///取消控件
         Button cancelBtn = new Button
         {
            TextAlignment = TextAlignment.Center,
            TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
            TextSize = 14,
            Height = bottomFrame.Height,
            Width = Application.GetRealWidth(397),
            BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
            TextID = R.MyInternationalizationString.cancel,
         };
         bottomFrame.AddChidren(cancelBtn);
         ///确认控件
         Button okBtn = new Button
         {
            TextAlignment = TextAlignment.Center,
            TextColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
            TextSize = 14,
            X = cancelBtn.Right,
            Height = bottomFrame.Height,
            Width = bottomFrame.Width - cancelBtn.Width,
            BackgroundColor = ZigbeeColor.Current.LogicBtnTypeColor,
            TextID = R.MyInternationalizationString.confrim,
         };
         bottomFrame.AddChidren(okBtn);
            if (_if) {
                cancelBtn.X = Application.GetRealWidth(0);
                cancelBtn.Width = Application.GetRealWidth(0);
                okBtn.X = Application.GetRealWidth(0);
                okBtn.Width = Application.GetRealWidth(792);
                okBtn.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerBottomLeft | HDLUtils.RectCornerBottomRight);
            }
            else
            {
                cancelBtn.X = Application.GetRealWidth(0);
                cancelBtn.Width = Application.GetRealWidth(397);
                okBtn.X = Application.GetRealWidth(397);
                okBtn.Width = bottomFrame.Width - cancelBtn.Width;
                cancelBtn.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerBottomLeft);
                okBtn.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerBottomRight);
         if (_if) {
            cancelBtn.X = Application.GetRealWidth(0);
            cancelBtn.Width = Application.GetRealWidth(0);
            okBtn.X = Application.GetRealWidth(0);
            okBtn.Width = Application.GetRealWidth(792);
            okBtn.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerBottomLeft | HDLUtils.RectCornerBottomRight);
         }
         else
         {
            cancelBtn.X = Application.GetRealWidth(0);
            cancelBtn.Width = Application.GetRealWidth(397);
            okBtn.X = Application.GetRealWidth(397);
            okBtn.Width = bottomFrame.Width - cancelBtn.Width;
            cancelBtn.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerBottomLeft);
            okBtn.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerBottomRight);
            }
            ///取消点击事件
            cancelBtn.MouseUpEventHandler += (sender, e) =>
            {
                dialog.Close();
            };
            ///确认点击事件
            okBtn.MouseUpEventHandler += (sender, e) =>
            {
                if (string.IsNullOrEmpty(editTime.Text))
                {
                    ShowErrorTip(Language.StringByID(R.MyInternationalizationString.timeNull),true);
                    return;
                }
                if (int.Parse(editTime.Text) < 1 || int.Parse(editTime.Text) > 12)
         }
         ///取消点击事件
         cancelBtn.MouseUpEventHandler += (sender, e) =>
         {
            dialog.Close();
         };
         ///确认点击事件
         okBtn.MouseUpEventHandler += (sender, e) =>
         {
            if (string.IsNullOrEmpty(editTime.Text))
            {
               ShowErrorTip(Language.StringByID(R.MyInternationalizationString.timeNull), true);
               return;
            }
            if (int.Parse(editTime.Text) < 1 || int.Parse(editTime.Text) > 12|| int.Parse(editTime.Text)>(int.MaxValue-1))
                {  ///限制输入数字范围;
                    string str = Language.StringByID(R.MyInternationalizationString.less) + Language.StringByID(R.MyInternationalizationString.or) + Language.StringByID(R.MyInternationalizationString.more);
                    ShowErrorTip(str, true);