CrabtreeOn,印度客户定制APP,迁移2.0平台版本
2021-03-24 1.修改时间选择控件不调用系统的时间选择器,实现自定义时间选择器。   2.优化注册和忘记密码页面,增加倒计时和重发按钮功能
8个文件已修改
420 ■■■■ 已修改文件
Crabtree/.vs/SmartHome/xs/UserPrefs.xml 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Crabtree/ON.Ios/Resources/Language.ini 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Crabtree/ON/Assets/Language.ini 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Crabtree/SmartHome/UI/SimpleControl/Phone/Register/AccountLogin.cs 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Crabtree/SmartHome/UI/SimpleControl/Phone/Register/AccountRegistration.cs 85 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Crabtree/SmartHome/UI/SimpleControl/Phone/Register/ForgotPassword.cs 83 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Crabtree/SmartHome/UI/SimpleControl/Phone/Schedule/AddSchedule.cs 220 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Crabtree/SmartHome/UI/SimpleControl/R.cs 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Crabtree/.vs/SmartHome/xs/UserPrefs.xml
@@ -1,15 +1,12 @@
<Properties StartupConfiguration="{1D83BF28-BA88-4152-BA41-D7EFE90A5437}|Default">
  <MonoDevelop.Ide.ItemProperties.ON.Droid PreferredExecutionTarget="Android.Android_Accelerated_Oreo" />
  <MonoDevelop.Ide.Workbench>
    <Files>
      <File FileName="SmartHome/UI/SimpleControl/Phone/Schedule/Method.cs" Line="83" Column="20" />
    </Files>
    <Pads>
      <Pad Id="ProjectPad">
        <State name="__root__">
          <Node name="SmartHome" expanded="True">
            <Node name="ON.Droid" expanded="True" selected="True">
              <Node name="Properties" expanded="True" />
            <Node name="ON.Droid" expanded="True">
              <Node name="Assets" expanded="True" />
            </Node>
            <Node name="Shared" expanded="True">
              <Node name="DLL" expanded="True" />
@@ -26,8 +23,12 @@
              <Node name="UI" expanded="True">
                <Node name="SimpleControl" expanded="True">
                  <Node name="Phone" expanded="True">
                    <Node name="Register" expanded="True" />
                    <Node name="Scene" expanded="True" />
                    <Node name="Schedule" expanded="True" />
                    <Node name="Schedule" expanded="True">
                      <Node name="Method.cs" selected="True" />
                    </Node>
                    <Node name="User" expanded="True" />
                  </Node>
                </Node>
              </Node>
@@ -45,7 +46,7 @@
    <String>IosService/IosService.csproj</String>
    <String>DroidService/DroidService.csproj</String>
  </DisabledProjects>
  <MonoDevelop.Ide.Workspace ActiveConfiguration="Release|iPhone" />
  <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|iPhone" />
  <MonoDevelop.Ide.ItemProperties.ON.Ios automaticSigning="False" PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.00008030-00014C392121802E" />
  <MonoDevelop.Ide.DebuggingService.Breakpoints>
    <BreakpointStore>
Crabtree/ON.Ios/Resources/Language.ini
@@ -1110,6 +1110,7 @@
20059=Device and scene data are successfully synchronized to the cloud!
20060=Failed to sync the device and scene data to the cloud!
20061=Do you want to synchronize all local devices and scenes to the cloud? This will be used for schedule and alexa control functions.
20062=Resend
[Chinese]
1=你好
@@ -2222,7 +2223,7 @@
20059=Device and scene data are successfully synchronized to the cloud!
20060=Failed to sync the device and scene data to the cloud!
20061=Do you want to synchronize all local devices and scenes to the cloud? This will be used for schedule and alexa control functions.
20062=Resend
[Czech]
1=Nazdar
Crabtree/ON/Assets/Language.ini
@@ -1110,6 +1110,7 @@
20059=Device and scene data are successfully synchronized to the cloud!
20060=Failed to sync the device and scene data to the cloud!
20061=Do you want to synchronize all local devices and scenes to the cloud? This will be used for schedule and alexa control functions.
20062=Resend
[Chinese]
1=你好
@@ -2222,6 +2223,7 @@
20059=Device and scene data are successfully synchronized to the cloud!
20060=Failed to sync the device and scene data to the cloud!
20061=Do you want to synchronize all local devices and scenes to the cloud? This will be used for schedule and alexa control functions.
20062=Resend
[Czech]
Crabtree/SmartHome/UI/SimpleControl/Phone/Register/AccountLogin.cs
@@ -83,8 +83,8 @@
            //etAccount.Text = "18824864143";
            //etAccount.Text = "cjl@hdlchina.com.cn";
            //etAccount.Text = "2791308028@qq.com";
            etAccount.Text = "858539859@qq.com";
            etAccount.Text = "2791308028@qq.com";
            //etAccount.Text = "858539859@qq.com";
