From f1c3921b08bb22ac6f5db22d620e01d7e8e5c49f Mon Sep 17 00:00:00 2001 From: WJC <wjc@hdlchina.com.cn> Date: 星期一, 30 十二月 2019 13:32:33 +0800 Subject: [PATCH] 2019-12-30-1 --- ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs | 432 +++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 297 insertions(+), 135 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs old mode 100755 new mode 100644 index 4f954b9..8070799 --- a/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs @@ -18,7 +18,7 @@ Tag = "Logic"; } EditText logicTextBox; - public void Show(Action action) + public async void Show(Action action) { #region 鏈�涓婇潰鐨勫竷灞�浠g爜 @@ -32,14 +32,15 @@ var titleName = new Button { - TextSize = 16, + TextSize = 17, TextColor = ZigbeeColor.Current.LogicTextBlackColor, TextAlignment = TextAlignment.CenterLeft, X = Application.GetRealWidth(176), - Width = Application.GetRealWidth(400), + Width = Application.GetRealWidth(600), Height = Application.GetRealHeight(69), Y = Application.GetRealHeight(92), TextID = MyInternationalizationString.selection, + IsBold = true, }; topRowLayout.AddChidren(titleName); if (Common.Logic.CurrentLogic.LogicId != 0) @@ -78,12 +79,7 @@ action(); RemoveFromParent(); }; - - - #endregion - - var middle = new VerticalScrolViewLayout { @@ -92,7 +88,26 @@ BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, }; this.AddChidren(middle); + var saveFrameLayout = new FrameLayout + { + Y = middle.Bottom, + Height = Application.GetRealHeight(180), + BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, + }; + this.AddChidren(saveFrameLayout); + var btnsave = new Button + { + X = Application.GetRealWidth(85), + Height = Application.GetRealHeight(130),//194 + Width = Application.GetRealWidth(910), + Radius = (uint)Application.GetRealHeight(60), + BackgroundColor = ZigbeeColor.Current.LogicBtnSaveBackgroundColor, + TextID = MyInternationalizationString.Save, + TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor, + TextSize = 16, + }; + saveFrameLayout.AddChidren(btnsave); #region -----鑷姩鍖栧悕绉� 璁剧疆鍚嶇О----- var logicnamefl = new FrameLayout @@ -112,6 +127,7 @@ TextID = MyInternationalizationString.automationname, TextColor = ZigbeeColor.Current.LogicTextBlackColor, Y = Application.GetRealHeight(35), + TextSize = 15, }; logicnamefl.AddChidren(text); @@ -123,7 +139,7 @@ X = text.Right, TextAlignment = TextAlignment.CenterLeft, TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - TextSize = 13, + TextSize = 14, Text = Common.Logic.CurrentLogic.LogicName, //TextID=MyInternationalizationString.automation1, }; @@ -166,7 +182,7 @@ TextColor = ZigbeeColor.Current.LogicTextBlackColor, Width = Application.GetRealWidth(300), Height = Application.GetRealHeight(60), - TextSize = 16, + TextSize = 15, Gravity = Gravity.CenterVertical, }); @@ -277,6 +293,7 @@ TextColor = ZigbeeColor.Current.LogicBlankBackgroundColor, TextID = MyInternationalizationString.addconditions, X = Application.GetRealWidth(390), + TextSize = 14, }; addfl.AddChidren(addtextbtn); @@ -343,6 +360,7 @@ TextAlignment = TextAlignment.CenterLeft, Gravity = Gravity.CenterVertical, TextColor = ZigbeeColor.Current.LogicBtnCancelColor, + TextSize = 14, }; conditionsRowLayout.AddChidren(timevalue); @@ -354,6 +372,7 @@ Gravity = Gravity.CenterVertical, TextColor = ZigbeeColor.Current.LogicBtnCancelColor, X = conditionsRowLayout.Width - Application.GetRealWidth(400), + TextSize = 14, }; conditionsRowLayout.AddChidren(timeTxet); @@ -454,6 +473,7 @@ Text = conditions["StartHour"] + ":" + s1 + "-" + conditions["StopHour"] + ":" + s2, //TextColor = 0xff121212, TextColor = ZigbeeColor.Current.LogicBtnCancelColor, + TextSize = 14, }; conditionsRowLayout.AddChidren(timevalue); var timeTxet = new Button @@ -464,6 +484,7 @@ TextColor = ZigbeeColor.Current.LogicBtnCancelColor, X = conditionsRowLayout.Width - Application.GetRealWidth(400), TextID = MyInternationalizationString.timeframe, + TextSize = 14, }; conditionsRowLayout.AddChidren(timeTxet); @@ -490,7 +511,8 @@ var deviceinof = Common.Logic.LogicDviceList.Find((obj) => { return obj.DeviceAddr == conditions["MacAddr"] && obj.DeviceEpoint.ToString() == conditions["Epoint"]; }); if (deviceinof == null) { - continue; + deviceinof = new ZigBee.Device.CommonDevice(); + //continue; } ///鏄剧ず璁惧鍚嶇О var btndevice = new Button @@ -501,6 +523,7 @@ TextAlignment = TextAlignment.CenterLeft, Text = deviceinof.DeviceEpointName, TextColor = ZigbeeColor.Current.LogicTextBlackColor, + TextSize = 14, }; conditionsRowLayout.AddChidren(btndevice); @@ -541,7 +564,7 @@ UserView.HomePage.Instance.AddChidren(memberList); UserView.HomePage.Instance.PageIndex += 1; MemberList.edit = true; - memberList.Show(deviceinof); + memberList.Show(deviceinof, conditions); } }; @@ -555,6 +578,7 @@ TextAlignment = TextAlignment.CenterRight, X = Application.GetRealWidth(400), TextColor = ZigbeeColor.Current.LogicBtnCancelColor, + TextSize = 14, }; conditionsRowLayout.AddChidren(devicestatus); @@ -609,14 +633,24 @@ { int minute = int.Parse(conditions["IgnoreTime"]) / 60; int second = int.Parse(conditions["IgnoreTime"]) % 60; - if (second != 0) + if (minute != 0 && second != 0) { devicestatus.Text = minute.ToString() + Language.StringByID(MyInternationalizationString.minute) + second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.unattendedtime1); } else { - devicestatus.Text = minute.ToString() + Language.StringByID(MyInternationalizationString.Minute) + Language.StringByID(MyInternationalizationString.unattendedtime1); + if (minute == 0 && second != 0) + { + devicestatus.Text = second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.unattendedtime1); + + } + if (minute != 0 && second == 0) + { + devicestatus.Text = minute.ToString() + Language.StringByID(MyInternationalizationString.Minute) + Language.StringByID(MyInternationalizationString.unattendedtime1); + + } + } } } @@ -624,7 +658,6 @@ case 21: case 22: { - conditionIcon.UnSelectedImagePath = "ZigeeLogic/doormagnetism.png"; if (intvalue == "1") { devicestatus.TextID = MyInternationalizationString.logicopen; @@ -636,14 +669,24 @@ int minute = int.Parse(conditions["IgnoreTime"]) / 60; int second = int.Parse(conditions["IgnoreTime"]) % 60; - if (second != 0) + if (minute != 0 && second != 0) { devicestatus.Text = minute.ToString() + Language.StringByID(MyInternationalizationString.minute) + second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.closetime); } else { - devicestatus.Text = minute.ToString() + Language.StringByID(MyInternationalizationString.Minute) + Language.StringByID(MyInternationalizationString.closetime); + if (minute == 0 && second != 0) + { + devicestatus.Text = second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.closetime); + + } + if (minute != 0 && second == 0) + { + devicestatus.Text = minute.ToString() + Language.StringByID(MyInternationalizationString.Minute) + Language.StringByID(MyInternationalizationString.closetime); + + } + } } @@ -656,7 +699,6 @@ break; case 40: { - conditionIcon.UnSelectedImagePath = "ZigeeLogic/smoke.png"; if (intvalue == "1") { devicestatus.TextID = MyInternationalizationString.smokescreen; @@ -666,7 +708,6 @@ break; case 42: { - conditionIcon.UnSelectedImagePath = "ZigeeLogic/waterleakage.png"; if (intvalue == "1") { devicestatus.TextID = MyInternationalizationString.waterleakage; @@ -679,7 +720,6 @@ break; case 43: { - conditionIcon.UnSelectedImagePath = "ZigeeLogic/gas.png"; if (intvalue == "1") { devicestatus.TextID = MyInternationalizationString.gas; @@ -689,7 +729,6 @@ break; case 277: { - conditionIcon.UnSelectedImagePath = "ZigeeLogic/waterleakage.png"; if (intvalue == "1") { devicestatus.TextID = MyInternationalizationString.callthepolice; @@ -699,7 +738,6 @@ break; default: { - conditionIcon.UnSelectedImagePath = "ZigeeLogic/infraredsensor.png"; if (intvalue == "1") { devicestatus.TextID = MyInternationalizationString.callthepolice; @@ -725,7 +763,7 @@ { if (Common.Logic.CurrentLogic.Accounts[a]["UserId"] == conditions["AttriButeData2"]) { - devicestatus.Text = conditions["Account"]; + devicestatus.Text = Common.Logic.CurrentLogic.Accounts[a]["Account"]; break; } @@ -735,22 +773,54 @@ } break; case DeviceType.TemperatureSensor: - // conditionIcon.UnSelectedImagePath = "ZigeeLogic/temperature.png"; + // conditionIcon.UnSelectedImagePath = "ZigeeLogic/temperature.png"; var dev = deviceinof as TemperatureSensor; - if (conditions["Cluster_ID"]=="1026") { + if (conditions["Cluster_ID"] == "1026") + { dev.SensorDiv = 1; - } else { + } + else + { dev.SensorDiv = 2; + } + string s = ""; + switch (conditions["Range"]) + { + case "0": + { + s = ">"; + } + break; + case "1": + { + s = "="; + } + break; + case "2": + { + s = "<"; + } + break; + case "6": + { + s = "鈮�"; + } + break; + case "7": + { + s = "鈮�"; + } + break; } if (conditions["Cluster_ID"] == "1026") { conditionIcon.UnSelectedImagePath = "ZigeeLogic/temperature.png"; - devicestatus.Text = ">" + conditions["AttriButeData1"] + "鈩�"; + devicestatus.Text = s + conditions["AttriButeData1"] + "鈩�"; } else { conditionIcon.UnSelectedImagePath = "ZigeeLogic/humidity.png"; - devicestatus.Text = "<" + conditions["AttriButeData1"] + "%"; + devicestatus.Text = s + conditions["AttriButeData1"] + "%"; } break; @@ -773,6 +843,7 @@ Gravity = Gravity.CenterVertical, Text = logicinof.LogicName, TextColor = ZigbeeColor.Current.LogicTextBlackColor, + TextSize = 14, //TextColor = 0xff121212, }; conditionsRowLayout.AddChidren(btnlogic); @@ -803,6 +874,7 @@ TextAlignment = TextAlignment.CenterRight, X = Application.GetRealWidth(500), TextColor = ZigbeeColor.Current.LogicBtnCancelColor, + TextSize = 14, }; conditionsRowLayout.AddChidren(logicstatus); @@ -827,6 +899,7 @@ TextColor = ZigbeeColor.Current.LogicTextBlackColor, //TextColor = 0xff121212, TextID = MyInternationalizationString.security, + TextSize = 14, }; //conditionsRowLayout.AddChidren(btnsecurity); @@ -859,42 +932,55 @@ Gravity = Gravity.CenterVertical, TextAlignment = TextAlignment.CenterLeft, TextColor = ZigbeeColor.Current.LogicBtnCancelColor, + TextSize = 14, }; conditionsRowLayout.AddChidren(securitystatus); - if (conditions["EnOrWithdrawMode"] == "1") + switch (conditions["EnOrWithdrawMode"]) { - conditionIcon.UnSelectedImagePath = "ZigeeLogic/withdrawal.png"; - securitystatus.Text = Language.StringByID(MyInternationalizationString.withdrawal); - } - else - { - if (conditions["ModeId"] == "1") - { - conditionIcon.UnSelectedImagePath = "ZigeeLogic/athome.png"; - securitystatus.Text = Language.StringByID(MyInternationalizationString.logicathomegarrison); + case "0": + { + if (conditions["ModeId"] == "1") + { + conditionIcon.UnSelectedImagePath = "ZigeeLogic/athome.png"; + securitystatus.Text = Language.StringByID(MyInternationalizationString.logicathomegarrison); - } - else - { - conditionIcon.UnSelectedImagePath = "ZigeeLogic/leavehome.png"; - securitystatus.Text = Language.StringByID(MyInternationalizationString.logicremovehomegarrison); - - } + } + else + { + conditionIcon.UnSelectedImagePath = "ZigeeLogic/leavehome.png"; + securitystatus.Text = Language.StringByID(MyInternationalizationString.logicremovehomegarrison); + } + } + break; + case "1": + { + conditionIcon.UnSelectedImagePath = "ZigeeLogic/withdrawal.png"; + securitystatus.Text = Language.StringByID(MyInternationalizationString.withdrawal); + } + break; + case "2": + { + conditionIcon.UnSelectedImagePath = "ZigeeLogic/withdrawal.png"; + securitystatus.Text = Language.StringByID(MyInternationalizationString.urgentwithdrawal); + } + break; } + } break; case 7: { + + conditionIcon.UnSelectedImagePath = "ZigeeLogic/position.png"; var btnlocation = new Button { - Width = Application.GetRealWidth(700), + Width = Application.GetRealWidth(250), TextAlignment = TextAlignment.CenterLeft, Gravity = Gravity.CenterVertical, - //Text = "鍦扮悊浣嶇疆", - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - //TextColor = 0xff121212, + TextColor = ZigbeeColor.Current.LogicBtnCancelColor, TextID = MyInternationalizationString.geographicalposition, + TextSize = 14, }; conditionsRowLayout.AddChidren(btnlocation); @@ -916,12 +1002,13 @@ var locationstatus = new Button { - Width = Application.GetRealWidth(300), + Width = Application.GetRealWidth(550), Height = Application.GetRealHeight(130), Gravity = Gravity.CenterVertical, TextAlignment = TextAlignment.CenterRight, - X = Application.GetRealWidth(500), + X = Application.GetRealWidth(250), TextColor = ZigbeeColor.Current.LogicBtnCancelColor, + TextSize = 14, }; conditionsRowLayout.AddChidren(locationstatus); foreach (var radius in Common.Logic.CurrentLogic.Accounts) @@ -1005,7 +1092,7 @@ TextColor = ZigbeeColor.Current.LogicTextBlackColor, Width = Application.GetRealWidth(300), Height = Application.GetRealHeight(60), - TextSize = 16, + TextSize = 15, Gravity = Gravity.CenterVertical, }; targetRowLayout.AddChidren(btntargettitle); @@ -1075,6 +1162,7 @@ TextColor = ZigbeeColor.Current.LogicBlankBackgroundColor, TextID = MyInternationalizationString.addfunction, X = Application.GetRealWidth(390), + TextSize = 14, }; addfl.AddChidren(addtextbtn); EventHandler<MouseEventArgs> addfunctionclick = (sender, e) => @@ -1133,18 +1221,21 @@ var deviceinof = Common.Logic.LogicDviceList.Find((obj) => { return ((obj.DeviceAddr == obj1) && (obj.DeviceEpoint.ToString() == obj2)); }); if (deviceinof == null) { - continue; + + deviceinof = new ZigBee.Device.CommonDevice(); + // continue; } - + ///璁惧鍚嶇ОButton var btndevicename = new Button { Y = Application.GetRealHeight(20), Height = Application.GetRealHeight(50), - Width = Application.GetRealWidth(450), + Width = Application.GetRealWidth(400), TextAlignment = TextAlignment.CenterLeft, Text = deviceinof.DeviceEpointName, TextColor = ZigbeeColor.Current.LogicTextBlackColor, + TextSize = 14, }; actionsrowLayout.AddChidren(btndevicename); @@ -1152,7 +1243,7 @@ var btnregionname = new Button { Y = btndevicename.Bottom + Application.GetRealHeight(10), - Width = Application.GetRealWidth(450), + Width = Application.GetRealWidth(400), TextAlignment = TextAlignment.CenterLeft, Height = Application.GetRealHeight(50), Text = "",//Language.StringByID(MyInternationalizationString.customroom), @@ -1164,12 +1255,13 @@ ///鏄剧ず璁惧鏉′欢鐘舵�佹帶浠� var devicestatus = new Button { - Width = Application.GetRealWidth(350), + Width = Application.GetRealWidth(400), Height = Application.GetRealHeight(130), Gravity = Gravity.CenterVertical, TextAlignment = TextAlignment.CenterRight, - X = Application.GetRealWidth(450), + X = Application.GetRealWidth(400), TextColor = ZigbeeColor.Current.LogicBtnCancelColor, + TextSize = 14, }; actionsrowLayout.AddChidren(devicestatus); @@ -1333,26 +1425,23 @@ { continue; } - string modetext = "", temperaturetext="", speedtext = ""; + string modetext = "", temperaturetext = "", speedtext = ""; bool ifclose = false; foreach (var status in TaskList) { - if (status["TaskType"].ToString() == "1") + + if (TaskList.Count == 1) { - if (status["Data1"].ToString() == "0") - { - // devicestatus.Text = Language.StringByID(MyInternationalizationString.close); - - ifclose = false; - } - else if (status["Data1"].ToString() == "1") - { - //devicestatus.Text = Language.StringByID(MyInternationalizationString.open); - ifclose = true; - } - + //鏁扮粍鍙湁涓�涓厓绱犺鏄庡綋鍓嶇┖璋冪姸鎬佷负鍏筹紱 + ifclose = false; + //濡傛灉绌鸿皟鐘舵�佹槸鍏筹紱鐩存帴璺冲嚭for寰潖锛� + break; } - else if (status["TaskType"].ToString() == "5") + else + { + ifclose = true; + } + if (status["TaskType"].ToString() == "5") { if (status["Data1"] == "3") {//3---璁剧疆宸ヤ綔妯″紡(1:鑷姩;3:鍒跺喎;4:鍒剁儹;7:閫侀;8:闄ゆ箍) @@ -1411,7 +1500,7 @@ //4---璁剧疆鍔犵儹搴︽暟;5---璁剧疆鍒跺喎銆侀櫎婀垮害鏁�;7---璁剧疆鑷姩搴︽暟 else if (status["Data1"] == "4" || status["Data1"] == "5" || status["Data1"] == "7") { - var s = int.Parse(status["Data2"]) /100; + var s = int.Parse(status["Data2"]) / 100; temperaturetext = s.ToString(); } else if (status["Data1"] == "20") @@ -1442,11 +1531,29 @@ break; case 2: { - + //鍦ㄦ湰鍦版煡鎵捐鍦烘櫙; var sceneinof = Common.Room.AllRoomSceneUIList.Find((obj) => { return obj.Id.ToString() == actions["DeviceAddr"].ToString(); }); + //鏈湴娌℃湁瀛樺湪; if (sceneinof == null) { - continue; + //瀹炵幇鐩殑:鏄剧ず鍑烘潵璁╁彲浠ヨ嚜宸辨槸鍚﹀垹闄� + sceneinof = new SceneUI(); + #region -------- + ////鍦ㄧ綉鍏虫煡鎵捐鍦烘櫙; + ////鏍囪闂:缃戠粶璇锋眰锛屽瓨鍦ㄨ鍥惧姞杞藉揩鎱㈢殑闂锛� + //sceneinof = await Send.GetScene(int.Parse(actions["DeviceAddr"].ToString())); + ////缃戝叧娌℃湁瀛樺湪; + //if (sceneinof == null) + //{ + // //娉ㄨВ:鏈湴鍜岀綉鍏抽兘涓嶅瓨鍦ㄨ鍦烘櫙,鐣岄潰灏嗕笉浼氭樉绀鸿鍦烘櫙; + // //sceneinof = new SceneUI(); + // //绉婚櫎璇ュ満鏅暟鎹�; + // Common.Logic.CurrentLogic.Actions.Remove(actions); + // //绉婚櫎璇ュ満鏅鍥�; + // devicesFrameLayout.RemoveFromParent(); + // continue; + //} + #endregion } actionsIcon.UnSelectedImagePath = "ZigeeLogic/scene.png"; @@ -1459,6 +1566,7 @@ TextAlignment = TextAlignment.CenterLeft, Text = sceneinof.Name, TextColor = ZigbeeColor.Current.LogicTextBlackColor, + TextSize = 14, }; actionsrowLayout.AddChidren(btndevicename); @@ -1479,7 +1587,6 @@ //Send.RoomNmae(btnregionname, deviceinof); - } break; case 4: @@ -1497,6 +1604,7 @@ Gravity = Gravity.CenterVertical, Text = logicinof.LogicName, TextColor = ZigbeeColor.Current.LogicTextBlackColor, + TextSize = 14, //TextColor = 0xff121212, }; actionsrowLayout.AddChidren(btnlogic); @@ -1528,6 +1636,7 @@ X = Application.GetRealWidth(1080 - 330), TextColor = ZigbeeColor.Current.LogicTextBlackColor, TextAlignment = TextAlignment.CenterRight, + TextSize = 14, }; actionsrowLayout.AddChidren(logicstatus); @@ -1551,6 +1660,7 @@ TextColor = ZigbeeColor.Current.LogicTextBlackColor, //TextColor = 0xff121212, TextID = MyInternationalizationString.security, + TextSize = 14, }; //actionsrowLayout.AddChidren(btnsecurity); @@ -1579,6 +1689,7 @@ Gravity = Gravity.CenterVertical, TextAlignment = TextAlignment.CenterLeft, TextColor = ZigbeeColor.Current.LogicBtnCancelColor, + TextSize = 14, }; actionsrowLayout.AddChidren(securitystatus); @@ -1626,6 +1737,7 @@ Width = Application.GetRealWidth(500), TextAlignment = TextAlignment.CenterLeft, TextColor = ZigbeeColor.Current.LogicBtnCancelColor, + TextSize = 14, }; actionsrowLayout.AddChidren(delaytimeBtn); if (Minutes != 0) @@ -1685,6 +1797,7 @@ if (e1) { Common.Logic.CurrentLogic.Actions.Remove(actions); + // devicesFrameLayout.RemoveFromParent(); var logicCommunalPage = new LogicCommunalPage(); UserView.HomePage.Instance.AddChidren(logicCommunalPage); UserView.HomePage.Instance.PageIndex += 1; @@ -1733,6 +1846,7 @@ Width = Application.GetRealWidth(300), Height = Application.GetRealHeight(60), Gravity = Gravity.CenterVertical, + TextSize = 14, }; weekRowLayout.AddChidren(settxet); var btnweektext = new Button @@ -1745,6 +1859,7 @@ TextID = MyInternationalizationString.everyday, Y = Application.GetRealHeight(35), X = settxet.Right, + TextSize = 14, }; weekRowLayout.AddChidren(btnweektext); @@ -1805,6 +1920,7 @@ Height = Application.GetRealHeight(60), Gravity = Gravity.CenterVertical, TextID = MyInternationalizationString.pushswitch, + TextSize = 14, }; pushswitchRowlayout.AddChidren(btnswitchtxet); @@ -1818,23 +1934,11 @@ Gravity = Gravity.CenterVertical, }; pushswitchRowlayout.AddChidren(btnswitch); - btnswitch.MouseUpEventHandler += (sender1, e1) => - { - btnswitch.IsSelected = !btnswitch.IsSelected; - if (btnswitch.IsSelected) - { - - } - else - { - - } - }; var custompushFrameLayout = new FrameLayout { - Height = Application.GetRealHeight(160), + Height = Application.GetRealHeight(0), BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, }; middle.AddChidren(custompushFrameLayout); @@ -1857,6 +1961,7 @@ Width = Application.GetRealWidth(300), Height = Application.GetRealHeight(60), Gravity = Gravity.CenterVertical, + TextSize = 14, }; custompushRowLayout.AddChidren(btncustompush); @@ -1881,50 +1986,53 @@ btncustompush.MouseUpEventHandler += customclick; custompushback.MouseUpEventHandler += customclick; custompushRowLayout.MouseUpEventHandler += customclick; + bool tag = false;//鏍囪寮�鍏崇姸鎬�; + btnswitch.MouseUpEventHandler += (sender1, e1) => + { + btnswitch.IsSelected = !btnswitch.IsSelected; + if (btnswitch.IsSelected) + { + tag = true; + custompushFrameLayout.Height = Application.GetRealHeight(160); + if (Common.Logic.CurrentLogic.LogicId != 0) + { + Send.Data("娣诲姞/鏇存柊", "/App/HomeLogicConfig", "POST"); + } + } + else + { + tag = false; + custompushFrameLayout.Height = Application.GetRealHeight(0); + if (Common.Logic.CurrentLogic.LogicId != 0) + { + Send.Data("鍒犻櫎", "/App/DelHomeLogicConfig", "POST"); + } + + } + }; #endregion - var saveFrameLayout = new FrameLayout - { - Y = middle.Bottom, - Height = Application.GetRealHeight(180), - BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, - }; - this.AddChidren(saveFrameLayout); - - var btnsave = new Button - { - X = Application.GetRealWidth(85), - Height = Application.GetRealHeight(130),//194 - Width = Application.GetRealWidth(910), - Radius = (uint)Application.GetRealHeight(60), - BackgroundColor = ZigbeeColor.Current.LogicBtnSaveBackgroundColor, - TextID = MyInternationalizationString.Save, - TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor, - }; - saveFrameLayout.AddChidren(btnsave); + btnsave.MouseUpEventHandler += async (sender, e) => { var name = logicTextBox.Text.Trim(); - //if (Common.Logic.CurrentLogic.Conditions.Count != 0 && Common.Logic.CurrentLogic.Actions.Count != 0) - //{ - // AddChidren(btnsave); - //} if (string.IsNullOrEmpty(logicTextBox.Text.Trim())) { new Alert(Language.StringByID(MyInternationalizationString.Tip), Language.StringByID(MyInternationalizationString.PleaseEnterLogicName), Language.StringByID(MyInternationalizationString.Close)).Show(); return; } - var logicname = Common.Logic.LogicList.Find((logic) => Common.Logic.CurrentLogic.LogicId != logic.LogicId && logic.LogicName == name); - if (logicname != null) - { - new Alert(Language.StringByID(MyInternationalizationString.Tip), Language.StringByID(MyInternationalizationString.Rename), Language.StringByID(MyInternationalizationString.Close)).Show(); - return; - } + ///鍏堥殣钘忓垽鏂悕瀛楃浉鍚岀殑鍔熻兘锛� + //var logicname = Common.Logic.LogicList.Find((logic) => Common.Logic.CurrentLogic.LogicId != logic.LogicId && logic.LogicName == name); + //if (logicname != null) + //{ + // new Alert(Language.StringByID(MyInternationalizationString.Tip), Language.StringByID(MyInternationalizationString.Rename), Language.StringByID(MyInternationalizationString.Close)).Show(); + // return; + //} Common.Logic.CurrentLogic.LogicName = name; - + bool succeed = false; //鍒ゆ柇鏄柊娣诲姞閫昏緫(榛樿0)杩樻槸淇敼閫昏緫 CommonPage.Loading.Start(); if (Common.Logic.CurrentLogic.LogicId == 0) @@ -1933,24 +2041,35 @@ var logicifon = await Send.AddModifyLogic(Common.Logic.CurrentLogic); if (logicifon != null && logicifon.LogicId != 0) { + succeed = true; Common.Logic.CurrentLogic.LogicId = logicifon.LogicId; Common.Logic.LogicList.Add(Common.Logic.CurrentLogic); + if (tag) + { + Send.Data("娣诲姞/鏇存柊", "/App/HomeLogicConfig", "POST"); + } } } else { //鍙戦�佷慨鏀归�昏緫鍛戒护 - Send.AddModifyLogic(Common.Logic.CurrentLogic); + var modlogic=Send.AddModifyLogic(Common.Logic.CurrentLogic); + //缂栬緫榛樿鎴愬姛锛堜笉鑰冭檻缃戠粶鎯呭喌锛夛紱 + succeed = true; } - CommonPage.Loading.Hide(); + + if (!succeed)//succeed鏍囪鏄坊鍔犳垚鍔熻繕鏄け璐� + { + //缃戝叧鍥炲澶辫触锛屼笉鍏抽棴鐣岄潰锛岃瀹冨仠鐣欏綋鍓嶇晫闈紱 + //锛堝師鍥狅細鑰冭檻鍒板け璐ラ噸鏂扮紪杈戝師鏉ユ暟鎹粰鐢ㄦ埛甯︽潵浜嗛夯鐑︼級 + ///鎻愮ず锛氭坊鍔犺嚜鍔ㄥ寲澶辫触锛� + //TipView("娣诲姞鑷姩鍖栧け璐�"); + //return; + } UserView.HomePage.Instance.RemoveViewByTag("Logic"); Category.Category.instance?.RefreshBodyView(); - //UserView.HomePage.Instance.RemoveAt("Logic1"); - //Category.Category category = new Category.Category(); - //UserView.HomePage.Instance.AddChidren(category); - //UserView.HomePage.Instance.PageIndex += 1; - //category.Show(2); + }; @@ -2226,14 +2345,7 @@ flMain.RemoveFromParent(); }; - var timetypeframelayout1 = new FrameLayout - { - Width = Application.GetRealWidth(1080), - Height = Application.GetRealHeight(100), - Y = Application.GetRealHeight(1920 - 100), - BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, - }; - flMain.AddChidren(timetypeframelayout1); + var framelayout = new FrameLayout { Width = Application.GetRealWidth(1080), @@ -2243,6 +2355,7 @@ Radius = (uint)Application.GetRealHeight(60), }; flMain.AddChidren(framelayout); + framelayout.SetCornerWithSameRadius(Application.GetRealHeight(58),HDLUtils.RectCornerTopLeft|HDLUtils.RectCornerTopRight); #region -------鍙栨秷 瀹屾垚 var timetype = new RowLayout @@ -2259,6 +2372,7 @@ Width = Application.GetRealWidth(200), X = Application.GetRealWidth(80), TextAlignment = TextAlignment.CenterLeft, + TextSize = 14, }; timetype.AddChidren(Btncancel); Btncancel.MouseUpEventHandler += (sender16, e16) => @@ -2286,6 +2400,7 @@ Width = Application.GetRealWidth(200), TextAlignment = TextAlignment.CenterRight, X = Btntitle.Right + Application.GetRealWidth(100), + TextSize = 14, }; timetype.AddChidren(Btncomplete); @@ -2321,6 +2436,7 @@ TextID = MyInternationalizationString.Allconditions, TextAlignment = TextAlignment.CenterLeft, TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, + TextSize = 14, }; androw.AddChidren(andbtn); @@ -2356,6 +2472,7 @@ TextID = MyInternationalizationString.anycondition, TextAlignment = TextAlignment.CenterLeft, TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, + TextSize = 14, }; orrow.AddChidren(orbtn); @@ -2449,5 +2566,50 @@ }; } + /// <summary> + /// 闂幇寮忔彁绀烘鐨勬柟娉� + /// </summary> + /// <param name="tipText">鎻愮ず鍐呭</param> + /// <param name="second">鍋滅暀鏃堕棿鍗曚綅涓簊</param> + public void TipView(string tipText, int second = 1) + { + + var frameLayout = new FrameLayout { BackgroundColor = 0x50000000 }; + this.AddChidren(frameLayout); + + var btn = new Button + { + Gravity = Gravity.Center, + Text = tipText, + BackgroundColor = 0xff1f1f1f, + Width = Application.GetRealWidth(500), + Height = Application.GetRealHeight(100), + Radius = (uint)Application.GetRealHeight(50), + }; + frameLayout.AddChidren(btn); + + var dateTime1 = DateTime.Now; + new System.Threading.Thread(() => + { + Application.RunOnMainThread(() => + { + while (true) + { + if ((DateTime.Now - dateTime1).TotalMilliseconds > second * 1000) + { + //榛樿涓�绉掑叧闂� + frameLayout.RemoveFromParent(); + break; + } + } + }); + }) + { IsBackground = true }.Start(); + + } + + + + } } -- Gitblit v1.8.0