From 25429f085093d89d543a0b90e30d0d62d1b7dac9 Mon Sep 17 00:00:00 2001 From: hxb <hxb@hdlchina.com.cn> Date: 星期二, 30 八月 2022 09:37:38 +0800 Subject: [PATCH] 合并了IOS的代码 --- ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs | 949 +++++++++++++++++------------------------------------------ 1 files changed, 276 insertions(+), 673 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs old mode 100644 new mode 100755 index 467f613..0992fcf --- a/ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs @@ -5,254 +5,88 @@ using Shared.Phone.Device; using Shared.R; using ZigBee.Device; +using Shared.Phone.Device.Logic.LogicView; + namespace Shared.Phone.Device.Logic { + public class AddLogicPage : FrameLayout { - public AddLogicPage () + public AddLogicPage() { Tag = "Logic"; } - public void Show () + public void Show() { - - this.BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor; + + #region 鐣岄潰鐨勫竷灞�浠g爜 + TopView view = new TopView(); + this.AddChidren(view.TopRowView()); + view.toptitleNameBtn.TextID = MyInternationalizationString.selection; + view.clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); }; + + var middle = new FrameLayout + { + Y = view.topRowLayout.Bottom, + Height = Application.GetRealHeight(Method.H - 184), + BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, + }; + this.AddChidren(middle); + ///鏃堕棿 + FunView timeView = new FunView(); + timeView.iconBtn.UnSelectedImagePath = "ZigeeLogic/time.png"; + timeView.funnameBtn.TextID = MyInternationalizationString.timecondition; + middle.AddChidren(timeView.FunFrameView()); + + ///璁惧 + FunView functionView = new FunView(); + functionView.funFrameLayout.Y = timeView.funFrameLayout.Bottom; + functionView.iconBtn.UnSelectedImagePath = "ZigeeLogic/function.png"; + functionView.funnameBtn.TextID = MyInternationalizationString.device; + middle.AddChidren(functionView.FunFrameView()); + + ///瀹夐槻 + FunView securityView = new FunView(); + securityView.funFrameLayout.Y = functionView.funFrameLayout.Bottom; + securityView.iconBtn.UnSelectedImagePath = "ZigeeLogic/security.png"; + securityView.funnameBtn.TextID = MyInternationalizationString.security; + middle.AddChidren(securityView.FunFrameView()); + + ///鍦扮悊鍥存爮 + FunView positionView = new FunView(); + positionView.funFrameLayout.Y = securityView.funFrameLayout.Bottom; + positionView.funFrameLayout.Height = Application.GetRealHeight(160+20);//鏈�鍚庝竴琛屽鍔�20楂樺害; + positionView.iconBtn.UnSelectedImagePath = "ZigeeLogic/position.png"; + positionView.funnameBtn.TextID = MyInternationalizationString.location; + positionView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor; + middle.AddChidren(positionView.FunFrameView()); + #endregion - var topFrameLayout = new FrameLayout { - Height = Application.GetRealHeight (140), - Y = Application.GetRealHeight (80), - }; - AddChidren (topFrameLayout); - - var titleName = new Button { - TextID = MyInternationalizationString.selection, - TextSize = 17, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(150), - }; - topFrameLayout.AddChidren (titleName); - - var back = new Button { - Width = Application.GetRealWidth (110), - Height = Application.GetRealHeight (110), - X = Application.GetRealWidth (20), - Gravity = Gravity.CenterVertical, - UnSelectedImagePath = "ZigeeLogic/Back.png", - }; - topFrameLayout.AddChidren (back); - back.MouseDownEventHandler += (sender, e) => { - RemoveFromParent (); - }; - - var middle = new FrameLayout (); - middle.Y = topFrameLayout.Bottom; - middle.Height = Application.GetRealHeight (1920 - 220); - middle.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; - this.AddChidren (middle); - - - #region ----鏃堕棿鏉′欢---- - var timerowlayout = new RowLayout { - Height = Application.GetRealHeight (180), - //Y=pointtimerowlayout.Bottom, - }; - middle.AddChidren (timerowlayout); - ///鏃堕棿鏉′欢 - var btntime = new Button { - Text=Language.StringByID (MyInternationalizationString.timecondition), - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth (60), - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - }; - timerowlayout.AddChidren (btntime); - - var btntimeback = new Button { - Width = Application.GetRealWidth (110), - Height = Application.GetRealHeight (110), - UnSelectedImagePath = "ZigeeLogic/next.png", - SelectedImagePath = "ZigeeLogic/NextSelecte.png", - X = Application.GetRealWidth (1080 - 140), - Gravity = Gravity.CenterVertical, - }; - timerowlayout.AddChidren (btntimeback); - - EventHandler<MouseEventArgs> timeclick = (sender, e) => { - //var timePage = new TimePage (); - //UserView.HomePage.Instance.AddChidren (timePage); - //UserView.HomePage.Instance.PageIndex += 1; - //timePage.Show (); + timeView.clickviewBtn.MouseUpEventHandler += (sender, e) => + { TimeView(); }; - btntime.MouseUpEventHandler += timeclick; - btntimeback.MouseUpEventHandler += timeclick; - #endregion - - #region ----璁惧鐘舵�佹潯浠�---- - var devicerowlayout = new RowLayout { - Height = Application.GetRealHeight (180), - Y=timerowlayout.Bottom, - }; - middle.AddChidren (devicerowlayout); - ///璁惧鐘舵�佹潯浠� - var btndevice = new Button { - //Text = "璁惧鐘舵�佹潯浠�", - TextID = MyInternationalizationString.devicestate, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth (60), - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - }; - devicerowlayout.AddChidren (btndevice); - - var btndeviceback = new Button { - Width = Application.GetRealWidth (110), - Height = Application.GetRealHeight (110), - UnSelectedImagePath = "ZigeeLogic/next.png", - SelectedImagePath = "ZigeeLogic/NextSelecte.png", - X = Application.GetRealWidth (1080-140), - Gravity = Gravity.CenterVertical, - }; - devicerowlayout.AddChidren (btndeviceback); - - EventHandler<MouseEventArgs> devicestateclick = (sender, e) => + functionView.clickviewBtn.MouseUpEventHandler += (sender, e) => { - Common.Logic.LogicDviceList.Clear(); - if (Common.Logic.LogicDviceList.Count == 0) - { - Common.Logic.LogicDviceList.AddRange(LocalDevice.Current.listAllDevice.ToArray()); - } - var deviceStateCondition = new DeviceStateCondition(); - UserView.HomePage.Instance.AddChidren(deviceStateCondition); + var roomAndDeviceView = new RoomAndDeviceView(); + UserView.HomePage.Instance.AddChidren(roomAndDeviceView); UserView.HomePage.Instance.PageIndex += 1; - deviceStateCondition.Show(); - }; - devicerowlayout.MouseUpEventHandler += devicestateclick; - btndevice.MouseUpEventHandler += devicestateclick; - btndeviceback.MouseUpEventHandler += devicestateclick; - #endregion + roomAndDeviceView.IfType = LogicView.IfString.Condition_Logic; + roomAndDeviceView.Show(Language.StringByID(MyInternationalizationString.devicestate)); - #region ----瀹夐槻鏉′欢---- - var securityrowlayout = new RowLayout + }; + securityView.clickviewBtn.MouseUpEventHandler += (sender, e) => { - Height = Application.GetRealHeight(180), - Y = devicerowlayout.Bottom, + SecurityView(this,false); }; - middle.AddChidren(securityrowlayout); - - var btnsecurity = new Button + positionView.clickviewBtn.MouseUpEventHandler += (sender, e) => { - //Text = "瀹夐槻鏉′欢", - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(60), - TextID = MyInternationalizationString.securityconditions, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, + + LocationView(this, false); }; - securityrowlayout.AddChidren(btnsecurity); - - var btnsecurityback = new Button - { - Width = Application.GetRealWidth(110), - Height = Application.GetRealHeight(110), - UnSelectedImagePath = "ZigeeLogic/next.png", - SelectedImagePath = "ZigeeLogic/NextSelecte.png", - X = Application.GetRealWidth(1080 - 140), - Gravity = Gravity.CenterVertical, - }; - securityrowlayout.AddChidren(btnsecurityback); - - EventHandler<MouseEventArgs> securityclick = (sender, e) => - { - var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; - this.AddChidren(flMain); - SecurityView(flMain, false); - }; - securityrowlayout.MouseUpEventHandler += securityclick; - btnsecurity.MouseUpEventHandler += securityclick; - btnsecurityback.MouseUpEventHandler += securityclick; - #endregion - - #region ----宸叉湁鑷姩鍖栨潯浠�---- - var existencerowlayout = new RowLayout { - Height = Application.GetRealHeight (180), - Y= securityrowlayout.Bottom, - }; - //middle.AddChidren (existencerowlayout); - ///宸叉湁鑷姩鍖栨潯浠� - var btnexistence = new Button - { - //Text = "宸叉湁鑷姩鍖栨潯浠�", - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(60), - TextID = MyInternationalizationString.automation, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - }; - existencerowlayout.AddChidren (btnexistence); - - var btnexistenceback = new Button { - Width = Application.GetRealWidth (110), - Height = Application.GetRealHeight (110), - UnSelectedImagePath = "ZigeeLogic/next.png", - SelectedImagePath = "ZigeeLogic/NextSelecte.png", - X = Application.GetRealWidth (1080 - 140), - Gravity=Gravity.CenterVertical, - }; - existencerowlayout.AddChidren (btnexistenceback); - - EventHandler<MouseEventArgs> logicclick = (sender, e) => { - var logicListAutomation = new LogicListAutomation (); - UserView.HomePage.Instance.AddChidren (logicListAutomation); - UserView.HomePage.Instance.PageIndex += 1; - logicListAutomation.Show (); - }; - btnexistenceback.MouseUpEventHandler += logicclick; - btnexistence.MouseUpEventHandler += logicclick; - existencerowlayout.MouseUpEventHandler += logicclick; - #endregion - - #region ----鍦扮悊鍥存爮鏉′欢---- - var locationrowlayout = new RowLayout - { - Height = Application.GetRealHeight(180), - Y = securityrowlayout.Bottom, - }; - //middle.AddChidren(locationrowlayout); - - var btnlocation = new Button - { - //Text = "鍦扮悊鍥存爮", - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(60), - TextID = MyInternationalizationString.location, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - }; - locationrowlayout.AddChidren(btnlocation); - - var btnlocationback = new Button - { - Width = Application.GetRealWidth(110), - Height = Application.GetRealHeight(110), - UnSelectedImagePath = "ZigeeLogic/next.png", - SelectedImagePath = "ZigeeLogic/NextSelecte.png", - X = Application.GetRealWidth(1080 - 140), - Gravity = Gravity.CenterVertical, - }; - locationrowlayout.AddChidren(btnlocationback); - - EventHandler<MouseEventArgs> locationclick = (sender, e) => - { - var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; - this.AddChidren(flMain); - LocationView(flMain, false); - }; - locationrowlayout.MouseUpEventHandler += locationclick; - btnlocation.MouseUpEventHandler += locationclick; - btnlocationback.MouseUpEventHandler += locationclick; - #endregion - - - } + /// <summary> /// 瀹夐槻鏉′欢View /// </summary> @@ -260,191 +94,90 @@ /// <param name="edit">If set to <c>true</c> edit.</param> public static void SecurityView(FrameLayout flMain, bool edit) { - UserView.HomePage.Instance.ScrollEnabled = false; - Dictionary<string, string> SecurityConditionsInfo = new Dictionary<string, string>(); - //var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; - //this.AddChidren(flMain); - flMain.MouseUpEventHandler += (sender12, e12) => - { - flMain.RemoveFromParent(); - }; - var devicefra = new FrameLayout - { - Width = Application.GetRealWidth(1080 - 80), - Height = Application.GetRealHeight(720), - Y = Application.GetRealHeight(1920 - 30 - 720), - X = Application.GetRealWidth(40), - BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, - Radius = (uint)Application.GetRealHeight(50), - }; - flMain.AddChidren(devicefra); - - var devicename = new Button - { - Y = Application.GetRealHeight(20), - TextID = MyInternationalizationString.securityconditions, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - Height = Application.GetRealHeight(150), - Width = Application.GetRealWidth(1080 - 80), - }; - devicefra.AddChidren(devicename); - - if (SecurityConditionsInfo.ContainsKey("Type")) - { - SecurityConditionsInfo.Remove("Type"); - } - if (SecurityConditionsInfo.ContainsKey("IsValid")) - { - SecurityConditionsInfo.Remove("IsValid"); - } - if (SecurityConditionsInfo.ContainsKey("ModeId")) - { - SecurityConditionsInfo.Remove("ModeId"); - } - - SecurityConditionsInfo.Add("Type", "6"); - SecurityConditionsInfo.Add("IsValid", "1"); - SecurityConditionsInfo.Add("ModeId", "0"); - - var defenceRowLayout = new RowLayout - { - Height = Application.GetRealHeight(180), - Y = devicename.Bottom, - }; - devicefra.AddChidren(defenceRowLayout); - - var btndefence = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.defence, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(40), - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - //Text="甯冮槻", - }; - defenceRowLayout.AddChidren(btndefence); - var defenceSelected = new Button - { - X = Application.GetRealWidth(1000 - 150), - Width = Application.GetMinRealAverage(110), - Height = Application.GetMinRealAverage(110), - UnSelectedImagePath = "Item/YesSelected.png", - Visible = false, - Gravity = Gravity.CenterVertical - }; - defenceRowLayout.AddChidren(defenceSelected); - - var withdrawalRowLayout = new RowLayout - { - Y = defenceRowLayout.Bottom, - Height = Application.GetRealHeight(180), - }; - devicefra.AddChidren(withdrawalRowLayout); - - var btnwithdrawal = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.withdrawal, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(40), - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - //Text = "鎾ら槻", - }; - withdrawalRowLayout.AddChidren(btnwithdrawal); - var withdrawalSelected = new Button - { - X = Application.GetRealWidth(1000 - 150), - Width = Application.GetMinRealAverage(110), - Height = Application.GetMinRealAverage(110), - UnSelectedImagePath = "Item/YesSelected.png", - Visible = false, - Gravity = Gravity.CenterVertical - }; - withdrawalRowLayout.AddChidren(withdrawalSelected); - - ///甯冮槻鐐瑰嚮浜嬩欢 - EventHandler<MouseEventArgs> copenclick = (sedner14, e14) => - { - UserView.HomePage.Instance.ScrollEnabled = true; - defenceSelected.Visible = true; - withdrawalSelected.Visible = false; - if (SecurityConditionsInfo.ContainsKey("EnOrWithdrawMode")) - { - SecurityConditionsInfo.Remove("EnOrWithdrawMode"); - } - SecurityConditionsInfo.Add("EnOrWithdrawMode", "0"); - - LogicIfon.AddSecurityconditions(SecurityConditionsInfo); - var logicCommunalPage = new LogicCommunalPage(); - UserView.HomePage.Instance.AddChidren(logicCommunalPage); - UserView.HomePage.Instance.PageIndex += 1; - logicCommunalPage.Show(() => { }); - }; - btndefence.MouseUpEventHandler += copenclick; - defenceRowLayout.MouseUpEventHandler += copenclick; - defenceSelected.MouseUpEventHandler += copenclick; - - - ///鎾ら槻鐐瑰嚮浜嬩欢 - EventHandler<MouseEventArgs> disableclick = (sedner15, e15) => - { - UserView.HomePage.Instance.ScrollEnabled = true; - defenceSelected.Visible = false; - withdrawalSelected.Visible = true; - if (SecurityConditionsInfo.ContainsKey("EnOrWithdrawMode")) - { - SecurityConditionsInfo.Remove("EnOrWithdrawMode"); - } - SecurityConditionsInfo.Add("EnOrWithdrawMode", "1"); - LogicIfon.AddSecurityconditions(SecurityConditionsInfo); - var logicCommunalPage = new LogicCommunalPage(); - UserView.HomePage.Instance.AddChidren(logicCommunalPage); - UserView.HomePage.Instance.PageIndex += 1; - logicCommunalPage.Show(() => { }); - }; - withdrawalRowLayout.MouseUpEventHandler += disableclick; - btnwithdrawal.MouseUpEventHandler += disableclick; - withdrawalSelected.MouseUpEventHandler += disableclick; - + + string stateText = ""; if (edit) { foreach (var securityifon in Common.Logic.CurrentLogic.Conditions) { - if (securityifon["Type"] == "6") { - if (securityifon["EnOrWithdrawMode"] == "0") + switch (securityifon["EnOrWithdrawMode"]) { - defenceSelected.Visible = true; - withdrawalSelected.Visible = false; - + case "0": + { + if (securityifon["ModeId"] == "1") + { + stateText = Language.StringByID(MyInternationalizationString.logicathomegarrison); + } + else + { + stateText = Language.StringByID(MyInternationalizationString.logicremovehomegarrison); + } + } + break; + case "1": + { + stateText = Language.StringByID(MyInternationalizationString.withdrawal); + } + break; + case "2": + { + stateText = Language.StringByID(MyInternationalizationString.urgentwithdrawal); + } + break; } - else - { - defenceSelected.Visible = false; - withdrawalSelected.Visible = true; - } - break; } } } - var cancel = new Button + PublicInterface publicInterface = new PublicInterface(); + var list=publicInterface.GetViewList("瀹夐槻"); + publicInterface.SingleSelectionShow(flMain, list, MyInternationalizationString.security, stateText, (str) => { - Height = Application.GetRealHeight(160), - TextID = MyInternationalizationString.cancel, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextSize = 16, - BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor, - Y = devicefra.Height - Application.GetRealHeight(160), + string EnOrWithdrawMode = ""; + string ModeId = ""; + //鍦ㄥ甯冮槻 + if (str == Language.StringByID(MyInternationalizationString.logicathomegarrison)) + { + EnOrWithdrawMode = "0"; + ModeId = "1"; - }; - devicefra.AddChidren(cancel); - cancel.MouseUpEventHandler += (sender16, e16) => - { - flMain.RemoveFromParent(); - UserView.HomePage.Instance.ScrollEnabled = true; - }; + } + //绂诲甯冮槻 + else if (str == Language.StringByID(MyInternationalizationString.logicremovehomegarrison)) + { + EnOrWithdrawMode = "0"; + ModeId = "2"; + } + //鎾ら槻 + else if (str == Language.StringByID(MyInternationalizationString.withdrawal)) + { + EnOrWithdrawMode = "1"; + ModeId = "0"; + + } + //鑳佽揩鎾ら槻 + else if (str == Language.StringByID(MyInternationalizationString.urgentwithdrawal)) + { + EnOrWithdrawMode = "2"; + ModeId = "0"; + + } + + var securityConditions = new Dictionary<string, string>(); + securityConditions.Add("Type", "6"); + securityConditions.Add("IsValid", "1"); + securityConditions.Add("EnOrWithdrawMode", EnOrWithdrawMode); + securityConditions.Add("ModeId", ModeId); + + LogicIfon.AddSecurityconditions(securityConditions); + var logicCommunalPage = new LogicCommunalPage(); + UserView.HomePage.Instance.AddChidren(logicCommunalPage); + UserView.HomePage.Instance.PageIndex += 1; + logicCommunalPage.Show(() => { }); + + }); } /// <summary> /// 鍦扮悊鍥存爮View @@ -453,187 +186,140 @@ /// <param name="edit">If set to <c>true</c> edit.</param> public static void LocationView(FrameLayout flMain, bool edit) { - UserView.HomePage.Instance.ScrollEnabled = false; - Dictionary<string, string> LocationConditionsInfo = new Dictionary<string, string>(); - //var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; - //this.AddChidren(flMain); - flMain.MouseUpEventHandler += (sender12, e12) => - { - flMain.RemoveFromParent(); - }; - var Locationfra = new FrameLayout - { - Width = Application.GetRealWidth(1080 - 80), - Height = Application.GetRealHeight(720), - Y = Application.GetRealHeight(1920 - 30 - 720), - X = Application.GetRealWidth(40), - BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, - Radius = (uint)Application.GetRealHeight(50), - }; - flMain.AddChidren(Locationfra); - - var locationviewname = new Button - { - Y = Application.GetRealHeight(20), - TextID = MyInternationalizationString.locationmode, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - Height = Application.GetRealHeight(150), - Width = Application.GetRealWidth(1080 - 80), - //Text="浣嶇疆妯″紡", - }; - Locationfra.AddChidren(locationviewname); - - if (LocationConditionsInfo.ContainsKey("Type")) - { - LocationConditionsInfo.Remove("Type"); - } - if (LocationConditionsInfo.ContainsKey("IsValid")) - { - LocationConditionsInfo.Remove("IsValid"); - } - - LocationConditionsInfo.Add("Type", "7"); - LocationConditionsInfo.Add("IsValid", "1"); - - var leavehomeRowLayout = new RowLayout - { - Height = Application.GetRealHeight(180), - Y = locationviewname.Bottom, - }; - Locationfra.AddChidren(leavehomeRowLayout); - - var btnleavehome = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.leavehome, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(40), - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - //Text="绂诲", - }; - leavehomeRowLayout.AddChidren(btnleavehome); - var leavehomeSelected = new Button - { - X = Application.GetRealWidth(1000 - 150), - Width = Application.GetMinRealAverage(110), - Height = Application.GetMinRealAverage(110), - UnSelectedImagePath = "Item/YesSelected.png", - Visible = false, - Gravity = Gravity.CenterVertical - }; - leavehomeRowLayout.AddChidren(leavehomeSelected); - - var athomeRowLayout = new RowLayout - { - Y = leavehomeRowLayout.Bottom, - Height = Application.GetRealHeight(180), - }; - Locationfra.AddChidren(athomeRowLayout); - - var btnathome = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.athome, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(40), - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - //Text = "鍦ㄥ", - }; - athomeRowLayout.AddChidren(btnathome); - var athomeSelected = new Button - { - X = Application.GetRealWidth(1000 - 150), - Width = Application.GetMinRealAverage(110), - Height = Application.GetMinRealAverage(110), - UnSelectedImagePath = "Item/YesSelected.png", - Visible = false, - Gravity = Gravity.CenterVertical - }; - athomeRowLayout.AddChidren(athomeSelected); - - ///绂诲鐐瑰嚮浜嬩欢 - EventHandler<MouseEventArgs> leavehomeclick = (sedner14, e14) => - { - UserView.HomePage.Instance.ScrollEnabled = true; - leavehomeSelected.Visible = true; - athomeSelected.Visible = false; - if (LocationConditionsInfo.ContainsKey("AtHome")) - { - LocationConditionsInfo.Remove("AtHome"); - } - LocationConditionsInfo.Add("AtHome", "0"); - - LogicIfon.AddLocationconditions(LocationConditionsInfo); - var logicCommunalPage = new LogicCommunalPage(); - UserView.HomePage.Instance.AddChidren(logicCommunalPage); - UserView.HomePage.Instance.PageIndex += 1; - logicCommunalPage.Show(() => { }); - }; - btnleavehome.MouseUpEventHandler += leavehomeclick; - leavehomeSelected.MouseUpEventHandler += leavehomeclick; - leavehomeRowLayout.MouseUpEventHandler += leavehomeclick; - - - ///鍦ㄥ鐐瑰嚮浜嬩欢 - EventHandler<MouseEventArgs> athomeclick = (sedner15, e15) => - { - UserView.HomePage.Instance.ScrollEnabled = true; - leavehomeSelected.Visible = false; - athomeSelected.Visible = true; - if (LocationConditionsInfo.ContainsKey("AtHome")) - { - LocationConditionsInfo.Remove("AtHome"); - } - LocationConditionsInfo.Add("AtHome", "1"); - LogicIfon.AddLocationconditions(LocationConditionsInfo); - var logicCommunalPage = new LogicCommunalPage(); - UserView.HomePage.Instance.AddChidren(logicCommunalPage); - UserView.HomePage.Instance.PageIndex += 1; - logicCommunalPage.Show(() => { }); - }; - btnathome.MouseUpEventHandler += athomeclick; - athomeSelected.MouseUpEventHandler += athomeclick; - athomeRowLayout.MouseUpEventHandler += athomeclick; - + string strname = ""; + double latitude = Config.Instance.Home.Latitude;//绾害 + double longitude = Config.Instance.Home.Longitude;//缁忓害 + int r = 500;//鍗婂緞 if (edit) { + string guid = ""; foreach (var Locationifon in Common.Logic.CurrentLogic.Conditions) { if (Locationifon["Type"] == "7") { - if (Locationifon["AtHome"] == "0") + guid = Locationifon["WhoSiteUId"]; + if (Locationifon["AtHome"] == "1") { - leavehomeSelected.Visible = true; - athomeSelected.Visible = false; - + strname = Language.StringByID(MyInternationalizationString.athome); } else { - leavehomeSelected.Visible = false; - athomeSelected.Visible = true; + //绂诲紑鍦扮偣 + strname = Language.StringByID(MyInternationalizationString.leavehome); } break; } } + + foreach (var accounts in Common.Logic.CurrentLogic.Accounts) + { + + if (accounts["Type"] == "7" && accounts["Account"] == guid) + { + + ///杞崲涓篸ouble绫诲瀷锛� + latitude = Convert.ToDouble(accounts["Latitude"]) / 1000000.0; + longitude = Convert.ToDouble(accounts["Longitude"]) / 1000000.0; + r = int.Parse(accounts["Radius"]); + break; + } + } } - var cancel = new Button - { - Height = Application.GetRealHeight(160), - TextID = MyInternationalizationString.cancel, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextSize = 16, - BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor, - Y = Locationfra.Height - Application.GetRealHeight(160), + PublicInterface publicInterface = new PublicInterface(); + var list = publicInterface.GetViewList("鍦扮悊鍥存爮"); + publicInterface.SingleSelectionShow(flMain, list, MyInternationalizationString.location, strname, (str) => + { + var LocationConditionsInfo = new Dictionary<string, string>(); + LocationConditionsInfo.Add("Type", "7"); + LocationConditionsInfo.Add("IsValid", "1"); + LocationConditionsInfo.Add("WhoSiteUId", Config.Instance.Guid); - }; - Locationfra.AddChidren(cancel); - cancel.MouseUpEventHandler += (sender16, e16) => - { - flMain.RemoveFromParent(); - UserView.HomePage.Instance.ScrollEnabled = true; - }; + if (str == Language.StringByID(MyInternationalizationString.athome)) + { + LocationConditionsInfo.Add("AtHome", "1"); + } + else if (str == Language.StringByID(MyInternationalizationString.leavehome)) + { + + LocationConditionsInfo.Add("AtHome", "0"); + } + +#if Android + //鐢宠瀹氫綅鏉冮檺 + ((BaseActivity)Application.Activity).SetGPSLocationPermission((result1) => + { + if (result1 == false) { return; } + + //鐢宠鍏佽绋嬪簭鍐欏叆澶栭儴瀛樺偍锛屽SD鍗′笂鍐欐枃浠� + ((BaseActivity)Application.Activity).SetPermission((result2) => + { + if (result2 == false) { return; } + //璇诲彇鐢佃瘽鐘舵�佹潈闄� + ((BaseActivity)Application.Activity).SetPermission((result3) => + { + if (result3 == false) { return; } + + //璋冪敤鏂规硶锛岃烦杞〉闈� + GDMapKit.Show((mLatitude, mLongitude, mRadius, name) => + { + //鎴彇瀛楃涓插悗绗�6浣嶏紱 + //var len = name.Substring(name.Length - 6, 6); + + //鐐瑰嚮淇濆瓨鎸夐挳锛屽洖璋冨綋鍓嶉�夋嫨鐨勭含搴︼紝缁忓害锛屽崐寰勮寖鍥� + var latitudW = (int)Math.Truncate(mLatitude * 1000000); + var longitudeH = (int)Math.Truncate(mLongitude * 1000000); + Dictionary<string, string> accounts = new Dictionary<string, string>(); + accounts.Add("Account", Config.Instance.Guid); + accounts.Add("Type", "7"); + accounts.Add("Latitude", latitudW.ToString()); + accounts.Add("Longitude", longitudeH.ToString()); + accounts.Add("Radius", mRadius.ToString()); + + LogicIfon.Addaccounts(accounts); + LogicIfon.AddLocationconditions(LocationConditionsInfo); + + var logicCommunalPage = new LogicCommunalPage(); + UserView.HomePage.Instance.AddChidren(logicCommunalPage); + UserView.HomePage.Instance.PageIndex += 1; + logicCommunalPage.Show(() => { }); + }, strname, Language.StringByID(R.MyInternationalizationString.uSave), true, latitude, longitude, r); + + }, "android.permission.READ_PHONE_STATE"); + + }, "android.permission.WRITE_EXTERNAL_STORAGE"); + }); +#endif +#if iOS + //璋冪敤鏂规硶锛岃烦杞〉闈� + GDMapKit.Show((mLatitude, mLongitude, mRadius, name) => + { + //鎴彇瀛楃涓插悗绗�6浣嶏紱 + //var len = name.Substring(name.Length - 6, 6); + + //鐐瑰嚮淇濆瓨鎸夐挳锛屽洖璋冨綋鍓嶉�夋嫨鐨勭含搴︼紝缁忓害锛屽崐寰勮寖鍥� + var latitudW = (int)Math.Truncate(mLatitude * 1000000); + var longitudeH = (int)Math.Truncate(mLongitude * 1000000); + Dictionary<string, string> accounts = new Dictionary<string, string>(); + accounts.Add("Account", Config.Instance.Guid); + accounts.Add("Type", "7"); + accounts.Add("Latitude", latitudW.ToString()); + accounts.Add("Longitude", longitudeH.ToString()); + accounts.Add("Radius", mRadius.ToString()); + + LogicIfon.Addaccounts(accounts); + LogicIfon.AddLocationconditions(LocationConditionsInfo); + + var logicCommunalPage = new LogicCommunalPage(); + UserView.HomePage.Instance.AddChidren(logicCommunalPage); + UserView.HomePage.Instance.PageIndex += 1; + logicCommunalPage.Show(() => { }); + }, strname, Language.StringByID(R.MyInternationalizationString.uSave), true, latitude, longitude, r); +#endif + }); + + } /// <summary> @@ -641,129 +327,46 @@ /// </summary> void TimeView() { - UserView.HomePage.Instance.ScrollEnabled = false; - Dictionary<string, string> SecurityConditionsInfo = new Dictionary<string, string>(); - var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; - this.AddChidren(flMain); - flMain.MouseUpEventHandler += (sender12, e12) => + PublicInterface publicInterface = new PublicInterface(); + var list = publicInterface.GetViewList("鏃堕棿"); + publicInterface.SingleSelectionShow(this, list, MyInternationalizationString.type, "", (str) => { - flMain.RemoveFromParent(); - }; - var timetypeframelayout = new FrameLayout - { - Width = Application.GetRealWidth(1080 - 80), - Height = Application.GetRealHeight(720), - Y = Application.GetRealHeight(1920 - 30 - 720), - X = Application.GetRealWidth(40), - BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, - Radius = (uint)Application.GetRealHeight(50), - }; - flMain.AddChidren(timetypeframelayout); + if (str == Language.StringByID(MyInternationalizationString.immediateexecution)) + { - var Btntitle= new Button - { - Y = Application.GetRealHeight(20), - TextID = MyInternationalizationString.Selectedtimetype, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - Height = Application.GetRealHeight(150), - Width = Application.GetRealWidth(1080 - 80), - //Text="鏃堕棿绫诲瀷", - }; - timetypeframelayout.AddChidren(Btntitle); + Dictionary<string, string> timeConditionsInfo = new Dictionary<string, string>(); + timeConditionsInfo.Add("Type", "0"); + timeConditionsInfo.Add("IsValid", "1"); + timeConditionsInfo.Add("DateType", "1"); + timeConditionsInfo.Add("RemindTime", "0"); + timeConditionsInfo.Add("EnDelay", "0"); + timeConditionsInfo.Add("DelayTime", "0"); + timeConditionsInfo.Add("AdjustTime", "0"); - + var timePoint = new TimePoint(); + UserView.HomePage.Instance.AddChidren(timePoint); + UserView.HomePage.Instance.PageIndex += 1; + timePoint.Show(timeConditionsInfo); + } + else if (str == Language.StringByID(MyInternationalizationString.timeframe)) + { + var timePage = new TimePage(); + UserView.HomePage.Instance.AddChidren(timePage); + UserView.HomePage.Instance.PageIndex += 1; + timePage.Show(); - var timepointrow= new RowLayout - { - Height = Application.GetRealHeight(180), - Y = Btntitle.Bottom, - }; - timetypeframelayout.AddChidren(timepointrow); + } - var Btntimepoint = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.immediateexecution, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(40), - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - //Text="绔嬪嵆鎵ц", - }; - timepointrow.AddChidren(Btntimepoint); - - var timerow = new RowLayout - { - Y = timepointrow.Bottom, - Height = Application.GetRealHeight(180), - }; - timetypeframelayout.AddChidren(timerow); - - var Btntime = new Button - { - Width = Application.GetRealWidth(600), - TextID = MyInternationalizationString.timeframe, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(40), - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - //Text = "鏃堕棿鑼冨洿", - }; - timerow.AddChidren(Btntime); - - ///绔嬪嵆鎵ц鐐瑰嚮浜嬩欢 - EventHandler<MouseEventArgs> timepointclick = (sedner14, e14) => - { - Dictionary<string, string> timeConditionsInfo = new Dictionary<string, string>(); - timeConditionsInfo.Add("Type", "0"); - timeConditionsInfo.Add("IsValid", "1"); - timeConditionsInfo.Add("DateType", "1"); - timeConditionsInfo.Add("RemindTime", "0"); - timeConditionsInfo.Add("EnDelay", "0"); - timeConditionsInfo.Add("DelayTime", "0"); - timeConditionsInfo.Add("AdjustTime", "0"); - UserView.HomePage.Instance.ScrollEnabled = true; - flMain.RemoveFromParent(); - var timePoint = new TimePoint(); - UserView.HomePage.Instance.AddChidren(timePoint); - UserView.HomePage.Instance.PageIndex += 1; - timePoint.Show(timeConditionsInfo); - }; - Btntimepoint.MouseUpEventHandler += timepointclick; - timepointrow.MouseUpEventHandler += timepointclick; + }); - ///鏃堕棿鑼冨洿鐐瑰嚮浜嬩欢 - EventHandler<MouseEventArgs> timeclick = (sedner15, e15) => - { - UserView.HomePage.Instance.ScrollEnabled = true; - flMain.RemoveFromParent(); - var timePage = new TimePage(); - UserView.HomePage.Instance.AddChidren (timePage); - UserView.HomePage.Instance.PageIndex += 1; - timePage.Show (); - - }; - Btntime.MouseUpEventHandler += timeclick; - timerow.MouseUpEventHandler += timeclick; - var cancel = new Button - { - Height = Application.GetRealHeight(160), - TextID = MyInternationalizationString.cancel, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextSize = 16, - BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor, - Y = timetypeframelayout.Height - Application.GetRealHeight(160), - }; - timetypeframelayout.AddChidren(cancel); - cancel.MouseUpEventHandler += (sender16, e16) => - { - flMain.RemoveFromParent(); - UserView.HomePage.Instance.ScrollEnabled = true; - }; } + } + } -- Gitblit v1.8.0