| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Threading; |
| | | using HDL_ON.Common; |
| | | using HDL_ON.DAL.Server; |
| | | using HDL_ON.DriverLayer; |
| | | using HDL_ON.Entity; |
| | |
| | | /// <summary> |
| | | /// 回调刷新 |
| | | /// </summary> |
| | | Action<GroupControl> backActon; |
| | | Action<GroupControl> addActon; |
| | | Action delAction; |
| | | /// <summary> |
| | | /// 是否新增群控 |
| | | /// </summary> |
| | |
| | | |
| | | GroupControlType groupControlType = new GroupControlType(); |
| | | |
| | | public AddGroupControlPage(GroupControl groupControl, Action<GroupControl> action) |
| | | public AddGroupControlPage(GroupControl groupControl, Action<GroupControl> addAction,Action delAction) |
| | | { |
| | | bodyView = this; |
| | | if(groupControl == null) |
| | |
| | | editDataString = Newtonsoft.Json.JsonConvert.SerializeObject(this.groupControl); |
| | | } |
| | | groupControlLightList = new List<Function>(); |
| | | backActon = action; |
| | | this.addActon = addAction; |
| | | |
| | | this.delAction = delAction; |
| | | |
| | | lightList = FunctionList.List.GetLightList(); |
| | | } |
| | | |
| | | public void LoadPage() |
| | | { |
| | | bodyView.BackgroundColor = CSS_Color.BackgroundColor; |
| | | if (isAdd) |
| | | { |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.CombinedDimming)).LoadTopView(); |
| | | } |
| | | else |
| | | { |
| | | new TopViewDiv(bodyView, "").LoadTopView_SettingText(()=> { |
| | | |
| | | Action action = () => { |
| | | 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) |
| | | { |
| | | FunctionList.List.groupControls.Remove(groupControl); |
| | | //list.Remove(groupControl); |
| | | this.RemoveFromParent(); |
| | | delAction?.Invoke(); |
| | | } |
| | | 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(); |
| | | |
| | | }; |
| | | new PublicAssmebly().TipOptionMsg(StringId.Tip, StringId.DoYouWantDelCombinedDimming, action); |
| | | |
| | | }, Language.StringByID(StringId.DelGroupControl),true); |
| | | } |
| | | var contentView = new FrameLayout() |
| | | { |
| | | Y = Application.GetRealHeight(64), |
| | |
| | | { |
| | | MainPage.Log($"添加群控异常,转译返回数据失败:{ex.Message}"); |
| | | } |
| | | backActon?.Invoke(groupControl); |
| | | addActon?.Invoke(groupControl); |
| | | this.RemoveFromParent(); |
| | | } |
| | | else |
| | |
| | | { |
| | | temp = groupControl; |
| | | } |
| | | backActon?.Invoke(temp); |
| | | addActon?.Invoke(temp); |
| | | this.RemoveFromParent(); |
| | | } |
| | | else |