| | |
| | | /// 回调刷新 |
| | | /// </summary> |
| | | Action backActon; |
| | | |
| | | /// <summary> |
| | | /// 是否新增群控 |
| | | /// </summary> |
| | | bool isAdd = true; |
| | | |
| | | GroupControl groupControl; |
| | | |
| | | GroupControlType groupControlType = new GroupControlType(); |
| | | |
| | | |
| | | public AddGroupControlPage(List<Function> functions, GroupControl groupControl, Action action) |
| | | public AddGroupControlPage(GroupControl groupControl, Action action) |
| | | { |
| | | bodyView = this; |
| | | groupControlLightList = functions; |
| | | if(groupControl == null) |
| | | { |
| | | this.groupControl = new GroupControl(); |
| | | } |
| | | else |
| | | { |
| | | isAdd = false; |
| | | this.groupControl = groupControl; |
| | | } |
| | | groupControlLightList = new List<Function>(); |
| | | backActon = action; |
| | | lightList = FunctionList.List.GetLightList(); |
| | | this.groupControl = groupControl; |
| | | } |
| | | |
| | | public void LoadPage() |
| | |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextColor = CSS_Color.TextualColor, |
| | | PlaceholderTextColor = CSS_Color.PromptingColor1, |
| | | }; |
| | | groupNameView.AddChidren(etGroupName); |
| | | |
| | |
| | | view.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | btnLocationInfoRight.MouseUpEventHandler = eventHandler; |
| | | btnLocationValues.MouseUpEventHandler = eventHandler; |
| | | btnLocationInfoRight.MouseUpEventHandler = eventHandler; |
| | | btnLocationValues.MouseUpEventHandler = eventHandler; |
| | | |
| | | |
| | | //locationMagtView.AddChidren( |
| | |
| | | try |
| | | { |
| | | var http = new HttpServerRequest(); |
| | | groupControl.type = groupControlType.type; |
| | | groupControl.sid = groupControl.NewGroupControlSid(); |
| | | var pack = http.AddGroupControl(new List<GroupControl>() { groupControl }); |
| | | if (pack != null) |
| | | { |
| | |
| | | |
| | | //加载功能筛选组件 |
| | | LoadDialog_ChangeFloor(); |
| | | |
| | | |
| | | new Thread(() => { |
| | | var http = new HttpServerRequest(); |
| | | if (isAdd) |
| | | { |
| | | var pack = http.GetGroupControlTypes("light.switch"); |
| | | if (pack != null) |
| | | { |
| | | if (pack.Code == StateCode.SUCCESS) |
| | | { |
| | | try |
| | | { |
| | | |
| | | var groupControlTypes = Newtonsoft.Json.JsonConvert.DeserializeObject<List<GroupControlType>>(pack.Data.ToString()); |
| | | if (groupControlTypes != null && groupControlTypes.Count > 0) |
| | | { |
| | | groupControlType = groupControlTypes[0]; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"读取组控类型失败:{ex.Message}"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | IMessageCommon.Current.ShowErrorInfoAlter(pack.Code); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | var pack = http.GetGroupControInfo(groupControl.userDeviceGroupControlId); |
| | | if (pack != null) |
| | | { |
| | | if (pack.Code == StateCode.SUCCESS) |
| | | { |
| | | try |
| | | { |
| | | |
| | | var groupControlTemps = Newtonsoft.Json.JsonConvert.DeserializeObject<List<GroupControl>>(pack.Data.ToString()); |
| | | if (groupControlTemps != null && groupControlTemps.Count > 0) |
| | | { |
| | | groupControl = groupControlTemps[0]; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"读取组控信息失败:{ex.Message}"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | IMessageCommon.Current.ShowErrorInfoAlter(pack.Code); |
| | | } |
| | | } |
| | | } |
| | | }) { IsBackground = true }.Start(); |
| | | |
| | | if (!isAdd) |
| | | { |
| | | etGroupName.Text = groupControl.name; |
| | | btnLocationValues.Text = groupControl.GetRoomListName(); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | var functionDiv = new LightRow(function) |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | //Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealHeight(62), |
| | | BorderColor = 0x00FFFFFF, |
| | | BorderWidth = 1, |
| | |
| | | btnConfrim.IsSelected = false; |
| | | } |
| | | }; |
| | | if (groupControl.sids.Find((obj) => obj.sid == function.sid) != null) |
| | | { |
| | | groupControlLightList.Add(function); |
| | | } |
| | | |
| | | functionDiv.LoadDiv(groupControlLightList, setAction); |
| | | functionListView.AddChidren(functionDiv); |