#endif
            accountView.AddChidren (etAccount);
@@ -138,7 +138,8 @@
            };
#if DEBUG
            //etPasswrod.Text = "123456";
            etPasswrod.Text = "123456-Aa";
            //etPasswrod.Text = "123456-Aa";
            etPasswrod.Text = "123456-Bb";
#endif
            passwrodView.AddChidren (etPasswrod);
Crabtree/SmartHome/UI/SimpleControl/Phone/Register/AccountRegistration.cs
@@ -1,5 +1,6 @@
using System;
using System.Text.RegularExpressions;
using System.Threading;
namespace Shared.SimpleControl.Phone
{
@@ -157,7 +158,9 @@
        /// </summary>
        /// <param name="account">账号 邮箱或者手机号</param>
        /// <param name="isPhone">是否是手机</param>
        void SendVerificationCode (string account, bool isPhone = true)
        /// <param name="isResend"></param>
        /// <param name="btnResend"></param>
        void SendVerificationCode (string account, bool isPhone = true, bool isResend = false, Button btnResend = null)
        {
            MainPage.Loading.Start (Language.StringByID (R.MyInternationalizationString.load));
            System.Threading.Tasks.Task.Run (() => {
@@ -165,9 +168,14 @@
                    var requestRevertObj = HttpServerRequest.Current.VerificationCodeSend (VerifyType.REGISTER_USER, account);
                    if (requestRevertObj.Code == StateCode.SUCCESS) {
                        Application.RunOnMainThread (() => {
                            // isPhone 是否是手机
                            InitSMSView (account, false);
                            bodyPageView.PageIndex = bodyPageView.ChildrenCount - 1;
                            if (isResend) {
                                //如果是重发的
                                StartCountdown (btnResend);
                            } else {
                                // isPhone 是否是手机
                                InitSMSView (account, false);
                                bodyPageView.PageIndex = bodyPageView.ChildrenCount - 1;
                            }
                        });
                    } else {
                        //提示错误
@@ -328,9 +336,12 @@
            mobileChencView.AddChidren (btnTitle);
            EditText etCode = new EditText () {
                Width = Application.GetRealWidth (500),
                //Width = Application.GetRealWidth (500),
                //Height = Application.GetRealWidth (85),
                //Gravity = Gravity.CenterHorizontal,
                Width = Application.GetRealWidth (390),
                Height = Application.GetRealWidth (85),
                Gravity = Gravity.CenterHorizontal,
                X = Application.GetRealWidth (70),
                Y = btnTitle.Bottom,
                BorderWidth = 1,
                Radius = 5,
@@ -339,6 +350,33 @@
                TextColor = SkinStyle.Current.TextColor1
            };
            mobileChencView.AddChidren (etCode);
            Button btnResend = new Button () {
                Y = btnTitle.Bottom,
                X = etCode.Right + Application.GetRealWidth (10),
                Width = Application.GetRealWidth (100),
                Height = Application.GetRealWidth (85),
                BackgroundColor = SkinStyle.Current.MainColor,
                SelectedBackgroundColor = SkinStyle.Current.SelectedColor,
                //TextID = R.MyInternationalizationString.Resend,
                Text = "Resend",
                TextColor = SkinStyle.Current.TextColor1,
                Radius = 5,
                BorderColor = SkinStyle.Current.Transparent,
                BorderWidth = 0,
                TextSize = 15,
                TextAlignment = TextAlignment.Center,
            };
            mobileChencView.AddChidren (btnResend);
            btnResend.MouseDownEventHandler += (sender, e) => {
                btnResend.IsSelected = true;
            };
            btnResend.MouseUpEventHandler += (sender, e) => {
                btnResend.IsSelected = false;
                Resend (mAccount, btnResend);
            };
            StartCountdown (btnResend);
            Button btnConfirem = new Button () {
                Gravity = Gravity.CenterHorizontal,
@@ -442,6 +480,41 @@
        }
        /// <summary>
        /// 重发
        /// </summary>
        void Resend (string account, Button btnResend)
        {
            SendVerificationCode (account, false, true, btnResend);
        }
        /// <summary>
        /// 开始计时
        /// </summary>
        /// <param name="btnResend"></param>
        void StartCountdown (Button btnResend)
        {
            if (btnResend == null) return;
            btnResend.Enable = false;
            int time = 60;
            //2.1获取验证码倒计时
            new Thread (() => {
                while (time > 0) {
                    time--;
                    Application.RunOnMainThread (() => {
                        btnResend.Text = time.ToString () + "s";
                    });
                    Thread.Sleep (1000);
                }
                Application.RunOnMainThread (() => {
                    //回复获取短信按钮事件
                    btnResend.Enable = true;
                    btnResend.TextID = R.MyInternationalizationString.Resend;
                });
            }) { IsBackground = true }.Start ();
        }
    }
}
Crabtree/SmartHome/UI/SimpleControl/Phone/Register/ForgotPassword.cs
@@ -1,5 +1,6 @@
using System;
using System.Text.RegularExpressions;
using System.Threading;
namespace Shared.SimpleControl.Phone
{
@@ -160,7 +161,7 @@
        /// </summary>
        /// <param name="account">账号 邮箱或者手机号</param>
        /// <param name="isPhone">是否是手机</param>
        void SendVerificationCode (string account, bool isPhone = true)
        void SendVerificationCode (string account, bool isPhone = true, bool isResend = false, Button btnResend = null)
        {
            MainPage.Loading.Start (Language.StringByID (R.MyInternationalizationString.load));
            System.Threading.Tasks.Task.Run (() => {
@@ -168,8 +169,14 @@
                    var requestRevertObj = HttpServerRequest.Current.VerificationCodeSend (VerifyType.FIND_PASSWORD, account);
                    if (requestRevertObj.Code.ToUpper () == StateCode.SUCCESS) {
                        Application.RunOnMainThread (() => {
                            InitSMSView (account, false);
                            bodyPageView.PageIndex = bodyPageView.ChildrenCount - 1;
                            if (isResend) {
                                //如果是重发的
                                StartCountdown (btnResend);
                            } else {
                                InitSMSView (account, false);
                                bodyPageView.PageIndex = bodyPageView.ChildrenCount - 1;
                            }
                        });
                    } else {
                        //提示错误
@@ -271,9 +278,10 @@
            mobileChencView.AddChidren (btnTitle);
            EditText etCode = new EditText () {
                Width = Application.GetRealWidth (500),
                Width = Application.GetRealWidth (390),
                Height = Application.GetRealWidth (85),
                Gravity = Gravity.CenterHorizontal,
                //Gravity = Gravity.CenterHorizontal,
                X = Application.GetRealWidth (70),
                Y = btnTitle.Bottom,
                BorderWidth = 1,
                Radius = 5,
@@ -282,6 +290,32 @@
                TextColor = SkinStyle.Current.TextColor1
            };
            mobileChencView.AddChidren (etCode);
            Button btnResend = new Button () {
                Y = btnTitle.Bottom,
                X = etCode.Right + Application.GetRealWidth (10),
                Width = Application.GetRealWidth (100),
                Height = Application.GetRealWidth (85),
                BackgroundColor = SkinStyle.Current.MainColor,
                SelectedBackgroundColor = SkinStyle.Current.SelectedColor,
                //TextID = R.MyInternationalizationString.Resend,
                Text = "Resend",
                TextColor = SkinStyle.Current.TextColor1,
                Radius = 5,
                BorderColor = SkinStyle.Current.Transparent,
                BorderWidth = 0,
                TextSize = 15,
                TextAlignment = TextAlignment.Center,
            };
            mobileChencView.AddChidren (btnResend);
            btnResend.MouseDownEventHandler += (sender, e) => {
                btnResend.IsSelected = true;
            };
            btnResend.MouseUpEventHandler += (sender, e) => {
                btnResend.IsSelected = false;
                Resend (mAccount, btnResend);
            };
            StartCountdown (btnResend);
            Button btnConfirem = new Button () {
                Y = etCode.Bottom + Application.GetRealWidth (50),
@@ -366,6 +400,45 @@
        }
        /// <summary>
        /// 重发
        /// </summary>
        void Resend (string account, Button btnResend)
        {
            SendVerificationCode (account, false, true, btnResend);
        }
        /// <summary>
        /// 开始计时
        /// </summary>
        /// <param name="btnResend"></param>
        void StartCountdown (Button btnResend)
        {
            if (btnResend == null) return;
            btnResend.Enable = false;
            int time = 60;
            //2.1获取验证码倒计时
            new Thread (() =>
            {
                while (time > 0) {
                    time--;
                    Application.RunOnMainThread (() =>
                    {
                        btnResend.Text = time.ToString () + "s";
                    });
                    Thread.Sleep (1000);
                }
                Application.RunOnMainThread (() =>
                {
                    //回复获取短信按钮事件
                    btnResend.Enable = true;
                    btnResend.TextID = R.MyInternationalizationString.Resend;
                });
            }) { IsBackground = true }.Start ();
        }
    }
Crabtree/SmartHome/UI/SimpleControl/Phone/Schedule/AddSchedule.cs
@@ -177,65 +177,69 @@
            timeView.AddChidren (btnTimelbl);
            btnTimelbl.MouseUpEventHandler += (timeSender, eee) => {
                var dialog = new Dialog ();
                var chooseTimeBodyView = new FrameLayout () {
                };
                dialog.AddChidren (chooseTimeBodyView);
                var chooseTime = new TimeView () {
                    Y = Application.GetRealHeight (1136 - 420 - 90),
                    Height = Application.GetRealHeight (420),
                    BackgroundColor = 0xFFD7D7D7,
                    //BackgroundColor = SkinStyle.Current.ViewColor,
                };
                chooseTimeBodyView.AddChidren (chooseTime);
                ShowTimePickerView (btnTimelbl);
                return;
                var bottomView = new FrameLayout () {
                    Y = chooseTime.Bottom,
                    Height = Application.GetRealHeight (90) + 1,
                    BackgroundColor = 0xFFD7D7D7,
                };
                chooseTimeBodyView.AddChidren (bottomView);
                //var dialog = new Dialog ();
                //var chooseTimeBodyView = new FrameLayout () {
                //};
                //dialog.AddChidren (chooseTimeBodyView);
                var btnCloseTime = new Button () {
                    Y = 1,
                    Width = Application.GetRealWidth (320),
                    BackgroundColor = SkinStyle.Current.ViewColor,
                    TextID = R.MyInternationalizationString.Close,
                    TextAlignment = TextAlignment.Center,
                    TextColor = SkinStyle.Current.TextColor1,
                };
                bottomView.AddChidren (btnCloseTime);
                btnCloseTime.MouseUpEventHandler += (ddf, dddf) => {
                    chooseTimeBodyView.RemoveAll ();
                    chooseTimeBodyView.RemoveFromParent ();
                    dialog.Close ();
                };
                //var chooseTime = new TimeView () {
                //    Y = Application.GetRealHeight (1136 - 420 - 90),
                //    Height = Application.GetRealHeight (420),
                //    BackgroundColor = 0xFFD7D7D7,
                //    //BackgroundColor = SkinStyle.Current.ViewColor,
                //};
                //chooseTimeBodyView.AddChidren (chooseTime);
                var btnSaveTime = new Button () {
                    X = btnCloseTime.Right + 1,
                    Y = 1,
                    Width = Application.GetRealWidth (320),
                    TextID = R.MyInternationalizationString.SAVE,
                    BackgroundColor = SkinStyle.Current.ViewColor,
                    TextAlignment = TextAlignment.Center,
                    TextColor = SkinStyle.Current.TextColor1,
                };
                bottomView.AddChidren (btnSaveTime);
                btnSaveTime.MouseUpEventHandler += (sender3, e3) => {
                    // var chooseHour = chooseTime.Hour - timerTemp.TimeZone;
                    var chooseTimeString = chooseTime.Hour.ToString ().PadLeft (2, '0') + ":" + chooseTime.Minute.ToString ().PadLeft (2, '0');
                    //if (chooseTime.Hour > 12) {
                    //    chooseTimeString = (chooseTime.Hour -12) + ":" + chooseTime.Minute + " PM";
                    //} else {
                    //    chooseTimeString = chooseTime.Hour + ":" + chooseTime.Minute + " AM";
                    //}
                    btnTimelbl.Text = chooseTimeString;
                    dialog.Close ();
                };
                //var bottomView = new FrameLayout () {
                //    Y = chooseTime.Bottom,
                //    Height = Application.GetRealHeight (90) + 1,
                //    BackgroundColor = 0xFFD7D7D7,
                //};
                //chooseTimeBodyView.AddChidren (bottomView);
                //var btnCloseTime = new Button () {
                //    Y = 1,
                //    Width = Application.GetRealWidth (320),
                //    BackgroundColor = SkinStyle.Current.ViewColor,
                //    TextID = R.MyInternationalizationString.Close,
                //    TextAlignment = TextAlignment.Center,
                //    TextColor = SkinStyle.Current.TextColor1,
                //};
                //bottomView.AddChidren (btnCloseTime);
                //btnCloseTime.MouseUpEventHandler += (ddf, dddf) => {
                //    chooseTimeBodyView.RemoveAll ();
                //    chooseTimeBodyView.RemoveFromParent ();
                //    dialog.Close ();
                //};
                //var btnSaveTime = new Button () {
                //    X = btnCloseTime.Right + 1,
                //    Y = 1,
                //    Width = Application.GetRealWidth (320),
                //    TextID = R.MyInternationalizationString.SAVE,
                //    BackgroundColor = SkinStyle.Current.ViewColor,
                //    TextAlignment = TextAlignment.Center,
                //    TextColor = SkinStyle.Current.TextColor1,
                //};
                //bottomView.AddChidren (btnSaveTime);
                //btnSaveTime.MouseUpEventHandler += (sender3, e3) => {
                //    // var chooseHour = chooseTime.Hour - timerTemp.TimeZone;
                //    var chooseTimeString = chooseTime.Hour.ToString ().PadLeft (2, '0') + ":" + chooseTime.Minute.ToString ().PadLeft (2, '0');
                //    //if (chooseTime.Hour > 12) {
                //    //    chooseTimeString = (chooseTime.Hour -12) + ":" + chooseTime.Minute + " PM";
                //    //} else {
                //    //    chooseTimeString = chooseTime.Hour + ":" + chooseTime.Minute + " AM";
                //    //}
                //    btnTimelbl.Text = chooseTimeString;
                //    dialog.Close ();
                //};
                dialog.Show ();
                //dialog.Show ();
            };
            #endregion
@@ -729,6 +733,116 @@
            };
        }
        /// <summary>
        /// 自定义TimePickerView
        /// 2021-03-24
        /// </summary>
        void ShowTimePickerView (Button btnTimelbl)
        {
            var chooseTimeString = "00:00";
            var dialog = new Dialog ();
            var chooseTimeBodyView = new FrameLayout () {
            };
            dialog.AddChidren (chooseTimeBodyView);
            var chooseTime = new UIPickerView () {
                Y = Application.GetRealHeight (1136 - 420 - 90),
                Height = Application.GetRealHeight (420),
                BackgroundColor = 0xFFD7D7D7,
                //BackgroundColor = SkinStyle.Current.ViewColor,
            };
            chooseTimeBodyView.AddChidren (chooseTime);
            var bottomView = new FrameLayout () {
                Y = chooseTime.Bottom,
                Height = Application.GetRealHeight (90) + 1,
                BackgroundColor = 0xFFD7D7D7,
            };
            chooseTimeBodyView.AddChidren (bottomView);
            var btnCloseTime = new Button () {
                Y = 1,
                Width = Application.GetRealWidth (320),
                BackgroundColor = SkinStyle.Current.ViewColor,
                TextID = R.MyInternationalizationString.Close,
                TextAlignment = TextAlignment.Center,
                TextColor = SkinStyle.Current.TextColor1,
            };
            bottomView.AddChidren (btnCloseTime);
            btnCloseTime.MouseUpEventHandler += (ddf, dddf) => {
                chooseTimeBodyView.RemoveAll ();
                chooseTimeBodyView.RemoveFromParent ();
                dialog.Close ();
            };
            var btnSaveTime = new Button () {
                X = btnCloseTime.Right + 1,
                Y = 1,
                Width = Application.GetRealWidth (320),
                TextID = R.MyInternationalizationString.SAVE,
                BackgroundColor = SkinStyle.Current.ViewColor,
                TextAlignment = TextAlignment.Center,
                TextColor = SkinStyle.Current.TextColor1,
            };
            bottomView.AddChidren (btnSaveTime);
            btnSaveTime.MouseUpEventHandler += (sender3, e3) => {
                btnTimelbl.Text = chooseTimeString;
                dialog.Close ();
            };
            var nowDateTime = DateTime.Now;
            var hour = nowDateTime.Hour;
            //hourStr
            var hourStr = hour.ToString();
            if (hour < 10) {
                hourStr = "0" + hour;
            }
            var minute = nowDateTime.Minute;
            //minuteStr
            var minuteStr = minute.ToString ();
            if (minute < 10) {
                minuteStr = "0" + minute;
            }
            var hourList = new List<string> ();
            for (int i = 0; i < 24; i++) {
                if (i < 10) {
                    var a = "0" + i.ToString ();
                    hourList.Add (a);
                } else {
                    hourList.Add (i.ToString ());
                }
            }
            var minuteList = new List<string> ();
            for (int i = 0; i < 60; i++) {
                if (i < 10) {
                    var a = "0" + i.ToString ();
                    minuteList.Add (a);
                } else {
                    minuteList.Add (i.ToString ());
                }
            }
            chooseTime.setNPicker (hourList, minuteList, null);
            chooseTime.setCurrentItems (hour, minute, 0);
            chooseTimeString = hourStr + ":" + minuteStr;
            //string selectde = "";
            chooseTime.OnSelectChangeEvent += (s1, s2, s3) => {
                var hourV = hourList [s1];
                var minuteV = minuteList [s2];
                chooseTimeString = hourV + ":" + minuteV;
            };
            dialog.Show ();
        }
        /// <summary>
        /// 加载房间设备列表界面
        /// </summary>
Crabtree/SmartHome/UI/SimpleControl/R.cs
@@ -1204,7 +1204,10 @@
        /// Do you want to synchronize all local devices and scenes to the cloud? This will be used for timer and alexa voice control functions.
        /// </summary>
        public const int DoYouWantToSynchronizeToTheCloud = 20061;
        /// <summary>
        /// Resend
        /// </summary>
        public const int Resend = 20062;
        #endregion
    }
}