| | |
| | | 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 界面的布局代码 |
| | | 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.device, |
| | | 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.security, |
| | | 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> |
| | |
| | | /// <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 |
| | |
| | | /// <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) |
| | | { |
| | | |
| | | ///转换为double类型; |
| | | 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> |
| | |
| | | /// </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; |
| | | }; |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | } |