| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using HDL_ON.Common; |
| | | using HDL_ON.DAL.Server; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.CSS; |
| | |
| | | try |
| | | { |
| | | var page = new AddGroupControlPage(null, |
| | | ()=> { |
| | | |
| | | }); |
| | | (newGC)=> { |
| | | ReadGroupControlList(); |
| | | },()=> { }); |
| | | MainPage.BasePageView.AddChidren(page); |
| | | page.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | |
| | | contentView = new VerticalScrolViewLayout() |
| | | { |
| | | Y = Application.GetRealHeight(64), |
| | | Height = Application.GetRealHeight(550), |
| | | Height = Application.GetRealHeight(667 - 64), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | | bodyView.AddChidren(contentView); |
| | | |
| | | ReadGroupControlList(); |
| | | |
| | | #region |
| | | contentView.AddChidren(new Button() { Height = Application.GetRealHeight(8) }); |
| | | |
| | | |
| | | |
| | | #endregion |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 读取组控数据 |
| | | /// </summary> |
| | | private void ReadGroupControlList() |
| | | { |
| | | |
| | | new System.Threading.Thread(() => { |
| | | var http = new HttpServerRequest(); |
| | | var pack = http.GetGroupControlList(); |
| | | if(pack != null) |
| | | var pack = ApiUtlis.Ins.HttpRequest.GetGroupControlList(); |
| | | if (pack != null) |
| | | { |
| | | if(pack.Code == StateCode.SUCCESS ) |
| | | if (pack.Code == StateCode.SUCCESS) |
| | | { |
| | | try |
| | | { |
| | |
| | | IMessageCommon.Current.ShowErrorInfoAlter(pack.Code); |
| | | } |
| | | } |
| | | }) { IsBackground = true }.Start(); |
| | | |
| | | #region |
| | | contentView.AddChidren(new Button() { Height = Application.GetRealHeight(8) }); |
| | | |
| | | |
| | | |
| | | #endregion |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | } |
| | | |
| | |
| | | list.Add(new GroupControl() |
| | | { |
| | | name = "组合调光1", |
| | | roomIds = new List<string> { Room.CurrentSpatial.RoomList[0].roomId }, |
| | | roomIds = new List<string> {}, |
| | | sid = "00000000000000001", |
| | | type = "light", |
| | | uids = new List<string>() { Room.CurrentSpatial.RoomList[0].uid }, |
| | | }); |
| | | |
| | | list.Add(new GroupControl() |
| | | { |
| | | name = "组合调光2", |
| | | roomIds = new List<string> { Room.CurrentSpatial.RoomList[0].roomId }, |
| | | roomIds = new List<string> { },//Room.CurrentSpatial.RoomList[0].roomId |
| | | sid = "00000000000000002", |
| | | type = "light", |
| | | uids = new List<string>() { Room.CurrentSpatial.RoomList[0].uid }, |
| | | }); |
| | | } |
| | | |
| | |
| | | |
| | | foreach (var groupControl in list) |
| | | { |
| | | var functionRow = new FrameLayout() |
| | | var functionRow = new RowLayout() |
| | | { |
| | | Height = Application.GetRealHeight(65), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | LineColor = 0x00000000 |
| | | }; |
| | | contentView.AddChidren(functionRow); |
| | | |
| | |
| | | |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => { |
| | | var page = new AddGroupControlPage(groupControl, |
| | | () => { |
| | | |
| | | (newGC) => { |
| | | try |
| | | { |
| | | if (newGC != null) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | groupControl.roomIds = newGC.uids; |
| | | btnFunctionLocationInfo.Text = newGC.GetUidListName(); |
| | | }); |
| | | } |
| | | }catch(Exception ex) |
| | | { |
| | | MainPage.Log($"刷新群控房间信息异常:{ex.Message}"); |
| | | } |
| | | },()=> { |
| | | LoadGroupControlView(FunctionList.List.groupControls); |
| | | }); |
| | | MainPage.BasePageView.AddChidren(page); |
| | | page.LoadPage(); |
| | |
| | | btnFunctionName.MouseUpEventHandler = eventHandler; |
| | | btnFunctionLocationInfo.MouseUpEventHandler = eventHandler; |
| | | |
| | | var btnDelGroupControl = new Button() |
| | | { |
| | | TextColor = CSS_Color.MainBackgroundColor, |
| | | BackgroundColor = CSS_Color.WarningColor, |
| | | TextID = StringId.Del, |
| | | TextAlignment = TextAlignment.Center, |
| | | }; |
| | | functionRow.AddRightView(btnDelGroupControl); |
| | | btnDelGroupControl.MouseUpEventHandler = (sender1, e1) => { |
| | | var waitPage = new Loading(); |
| | | this.AddChidren(waitPage); |
| | | waitPage.Start(""); |
| | | new System.Threading.Thread(() => |
| | | { |
| | | try |
| | | { |
| | | var pack = ApiUtlis.Ins.HttpRequest.DelGroupControl(groupControl.userDeviceGroupControlId); |
| | | if (pack != null) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | try |
| | | { |
| | | if (pack.Code == StateCode.SUCCESS) |
| | | { |
| | | list.Remove(groupControl); |
| | | LoadGroupControlView(list); |
| | | } |
| | | else |
| | | { |
| | | IMessageCommon.Current.ShowErrorInfoAlter(pack.Code); |
| | | } |
| | | }catch(Exception ex) |
| | | { |
| | | MainPage.Log($"刷新组控数据异常:{ex.Message}"); |
| | | } |
| | | }); |
| | | } |
| | | }catch(Exception ex) |
| | | { |
| | | MainPage.Log($"删除组控异常:{ex.Message}"); |
| | | } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => { |
| | | if (waitPage != null) |
| | | { |
| | | waitPage.Hide(); |
| | | waitPage.RemoveFromParent(); |
| | | waitPage = null; |
| | | } |
| | | }); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | }; |
| | | |
| | | } |
| | | |
| | | } |