using 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; namespace HDL_ON.UI.UI1Login { public partial class LoginPage : FrameLayout { public LoginPage() { //bodyView = new FrameLayout(); //AddChidren(bodyView); bodyView = this; //2020-12-22 增加点击隐藏键盘事件 bodyView.MouseDownEventHandler += (sender, e) => { Application.HideSoftInput(); }; pm = new HttpServerRequest(); #if __ANDROID__ BaseActivity.HideKeyboardEvent = () => { if (this.Y != 0) { Application.RunOnMainThread(() => { try { this.Y = 0; } catch { } }); } }; BaseActivity.ShowKeyboardEvent = () => { try { if (etPassword.Foucs) { new Thread(() => { for (var i = 0; i < 10; i++) { Application.RunOnMainThread(() => { try { this.Y = 0 - Application.GetRealHeight(10 * i); } catch { } }); Thread.Sleep(10); } }) { IsBackground = true }.Start(); } } catch { } }; BaseActivity.SmsAction = (message) => { Console.WriteLine($"接收到短信:"+ message); string pattern = @"【HDL】.*(\d{6}).*"; Regex regex = new Regex(pattern); Match match = regex.Match(message); if (match.Success) { string code = match.Groups[1].Value; Console.WriteLine("验证码为:" + code); if(loginType==0 && logintMode == 1) { etPassword.Text = code; } smsCode = code; } else { Console.WriteLine("未找到验证码!"); } }; #endif } public override void RemoveFromParent() { //如果当前界面存在正在等待数据的情况,先将该动作关掉 if (waitPage != null) { waitPage.RemoveFromParent(); waitPage = null; } #if __ANDROID__ BaseActivity.HideKeyboardEvent = () => { }; BaseActivity.ShowKeyboardEvent = () => { }; BaseActivity.SmsAction = (sms) => { }; #endif base.RemoveFromParent(); //2020-12-22 增加点击隐藏键盘事件 //Application.HideSoftInput(); } #region 局部变量 /// /// 登录类型 /// 0:手机 /// 1:邮箱 /// int loginType = 0; /// /// 登录方式 /// 0:密码 /// 1:验证码 /// int logintMode = 0; string account = ""; string password = ""; /// /// 短信验证码 /// string smsCode = ""; #endregion #region 控件列表 /// /// 等待提示 /// Loading waitPage; /// /// 当前界面 /// FrameLayout bodyView; /// /// 选择手机登录按钮 /// Button btnPhoneLogin; /// /// 选择邮箱登录按钮 /// Button btnEmailLogin; /// /// 账号子区域 /// FrameLayout accountView; /// /// 国际区号按钮 /// Button btnGlobalRoaming; /// /// 账号子区域里面的分割线 /// Button btnDividingLineVertical_AccountView; /// /// 账号文本框 /// EditText etAccount; /// /// 账号Icon按钮 /// Button btnAccountIcon; /// /// 密码子区域 /// FrameLayout passwordView; /// /// 密码Icon按钮 /// Button btnPasswordIcon; /// /// 密码文本框 /// EditText etPassword; /// /// 密码子区域里面的分割线1 /// Button btnDividingLineVertical_PasswordView1; /// /// 密码子区域里面的分割线2 /// Button btnDividingLineVertical_PasswordView2; /// /// 忘记密码按钮 /// Button btnForgetPassword; /// /// 获取手机验证码按钮 /// Button btnGetVerificationCode; /// /// 密码是否可见按钮 /// Button btnVisiblePassword; /// /// 账号子区域底部横线 /// Button btnAccountViewBottomLine; /// /// 密码子区域底部横线 /// Button btnPasswordViewBottomLine; /// /// 注册按钮 /// Button btnRegister; /// /// 验证码登录按钮 /// Button btnSwitchLoginMode; /// /// 登录按钮 /// Button btnLogin; /// /// 服务器请求对象 /// HttpServerRequest pm; #endregion string verAccount = ""; /// /// /// string registerPhone; string registerEmail; /// /// 手机区号 /// string phoneZoneCode = "86"; /// /// 加载视图 /// public void LoadView(UserInfo userInfo = null) { #if __Android__ OnAppConfig.Instance.isAgreePrivacyPolicy = true; #endif var btnIcon = new Button() { X = Application.GetRealWidth(28), Y = Application.GetRealHeight(73), Width = Application.GetMinRealAverage(62), Height = Application.GetMinRealAverage(62), UnSelectedImagePath = "Public/Logo.png", }; bodyView.AddChidren(btnIcon); var btnIcon_bg = new Button() { X = Application.GetRealWidth(171), Y = Application.GetRealHeight(69), Width = Application.GetMinRealAverage(254), Height = Application.GetMinRealAverage(156), UnSelectedImagePath = "Public/Logo-bg.png" }; bodyView.AddChidren(btnIcon_bg); btnIcon_bg.MouseDownEventHandler += (sender, e) => { Application.HideSoftInput(); }; #if DEBUG btnIcon_bg.MouseUpEventHandler += (sender, e) => { return; }; bool b = false; btnIcon.MouseUpEventHandler += (sender, e) => { //ESOnVideo.Current.Test(false); //return; if (b) { //etAccount.Text = "1033326940@qq.com"; //etAccount.Text = "18022428438";//wjc //etAccount.Text = "13602944661";//kx //etAccount.Text = "13226233133";//豆豆 //etAccount.Text = "18316120654";//tujie //etAccount.Text = "13450425807";//黄竹溪 knx项目 //etAccount.Text = "tf@smarttech.com.ua"; //etAccount.Text = "455740454@qq.com"; //etAccount.Text = "18688565449"; //etAccount.Text = "18570064522"; //etAccount.Text = "18718417827"; //etAccount.Text = "18188019284"; //etAccount.Text = "13143792049"; //etAccount.Text = "13288623489";//罗晓东 //etAccount.Text = "18244942707"; //etAccount.Text = "13143792049"; etAccount.Text = "18688414428";//天河3楼 //etAccount.Text = "18244942707"; //etAccount.Text = "12345678904"; //etAccount.Text = "13418062953"; etAccount.Text = "13138683659"; //etAccount.Text = "15217626103"; //etAccount.Text = "18100573477"; //etAccount.Text = "18321091245"; //etAccount.Text = "13751916353"; etAccount.Text = "13549566666"; etAccount.Text = "18316672920"; etAccount.Text = "support7@hdlautomation.com"; etAccount.Text = "13375012446";//测试服务器 } else { //etAccount.Text = "464027401@qq.com";// //etAccount.Text = "15217626103";// etAccount.Text = "13168123446";//昆明金茂项目,新风问题 //etAccount.Text = "2949126848@qq.com";//陈琳 etAccount.Text = "15014291819 "; //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";//董泽斌 天河办公室 //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 etAccount.Text = "15626203746"; //etAccount.Text = "zhangquansongjava@163.com"; //etAccount.Text = "s.savinov@hdlautomation.ru"; } b = !b; etPassword.Text = "123456"; if(etAccount.Text == "18188019284") { etPassword.Text = "CEZUJHSZ"; } else if(etAccount.Text == "13143792049") { etPassword.Text = "BVVBQATD"; }else if(etAccount.Text == "13288623489") { etPassword.Text = "luoxiaodong"; }else if(etAccount.Text == "18688414428") { etPassword.Text = "HDL1985000"; }else if (etAccount.Text == "13138683659") { etPassword.Text = "wsad123321"; } else if (etAccount.Text == "18100573477") { etPassword.Text = "huang12345"; }else if(etAccount.Text == "13549566666") { etPassword.Text = "12345678"; } //etPassword.Text = "Hdl85521566"; btnLogin.IsSelected = true; }; #endif #region 登录方式选择 btnPhoneLogin = new Button() { X = Application.GetRealWidth(28), Y = Application.GetRealHeight(177), Width = Application.GetRealWidth(150), Height = Application.GetRealHeight(40), TextID = StringId.LoginByPhone, TextColor = CSS_Color.MainColor, TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.EmphasisFontSize_Secondary, }; bodyView.AddChidren(btnPhoneLogin); btnEmailLogin = new Button() { X = btnPhoneLogin.Right ,//+ Application.GetRealWidth(20), Y = Application.GetRealHeight(177), Width = Application.GetRealWidth(140), Height = Application.GetRealHeight(40), TextID = StringId.LoginByEmail, TextColor = CSS_Color.PromptingColor1, TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.TextFontSize, }; bodyView.AddChidren(btnEmailLogin); #endregion #region 账号填写 accountView = new FrameLayout() { X = Application.GetRealWidth(28), Y = Application.GetRealHeight(232), Width = Application.GetRealWidth(319), Height = Application.GetRealHeight(44), }; bodyView.AddChidren(accountView); btnGlobalRoaming = new Button() { Width = Application.GetRealWidth(65), TextAlignment = TextAlignment.Center, TextColor = CSS_Color.FirstLevelTitleColor, Text = "+" + phoneZoneCode, TextSize = CSS_FontSize.TextFontSize, Enable = true, }; //跳转国家区号选择界面 EventHandler 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() { X = Application.GetRealWidth(65), Gravity = Gravity.CenterVertical, Width = 1, Height = Application.GetRealHeight(20), BackgroundColor = CSS_Color.DividingLineColor, }; accountView.AddChidren(btnDividingLineVertical_AccountView); etAccount = new EditText() { X = Application.GetRealWidth(78), Width = Application.GetRealWidth(319 - 78), TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.TextFontSize, PlaceholderTextColor = CSS_Color.PromptingColor1, PlaceholderText = Language.StringByID(StringId.PlsEntryPhoneNumber), TextAlignment = TextAlignment.CenterLeft, }; accountView.AddChidren(etAccount); if (userInfo != null && userInfo.ID != "1234567890") { registerEmail = userInfo.userEmailInfo; etAccount.Text = registerPhone = userInfo.userMobileInfo; } btnAccountViewBottomLine = new Button() { Y = Application.GetRealHeight(42), BackgroundColor = CSS_Color.DividingLineColor, Height = Application.GetRealHeight(1), }; accountView.AddChidren(btnAccountViewBottomLine); btnAccountIcon = new Button() { X = Application.GetRealWidth(21), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(20), Height = Application.GetMinRealAverage(20), UnSelectedImagePath = "LoginIcon/AccountIcon.png", }; if (loginType == 1) { accountView.AddChidren(btnAccountIcon); } #endregion #region 密码填写 passwordView = new FrameLayout() { X = Application.GetRealWidth(28), Y = Application.GetRealHeight(288), Width = Application.GetRealWidth(319), Height = Application.GetRealHeight(44), }; bodyView.AddChidren(passwordView); btnPasswordIcon = new Button() { X = Application.GetRealWidth(21), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(20), Height = Application.GetMinRealAverage(20), UnSelectedImagePath = "LoginIcon/PasswordIcon.png", SelectedImagePath = "LoginIcon/VerificationCodeIcon.png", }; passwordView.AddChidren(btnPasswordIcon); btnDividingLineVertical_PasswordView1 = new Button() { X = Application.GetRealWidth(65), Gravity = Gravity.CenterVertical, Width = 1, Height = Application.GetRealHeight(20), BackgroundColor = CSS_Color.DividingLineColor, }; passwordView.AddChidren(btnDividingLineVertical_PasswordView1); etPassword = new EditText() { X = Application.GetRealWidth(78), Width = Application.GetRealWidth(61 + 84), TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.TextFontSize, PlaceholderTextColor = CSS_Color.PromptingColor1, PlaceholderText = Language.StringByID(StringId.PlsEntryPassword), SecureTextEntry = true, TextAlignment = TextAlignment.CenterLeft, }; passwordView.AddChidren(etPassword); #region 密码登录-控件加载 btnVisiblePassword = new Button() { X = Application.GetRealWidth(223), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(20), Height = Application.GetMinRealAverage(20), UnSelectedImagePath = "LoginIcon/HidePasswordIcon.png", SelectedImagePath = "LoginIcon/ShowPasswordIcon.png", }; passwordView.AddChidren(btnVisiblePassword); btnDividingLineVertical_PasswordView2 = new Button() { X = Application.GetRealWidth(253), Gravity = Gravity.CenterVertical, Width = 1, Height = Application.GetRealHeight(20), BackgroundColor = CSS_Color.DividingLineColor, }; passwordView.AddChidren(btnDividingLineVertical_PasswordView2); btnForgetPassword = new Button() { X = Application.GetRealWidth(263), Width = Application.GetRealWidth(56), TextColor = CSS_Color.FirstLevelTitleColor, TextAlignment = TextAlignment.CenterLeft, TextID = StringId.ForgetPassword, TextSize = 12, }; passwordView.AddChidren(btnForgetPassword); #endregion #region 验证码登录-控件加载 btnGetVerificationCode = new Button() { X = Application.GetRealWidth(219), Width = Application.GetRealWidth(100), TextID = StringId.GetVerificationCode, SelectedTextColor = CSS_Color.MainColor, TextAlignment = TextAlignment.CenterRight, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, TextColor = CSS_Color.PromptingColor1, Visible = false, IsSelected = false, }; passwordView.AddChidren(btnGetVerificationCode); #endregion btnPasswordViewBottomLine = new Button() { Y = Application.GetRealHeight(42), BackgroundColor = CSS_Color.DividingLineColor, SelectedBackgroundColor = CSS_Color.MainColor, Height = Application.GetRealHeight(1), }; passwordView.AddChidren(btnPasswordViewBottomLine); #endregion #region 注册与快捷登录 btnRegister = new Button() { X = Application.GetRealWidth(28), Y = passwordView.Bottom, Width = Application.GetRealWidth(60), Height = Application.GetRealHeight(17 + 12 + 12), TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, TextID = StringId.SingUp, TextAlignment = TextAlignment.CenterLeft, }; bodyView.AddChidren(btnRegister); btnSwitchLoginMode = new Button() { X = Application.GetRealWidth(223 + 28), Y = passwordView.Bottom, Width = Application.GetRealWidth(96), Height = Application.GetRealHeight(51), TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, TextID = StringId.VerificationCodeLogin, TextAlignment = TextAlignment.CenterRight, }; bodyView.AddChidren(btnSwitchLoginMode); #endregion btnLogin = new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(403), Width = Application.GetRealWidth(220), Height = Application.GetRealWidth(44), Radius = (uint)Application.GetRealWidth(22), SelectedBackgroundColor = CSS_Color.MainColor, BackgroundColor = CSS_Color.PromptingColor1, TextID = StringId.Login, TextSize = CSS_FontSize.SubheadingFontSize, TextColor = CSS_Color.MainBackgroundColor, TextAlignment = TextAlignment.Center, }; 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") { if (Language.CurrentLanguage == "russian") { btnDomeLogin.Text = "Гостевой режим"; } else { 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() { "1405771024583090178"}, collect = true, attributes = new List() { new FunctionAttributes() { key = "on_off",value =new List(){ "on","off" }, curValue="on",state = "on" }, new FunctionAttributes() { key = "brightness",value =new List(){ "0","100" }, curValue="100",state = "100" }, new FunctionAttributes() { key = "rgb",value =new List(){ "0","100" }, curValue="0,0,0",state = "0,0,0" }, //new FunctionAttributes() { key = "fade_time",value =new List(){ "0","100" }, curValue="0",state = "0" }, new FunctionAttributes() { key = "delay",value =new List(){ "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() { "1405771024583090178"}, attributes = new List() { new FunctionAttributes() { key = "on_off",value =new List(){ "on","off" }, curValue="on",state = "on" }, new FunctionAttributes() { key = "brightness",value =new List(){ "0","100" }, curValue="0",state = "0" }, new FunctionAttributes() { key = "rgb",value =new List(){ "0","100" }, curValue="0,0,0",state = "0,0,0" }, new FunctionAttributes() { key = "fade_time",value =new List(){ "0","100" }, curValue="0",state = "0" }, new FunctionAttributes() { key = "delay",value =new List(){ "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() { "1405771024583090178"}, attributes = new List() { new FunctionAttributes() { key = "on_off",value =new List(){ "on","off" }, curValue="on",state = "on" }, new FunctionAttributes() { key = "brightness",value =new List(){ "0","100" }, curValue="0",state = "0" }, new FunctionAttributes() { key = "cct",value =new List(){ "0","65535" }, curValue="0",state = "0" ,min = 2700,max = 6500 }, new FunctionAttributes() { key = "fade_time",value =new List(){ "0","100" }, curValue="0",state = "0" }, new FunctionAttributes() { key = "delay",value =new List(){ "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() { "1405771024583090178" }, attributes = new List() { new FunctionAttributes() { key = "on_off",value =new List(){ "on","off" }, curValue="on",state = "on" }, new FunctionAttributes() { key = "brightness",value =new List(){ "0","100" }, curValue="100",state = "100" }, new FunctionAttributes() { key = "fade_time",value =new List(){ "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() { "1405771024583090178"}, attributes = new List() { new FunctionAttributes() { key = "on_off",value =new List(){ "on","off" }, curValue="on",state = "on" }, new FunctionAttributes() { key = "fade_time",value =new List(){ "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() { "1405771024583090178"}, attributes = new List() { new FunctionAttributes() { key = "on_off",value =new List(){ "on","off" }, curValue="on",state = "on" }, new FunctionAttributes() { key = "percent",value =new List(){ "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() { "1405771024583090178"}, attributes = new List() { new FunctionAttributes() { key = "on_off",value =new List(){ "on","off" }, curValue="on",state = "on" }, new FunctionAttributes() { key = "percent",value =new List(){ "0","100" }, curValue="0",state = "0" }, }, }; curtain2.SaveFunctionFile(); var curtain3 = new Function() { sid = "curtain3", deviceId = "curtain3", name = Language.CurrentLanguage == "Chinese" ? "百叶帘" : "Curtain 3", spk = SPK.CurtainRoller, roomIds = new List() { "1405771024583090178" }, collect = true, attributes = new List() { new FunctionAttributes() { key = "on_off",value =new List(){ "on","off" }, curValue="on",state = "on" }, new FunctionAttributes() { key = "percent",value =new List(){ "0","100" }, curValue="0",state = "0" }, new FunctionAttributes(){ key = "angle",curValue= "0",state = "0" }, }, }; curtain3.SaveFunctionFile(); var fh = new Function() { sid = "floorheat1", deviceId = "floorheat1", name = Language.CurrentLanguage == "Chinese" ? "地暖" : "Floorheat 1", spk = SPK.FloorHeatStandard, roomIds = new List() { "1405771024583090178"}, attributes = new List() { new FunctionAttributes() { key = "on_off",value =new List(){ "on","off" }, curValue="on",state = "on" }, new FunctionAttributes() { key = "mode",value =new List(){ "day", "night", "away", "normal", "timer" }, curValue="day",state = "day" }, new FunctionAttributes() { key = "set_temp",value =new List(){ "" }, curValue="26",state = "26" ,max = 35,min = 5 }, new FunctionAttributes() { key = "room_temp",value =new List(){ "" }, curValue="26",state = "26" }, new FunctionAttributes() { key = "temperature_type", value = new List() { "°F", "°C" }, curValue = "°F", state = "°F" }, }, }; fh.SaveFunctionFile(); #if DEBUG var mechanicalArm = new Function() { sid = "mechanicalArm1", deviceId = "mechanicalArm1", name = Language.CurrentLanguage == "Chinese" ? "机械手" : "Mechanical Arm", spk = SPK.MechanicalArm, roomIds = new List() { "1405771024583090178" }, attributes = new List() { new FunctionAttributes() { key = "on_off",value =new List(){ "on","off" }, curValue="on",state = "on" }, }, }; mechanicalArm.SaveFunctionFile(); var lightRgbw1 = new Function() { sid = "light11", deviceId = "light11", name = Language.CurrentLanguage == "Chinese" ? "客厅氛围灯12" : "RGB light 21", spk = SPK.LightRGBW, roomIds = new List() { "1405771024583090178" }, collect = true, attributes = new List() { new FunctionAttributes() { key = "on_off",value =new List(){ "on","off" }, curValue="on",state = "on" }, new FunctionAttributes() { key = "brightness",value =new List(){ "0","100" }, curValue="100",state = "100" }, new FunctionAttributes() { key = "rgbw",value =new List(){ "0","100" }, curValue="0,0,0,0",state = "0,0,0,0" }, //new FunctionAttributes() { key = "fade_time",value =new List(){ "0","100" }, curValue="0",state = "0" }, new FunctionAttributes() { key = "delay",value =new List(){ "0","100" }, curValue="0",state = "0" }, }, }; FunctionList.List.Functions.Add(lightRgbw1); FunctionList.List.Functions.Add(new Function { name = "测试-空调科技系统总控", spk = SPK.AcstParent, collect = true, attributes = new List() { new FunctionAttributes(){ key = FunctionAttributeKey.OnOff ,curValue = "on",state = "on" }, new FunctionAttributes(){ key = AcstParent_AttrEnum.mode.ToString(),curValue = AcstParent_Attr_ModeValueEnum.cool.ToString(),state = AcstParent_Attr_ModeValueEnum.cool.ToString(), value = new List { AcstParent_Attr_ModeValueEnum.cool.ToString(), AcstParent_Attr_ModeValueEnum.dry.ToString(), AcstParent_Attr_ModeValueEnum.fan.ToString(), AcstParent_Attr_ModeValueEnum.heat.ToString(), AcstParent_Attr_ModeValueEnum.humidity.ToString(), AcstParent_Attr_ModeValueEnum.heat_humidity.ToString(), } }, new FunctionAttributes(){ key = AcstParent_AttrEnum.scene.ToString(), curValue = AcstParent_Attr_SceneValueEnum.at_home.ToString(), state = AcstParent_Attr_SceneValueEnum.at_home.ToString(), value = new List() { AcstParent_Attr_SceneValueEnum.at_home.ToString(), AcstParent_Attr_SceneValueEnum.leave_home.ToString(), AcstParent_Attr_SceneValueEnum.sleep.ToString(), } }, new FunctionAttributes(){ key = AcstParent_AttrEnum.day_electricity.ToString(),curValue = "99",state = "99"}, new FunctionAttributes(){ key = AcstParent_AttrEnum.month_electricity.ToString(),curValue = "999",state = "999"}, new FunctionAttributes(){ key = AcstParent_AttrEnum.total_electricity.ToString(),curValue = "9999",state = "9999"}, new FunctionAttributes(){ key = AcstParent_AttrEnum.active_power.ToString(),curValue = "9999",state = "9999"}, //new FunctionAttributes(){ key = AcstParent_AttrEnum.room_temp.ToString(),curValue = "26",state = "26"}, //new FunctionAttributes(){ key = AcstParent_AttrEnum.room_humidity.ToString(),curValue = "66",state = "66"}, //new FunctionAttributes(){ key = AcstParent_AttrEnum.co2.ToString(),curValue = "266",state = "266"}, //new FunctionAttributes(){ key = AcstParent_AttrEnum.tvoc.ToString(),curValue = "666",state = "666"}, //new FunctionAttributes(){ key = AcstParent_AttrEnum.pm25.ToString(),curValue = "36",state = "36"}, } }); FunctionList.List.Functions.Add(new Function { name = "测试-空调科技系统子控-1", spk = SPK.AcstSub, sid = "0000001", attributes = new List() { new FunctionAttributes(){ key = FunctionAttributeKey.OnOff ,curValue = "on",state = "on" }, new FunctionAttributes(){ key = AcstSub_AttrEnum.set_temp.ToString(),curValue = "26",state = "26"}, new FunctionAttributes(){ key = AcstSub_AttrEnum.room_temp.ToString(),curValue = "26",state = "26"}, new FunctionAttributes(){ key = AcstSub_AttrEnum.room_humidity.ToString(),curValue = "66",state = "66"}, } }); FunctionList.List.Functions.Add(new Function { name = "测试-空调科技系统子控-2", spk = SPK.AcstSub, sid = "0000002", attributes = new List() { new FunctionAttributes(){ key = FunctionAttributeKey.OnOff ,curValue = "on",state = "on" }, new FunctionAttributes(){ key = AcstSub_AttrEnum.set_temp.ToString(),curValue = "26",state = "26"}, new FunctionAttributes(){ key = AcstSub_AttrEnum.room_temp.ToString(),curValue = "26",state = "26"}, new FunctionAttributes(){ key = AcstSub_AttrEnum.room_humidity.ToString(),curValue = "66",state = "66"}, } }); FunctionList.List.Functions.Add(new Function { name = "测试-空调科技系统子控-3", spk = SPK.AcstSub, sid = "0000003", attributes = new List() { new FunctionAttributes(){ key = FunctionAttributeKey.OnOff ,curValue = "on",state = "on" }, new FunctionAttributes(){ key = AcstSub_AttrEnum.set_temp.ToString(),curValue = "26",state = "26"}, new FunctionAttributes(){ key = AcstSub_AttrEnum.room_temp.ToString(),curValue = "26",state = "26"}, new FunctionAttributes(){ key = AcstSub_AttrEnum.room_humidity.ToString(),curValue = "66",state = "66"}, } }); FunctionList.List.Functions.Add(new Function { name = "测试-空调科技系统子控-4", spk = SPK.AcstSub, sid = "0000004", attributes = new List() { new FunctionAttributes(){ key = FunctionAttributeKey.OnOff ,curValue = "on",state = "on" }, new FunctionAttributes(){ key = AcstSub_AttrEnum.set_temp.ToString(),curValue = "26",state = "26"}, new FunctionAttributes(){ key = AcstSub_AttrEnum.room_temp.ToString(),curValue = "26",state = "26"}, new FunctionAttributes(){ key = AcstSub_AttrEnum.room_humidity.ToString(),curValue = "66",state = "66"}, } }); FunctionList.List.Functions.Add(new Function { name = "测试-空调科技系统子控-5", spk = SPK.AcstSub, sid = "0000005", attributes = new List() { new FunctionAttributes(){ key = FunctionAttributeKey.OnOff ,curValue = "on",state = "on" }, new FunctionAttributes(){ key = AcstSub_AttrEnum.set_temp.ToString(),curValue = "26",state = "26"}, new FunctionAttributes(){ key = AcstSub_AttrEnum.room_temp.ToString(),curValue = "26",state = "26"}, new FunctionAttributes(){ key = AcstSub_AttrEnum.room_humidity.ToString(),curValue = "66",state = "66"}, } }); //FunctionList.List.Functions.Add(new Function //{ // name = "测试梦幻窗帘", // spk = SPK.CurtainDream, // sid = "1234577", // attributes = new List { // new FunctionAttributes(){ key = "on_off",curValue= "on",state = "on" }, // new FunctionAttributes(){ key = "percent",curValue= "100",state = "100" }, // new FunctionAttributes(){ key = "angle",curValue= "0",state = "0" }, // } //}); //FunctionList.List.Functions.Add(new Function //{ // name = "测试毫米波传感器", // spk = SPK.SenesorMegahealth, // attributes = new List // { // new FunctionAttributes(){ key = "enable",curValue = "true",state = "true" }, // new FunctionAttributes(){ key = "people_num",curValue = "0",state = "0" }, // new FunctionAttributes(){ key = "people_id",curValue = "1",state = "1" }, // new FunctionAttributes(){ key = "target_status",curValue = "0",state = "0" },//0空,1走,2跑,3坐,4跌倒,5站 // new FunctionAttributes(){ key = "people_status",curValue = "false",state = "false" },//状态 有人无人 // //new FunctionAttributes(){ key = "",curValue = "",state = "" }, // //new FunctionAttributes(){ key = "",curValue = "",state = "" }, // //new FunctionAttributes(){ key = "",curValue = "",state = "" }, // } //}); FunctionList.List.Functions.Add(new Function { name = "测试温控器", spk = SPK.HvacCac, attributes = new List { new FunctionAttributes(){ key = "on_off",curValue = "on",state = "on" }, new FunctionAttributes(){ key = "cac_valve",curValue = "on",state = "on" },//毛细阀 new FunctionAttributes(){ key = "fh_valve",curValue = "on",state = "on" },//地暖阀 new FunctionAttributes(){ key = "mode",curValue = "cool",state = "cool", value = new List{ "cool","heat"} }, new FunctionAttributes(){ key = "set_temp",curValue = "20",state = "20",min = 16,max = 30 }, new FunctionAttributes(){ key = "room_temp",curValue = "20",state = "20" }, new FunctionAttributes(){ key = "dew_point_temp",curValue = "20",state = "20" },//露点温度 new FunctionAttributes(){ key = "surface_temp",curValue = "20",state = "20" },//表面温度 new FunctionAttributes(){ key = "energy_saving",curValue = "true",state = "true" },//节能 new FunctionAttributes(){ key = "room_humidity",curValue = "66",state = "66" }, //new FunctionAttributes(){ key = "",curValue = "",state = "" }, } }); //FunctionList.List.Functions.Add(new Function //{ // name = "门锁", // spk = SPK.DoorLock, // sid = "12345", // attributes = new List { // new FunctionAttributes(){ key = "door_status",curValue= "open",state = "open" }, // new FunctionAttributes(){ key = "normal_open",curValue= "true",state = "true" }, // new FunctionAttributes(){ key = "normal_open_countdown",curValue= "10",state = "10" }, // new FunctionAttributes(){ key = "local_id",curValue= "10",state = "10" }, // new FunctionAttributes(){ key = "door_volume",curValue= "10",state = "10" }, // new FunctionAttributes(){ key = "door_volume_step",curValue= "up",state = "up" }, // new FunctionAttributes(){ key = "battery_value",curValue= "100",state = "100" }, // new FunctionAttributes(){ key = "battery_percentage",curValue= "100",state = "100" }, // new FunctionAttributes(){ key = "battery_state",curValue= "high",state = "high" }, // } //}); //FunctionList.List.Functions.Add(new Function //{ // name = "门锁1", // spk = SPK.DoorLock, // sid = "123", // attributes = new List { // new FunctionAttributes(){ key = "door_status",curValue= "open",state = "open" }, // new FunctionAttributes(){ key = "normal_open",curValue= "true",state = "true" }, // new FunctionAttributes(){ key = "normal_open_countdown",curValue= "10",state = "10" }, // new FunctionAttributes(){ key = "local_id",curValue= "10",state = "10" }, // new FunctionAttributes(){ key = "door_volume",curValue= "10",state = "10" }, // new FunctionAttributes(){ key = "door_volume_step",curValue= "up",state = "up" }, // new FunctionAttributes(){ key = "battery_value",curValue= "100",state = "100" }, // new FunctionAttributes(){ key = "battery_percentage",curValue= "100",state = "100" }, // new FunctionAttributes(){ key = "battery_state",curValue= "high",state = "high" }, // } //}); //FunctionList.List.Functions.Add(new Function() //{ // spk = SPK.PanelSocket, // name = "面板插座", // attributes = new List // { // new FunctionAttributes(){ key = "on_off",curValue= "on",state = "on" }, // new FunctionAttributes(){ key = "on_off_usb",curValue= "on",state = "on" }, // new FunctionAttributes(){ key = "active_power",curValue= "220",state = "220" }, // new FunctionAttributes(){ key = "voltage",curValue= "5",state = "5" }, // new FunctionAttributes(){ key = "current",curValue= "110",state = "110" }, // new FunctionAttributes(){ key = "total_electricity",curValue= "123.33",state = "123.33" }, // } //}); //FunctionList.List.Functions.Add(new Function() //{ // spk = SPK.SensorDryContact, // name = "干接点", // attributes = new List() // { // new FunctionAttributes(){ key = "status",curValue= "on",state = "on" }, // }, //}); //FunctionList.List.Functions.Add(new Function() //{ // spk = SPK.SensorPm25, // name = "测试Pm2.5", // attributes = new List() // { // new FunctionAttributes(){ key = "pm25",curValue= "70",state = "70" }, // }, // attrKeyConfigs = new List() // { // new AttrKeyConfig (){ // key = "pm2.5", // type = "interval" , // unit = "ug/m³", // configs = new List(){ // new AttrKeyInfo(){ start = "0",end = "75",color = "0xFFADE764", desc = "良好"}, // new AttrKeyInfo(){ start = "76",end = "150",color = "0xFFFFD154",desc = "轻/中度污染"}, // new AttrKeyInfo(){ start = "151",end = "500",color = "0xFFFF9D54",desc = "重度/严重污染"}, // } // } // }, //}); //FunctionList.List.Functions.Add(new Function() //{ // spk = SPK.SensorHelp, // name = "测试紧急求助按钮", // attributes = new List() // { // new FunctionAttributes(){ key = "status",curValue= "on",state = "on" }, // new FunctionAttributes(){ key = "alarm_status",curValue= "alarm",state = "alarm" }, // new FunctionAttributes(){ key = "battery_value",curValue= "200",state = "200" }, // new FunctionAttributes(){ key = "battery_percentage",curValue= "10",state = "10" }, // new FunctionAttributes(){ key = "battery_state",curValue= "low",state = "low" }, // }, //}); //FunctionList.List.Functions.Add(new Function() //{ // spk = SPK.AirSwitch, // name = "智能空开", // attributes = new List() // { // new FunctionAttributes(){ key = "on_off",curValue= "on",state = "on" }, // }, //}); //FunctionList.List.Functions.Add(new Function() //{ // spk = SPK.AirFreshStandard, // name = "测试新风", // attributes = new List() // { // new FunctionAttributes(){ key = "on_off",curValue= "on",state = "on" }, // new FunctionAttributes(){ key = "fan",curValue= "low",state = "low" ,value = new List(){ "high", "medium", "low" } }, // }, //}); //FunctionList.List.Functions.Add(new Function() //{ // spk = SPK.HvacAirFreshJinmao, // name = "测试金茂新风", // attributes = new List() // { // new FunctionAttributes(){ key = "on_off",curValue= "on",state = "on" }, // new FunctionAttributes(){ key = "mode",curValue= "humidification",state = "humidification" ,value = new List(){ "humidification", "fan" } }, // new FunctionAttributes(){ key = "energy",curValue= "true",state = "true" ,value = new List(){ "true", "false" } }, // new FunctionAttributes(){ key = "fan",curValue= "level_1",state = "level_1" ,value = new List(){ "level_1", "level_2", "level_3","auto" } }, // new FunctionAttributes(){ key = "humidity",curValue= "0",state = "0" ,value = new List(){ },min = 0,max = 100 }, // new FunctionAttributes(){ key = "indoor_temp",curValue= "26",state = "26" ,value = new List(){ },min = 0,max = 100 }, // new FunctionAttributes(){ key = "indoor_humidity",curValue= "0",state = "0" ,value = new List(){ },min = 0,max = 100 }, // new FunctionAttributes(){ key = "filter_remain",curValue= "0",state = "0" ,value = new List(){ },min = 0,max = 100 }, // new FunctionAttributes(){ key = "filter_timeout",curValue= "false",state = "false" ,value = new List(){ "true", "false" }}, // }, //}); //FunctionList.List.Functions.Add(new Function() //{ // spk = SPK.SensorGas, // name = "燃气传感器", // attributes = new List() // { // new FunctionAttributes(){ key = "enable",curValue= "true",state = "true" ,value = new List(){ "true", "false" } }, // new FunctionAttributes(){ key = "status",curValue= "normal",state = "normal" ,value = new List(){ "alarm", "normal" } }, // }, //}); //FunctionList.List.Functions.Add(new Function() { spk = SPK.PjtIr, name = "测试投影仪", // attributes = new List() { // new FunctionAttributes(){ key = "on_off",curValue= "on",state = "on" }, // new FunctionAttributes(){ key = "computer",value = new List(){"电脑" } }, // new FunctionAttributes(){ key = "video",value = new List(){"视频" } }, // new FunctionAttributes(){ key = "source",value = new List(){"信号源" } }, // new FunctionAttributes(){ key = "zoom+",value = new List(){"变焦+" } }, // new FunctionAttributes(){ key = "zoom-",value = new List(){"变焦-" } }, // new FunctionAttributes(){ key = "page+",value = new List(){"画面+" } }, // new FunctionAttributes(){ key = "page-",value = new List(){"画面-" } }, // new FunctionAttributes(){ key = "menu",value = new List(){"菜单" } }, // new FunctionAttributes(){ key = "ok",value = new List(){"确认" } }, // new FunctionAttributes(){ key = "up",value = new List(){"上" } }, // new FunctionAttributes(){ key = "left",value = new List(){"左" } }, // new FunctionAttributes(){ key = "right",value = new List(){"右" } }, // new FunctionAttributes(){ key = "down",value = new List(){"下" } }, // new FunctionAttributes(){ key = "exit",value = new List(){"退出" } }, // new FunctionAttributes(){ key = "volume+",value = new List(){"音量+" } }, // new FunctionAttributes(){ key = "volume-",value = new List(){"音量-" } }, // new FunctionAttributes(){ key = "mute",value = new List(){"静音" } }, // new FunctionAttributes(){ key = "auto",value = new List(){"自动" } }, // new FunctionAttributes(){ key = "pause",value = new List(){"暂停" } }, // } //}); //FunctionList.List.Functions.Add(new Function() //{ // spk = SPK.StbIr, // name = "测试机顶盒", // attributes = new List() { // new FunctionAttributes(){ key = "on_off",curValue= "on",state = "on" }, // new FunctionAttributes(){ key = "computer",value = new List(){"电脑" } }, // new FunctionAttributes(){ key = "video",value = new List(){"视频" } }, // new FunctionAttributes(){ key = "source",value = new List(){"信号源" } }, // new FunctionAttributes(){ key = "zoom+",value = new List(){"变焦+" } }, // new FunctionAttributes(){ key = "zoom-",value = new List(){"变焦-" } }, // new FunctionAttributes(){ key = "page+",value = new List(){"画面+" } }, // new FunctionAttributes(){ key = "page-",value = new List(){"画面-" } }, // new FunctionAttributes(){ key = "menu",value = new List(){"菜单" } }, // new FunctionAttributes(){ key = "ok",value = new List(){"确认" } }, // new FunctionAttributes(){ key = "up",value = new List(){"上" } }, // new FunctionAttributes(){ key = "left",value = new List(){"左" } }, // new FunctionAttributes(){ key = "right",value = new List(){"右" } }, // new FunctionAttributes(){ key = "down",value = new List(){"下" } }, // new FunctionAttributes(){ key = "exit",value = new List(){"退出" } }, // new FunctionAttributes(){ key = "volume+",value = new List(){"音量+" } }, // new FunctionAttributes(){ key = "volume-",value = new List(){"音量-" } }, // new FunctionAttributes(){ key = "mute",value = new List(){"静音" } }, // new FunctionAttributes(){ key = "auto",value = new List(){"自动" } }, // new FunctionAttributes(){ key = "pause",value = new List(){"暂停" } }, // } //}); //FunctionList.List.Functions.Add(new Function() //{ // spk = SPK.TvIr, // name = "测试电视", // attributes = new List() { // new FunctionAttributes(){ key = "on_off",curValue= "on",state = "on" }, // new FunctionAttributes(){ key = "computer",value = new List(){"电脑" } }, // new FunctionAttributes(){ key = "video",value = new List(){"视频" } }, // new FunctionAttributes(){ key = "source",value = new List(){"信号源" } }, // new FunctionAttributes(){ key = "zoom+",value = new List(){"变焦+" } }, // new FunctionAttributes(){ key = "zoom-",value = new List(){"变焦-" } }, // new FunctionAttributes(){ key = "page+",value = new List(){"画面+" } }, // new FunctionAttributes(){ key = "page-",value = new List(){"画面-" } }, // new FunctionAttributes(){ key = "menu",value = new List(){"菜单" } }, // new FunctionAttributes(){ key = "ok",value = new List(){"确认" } }, // new FunctionAttributes(){ key = "up",value = new List(){"上" } }, // new FunctionAttributes(){ key = "left",value = new List(){"左" } }, // new FunctionAttributes(){ key = "right",value = new List(){"右" } }, // new FunctionAttributes(){ key = "down",value = new List(){"下" } }, // new FunctionAttributes(){ key = "exit",value = new List(){"退出" } }, // new FunctionAttributes(){ key = "volume+",value = new List(){"音量+" } }, // new FunctionAttributes(){ key = "volume-",value = new List(){"音量-" } }, // new FunctionAttributes(){ key = "mute",value = new List(){"静音" } }, // new FunctionAttributes(){ key = "auto",value = new List(){"自动" } }, // new FunctionAttributes(){ key = "pause",value = new List(){"暂停" } }, // } //}); #endif #endregion #region 场景 var scene1 = new Scene() { sid = "scene1", userSceneId = "scene1", name = Language.CurrentLanguage == "Chinese" ? "明亮模式" : "Bright scene", roomIds = new List() { "1405771024583090178" }, gatewayId = "1234567890123456", collect = true, functions = new List() { new SceneFunction() { sid = lightRgb1.sid, status = new List() { new SceneFunctionStatus() { key = "on_off", value = "on", } } }, new SceneFunction() { sid = lightRgb2.sid, status = new List() { new SceneFunctionStatus() { key = "on_off", value = "on", } } }, new SceneFunction() { sid = lightCct.sid, status = new List() { new SceneFunctionStatus() { key = "on_off", value = "on", } } }, new SceneFunction() { sid = lightSwitch1.sid, status = new List() { new SceneFunctionStatus() { key = "on_off", value = "on", } } }, new SceneFunction() { sid = lightSwitch2.sid, status = new List() { 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() { "1405771024583090178" }, gatewayId = "1234567890123456", collect = false, functions = new List() { new SceneFunction() { sid = lightRgb1.sid, status = new List() { new SceneFunctionStatus() { key = "on_off", value = "on", } } }, new SceneFunction() { sid = lightRgb2.sid, status = new List() { new SceneFunctionStatus() { key = "on_off", value = "on", } } }, new SceneFunction() { sid = lightCct.sid, status = new List() { new SceneFunctionStatus() { key = "on_off", value = "on", } } }, new SceneFunction() { sid = lightSwitch1.sid, status = new List() { new SceneFunctionStatus() { key = "on_off", value = "off", } } }, new SceneFunction() { sid = lightSwitch2.sid, status = new List() { 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() { room3.roomId }, attributes = new List() { new FunctionAttributes() { key = "on_off",value =new List(){ "on","off" }, curValue="on",state = "on" }, new FunctionAttributes() { key = "brightness",value =new List(){ "0","100" }, curValue="100",state = "100" }, new FunctionAttributes() { key = "fade_time",value =new List(){ "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() { room3.roomId }, attributes = new List() { new FunctionAttributes() { key = "on_off",value =new List(){ "on","off" }, curValue="on",state = "on" }, new FunctionAttributes() { key = "fade_time",value =new List(){ "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() { room3.roomId }, gatewayId = "1234567890123456", collect = true, functions = new List() { new SceneFunction() { sid = lightSwitch4.sid, status = new List() { new SceneFunctionStatus() { key = "on_off", value = "off", } } }, new SceneFunction() { sid = lightSwitch4.sid, status = new List() { 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() { room3.roomId }, gatewayId = "1234567890123456", collect = false, functions = new List() { new SceneFunction() { sid = lightSwitch4.sid, status = new List() { new SceneFunctionStatus() { key = "on_off", value = "on", } } }, new SceneFunction() { sid = lightSwitch4.sid, status = new List() { 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() { room3.roomId }, attributes = new List() { new FunctionAttributes() { key = "on_off", value = new List() { "on", "off" }, curValue = "on", state = "on" }, new FunctionAttributes() { key = "mode", value = new List() { "cool", "heat", "fan", "auto", "dry" }, curValue = "cool", state = "cool" }, new FunctionAttributes() { key = "fan", value = new List() { "high", "medium", "low", "auto" }, curValue = "auto", state = "auto" }, new FunctionAttributes() { key = "set_temp",step = "1", value = new List() { "16", "30"}, curValue = "16", state = "16",max = 30,min = 16 }, new FunctionAttributes() { key = "room_temp", value = new List() { }, curValue = "20", state = "20" }, new FunctionAttributes() { key = "swing", value = new List() {"up_down", "left_right", "stop" }, curValue = "20", state = "20" }, } }; ac.SaveFunctionFile(); var ac2 = new Function() { sid = "ac2", deviceId = "ac2", name = Language.CurrentLanguage == "Chinese" ? "客厅空调" : "AC", spk = SPK.AcStandard, roomIds = new List() { room4.roomId }, attributes = new List() { new FunctionAttributes() { key = "on_off", value = new List() { "on", "off" }, curValue = "on", state = "on" }, new FunctionAttributes() { key = "mode", value = new List() { "cool", "heat", "fan", "auto", "dry" }, curValue = "cool", state = "cool" }, new FunctionAttributes() { key = "fan", value = new List() { "high", "medium", "low", "auto" }, curValue = "auto", state = "auto" }, new FunctionAttributes() { key = "set_temp",step = "0.5", value = new List() { "16", "30"}, curValue = "16", state = "16",max = 30,min = 16 }, new FunctionAttributes() { key = "room_temp", value = new List() { }, curValue = "20", state = "20" }, new FunctionAttributes() { key = "swing", value = new List() {"up_down", "left_right", "stop" }, curValue = "20", state = "20" }, new FunctionAttributes() { key = "temperature_type", value = new List() { "°F", "°C" }, curValue = "°F", state = "°F" }, } }; ac2.SaveFunctionFile(); //var scene5 = new Scene() //{ // sid = "scene5", // userSceneId = "scene5", // name = Language.CurrentLanguage == "Chinese" ? "阅读" : "Reading mode", // roomIds = new List() { 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() { 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() { room1.roomId }, attributes = new List() { new FunctionAttributes() { key = "on_off",value =new List(){ "on","off" }, curValue="on",state = "on" }, new FunctionAttributes() { key = "fade_time",value =new List(){ "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 DEBUG1211 //本地模式 Button btnLocalMode = new Button() { Y = Application.GetRealHeight(600), Height = Application.GetRealHeight(67), Text = "Local Mode", TextAlignment = TextAlignment.Center, BackgroundColor = CSS_Color.MainColor, TextColor = CSS_Color.TextualColor, }; bodyView.AddChidren(btnLocalMode); btnLocalMode.MouseUpEventHandler = (sender, e) => { MainPage.LocalMode = true; UserInfo.Current = new UserInfo(); MainPage.GoUserPage(); }; MainPage.Log("etAccount.TextAlignment : " + etAccount.TextAlignment.ToString()); #endif #region 隐私政策 AddServiceAgreementControl(bodyView); #endregion } #region ■ 服务协议___________________________ bool isAgreePrivacyPolicy = false; /// /// 添加服务协议控件 /// /// private void AddServiceAgreementControl(FrameLayout frameLayout) { isAgreePrivacyPolicy = false; OnAppConfig.Instance.isAgreePrivacyPolicy = false; 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 = OnAppConfig.Instance.isAgreePrivacyPolicy, Gravity = Gravity.Center }; agreeView.AddChidren(agreeBtn); EventHandler 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); }; #if __ANDROID__ //if(OnAppConfig.Instance.FirstRunApp || !OnAppConfig.Instance.isAgreePrivacyPolicy) //{ // HDL_ON_Android.HDLONUtils.StartSplashActivity(); //} #endif } /// /// OpenWebViewPage /// /// 是否隐私政策 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); } /// /// 检测隐私协议 /// /// private bool CheckPrivacyPolicy() { if (isAgreePrivacyPolicy == false) { //请同意《用户协议》和《隐私政策》 Utlis.ShowTip(Language.StringByID(StringId.PleaseReadAndAgreePrivacyPolicyMsg)); return false; } return true; } #endregion } }