From 6d73bf6e816570291865674bef8bce8972e4de3f Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期三, 01 十二月 2021 16:32:57 +0800
Subject: [PATCH] 2021-12-01-01

---
 HDL_ON/UI/UI1-Login/LoginPage.cs |  851 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 826 insertions(+), 25 deletions(-)

diff --git a/HDL_ON/UI/UI1-Login/LoginPage.cs b/HDL_ON/UI/UI1-Login/LoginPage.cs
index 4d112ea..bdb35c9 100644
--- a/HDL_ON/UI/UI1-Login/LoginPage.cs
+++ b/HDL_ON/UI/UI1-Login/LoginPage.cs
@@ -1,6 +1,10 @@
 锘縰sing System;
+using System.Collections.Generic;
+using System.Text.RegularExpressions;
 using System.Threading;
+using HDL_ON.Common;
 using HDL_ON.DAL.Server;
+using HDL_ON.Entity;
 using HDL_ON.UI.CSS;
 using Shared;
 
@@ -13,6 +17,10 @@
             //bodyView = new FrameLayout();
             //AddChidren(bodyView);
             bodyView = this;
+            //2020-12-22 澧炲姞鐐瑰嚮闅愯棌閿洏浜嬩欢
+            bodyView.MouseDownEventHandler += (sender, e) => {
+                Application.HideSoftInput();
+            };
             pm = new HttpServerRequest();
         }
 
@@ -24,10 +32,11 @@
                 waitPage.RemoveFromParent();
                 waitPage = null;
             }
-            else
-            {
-                base.RemoveFromParent();
-            }
+
+            base.RemoveFromParent();
+
+            ////2020-12-22 澧炲姞鐐瑰嚮闅愯棌閿洏浜嬩欢
+            //Application.HideSoftInput();
         }
 
         #region 灞�閮ㄥ彉閲�
@@ -144,18 +153,21 @@
 
         string verAccount = "";
 
-        public void VerfifyLogin(string account ) 
-        {
-            verAccount = account;
-            LoadView(account);
-        }
+        /// <summary>
+        /// 
+        /// </summary>
+        string registerPhone;
+        string registerEmail;
+        /// <summary>
+        /// 鎵嬫満鍖哄彿
+        /// </summary>
+        string phoneZoneCode = "86";
 
         /// <summary>
         /// 鍔犺浇瑙嗗浘
         /// </summary>
