| | |
| | | public void LoadPage() |
| | | { |
| | | |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.CombinedDimming)).LoadTopView_AddIcon("CombinedDimming", |
| | | (s,c)=>{ |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.GroupControl)).LoadTopView_AddIcon("CombinedDimming", |
| | | (s, c) => |
| | | { |
| | | try |
| | | { |
| | | var page = new AddGroupControlPage(null, |
| | | (newGC)=> { |
| | | (newGC) => |
| | | { |
| | | ReadGroupControlList(); |
| | | },()=> { }); |
| | | MainPage.BasePageView.AddChidren(page); |
| | |
| | | private void ReadGroupControlList() |
| | | { |
| | | |
| | | new System.Threading.Thread(() => { |
| | | new System.Threading.Thread(() => |
| | | { |
| | | var pack = ApiUtlis.Ins.HttpRequest.GetGroupControlList(); |
| | | if (pack != null) |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | var groupControlList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<GroupControl>>(pack.Data.ToString()); |
| | | FunctionList.List.groupControls.Clear(); |
| | | FunctionList.List.groupControls = Newtonsoft.Json.JsonConvert.DeserializeObject<List<GroupControl>>(pack.Data.ToString()); |
| | | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | LoadGroupControlView(groupControlList); |
| | | LoadGroupControlView(); |
| | | }); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | } |
| | | |
| | | |
| | | private void LoadGroupControlView(List<GroupControl> list) |
| | | { |
| | | #if DEBUG |
| | | if (list.Count == 0) |
| | | { |
| | | list.Add(new GroupControl() |
| | | { |
| | | name = "组合调光1", |
| | | roomIds = new List<string> {}, |
| | | sid = "00000000000000001", |
| | | type = "light", |
| | | }); |
| | | |
| | | list.Add(new GroupControl() |
| | | { |
| | | name = "组合调光2", |
| | | roomIds = new List<string> { },//Room.CurrentSpatial.RoomList[0].roomId |
| | | sid = "00000000000000002", |
| | | type = "light", |
| | | }); |
| | | } |
| | | |
| | | #endif |
| | | |
| | | if (list.Count == 0) |
| | | { |
| | | |
| | | } |
| | | else |
| | | private void LoadGroupControlView() |
| | | { |
| | | contentView.RemoveAll(); |
| | | |
| | | foreach (var groupControl in list) |
| | | foreach (var groupControl in FunctionList.List.groupControls) |
| | | { |
| | | var functionRow = new RowLayout() |
| | | { |
| | |
| | | BackgroundColor = CSS_Color.DividingLineColor, |
| | | }); |
| | | |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => { |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | { |
| | | var page = new AddGroupControlPage(groupControl, |
| | | (newGC) => { |
| | | (newGC) => |
| | | { |
| | | try |
| | | { |
| | | if (newGC != null) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | groupControl.roomIds = newGC.uids; |
| | | //groupControl.roomIds = newGC.roomIds; |
| | | //groupControl.uids = newGC.uids; |
| | | var localTemp = FunctionList.List.groupControls.Find((obj) => obj.deviceId == newGC.deviceId); |
| | | localTemp.roomIds = newGC.roomIds; |
| | | localTemp.uids = newGC.uids; |
| | | localTemp.sids = newGC.sids; |
| | | |
| | | btnFunctionLocationInfo.Text = newGC.GetUidListName(); |
| | | }); |
| | | } |
| | | }catch(Exception ex) |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"刷新群控房间信息异常:{ex.Message}"); |
| | | } |
| | | },()=> { |
| | | LoadGroupControlView(FunctionList.List.groupControls); |
| | | }, () => |
| | | { |
| | | LoadGroupControlView(); |
| | | }); |
| | | MainPage.BasePageView.AddChidren(page); |
| | | page.LoadPage(); |
| | |
| | | TextAlignment = TextAlignment.Center, |
| | | }; |
| | | functionRow.AddRightView(btnDelGroupControl); |
| | | btnDelGroupControl.MouseUpEventHandler = (sender1, e1) => { |
| | | btnDelGroupControl.MouseUpEventHandler = (sender1, e1) => |
| | | { |
| | | var waitPage = new Loading(); |
| | | this.AddChidren(waitPage); |
| | | waitPage.Start(""); |
| | |
| | | { |
| | | if (pack.Code == StateCode.SUCCESS) |
| | | { |
| | | list.Remove(groupControl); |
| | | LoadGroupControlView(list); |
| | | var delTemp = FunctionList.List.groupControls.Find((obj) => groupControl.sid == obj.sid); |
| | | FunctionList.List.groupControls.Remove(delTemp); |
| | | LoadGroupControlView(); |
| | | } |
| | | else |
| | | { |
| | | IMessageCommon.Current.ShowErrorInfoAlter(pack.Code); |
| | | } |
| | | }catch(Exception ex) |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"刷新组控数据异常:{ex.Message}"); |
| | | } |
| | | }); |
| | | } |
| | | }catch(Exception ex) |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"删除组控异常:{ex.Message}"); |
| | | } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (waitPage != null) |
| | | { |
| | | waitPage.Hide(); |
| | |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | |