| | |
| | | 5374=添加传感器 |
| | | 5375=添加开关/灯光 |
| | | 5376=应用 |
| | | |
| | | 5377=没有自动化{\r\n} 请点击右上角添加 |
| | | |
| | | |
| | | |
| | |
| | | 5374=添加传感器 |
| | | 5375=添加开关/灯光 |
| | | 5376=应用 |
| | | 5377=没有自动化{\r\n} 请点击右上角添加 |
| | | |
| | | |
| | | |
old mode 100755
new mode 100644
| | |
| | | /// <summary> |
| | | /// 推送内容 |
| | | /// </summary> |
| | | public string LogicCustomPushText; |
| | | public string LogicCustomPushText=string.Empty; |
| | | |
| | | //public Dictionary<string, string> TimeAttribute = new Dictionary<string, string>(); |
| | | public TimeAttributeObj TimeAttribute = new TimeAttributeObj(); |
| | |
| | | /// </summary> |
| | | private void ShowAutotion() |
| | | {
|
| | |
|
| | | functionSceneAutoBodyView.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor; |
| | | // functionSceneAutoBodyView.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor; |
| | |
|
| | | var bjFrameLayout = new FrameLayout |
| | | { |
| | |
| | | var logicScrolView = new VerticalRefreshLayout//VerticalScrolViewLayout |
| | | { |
| | | Height = functionSceneAutoBodyView.Height - bjFrameLayout.Height - bjFrameLayout.Y - scenehorizontalScrol.Height - Application.GetRealHeight(30), |
| | | BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, |
| | | //BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,/ |
| | | X = Application.GetRealWidth(58), |
| | | //Radius = (uint)Application.GetRealHeight(50), |
| | | Y = scenehorizontalScrol.Bottom, |
| | | }; |
| | | functionSceneAutoBodyView.AddChidren(logicScrolView); |
| | | logicScrolView.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft); |
| | | |
| | | bool no = false; |
| | | recommendswitchBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | int Yheight = 0; |
| | |
| | | scenehorizontalScrol.RemoveAll(); |
| | | if (recommendswitchBtn.IsSelected) |
| | | { |
| | | no = true; |
| | | scenehorizontalScrol.Height = Application.GetRealHeight(246); |
| | | Yheight = 20; |
| | | for (int i = 1; i < 4; i++) |
| | |
| | | } |
| | | else |
| | | { |
| | | no = false; |
| | | scenehorizontalScrol.Height = Application.GetRealHeight(0); |
| | | Yheight = 0; |
| | | } |
| | | logicScrolView.Y = scenehorizontalScrol.Bottom + Yheight; |
| | | logicScrolView.Height = functionSceneAutoBodyView.Height - bjFrameLayout.Height - bjFrameLayout.Y - scenehorizontalScrol.Height - Application.GetRealHeight(30) - Yheight; |
| | | Automationview(logicScrolView); |
| | | Automationview(logicScrolView,no); |
| | | }; |
| | | logicScrolView.BeginHeaderRefreshingAction += () => |
| | | { |
| | | //重新刷新logic列表 |
| | | Common.Logic.LogicList.Clear(); |
| | | Read(logicScrolView); |
| | | Read(logicScrolView,no); |
| | | //关闭刷新View; |
| | | logicScrolView.EndHeaderRefreshing(); |
| | | }; |
| | | |
| | | Read(logicScrolView); |
| | | Read(logicScrolView,no); |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 读取自动化列表数据; |
| | | /// </summary> |
| | | /// <param name="logicScrolView"></param> |
| | | private async void Read(VerticalRefreshLayout logicScrolView) |
| | | private async void Read(VerticalRefreshLayout logicScrolView,bool no) |
| | | { |
| | | CommonPage.Loading.Start(); |
| | | if (Common.Logic.LogicList.Count == 0) |
| | |
| | | } |
| | | } |
| | | //自动化 |
| | | Automationview(logicScrolView); |
| | | Automationview(logicScrolView,no); |
| | | CommonPage.Loading.Hide(); |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 加载自动化列表界面 |
| | | /// </summary> |
| | | /// <param name="refresview">Refresview.</param> |
| | | private async void Automationview(VerticalRefreshLayout refresview) |
| | | private async void Automationview(VerticalRefreshLayout refresview,bool no) |
| | | { |
| | | refresview.RemoveAll(); |
| | | if (Common.Logic.LogicList.Count == 0&&no==false) |
| | | { |
| | | //就是为了显示引导添加图标; |
| | | refresview.BackgroundColor = 0x00000000; |
| | | var noFrameLayout = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(434+ 200+32+160), |
| | | //BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, |
| | | }; |
| | | refresview.AddChidren(noFrameLayout); |
| | | |
| | | |
| | | var noIconBtn = new Button |
| | | { |
| | | Y=Application.GetRealHeight(160), |
| | | Width = Application.GetMinRealAverage(756), |
| | | Height = Application.GetMinRealAverage(434), |
| | | UnSelectedImagePath = "Item/NoFunction.png", |
| | | X = Application.GetRealWidth(104), |
| | | }; |
| | | noFrameLayout.AddChidren(noIconBtn); |
| | | |
| | | var noTextBtn = new Button() |
| | | { |
| | | Y = noIconBtn.Bottom, |
| | | Height = Application.GetRealHeight(200)+Application.GetRealHeight(32), |
| | | Width = Application.GetRealWidth(700), |
| | | //Gravity = Gravity.CenterHorizontal, |
| | | Text = Language.StringByID(MyInternationalizationString.automationaddtext).Replace("{\\r\\n}", "\r\n"), |
| | | TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor, |
| | | TextAlignment = TextAlignment.Center, |
| | | IsMoreLines = true, |
| | | X = Application.GetRealWidth(190-58), |
| | | }; |
| | | noFrameLayout.AddChidren(noTextBtn); |
| | | |
| | | } |
| | | else |
| | | { |
| | | |
| | | if (Common.Logic.LogicList.Count == 0 && no == true) |
| | | { |
| | | ///改变滑动view的颜色; |
| | | refresview.BackgroundColor = 0x00000000; |
| | | } |
| | | else |
| | | { |
| | | refresview.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; |
| | | } |
| | | } |
| | | foreach (var logic in Common.Logic.LogicList) |
| | | { |
| | | |
| | |
| | | var logicCommunalPage = new Logic.LogicCommunalPage(); |
| | | HomePage.Instance.AddChidren(logicCommunalPage); |
| | | HomePage.Instance.PageIndex += 1; |
| | | logicCommunalPage.Show(() => { logicnameBtn.Text = logic.LogicName; Automationview(refresview); }); |
| | | logicCommunalPage.Show(() => { logicnameBtn.Text = logic.LogicName; Automationview(refresview,no); }); |
| | | |
| | | }; |
| | | |
| | |
| | | if (e1) |
| | | { |
| | | Common.Logic.LogicList.Remove(logic); |
| | | Automationview(refresview); |
| | | Automationview(refresview,no); |
| | | Logic.Send.DelLogic(logic.LogicId); |
| | | } |
| | | }; |
| | |
| | | #endregion |
| | | |
| | | |
| | | #region ----在家布防 离家布防 撤防 |
| | | #region ----在家布防 离家布防 撤防 胁迫撤防 |
| | | |
| | | #region 在家布防 |
| | | |
| | |
| | | var urgentwithdrawalSelected = new SelectedButton(); |
| | | urgentwithdrawalRowLayout.AddChidren(urgentwithdrawalSelected); |
| | | #endregion |
| | | #region ----在家布防 离家布防 撤防点击事件 |
| | | #region ----在家布防 离家布防 撤防 胁迫撤防点击事件 |
| | | ///在家布防点击事件 |
| | | EventHandler<MouseEventArgs> athomeclick = (sedner14, e14) => |
| | | { |
| | |
| | | typeRow.AddChidren(Btncomplete); |
| | | #endregion |
| | | |
| | | #region ------在家 离家 |
| | | #region ------在家 |
| | | #region ------到达地点 离开地点 |
| | | #region ------到达地点 |
| | | |
| | | var athomeFrameLayout = new FrameLayout |
| | | { |
| | |
| | | athomeRowLayout.AddChidren(athomeSelected); |
| | | #endregion |
| | | |
| | | #region -------离家 |
| | | #region -------离开地点 |
| | | var leavehomeFrameLayout = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(160), |
| | |
| | | |
| | | #endregion |
| | | string strname = ""; |
| | | ///在家点击事件 |
| | | ///到达地点点击事件 |
| | | EventHandler<MouseEventArgs> athomeclick = (sedner15, e15) => |
| | | { |
| | | strname = btnathome.Text; |
| | |
| | | athomeRowLayout.MouseUpEventHandler += athomeclick; |
| | | athomeFrameLayout.MouseUpEventHandler += athomeclick; |
| | | |
| | | ///离家点击事件 |
| | | ///离开地点点击事件 |
| | | EventHandler<MouseEventArgs> leavehomeclick = (sedner14, e14) => |
| | | { |
| | | strname = btnleavehome.Text; |
| | |
| | | { |
| | | ///只改推送内容; |
| | | Send.LogicControlSwitch(Common.Logic.CurrentLogic); |
| | | Send.Data("添加/更新", "/App/HomeLogicConfig", "POST"); |
| | | } |
| | | RemoveFromParent(); |
| | | |
| | |
| | | BackgroundColor = ZigbeeColor.Current.LogicBtnSaveBackgroundColor, |
| | | TextID = MyInternationalizationString.Save, |
| | | TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor, |
| | | TextSize=16, |
| | | }; |
| | | PickerViewfra.AddChidren(btnsave); |
| | | |
| | |
| | | } |
| | | } |
| | | CommonPage.Loading.Start(); |
| | | if (!d) |
| | | middle.RemoveAll(); |
| | | System.Threading.Tasks.Task.Run(async () => |
| | | { |
| | | |
| | | CommonPage.Loading.Start(); |
| | | new System.Threading.Thread(async () => |
| | | try |
| | | { |
| | | var allMemberslist = await Send.AllMembers(macport); |
| | | Send.LockList.AddRange(allMemberslist); |
| | | if (!d) |
| | | { |
| | | var allMemberslist = await Send.AllMembers(macport); |
| | | Send.LockList.AddRange(allMemberslist); |
| | | } |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | CommonPage.Loading.Hide(); |
| | | UserAllView(macport); |
| | | }); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | } |
| | | UserAllView(macport); |
| | | CommonPage.Loading.Hide(); |
| | | |
| | | } |
| | | }); |
| | | } |
| | | /// <summary> |
| | | /// 显示所有用户 |
| | |
| | | }; |
| | | lockRow.AddChidren(Btncomplete); |
| | | #endregion |
| | | |
| | | bool @false = false; |
| | | if (membershipIfon.UserIdMode.Count > 10) |
| | | { |
| | | @false = false;// |
| | | lockcolorfra1.Y = Application.GetRealHeight(1920 - 140 - (160 * 10) - 20 - 50); |
| | | lockcolorfra1.Height = Application.GetRealHeight(140 + (160 * 10) + 20 + 50); |
| | | } |
| | | else |
| | | { |
| | | @false = false; |
| | | lockcolorfra1.Y = Application.GetRealHeight(1920 - 140 - (160 * membershipIfon.UserIdMode.Count) - 20 - 50); |
| | | lockcolorfra1.Height = Application.GetRealHeight(140 + (160 * membershipIfon.UserIdMode.Count) + 20 + 50); |
| | | } |
| | | string SelectedLockStatus = ""; |
| | | lockcolorfra1.Y = Application.GetRealHeight(1920 - 140 - (160 * membershipIfon.UserIdMode.Count) - 20 - 50); |
| | | lockcolorfra1.Height = Application.GetRealHeight(140 + (160 * membershipIfon.UserIdMode.Count) + 20 + 50); |
| | | ///定义两个变量记录选中状态; |
| | | string attriButeId = ""; |
| | | string attriButeData2 = ""; |
| | | string modeName = ""; |
| | | for (int j = 0; j < membershipIfon.UserIdMode.Count; j++) |
| | | if (!@false) |
| | | { |
| | | var userIdmode = membershipIfon.UserIdMode[j]; |
| | | var doorlockfra = new FrameLayout |
| | | for (int j = 0; j < membershipIfon.UserIdMode.Count; j++) |
| | | { |
| | | Height = Application.GetRealHeight(160), |
| | | Y = lockRow.Bottom + Application.GetRealHeight(20 + 160 * j), |
| | | }; |
| | | lockcolorfra1.AddChidren(doorlockfra); |
| | | |
| | | var doorlockRow = new RowLayout |
| | | { |
| | | Y = Application.GetRealHeight(30), |
| | | Width = Application.GetRealWidth(920), |
| | | Height = Application.GetRealHeight(130), |
| | | X = Application.GetRealWidth(80), |
| | | LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, |
| | | }; |
| | | doorlockfra.AddChidren(doorlockRow); |
| | | |
| | | var doorlockBtn = new Button |
| | | { |
| | | Width = Application.GetRealWidth(600), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, |
| | | Text = userIdmode.ModeName, |
| | | TextSize = 14, |
| | | }; |
| | | doorlockRow.AddChidren(doorlockBtn); |
| | | |
| | | var doorlockSelected = new Button |
| | | { |
| | | X = Application.GetRealWidth(860), |
| | | Width = Application.GetMinRealAverage(60), |
| | | Height = Application.GetMinRealAverage(60), |
| | | UnSelectedImagePath = "ZigeeLogic/selected.png", |
| | | Visible = false, |
| | | Gravity = Gravity.CenterVertical, |
| | | |
| | | }; |
| | | doorlockRow.AddChidren(doorlockSelected); |
| | | if ((membershipIfon.UserIdMode.Count - 1) == j) |
| | | { |
| | | doorlockRow.LineColor = ZigbeeColor.Current.LogicBackgroundColor; |
| | | } |
| | | EventHandler<MouseEventArgs> doorlockclick = (sender2, e2) => |
| | | { |
| | | SelectedLockStatus = "DoorLock"; |
| | | selectedIcon.Visible = false; |
| | | selectedIcon = doorlockSelected; |
| | | doorlockSelected.Visible = true; |
| | | //doorlockBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; |
| | | attriButeId = userIdmode.OpenMode.ToString(); |
| | | attriButeData2 = userIdmode.UserId; |
| | | modeName = userIdmode.ModeName; |
| | | }; |
| | | doorlockRow.MouseUpEventHandler += doorlockclick; |
| | | doorlockBtn.MouseUpEventHandler += doorlockclick; |
| | | doorlockSelected.MouseUpEventHandler += doorlockclick; |
| | | doorlockfra.MouseUpEventHandler += doorlockclick; |
| | | ///显示之前的状态 |
| | | if (conditionsIndex != -1) |
| | | { |
| | | var s = Common.Logic.CurrentLogic.Conditions[conditionsIndex]; |
| | | if (s["AttriButeId"] == userIdmode.OpenMode.ToString() && s["AttriButeData2"] == userIdmode.UserId) |
| | | var userIdmode = membershipIfon.UserIdMode[j]; |
| | | var doorlockfra = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(160), |
| | | Y = lockRow.Bottom + Application.GetRealHeight(20 + 160 * j), |
| | | }; |
| | | lockcolorfra1.AddChidren(doorlockfra); |
| | | |
| | | var doorlockRow = new RowLayout |
| | | { |
| | | Y = Application.GetRealHeight(30), |
| | | Width = Application.GetRealWidth(920), |
| | | Height = Application.GetRealHeight(130), |
| | | X = Application.GetRealWidth(80), |
| | | LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, |
| | | }; |
| | | doorlockfra.AddChidren(doorlockRow); |
| | | |
| | | var doorlockBtn = new Button |
| | | { |
| | | Width = Application.GetRealWidth(600), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, |
| | | Text = userIdmode.ModeName, |
| | | TextSize = 14, |
| | | }; |
| | | doorlockRow.AddChidren(doorlockBtn); |
| | | |
| | | var doorlockSelected = new Button |
| | | { |
| | | X = Application.GetRealWidth(860), |
| | | Width = Application.GetMinRealAverage(60), |
| | | Height = Application.GetMinRealAverage(60), |
| | | UnSelectedImagePath = "ZigeeLogic/selected.png", |
| | | Visible = false, |
| | | Gravity = Gravity.CenterVertical, |
| | | |
| | | }; |
| | | doorlockRow.AddChidren(doorlockSelected); |
| | | if ((membershipIfon.UserIdMode.Count - 1) == j) |
| | | { |
| | | doorlockRow.LineColor = ZigbeeColor.Current.LogicBackgroundColor; |
| | | } |
| | | EventHandler<MouseEventArgs> doorlockclick = (sender2, e2) => |
| | | { |
| | | SelectedLockStatus = "DoorLock"; |
| | | selectedIcon.Visible = false; |
| | | selectedIcon = doorlockSelected; |
| | | doorlockSelected.Visible = true; |
| | | //doorlockBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; |
| | | attriButeId = userIdmode.OpenMode.ToString(); |
| | | attriButeData2 = userIdmode.UserId; |
| | | modeName = userIdmode.ModeName; |
| | | }; |
| | | doorlockRow.MouseUpEventHandler += doorlockclick; |
| | | doorlockBtn.MouseUpEventHandler += doorlockclick; |
| | | doorlockSelected.MouseUpEventHandler += doorlockclick; |
| | | doorlockfra.MouseUpEventHandler += doorlockclick; |
| | | ///显示之前的状态 |
| | | if (conditionsIndex != -1) |
| | | { |
| | | var s = Common.Logic.CurrentLogic.Conditions[conditionsIndex]; |
| | | if (s["AttriButeId"] == userIdmode.OpenMode.ToString() && s["AttriButeData2"] == userIdmode.UserId) |
| | | { |
| | | selectedIcon.Visible = false; |
| | | selectedIcon = doorlockSelected; |
| | | doorlockSelected.Visible = true; |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | for (int j = 0; j < membershipIfon.UserIdMode.Count; j++) |
| | | { |
| | | var userIdmode = membershipIfon.UserIdMode[j]; |
| | | |
| | | var vv = new VerticalScrolViewLayout |
| | | { |
| | | Height = Application.GetRealHeight(160 * 8), |
| | | Y = lockRow.Bottom, |
| | | }; |
| | | lockcolorfra1.AddChidren(vv); |
| | | var doorlockfra = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(160), |
| | | Y = Application.GetRealHeight(160 * j), |
| | | }; |
| | | vv.AddChidren(doorlockfra); |
| | | |
| | | var doorlockRow = new RowLayout |
| | | { |
| | | Y = Application.GetRealHeight(30), |
| | | Width = Application.GetRealWidth(920), |
| | | Height = Application.GetRealHeight(130), |
| | | X = Application.GetRealWidth(80), |
| | | LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor, |
| | | }; |
| | | doorlockfra.AddChidren(doorlockRow); |
| | | |
| | | var doorlockBtn = new Button |
| | | { |
| | | Width = Application.GetRealWidth(600), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, |
| | | Text = userIdmode.ModeName, |
| | | TextSize = 14, |
| | | }; |
| | | doorlockRow.AddChidren(doorlockBtn); |
| | | |
| | | var doorlockSelected = new Button |
| | | { |
| | | X = Application.GetRealWidth(860), |
| | | Width = Application.GetMinRealAverage(60), |
| | | Height = Application.GetMinRealAverage(60), |
| | | UnSelectedImagePath = "ZigeeLogic/selected.png", |
| | | Visible = false, |
| | | Gravity = Gravity.CenterVertical, |
| | | |
| | | }; |
| | | doorlockRow.AddChidren(doorlockSelected); |
| | | if ((membershipIfon.UserIdMode.Count - 1) == j) |
| | | { |
| | | doorlockRow.LineColor = ZigbeeColor.Current.LogicBackgroundColor; |
| | | } |
| | | EventHandler<MouseEventArgs> doorlockclick = (sender2, e2) => |
| | | { |
| | | SelectedLockStatus = "DoorLock"; |
| | | selectedIcon.Visible = false; |
| | | selectedIcon = doorlockSelected; |
| | | doorlockSelected.Visible = true; |
| | | //doorlockBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; |
| | | attriButeId = userIdmode.OpenMode.ToString(); |
| | | attriButeData2 = userIdmode.UserId; |
| | | modeName = userIdmode.ModeName; |
| | | }; |
| | | doorlockRow.MouseUpEventHandler += doorlockclick; |
| | | doorlockBtn.MouseUpEventHandler += doorlockclick; |
| | | doorlockSelected.MouseUpEventHandler += doorlockclick; |
| | | doorlockfra.MouseUpEventHandler += doorlockclick; |
| | | ///显示之前的状态 |
| | | if (conditionsIndex != -1) |
| | | { |
| | | var s = Common.Logic.CurrentLogic.Conditions[conditionsIndex]; |
| | | if (s["AttriButeId"] == userIdmode.OpenMode.ToString() && s["AttriButeData2"] == userIdmode.UserId) |
| | | { |
| | | selectedIcon.Visible = false; |
| | | selectedIcon = doorlockSelected; |
| | | doorlockSelected.Visible = true; |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | #endregion |
| | | |
| | | 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"); |
| | | } |
| | | |
| | | } |
| | | }; |
| | | |
| | | |
| | | var saveFrameLayout = new FrameLayout |
| | | { |
| | | Y = middle.Bottom, |
| | |
| | | new Alert(Language.StringByID(MyInternationalizationString.Tip), Language.StringByID(MyInternationalizationString.PleaseEnterLogicName), Language.StringByID(MyInternationalizationString.Close)).Show(); |
| | | return; |
| | | } |
| | | var logicname = Common.Logic.LockLogicList.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.LockLogicList.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; |
| | | |
| | |
| | | { |
| | | Common.Logic.CurrentLogic.LogicId = logicifon.LogicId; |
| | | Common.Logic.LockLogicList.Add(Common.Logic.CurrentLogic); |
| | | if (tag) |
| | | { |
| | | Send.Data("添加/更新", "/App/HomeLogicConfig", "POST"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | |
| | | public void Automationview() |
| | | { |
| | | middle.RemoveAll(); |
| | | |
| | | if (Common.Logic.LockLogicList.Count == 0) |
| | | { |
| | | //就是为了显示引导添加图标; |
| | | var noFrameLayout = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(434 + 200 + 32 + 320), |
| | | //BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, |
| | | }; |
| | | middle.AddChidren(noFrameLayout); |
| | | |
| | | |
| | | var noIconBtn = new Button |
| | | { |
| | | Y = Application.GetRealHeight(320), |
| | | Width = Application.GetMinRealAverage(756), |
| | | Height = Application.GetMinRealAverage(434), |
| | | UnSelectedImagePath = "Item/NoFunction.png", |
| | | X = Application.GetRealWidth(162), |
| | | }; |
| | | noFrameLayout.AddChidren(noIconBtn); |
| | | |
| | | var noTextBtn = new Button() |
| | | { |
| | | Y = noIconBtn.Bottom, |
| | | Height = Application.GetRealHeight(200) + Application.GetRealHeight(32), |
| | | Width = Application.GetRealWidth(700), |
| | | //Gravity = Gravity.CenterHorizontal, |
| | | Text = Language.StringByID(MyInternationalizationString.automationaddtext).Replace("{\\r\\n}", "\r\n"), |
| | | TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor, |
| | | TextAlignment = TextAlignment.Center, |
| | | IsMoreLines = true, |
| | | X = Application.GetRealWidth(190), |
| | | }; |
| | | noFrameLayout.AddChidren(noTextBtn); |
| | | |
| | | } |
| | | for (int i = 0; i < Common.Logic.LockLogicList.Count; i++) |
| | | { |
| | | var logic = Common.Logic.LockLogicList[i]; |
| | |
| | | conditionIcon.UnSelectedImagePath = "ZigeeLogic/position.png"; |
| | | var btnlocation = new Button |
| | | { |
| | | Width = Application.GetRealWidth(700), |
| | | Width = Application.GetRealWidth(250), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Gravity = Gravity.CenterVertical, |
| | | TextColor = ZigbeeColor.Current.LogicBtnCancelColor, |
| | |
| | | |
| | | 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, |
| | | }; |
| | |
| | | btncustompush.MouseUpEventHandler += customclick; |
| | | custompushback.MouseUpEventHandler += customclick; |
| | | custompushRowLayout.MouseUpEventHandler += customclick; |
| | | bool tag = false;//标记开关状态; |
| | | btnswitch.MouseUpEventHandler += (sender1, e1) => |
| | | { |
| | | btnswitch.IsSelected = !btnswitch.IsSelected; |
| | | if (btnswitch.IsSelected) |
| | | { |
| | | custompushFrameLayout.Height = Application.GetRealHeight(160); |
| | | } |
| | | else |
| | | { |
| | | custompushFrameLayout.Height = Application.GetRealHeight(0); |
| | | } |
| | | }; |
| | | { |
| | | 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 |
| | | |
| | | |
| | |
| | | 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; |
| | |
| | | succeed = true; |
| | | Common.Logic.CurrentLogic.LogicId = logicifon.LogicId; |
| | | Common.Logic.LogicList.Add(Common.Logic.CurrentLogic); |
| | | if (tag) |
| | | { |
| | | Send.Data("添加/更新", "/App/HomeLogicConfig", "POST"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | |
| | | { IsBackground = true }.Start(); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | } |
| | | if (!d) |
| | | { |
| | | CommonPage.Loading.Start(); |
| | | new System.Threading.Thread(async () => |
| | | { |
| | | var allMemberslist = await Send.AllMembers(macport); |
| | | Send.LockList.AddRange(allMemberslist); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | CommonPage.Loading.Hide(); |
| | | }); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | UserList(macport); |
| | | |
| | | CommonPage.Loading.Start(); |
| | | middle.RemoveAll(); |
| | | System.Threading.Tasks.Task.Run(async () => |
| | | { |
| | | try |
| | | { |
| | | if (!d) |
| | | { |
| | | var allMemberslist = await Send.AllMembers(macport); |
| | | Send.LockList.AddRange(allMemberslist); |
| | | } |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | CommonPage.Loading.Hide(); |
| | | UserList(macport); |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | /// <summary> |
| | | /// 成员列表的方法 |
| | |
| | | /// <param name="macport"></param> |
| | | public void UserList(string macport) |
| | | { |
| | | middle.RemoveAll(); |
| | | foreach (var user in Send.LockList) |
| | | { |
| | | if (user.DoorLockMacPort != macport) |
| | |
| | | BackgroundColor = ZigbeeColor.Current.LogicBtnSaveBackgroundColor, |
| | | TextID = MyInternationalizationString.Save, |
| | | TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor, |
| | | TextSize=16, |
| | | |
| | | }; |
| | | middle.AddChidren(btnsave); |
| | |
| | | using ZigBee.Common; |
| | | using Shared.Common; |
| | | using System.Collections.Specialized; |
| | | using System.Net; |
| | | using System.IO; |
| | | |
| | | namespace Shared.Phone.Device.Logic |
| | | { |
| | |
| | | return await WebClientAsync(2, lockifon.Url, lockifon); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 请求服务器的方法 |
| | | /// </summary> |
| | | /// <param name="postValues">post参数</param> |
| | | /// <param name="url"></param> |
| | | /// <returns></returns> |
| | | public static async System.Threading.Tasks.Task<string> WebClientAsync(int value, string url, Residential residential = null) |
| | | //打印NameValueCollection()显示索引, 键,值 |
| | | public static void PrintKeysAndValues2(NameValueCollection myCol) |
| | | { |
| | | NameValueCollection postValues = new NameValueCollection(); |
| | | |
| | | if (value == 0) |
| | | for (int i = 0; i < myCol.Count; i++) |
| | | { |
| | | postValues.Add("RequestVersion", CommonPage.RequestVersion); |
| | | postValues.Add("ReqDto.LoginAccessToken", Config.Instance.Token); |
| | | postValues.Add("ReqDto.PageSetting.PageSize", Int32.MaxValue.ToString());// |
| | | |
| | | //打印显示索引, 键,值 |
| | | Console.WriteLine("[{0}]{1,-10} {2}", i, myCol.GetKey(i), myCol.Get(i)); |
| | | } |
| | | else if (value == 1) |
| | | { |
| | | postValues.Add("RequestVersion", CommonPage.RequestVersion); |
| | | postValues.Add("LoginAccessToken", Config.Instance.Token); |
| | | postValues.Add("MainAccountId", residential.MainUserDistributedMark); |
| | | postValues.Add("SharedHid", residential.Id);
|
| | | } |
| | | else if (value == 2) |
| | | { |
| | | postValues.Add("RequestVersion", CommonPage.RequestVersion); |
| | | postValues.Add("LoginAccessToken", residential.Token); |
| | | postValues.Add("HomeId", residential.Id); |
| | | postValues.Add("DoorLockId", residential.doorlockmac);//门锁Mac+端口 |
| | | postValues.Add("IsOtherAccountCtrl", residential.IsOtherAccountCtrl.ToString()); |
| | | postValues.Add("PageSetting.PageSize", Int32.MaxValue.ToString()); |
| | | } |
| | | System.Net.WebClient webClient = new System.Net.WebClient(); |
| | | byte[] responseArray = webClient.UploadValues(url, postValues); |
| | | var s = System.Text.Encoding.UTF8.GetString(responseArray); |
| | | return s; |
| | | } |
| | | |
| | | public class Residential |
| | | { |
| | | /// <summary> |
| | |
| | | public static UserCenter.MemberInfoRes UserMemberInfoRes = null; |
| | | #endregion |
| | | |
| | | #region 请求服务器方法--- |
| | | /// <summary> |
| | | /// 请求数据的封装方法 |
| | | /// </summary> |
| | | /// <param name="command">识别命令判断字符串</param> |
| | | /// <param name="url">请求地址</param> |
| | | /// <param name="method">请求方式为POST/GET</param> |
| | | /// <param name="obj">存储发送数据的对象</param> |
| | | /// <returns></returns> |
| | | public static async System.Threading.Tasks.Task<string>Data(string command, string url, string method, object obj = null) |
| | | { |
| | | var getUrl = CommonPage.RequestHttpsHost + url;//请求地址; |
| | | var jObject = new JObject(); |
| | | if (UserCenter.UserCenterResourse.UserInfo.AuthorityNo == 1) |
| | | { |
| | | jObject.Add("IsOtherAccountCtrl", false); |
| | | } |
| | | else |
| | | { |
| | | jObject.Add("IsOtherAccountCtrl", true); |
| | | } |
| | | switch (command) |
| | | { |
| | | case "添加/更新": |
| | | { |
| | | jObject.Add("RequestVersion", CommonPage.RequestVersion); |
| | | jObject.Add("LoginAccessToken", Config.Instance.Token); |
| | | jObject.Add("HomeId", Config.Instance.HomeId); |
| | | jObject.Add("LogicID", Common.Logic.CurrentLogic.LogicId); |
| | | jObject.Add("PushUserIds", new JArray { Config.Instance.Guid }); |
| | | jObject.Add("PushContent", Common.Logic.CurrentLogic.LogicCustomPushText); |
| | | |
| | | } |
| | | break; |
| | | case "删除": |
| | | { |
| | | jObject.Add("RequestVersion", CommonPage.RequestVersion); |
| | | jObject.Add("LoginAccessToken", Config.Instance.Token); |
| | | jObject.Add("HomeId", Config.Instance.HomeId); |
| | | jObject.Add("LogicID", Common.Logic.CurrentLogic.LogicId); |
| | | } |
| | | break; |
| | | } |
| | | return await HttpWebRequest(getUrl, jObject.ToString(), method); |
| | | } |
| | | /// <summary> |
| | | /// 请求服务器的方法(支持请求方式为POST/GET) |
| | | /// </summary> |
| | | /// <param name="getUrl">请求的地址</param> |
| | | /// <param name="str">请求数据</param> |
| | | /// <param name="method">请求方式为POST/GET</param> |
| | | /// <param name="second">超时时间</param> |
| | | /// <returns></returns> |
| | | public static async System.Threading.Tasks.Task<string>HttpWebRequest(string getUrl, string str, string method,int second= 3) |
| | | { |
| | | HttpWebRequest request = WebRequest.Create(getUrl) as HttpWebRequest; //创建请求 |
| | | request.Method = method; //请求方式为POST/GET |
| | | request.ContentType = "application/json"; |
| | | request.Timeout = second * 1000;//超时时间 |
| | | if (method == "POST") |
| | | { |
| | | byte[] jsonbyte = System.Text.Encoding.UTF8.GetBytes(str); |
| | | request.ContentLength = jsonbyte.Length; |
| | | Stream postStream = request.GetRequestStream(); |
| | | postStream.Write(jsonbyte, 0, jsonbyte.Length); |
| | | postStream.Close(); |
| | | } |
| | | //发送请求并获取相应回应数据 |
| | | HttpWebResponse res; |
| | | try |
| | | { |
| | | res = (HttpWebResponse)request.GetResponse(); |
| | | } |
| | | catch (WebException ex) |
| | | { |
| | | res = (HttpWebResponse)ex.Response; |
| | | } |
| | | StreamReader sr = new StreamReader(res.GetResponseStream(), System.Text.Encoding.UTF8); |
| | | string content = sr.ReadToEnd(); //获得响应字符串 |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// 请求服务器的方法 |
| | | /// </summary> |
| | | /// <param name="value">区分发送命令的数据判断值</param> |
| | | /// <param name="url">请求的地址</param> |
| | | /// <param name="residential">装数据的对象</param> |
| | | /// <returns></returns> |
| | | public static async System.Threading.Tasks.Task<string> WebClientAsync(int value, string url, Residential residential = null) |
| | | { |
| | | NameValueCollection postValues = new NameValueCollection(); |
| | | switch (value) |
| | | { |
| | | case 0: |
| | | { |
| | | postValues.Add("RequestVersion", CommonPage.RequestVersion); |
| | | postValues.Add("ReqDto.LoginAccessToken", Config.Instance.Token); |
| | | postValues.Add("ReqDto.PageSetting.PageSize", Int32.MaxValue.ToString());// |
| | | } |
| | | break; |
| | | case 1: |
| | | { |
| | | postValues.Add("RequestVersion", CommonPage.RequestVersion); |
| | | postValues.Add("LoginAccessToken", Config.Instance.Token); |
| | | postValues.Add("MainAccountId", residential.MainUserDistributedMark); |
| | | postValues.Add("SharedHid", residential.Id); |
| | | |
| | | } |
| | | break; |
| | | case 2: |
| | | { |
| | | postValues.Add("RequestVersion", CommonPage.RequestVersion); |
| | | postValues.Add("LoginAccessToken", residential.Token); |
| | | postValues.Add("HomeId", residential.Id); |
| | | postValues.Add("DoorLockId", residential.doorlockmac);//门锁Mac+端口 |
| | | postValues.Add("IsOtherAccountCtrl", residential.IsOtherAccountCtrl.ToString()); |
| | | postValues.Add("PageSetting.PageSize", Int32.MaxValue.ToString()); |
| | | } |
| | | break; |
| | | } |
| | | //PrintKeysAndValues2(postValues); |
| | | System.Net.WebClient webClient = new System.Net.WebClient(); |
| | | byte[] responseArray = webClient.UploadValues(url, postValues); |
| | | var s = System.Text.Encoding.UTF8.GetString(responseArray); |
| | | return s; |
| | | } |
| | | #endregion |
| | | |
| | | #region 存取本地文件的方法 ---暂时不用合并该方法--- |
| | | /// <summary>
|
| | | /// 文件保存
|
| | |
| | | Height = Application.GetRealHeight(436), |
| | | X = Application.GetRealWidth(72), |
| | | Y = Application.GetRealHeight(30), |
| | | UnSelectedImagePath = "ZigeeLogic/logicbj" + s + ".png", |
| | | UnSelectedImagePath = $"ZigeeLogic/logicbj{s}.png", |
| | | }; |
| | | logiciconfl.AddChidren(iconBtn); |
| | | |
| | |
| | | var addtextbtn = new Button |
| | | { |
| | | Height = Application.GetRealHeight(58), |
| | | Width = Application.GetRealWidth(300), |
| | | Width = Application.GetRealWidth(400), |
| | | Y = Application.GetRealHeight(45 + 30), |
| | | TextColor = ZigbeeColor.Current.LogicBlankBackgroundColor, |
| | | TextID = MyInternationalizationString.addsensor, |
| | | X = Application.GetRealWidth(390), |
| | | X = Application.GetRealWidth(340), |
| | | TextSize = 14, |
| | | }; |
| | | addfl.AddChidren(addtextbtn); |
| | |
| | | var addtextbtn = new Button |
| | | { |
| | | Height = Application.GetRealHeight(58), |
| | | Width = Application.GetRealWidth(300), |
| | | Width = Application.GetRealWidth(400), |
| | | Y = Application.GetRealHeight(45 + 30), |
| | | TextColor = ZigbeeColor.Current.LogicBlankBackgroundColor, |
| | | TextID = MyInternationalizationString.addlighting, |
| | | X = Application.GetRealWidth(390), |
| | | X = Application.GetRealWidth(340), |
| | | TextSize = 14, |
| | | }; |
| | | addfl.AddChidren(addtextbtn); |
| | |
| | | |
| | | #endregion |
| | | |
| | | 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"); |
| | | } |
| | | |
| | | } |
| | | }; |
| | | var saveFrameLayout = new FrameLayout |
| | |
| | | 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; |
| | | |
| | |
| | | { |
| | | Common.Logic.CurrentLogic.LogicId = logicifon.LogicId; |
| | | Common.Logic.LogicList.Add(Common.Logic.CurrentLogic); |
| | | if (tag) |
| | | { |
| | | Send.Data("添加/更新", "/App/HomeLogicConfig", "POST"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | |
| | | public readonly static int addsensor = 5374; |
| | | public readonly static int addlighting = 5375; |
| | | public readonly static int application = 5376; |
| | | public readonly static int automationaddtext = 5377; |
| | | |
| | | #region 登录注册 |
| | | /// <summary> |