-        public void LoadView(string account = "")
+        public void LoadView(UserInfo userInfo = null)
         {
-            Language.CurrentLanguage = "Chinese";
             var btnIcon = new Button()
             {
                 X = Application.GetRealWidth(28),
@@ -176,21 +188,75 @@
             };
             bodyView.AddChidren(btnIcon_bg);
 
+#if DEBUG
+            btnIcon_bg.MouseUpEventHandler += (sender, e) =>
+            {
+                return;
+                
+            };
+
+            bool b = false;
             btnIcon.MouseUpEventHandler += (sender, e) =>
             {
-#if DEBUG
-                etAccount.Text = "464027401@qq.com";
-                etPassword.Text = "qqqqqq";
+                //ESOnVideo.Current.Test(false);
+
+                //return;
+                if (b)
+                {
+                    //etAccount.Text = "tf@smarttech.com.ua";//鍥藉璐﹀彿锛屾湁浣忓畢锛岀櫥褰曟棤娉曟樉绀�
+                    //etAccount.Text = "13375012446";//娴嬭瘯鏈嶅姟鍣�
+                    //etAccount.Text = "1033326940@qq.com";
+                    //etAccount.Text = "18022428438";//wjc
+                    //etAccount.Text = "13602944661";//kx
+                    etAccount.Text = "13226233133";//璞嗚眴
+                    etAccount.Text = "18316672920";
+                    //etAccount.Text = "18316120654";//tujie
+                    //etAccount.Text = "15626203746";
+                    //etAccount.Text = "13450425807";//榛勭婧� knx椤圭洰
+                }
+                else
+                {
+                    //etAccount.Text = "15018447586";//闊充箰鏁伴噺鍒锋柊闂
+                    //etAccount.Text = "464027401@qq.com";//
+                    //etAccount.Text = "15217626103";//
+                    //etAccount.Text = "13682244600";//娉㈠摜
+                    etAccount.Text = "13168123446";//鏄嗘槑閲戣寕椤圭洰锛屾柊椋庨棶棰�
+                    //etAccount.Text = "2949126848@qq.com";//闄堢惓
+                    //etAccount.Text = "13415629083";
+                    //etAccount.Text = "13676202754";//宸存灄鏈嶅姟鍣�
+                    //etAccount.Text = "13602944661";//kx
+                    //etAccount.Text = "18666455392";//13375012446//13602944661//tzy 18778381374
+                    //etAccount.Text = "15971583093";//楂樿儨
+                    //etAccount.Text = "15217626103";//鏄嗘槑閲戣寕椤圭洰
+                    //etAccount.Text = "18598273624";
+                    //etAccount.Text = "tf@smarttech.com.ua";
+                    etAccount.Text = "18814122445";//钁f辰鏂� 澶╂渤鍔炲叕瀹�
+                    //etAccount.Text = "18824864143";//"464027401@qq.com"; //"2791308028@qq.com";//13697499568
+                    etAccount.Text = "18402017839";//wjc
+                    //etAccount.Text = "13430286286";//cwc
+                    //etAccount.Text = "13709260805";
+                    //etAccount.Text = "support5@hdlchina.com.cn";
+                    //etAccount.Text = "13375012441";
+                    etAccount.Text = "info@smartlife-ks.com";
+                    etAccount.Text = "551775569@qq.com";//wcf
+                }
+                b = !b;
+                etPassword.Text = "123456";
+                if(etAccount.Text == "fslcjm5@163.com")
+                {
+                    etPassword.Text = "a123456";
+                }
+                //etPassword.Text = "Hdl85521566";
                 btnLogin.IsSelected = true;
-#endif
             };
+#endif
 
             #region 鐧诲綍鏂瑰紡閫夋嫨
             btnPhoneLogin = new Button()
             {
                 X = Application.GetRealWidth(28),
                 Y = Application.GetRealHeight(177),
-                Width = Application.GetRealWidth(120),
+                Width = Application.GetRealWidth(150),
                 Height = Application.GetRealHeight(40),
                 TextID = StringId.LoginByPhone,
                 TextColor = CSS_Color.MainColor,
@@ -201,9 +267,9 @@
 
             btnEmailLogin = new Button()
             {
-                X = btnPhoneLogin.Right + Application.GetRealWidth(20),
+                X = btnPhoneLogin.Right ,//+ Application.GetRealWidth(20),
                 Y = Application.GetRealHeight(177),
-                Width = Application.GetRealWidth(100),
+                Width = Application.GetRealWidth(140),
                 Height = Application.GetRealHeight(40),
                 TextID = StringId.LoginByEmail,
                 TextColor = CSS_Color.PromptingColor1,
@@ -228,11 +294,29 @@
                 Width = Application.GetRealWidth(65),
                 TextAlignment = TextAlignment.Center,
                 TextColor = CSS_Color.FirstLevelTitleColor,
-                Text = "+86",
+                Text = "+" + phoneZoneCode,
                 TextSize = CSS_FontSize.TextFontSize,
+                Enable = true,
             };
+
+            //璺宠浆鍥藉鍖哄彿閫夋嫨鐣岄潰
+            EventHandler<MouseEventArgs> eHandler = (sender, e) =>
+            {
+                JLCountrycode.CountryCodeView.Current.Show((countryName, code) =>
+                {
+                    if (!string.IsNullOrEmpty(code))
+                    {
+                        phoneZoneCode = code;
+                        btnGlobalRoaming.Text = "+" + phoneZoneCode;
+                    }
+                });
+            };
+            btnGlobalRoaming.MouseUpEventHandler += eHandler;
+
             if (loginType == 0)
+            {
                 accountView.AddChidren(btnGlobalRoaming);
+            }
 
             btnDividingLineVertical_AccountView = new Button()
             {
@@ -256,9 +340,10 @@
             };
             accountView.AddChidren(etAccount);
 
-            if (account != "")
+            if (userInfo != null && userInfo.ID != "1234567890")
             {
-                etAccount.Text = account;
+                registerEmail = userInfo.userEmailInfo;
+                etAccount.Text = registerPhone = userInfo.userMobileInfo;
             }
 
             btnAccountViewBottomLine = new Button()
@@ -423,8 +508,8 @@
                 Gravity = Gravity.CenterHorizontal,
                 Y = Application.GetRealHeight(403),
                 Width = Application.GetRealWidth(220),
-                Height = Application.GetRealHeight(44),
-                Radius = (uint)Application.GetRealHeight(22),
+                Height = Application.GetRealWidth(44),
+                Radius = (uint)Application.GetRealWidth(22),
                 SelectedBackgroundColor = CSS_Color.MainColor,
                 BackgroundColor = CSS_Color.PromptingColor1,
                 TextID = StringId.Login,
@@ -434,10 +519,577 @@
             };
             bodyView.AddChidren(btnLogin);
 
+            Button btnDomeLogin = new Button()
+            {
+                Y = btnLogin.Bottom + Application.GetRealHeight(10),
+                Height = Application.GetRealWidth(44),
+                TextSize = CSS_FontSize.SubheadingFontSize,
+                IsBold = true,
+                TextColor = CSS_Color.MainColor,
+                TextAlignment = TextAlignment.Center,
+                Text = "娓稿浣撻獙"
+            };
+            bodyView.AddChidren(btnDomeLogin);
+
+            if(Language.CurrentLanguage!= "Chinese")
+            {
+                btnDomeLogin.Text = "Tourist experience";
+            }
+
+            btnDomeLogin.MouseUpEventHandler = (sender, e) => {
+
+                MainPage.NoLoginMode = true;
+#if DEBUG
+                FileUtlis.Files.DeleteAllFile();
+#endif
+                //DB_ResidenceData.Instance.HomeGateway.gatewayType = "AGATEWAY";
+                //妤煎眰鎴块棿鍒楄〃
+                var floor1 = new SpatialInfo("FLOOR") { roomName = "F1", parentId = DB_ResidenceData.Instance.CurrentRegion.id };
+                floor1.SaveRoomFile();
+                #region 鎴块棿涓� -- 瀹㈠巺
+                //澶勭悊鎴块棿鍒楄〃
+
+                var room1 = new Room()
+                {
+                    roomId = "1405771366041378818",
+                    roomName = Language.CurrentLanguage == "Chinese"? "娲楁墜闂�" : "Restroom",
+                    roomImage = "Classification/Room/Roombg.png",
+                    uid = "47c98953-6fd4-4379-88b9-4b748963504f",
+                    roomType = "ROOM",
+                    parentId = "2348be0f-eec2-43c4-b74d-9b6037a5ba55",
+                    homeId = "1396717478877241345",
+                    createTime = "1623996986290",
+                    modifyTime = "1623996986290",
+                    floorRoomName = "1F-Restroom"
+                };
+                room1.SaveRoomFile();
+                //var room2 = new Room()
+                //{
+                //    roomId = "1405771310345216001",
+                //    roomName = Language.CurrentLanguage == "Chinese"? "涓诲崸" : "Master bedroom",
+                //    roomImage = "Classification/Room/Roombg.png",
+                //    uid = "168d27a1-9e53-42c0-95c9-f5cbf41ea167",
+                //    roomType = "ROOM",
+                //    parentId = "2348be0f-eec2-43c4-b74d-9b6037a5ba55",
+                //    homeId = "1396717478877241345",
+                //    createTime = "1623996973011",
+                //    modifyTime = "1623996973011",
+                //    floorRoomName = "1F-Master bedroom"
+                //};
+                //room2.SaveRoomFile();
+                var room3 = new Room()
+                {
+                    roomId = "1405771193802285057",
+                    roomName = Language.CurrentLanguage == "Chinese"? "椁愬巺" : "Restaurant",
+                    roomImage = "Classification/Room/Roombg.png",
+                    uid = "ed7fc784-aace-44b8-97a3-bc3e727e598b",
+                    roomType = "ROOM",
+                    parentId = "2348be0f-eec2-43c4-b74d-9b6037a5ba55",
+                    homeId = "1396717478877241345",
+                    createTime = "1623996945225",
+                    modifyTime = "1623996945225",
+                    floorRoomName = "1F-Restaurant"
+                };
+                room3.SaveRoomFile();
+                var room4 = new Room()
+                {
+                    roomId = "1405771024583090178",
+                    roomName = Language.CurrentLanguage == "Chinese"? "瀹㈠巺" : "Drawing room",
+                    roomImage = "Classification/Room/Roombg.png",
+                    uid = "9191a3a2-026f-4667-a0b1-e3af699e7295",
+                    roomType = "ROOM",
+                    parentId = "2348be0f-eec2-43c4-b74d-9b6037a5ba55",
+                    homeId = "1396717478877241345",
+                    createTime = "1623996904880",
+                    modifyTime = "1623996904880",
+                    floorRoomName = "1F-Drawing room"
+                };
+                room4.SaveRoomFile();
+                var floor = new SpatialInfo()
+                {
+                    roomId = "1405770943695937537",
+                    roomName = "1F",
+                    roomImage = "Classification/Room/Roombg.png",
+                    uid = "2348be0f-eec2-43c4-b74d-9b6037a5ba55",
+                    roomType = "FLOOR",
+                    parentId = "1396717478877241345",
+                    homeId = "1396717478877241345",
+                    createTime = "1623996885595",
+                    modifyTime = "1623996885595"
+                };
+                floor.SaveRoomFile();
+
+                SpatialInfo.CurrentSpatial.FloorList.Add(floor);
+                SpatialInfo.CurrentSpatial.RoomList.Add(room1);
+                //SpatialInfo.CurrentSpatial.RoomList.Add(room2);
+                SpatialInfo.CurrentSpatial.RoomList.Add(room3);
+                SpatialInfo.CurrentSpatial.RoomList.Add(room4);
+
+
+                #region 瀹㈠巺
+                #region 鍔熻兘
+                var lightRgb1 = new Function()
+                {
+                    sid = "light1",
+                    deviceId = "light1",
+                    name = Language.CurrentLanguage == "Chinese"?  "瀹㈠巺姘涘洿鐏�1": "RGB light 1",
+                    spk = SPK.LightRGB,
+                    roomIds = new List<string>() { "1405771024583090178"},
+                    collect = true,
+                    attributes = new List<FunctionAttributes>()
+                    {
+                        new FunctionAttributes() { key = "on_off",value =new List<string>(){ "on","off" }, curValue="on",state = "on"   },
+                        new FunctionAttributes() { key = "brightness",value =new List<string>(){ "0","100" }, curValue="100",state = "100"   },
+                        new FunctionAttributes() { key = "rgb",value =new List<string>(){ "0","100" }, curValue="0,0,0",state = "0,0,0"   },
+                        //new FunctionAttributes() { key = "fade_time",value =new List<string>(){ "0","100" }, curValue="0",state = "0"   },
+                        new FunctionAttributes() { key = "delay",value =new List<string>(){ "0","100" }, curValue="0",state = "0"   },
+                    },
+                };
+                lightRgb1.SaveFunctionFile();
+                var lightRgb2 = new Function()
+                {
+                    sid = "light2",
+                    deviceId = "light2",
+                    name = Language.CurrentLanguage == "Chinese" ? "瀹㈠巺姘涘洿鐏�2" : "RGB light 2",
+                    spk = SPK.LightRGB,
+                    roomIds = new List<string>() { "1405771024583090178"},
+                    attributes = new List<FunctionAttributes>()
+                    {
+                        new FunctionAttributes() { key = "on_off",value =new List<string>(){ "on","off" }, curValue="on",state = "on"   },
+                        new FunctionAttributes() { key = "brightness",value =new List<string>(){ "0","100" }, curValue="0",state = "0"   },
+                        new FunctionAttributes() { key = "rgb",value =new List<string>(){ "0","100" }, curValue="0,0,0",state = "0,0,0"   },
+                        new FunctionAttributes() { key = "fade_time",value =new List<string>(){ "0","100" }, curValue="0",state = "0"   },
+                        new FunctionAttributes() { key = "delay",value =new List<string>(){ "0","100" }, curValue="0",state = "0"   },
+                    },
+                };
+                lightRgb2.SaveFunctionFile();
+                var lightCct = new Function()
+                {
+                    sid = "light3",
+                    deviceId = "light3",
+                    name = Language.CurrentLanguage == "Chinese" ? "闃呰鐏�" : "CCT light",
+                    spk = SPK.LightCCT,
+                    roomIds = new List<string>() { "1405771024583090178"},
+                    attributes = new List<FunctionAttributes>()
+                    {
+                        new FunctionAttributes() { key = "on_off",value =new List<string>(){ "on","off" }, curValue="on",state = "on"   },
+                        new FunctionAttributes() { key = "brightness",value =new List<string>(){ "0","100" }, curValue="0",state = "0"   },
+                        new FunctionAttributes() { key = "cct",value =new List<string>(){ "0","65535" }, curValue="0",state = "0" ,min = 2700,max = 6500 },
+                        new FunctionAttributes() { key = "fade_time",value =new List<string>(){ "0","100" }, curValue="0",state = "0"   },
+                        new FunctionAttributes() { key = "delay",value =new List<string>(){ "0","100" }, curValue="0",state = "0"   },
+                    },
+                };
+                lightCct.SaveFunctionFile();
+                var lightSwitch1 = new Function()
+                {
+                    sid = "light4",
+                    deviceId = "light4",
+                    name = Language.CurrentLanguage == "Chinese" ? "澶х伅" : "light 1",
+                    spk = SPK.LightDimming,
+                    roomIds = new List<string>() { "1405771024583090178" },
+                    attributes = new List<FunctionAttributes>()
+                    {
+                        new FunctionAttributes() { key = "on_off",value =new List<string>(){ "on","off" }, curValue="on",state = "on"   },
+                        new FunctionAttributes() { key = "brightness",value =new List<string>(){ "0","100" }, curValue="100",state = "100"   },
+                        new FunctionAttributes() { key = "fade_time",value =new List<string>(){ "0","100" }, curValue="0",state = "0"   },
+                    },
+                };
+                lightSwitch1.SaveFunctionFile();
+                var lightSwitch2 = new Function()
+                {
+                    sid = "light5",
+                    deviceId = "light5",
+                    name = Language.CurrentLanguage == "Chinese" ? "寮�鍏崇伅" : "light 2",
+                    spk = SPK.LightSwitch,
+                    roomIds = new List<string>() { "1405771024583090178"},
+                    attributes = new List<FunctionAttributes>()
+                    {
+                        new FunctionAttributes() { key = "on_off",value =new List<string>(){ "on","off" }, curValue="on",state = "on"   },
+                        new FunctionAttributes() { key = "fade_time",value =new List<string>(){ "0","100" }, curValue="0",state = "0"   },
+                    },
+                };
+                lightSwitch2.SaveFunctionFile();
+                var curtain1 = new Function()
+                {
+                    sid = "curtain1",
+                    deviceId = "curtain1",
+                    name = Language.CurrentLanguage == "Chinese" ? "寮�鍚堝笜" : "Curtain 1",
+                    spk = SPK.CurtainTrietex,
+                    roomIds = new List<string>() { "1405771024583090178"},
+                    attributes = new List<FunctionAttributes>()
+                    {
+                        new FunctionAttributes() { key = "on_off",value =new List<string>(){ "on","off" }, curValue="on",state = "on"   },
+                        new FunctionAttributes() { key = "percent",value =new List<string>(){ "0","100" }, curValue="0",state = "0"   },
+                    },
+                };
+                curtain1.SaveFunctionFile();
+                var curtain2 = new Function()
+                {
+                    sid = "curtain2",
+                    deviceId = "curtain2",
+                    name = Language.CurrentLanguage == "Chinese" ? "鍗峰笜" : "Curtain 2",
+                    spk = SPK.CurtainRoller,
+                    roomIds = new List<string>() { "1405771024583090178"},
+                    attributes = new List<FunctionAttributes>()
+                    {
+                        new FunctionAttributes() { key = "on_off",value =new List<string>(){ "on","off" }, curValue="on",state = "on"   },
+                        new FunctionAttributes() { key = "percent",value =new List<string>(){ "0","100" }, curValue="0",state = "0"   },
+                    },
+                };
+                curtain2.SaveFunctionFile();
+                var fh = new Function()
+                {
+                    sid = "floorheat1",
+                    deviceId = "floorheat1",
+                    name = Language.CurrentLanguage == "Chinese" ? "鍦版殩" : "Floorheat 1",
+                    spk = SPK.FloorHeatStandard,
+                    roomIds = new List<string>() { "1405771024583090178"},
+                    attributes = new List<FunctionAttributes>()
+                    {
+                        new FunctionAttributes() { key = "on_off",value =new List<string>(){ "on","off" }, curValue="on",state = "on"   },
+                        new FunctionAttributes() { key = "mode",value =new List<string>(){ "day", "night", "away", "normal", "timer" }, curValue="day",state = "day"   },
+                        new FunctionAttributes() { key = "set_temp",value =new List<string>(){ "" }, curValue="26",state = "26" ,max = 35,min = 5  },
+                        new FunctionAttributes() { key = "room_temp",value =new List<string>(){ "" }, curValue="26",state = "26"   },
+                    },
+                };
+                fh.SaveFunctionFile();
+                #endregion
+                #region 鍦烘櫙
+                var scene1 = new Scene()
+                {
+                    sid = "scene1",
+                    userSceneId = "scene1",
+                    name = Language.CurrentLanguage == "Chinese" ? "鏄庝寒妯″紡" : "Bright scene",
+                    roomIds = new List<string>() { "1405771024583090178" },
+                    gatewayId = "1234567890123456",
+                    collect = true,
+                    functions = new List<SceneFunction>()
+                    {
+                        new SceneFunction()
+                        {
+                            sid = lightRgb1.sid,
+                            status = new List<SceneFunctionStatus>()
+                            {
+                                new SceneFunctionStatus()
+                                {
+                                    key = "on_off",
+                                    value = "on",
+                                }
+                            }
+                        },
+                        new SceneFunction()
+                        {
+                            sid = lightRgb2.sid,
+                            status = new List<SceneFunctionStatus>()
+                            {
+                                new SceneFunctionStatus()
+                                {
+                                    key = "on_off",
+                                    value = "on",
+                                }
+                            }
+                        },
+                        new SceneFunction()
+                        {
+                            sid = lightCct.sid,
+                            status = new List<SceneFunctionStatus>()
+                            {
+                                new SceneFunctionStatus()
+                                {
+                                    key = "on_off",
+                                    value = "on",
+                                }
+                            }
+                        },
+                        new SceneFunction()
+                        {
+                            sid = lightSwitch1.sid,
+                            status = new List<SceneFunctionStatus>()
+                            {
+                                new SceneFunctionStatus()
+                                {
+                                    key = "on_off",
+                                    value = "on",
+                                }
+                            }
+                        },
+                        new SceneFunction()
+                        {
+                            sid = lightSwitch2.sid,
+                            status = new List<SceneFunctionStatus>()
+                            {
+                                new SceneFunctionStatus()
+                                {
+                                    key = "on_off",
+                                    value = "on",
+                                }
+                            }
+                        },
+
+
+                    },
+                };
+                scene1.SaveSceneFile();
+                var scene2 = new Scene()
+                {
+                    sid = "scene2",
+                    userSceneId = "scene2",
+                    name = Language.CurrentLanguage == "Chinese" ? "娴极妯″紡" : "Romantic scene",
+                    roomIds = new List<string>() { "1405771024583090178" },
+                    gatewayId = "1234567890123456",
+                    collect = false,
+                    functions = new List<SceneFunction>()
+                    {
+                        new SceneFunction()
+                        {
+                            sid = lightRgb1.sid,
+                            status = new List<SceneFunctionStatus>()
+                            {
+                                new SceneFunctionStatus()
+                                {
+                                    key = "on_off",
+                                    value = "on",
+                                }
+                            }
+                        },
+                        new SceneFunction()
+                        {
+                            sid = lightRgb2.sid,
+                            status = new List<SceneFunctionStatus>()
+                            {
+                                new SceneFunctionStatus()
+                                {
+                                    key = "on_off",
+                                    value = "on",
+                                }
+                            }
+                        },
+                        new SceneFunction()
+                        {
+                            sid = lightCct.sid,
+                            status = new List<SceneFunctionStatus>()
+                            {
+                                new SceneFunctionStatus()
+                                {
+                                    key = "on_off",
+                                    value = "on",
+                                }
+                            }
+                        },
+                        new SceneFunction()
+                        {
+                            sid = lightSwitch1.sid,
+                            status = new List<SceneFunctionStatus>()
+                            {
+                                new SceneFunctionStatus()
+                                {
+                                    key = "on_off",
+                                    value = "off",
+                                }
+                            }
+                        },
+                        new SceneFunction()
+                        {
+                            sid = lightSwitch2.sid,
+                            status = new List<SceneFunctionStatus>()
+                            {
+                                new SceneFunctionStatus()
+                                {
+                                    key = "on_off",
+                                    value = "off",
+                                }
+                            }
+                        },
+
+
+                    },
+
+                };
+                scene2.SaveSceneFile();
+                #endregion
+                #endregion
+                #region 椁愬巺
+                var lightSwitch3 = new Function()
+                {
+                    sid = "light6",
+                    deviceId = "light6",
+                    name = Language.CurrentLanguage == "Chinese" ? "椁愬巺鐏�1" : "Dining room light 1",
+                    spk = SPK.LightDimming,
+                    roomIds = new List<string>() { room3.roomId },
+                    attributes = new List<FunctionAttributes>()
+                    {
+                        new FunctionAttributes() { key = "on_off",value =new List<string>(){ "on","off" }, curValue="on",state = "on"   },
+                        new FunctionAttributes() { key = "brightness",value =new List<string>(){ "0","100" }, curValue="100",state = "100"   },
+                        new FunctionAttributes() { key = "fade_time",value =new List<string>(){ "0","100" }, curValue="0",state = "0"   },
+                    },
+                };
+                lightSwitch3.SaveFunctionFile();
+                var lightSwitch4 = new Function()
+                {
+                    sid = "light7",
+                    deviceId = "light7",
+                    name = Language.CurrentLanguage == "Chinese" ? "椁愬巺鐏�2" : "Dining room light 2",
+                    spk = SPK.LightSwitch,
+                    roomIds = new List<string>() { room3.roomId },
+                    attributes = new List<FunctionAttributes>()
+                    {
+                        new FunctionAttributes() { key = "on_off",value =new List<string>(){ "on","off" }, curValue="on",state = "on"   },
+                        new FunctionAttributes() { key = "fade_time",value =new List<string>(){ "0","100" }, curValue="0",state = "0"   },
+                    },
+                };
+                lightSwitch4.SaveFunctionFile();
+                var scene3 = new Scene()
+                {
+                    sid = "scene3",
+                    userSceneId = "scene3",
+                    name = Language.CurrentLanguage == "Chinese" ? "娓╅Θ妯″紡" : "Warm scene",
+                    roomIds = new List<string>() { room3.roomId },
+                    gatewayId = "1234567890123456",
+                    collect = true,
+                    functions = new List<SceneFunction>()
+                    {
+                        new SceneFunction()
+                        {
+                            sid = lightSwitch4.sid,
+                            status = new List<SceneFunctionStatus>()
+                            {
+                                new SceneFunctionStatus()
+                                {
+                                    key = "on_off",
+                                    value = "off",
+                                }
+                            }
+                        },
+                        new SceneFunction()
+                        {
+                            sid = lightSwitch4.sid,
+                            status = new List<SceneFunctionStatus>()
+                            {
+                                new SceneFunctionStatus()
+                                {
+                                    key = "on_off",
+                                    value = "off",
+                                }
+                            }
+                        },
+                    }
+                };
+                scene3.SaveSceneFile();
+                var scene4 = new Scene()
+                {
+                    sid = "scene4",
+                    userSceneId = "scene4",
+                    name = Language.CurrentLanguage == "Chinese" ? "瑗块妯″紡" : "Western food mode",
+                    roomIds = new List<string>() { room3.roomId },
+                    gatewayId = "1234567890123456",
+                    collect = false,
+                    functions = new List<SceneFunction>()
+                    {
+                        new SceneFunction()
+                        {
+                            sid = lightSwitch4.sid,
+                            status = new List<SceneFunctionStatus>()
+                            {
+                                new SceneFunctionStatus()
+                                {
+                                    key = "on_off",
+                                    value = "on",
+                                }
+                            }
+                        },
+                        new SceneFunction()
+                        {
+                            sid = lightSwitch4.sid,
+                            status = new List<SceneFunctionStatus>()
+                            {
+                                new SceneFunctionStatus()
+                                {
+                                    key = "on_off",
+                                    value = "on",
+                                }
+                            }
+                        },
+                    }
+                };
+                scene4.SaveSceneFile();
+                #endregion
+                #region 鍗у
+                var ac = new Function()
+                {
+                    sid = "ac1",
+                    deviceId = "ac1",
+                    name = Language.CurrentLanguage == "Chinese" ? "鍗у绌鸿皟" : "Bedroom air conditioning",
+                    spk = SPK.AcStandard,
+                    roomIds = new List<string>() { room3.roomId },
+                    attributes = new List<FunctionAttributes>()
+                    {
+                        new FunctionAttributes() { key = "on_off", value = new List<string>() { "on", "off" }, curValue = "on", state = "on" },
+                        new FunctionAttributes() { key = "mode", value = new List<string>() { "cool", "heat", "fan", "auto", "dry" }, curValue = "cool", state = "cool" },
+                        new FunctionAttributes() { key = "fan", value = new List<string>() { "high", "medium", "low", "auto" }, curValue = "auto", state = "auto" },
+                        new FunctionAttributes() { key = "set_temp", value = new List<string>() { "16", "30"}, curValue = "16", state = "16",max = 30,min = 16 },
+                        new FunctionAttributes() { key = "room_temp", value = new List<string>() { }, curValue = "20", state = "20" },
+                        new FunctionAttributes() { key = "swing", value = new List<string>() {"up_down", "left_right", "stop" }, curValue = "20", state = "20" },
+                    }
+                };
+                ac.SaveFunctionFile();
+                //var scene5 = new Scene()
+                //{
+                //    sid = "scene5",
+                //    userSceneId = "scene5",
+                //    name = Language.CurrentLanguage == "Chinese" ? "闃呰" : "Reading mode",
+                //    roomIds = new List<string>() { room2.roomId },
+                //    gatewayId = "1234567890123456",
+                //    collect = true,
+                //};
+                //scene5.SaveSceneFile();
+                //var scene6 = new Scene()
+                //{
+                //    sid = "scene6",
+                //    userSceneId = "scene6",
+                //    name = Language.CurrentLanguage == "Chinese" ? "璧峰簥" : "Wake up scene",
+                //    roomIds = new List<string>() { room2.roomId },
+                //    gatewayId = "1234567890123456",
+                //    collect = false,
+                //};
+                //scene6.SaveSceneFile();
+                #endregion
+
+
+                var lightSwitch6 = new Function()
+                {
+                    sid = "lightSwitch6",
+                    deviceId = "lightSwitch6",
+                    name = Language.CurrentLanguage == "Chinese" ? "娲楁墜闂寸伅" : "Toilet light",
+                    spk = SPK.LightSwitch,
+                    roomIds = new List<string>() { room1.roomId },
+                    attributes = new List<FunctionAttributes>()
+                    {
+                        new FunctionAttributes() { key = "on_off",value =new List<string>(){ "on","off" }, curValue="on",state = "on"   },
+                        new FunctionAttributes() { key = "fade_time",value =new List<string>(){ "0","100" }, curValue="0",state = "0"   },
+                    },
+                };
+                lightSwitch6.SaveFunctionFile();
+
+                #endregion
+
+                var fileList = Common.FileUtlis.Files.ReadFiles();
+                foreach(var file in fileList)
+                {
+                    FunctionList.List.IniFunctionList(file,true);
+                }
+                Room.CurrentSpatial.InitRoomListFunctions();
+
+
+
+                MainPage.GoUserPage(false);
+            };
+
+
+
             LoadEventList();
             account = etAccount.Text.Trim();
 
-            #if DEBUG
+            #if DEBUG1211
             //鏈湴妯″紡
             Button btnLocalMode = new Button()
             {
@@ -453,7 +1105,7 @@
             btnLocalMode.MouseUpEventHandler = (sender, e) =>
             {
                 MainPage.LocalMode = true;
-                MainPage.LoginUser = new UserInfo();
+                 UserInfo.Current = new UserInfo();
                 MainPage.GoUserPage();
             };
 
@@ -461,6 +1113,155 @@
 
             #endif
 
+            #region 闅愮鏀跨瓥
+            AddServiceAgreementControl(bodyView);
+            #endregion
+
         }
+
+        #region 鈻� 鏈嶅姟鍗忚___________________________
+        bool isAgreePrivacyPolicy = false;
+        /// <summary>
+        /// 娣诲姞鏈嶅姟鍗忚鎺т欢
+        /// </summary>
+        /// <param name="frameBack"></param>
+        private void AddServiceAgreementControl(FrameLayout frameLayout)
+        {
+            isAgreePrivacyPolicy = OnAppConfig.Instance.isAgreePrivacyPolicy;
+            var frameRow = new FrameLayout()
+            {
+                Height = Application.GetRealHeight(28),
+                Y = Application.GetRealHeight(628),
+            };
+            frameLayout.AddChidren(frameRow);
+
+            //鍚屾剰鎸夐挳鑳屾櫙
+            var agreeView = new FrameLayout()
+            {
+                Height = Application.GetRealHeight(28),
+                Width = Application.GetRealWidth(28),
+                X = Application.GetRealWidth(22),
+            };
+            frameRow.AddChidren(agreeView);
+            if(Language.CurrentLanguage == "Chinese")
+            {
+                agreeView.X = Application.GetRealWidth(52);
+            }
+            //鍚屾剰鍥炬爣鎸夐挳
+            var agreeBtn = new Button()
+            {
+                Width = Application.GetMinRealAverage(28),
+                Height = Application.GetMinRealAverage(28),
+                UnSelectedImagePath = "Public/ChooseIcon.png",
+                SelectedImagePath = "Public/ChooseOnIcon.png",
+                IsSelected = isAgreePrivacyPolicy,
+                Gravity = Gravity.Center
+            };
+            agreeView.AddChidren(agreeBtn);
+
+            EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
+            {
+                isAgreePrivacyPolicy = !isAgreePrivacyPolicy;
+                agreeBtn.IsSelected = isAgreePrivacyPolicy;
+                OnAppConfig.Instance.isAgreePrivacyPolicy = isAgreePrivacyPolicy;
+                OnAppConfig.Instance.SaveConfig();
+            };
+
+            agreeBtn.MouseUpEventHandler = eventHandler;
+            agreeView.MouseUpEventHandler = eventHandler;
+
+            //int btnWidth = 0;
+            //鍚屾剰鏂囨湰
+            var agreeTextBtn = new TextButton()
+            {
+                X = agreeView.Right,
+                Width = Application.GetRealWidth(28),
+                Height = Application.GetRealHeight(28),
+                TextColor = CSS_Color.TextualColor,
+                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+                TextID = StringId.Agree
+            };
+            frameRow.AddChidren(agreeTextBtn);
+            agreeTextBtn.Width = Utlis.GetRealWidthByTextButton(agreeTextBtn);
+
+            //鐢ㄦ埛鍗忚鎸夐挳
+            var userAgreementBtn = new TextButton()
+            {
+                X = agreeTextBtn.Right,
+                Width = Application.GetRealWidth(28),
+                Height = Application.GetRealHeight(28),
+                TextColor = CSS_Color.MainColor,
+                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+                Text = "銆�" + Language.StringByID(StringId.UserAgreement) + "銆�"
+            };
+            frameRow.AddChidren(userAgreementBtn);
+            userAgreementBtn.Width = Utlis.GetRealWidthByTextButton(userAgreementBtn);
+
+            //鍜屾枃鏈�
+            var andTextBtn = new TextButton()
+            {
+                X = userAgreementBtn.Right,
+                Width = Application.GetRealWidth(28),
+                Height = Application.GetRealHeight(28),
+                TextColor = CSS_Color.TextualColor,
+                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+                TextID = StringId.And
+            };
+            frameRow.AddChidren(andTextBtn);
+            andTextBtn.Width = Utlis.GetRealWidthByTextButton(andTextBtn);
+
+            //闅愮鏀跨瓥鎸夐挳
+            var privacyPolicyBtn = new TextButton()
+            {
+                X = andTextBtn.Right,
+                Width = Application.GetRealWidth(28),
+                Height = Application.GetRealHeight(28),
+                TextColor = CSS_Color.MainColor,
+                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+                Text = "銆�" + Language.StringByID(StringId.PrivacyPolicy) + "銆�"
+            };
+            frameRow.AddChidren(privacyPolicyBtn);
+            privacyPolicyBtn.Width = Utlis.GetRealWidthByTextButton(privacyPolicyBtn);
+
+            //鎵撳紑鐢ㄦ埛鍗忚
+            userAgreementBtn.MouseUpEventHandler = (sender, e) =>
+            {
+                OpenWebViewPage(false);
+            };
+
+            //鎵撳紑闅愮鏀跨瓥
+            privacyPolicyBtn.MouseUpEventHandler = (sender, e) =>
+            {
+                OpenWebViewPage(true);
+            };
+        }
+
+        /// <summary>
+        /// OpenWebViewPage
+        /// </summary>
+        /// <param name="isOpenPrivacyPolicy">鏄惁闅愮鏀跨瓥</param>
+        private void OpenWebViewPage(bool isOpenPrivacyPolicy)
+        {
+            string url = isOpenPrivacyPolicy ? Constant.URL_PRIVACYPOLICY : Constant.URL_USERAGREEMENT;
+            string titleStr = isOpenPrivacyPolicy ? Language.StringByID(StringId.PrivacyPolicy) : Language.StringByID(StringId.UserAgreement);
+            new WebViewDialog().LoadPage(titleStr, url);
+        }
+
+        /// <summary>
+        /// 妫�娴嬮殣绉佸崗璁�
+        /// </summary>
+        /// <returns></returns>
+        private bool CheckPrivacyPolicy()
+        {
+            if (isAgreePrivacyPolicy == false)
+            {
+                //璇峰悓鎰忋�婄敤鎴峰崗璁�嬪拰銆婇殣绉佹斂绛栥��
+                Utlis.ShowTip(Language.StringByID(StringId.PleaseReadAndAgreePrivacyPolicyMsg));
+                return false;
+            }
+            return true;
+        }
+
+        #endregion
     }
 }
\ No newline at end of file

--
Gitblit v1.8.0