From 36540bdc906f402f4c55cc7460b6facfd344a793 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期五, 04 八月 2023 14:55:14 +0800
Subject: [PATCH] 2023年08月04日14:55:04
---
HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/AddGroupControlPage.cs | 105 +++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 91 insertions(+), 14 deletions(-)
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/AddGroupControlPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/AddGroupControlPage.cs
index 76991c1..b5f70fd 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/AddGroupControlPage.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/AddGroupControlPage.cs
@@ -2,6 +2,7 @@
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;
@@ -50,7 +51,8 @@
/// <summary>
/// 鍥炶皟鍒锋柊
/// </summary>
- Action<GroupControl> backActon;
+ Action<GroupControl> addActon;
+ Action delAction;
/// <summary>
/// 鏄惁鏂板缇ゆ帶
/// </summary>
@@ -64,7 +66,7 @@
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)
@@ -78,15 +80,82 @@
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;
- new TopViewDiv(bodyView, Language.StringByID(StringId.CombinedDimming)).LoadTopView();
+ if (isAdd)
+ {
+ new TopViewDiv(bodyView, Language.StringByID(StringId.GroupControl)).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)
+ {
+ var delTemp = FunctionList.List.groupControls.Find((obj) => groupControl.sid == obj.sid);
+ FunctionList.List.groupControls.Remove(delTemp);
+ //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),
@@ -390,9 +459,9 @@
}
catch (Exception ex)
{
- MainPage.Log($"娣诲姞缇ゆ帶鎴愬姛锛岃浆璇戣繑鍥炴暟鎹け璐�:{ex.Message}");
+ MainPage.Log($"娣诲姞缇ゆ帶寮傚父锛岃浆璇戣繑鍥炴暟鎹け璐�:{ex.Message}");
}
- backActon?.Invoke(groupControl);
+ addActon?.Invoke(groupControl);
this.RemoveFromParent();
}
else
@@ -410,13 +479,15 @@
{
try
{
- var newEditDataString = Newtonsoft.Json.JsonConvert.SerializeObject(this.groupControl);
- //娌℃湁鏇存柊鏁版嵁鍒欑洿鎺ラ��鍑�
- if (newEditDataString == editDataString)
- {
- this.RemoveFromParent();
- return;
- }
+ //var newEditDataString = Newtonsoft.Json.JsonConvert.SerializeObject(this.groupControl);
+ //var newEditDataString1 = Newtonsoft.Json.JsonConvert.SerializeObject(groupControlLightList);
+ //var newEditDataString2 = Newtonsoft.Json.JsonConvert.SerializeObject(this.groupControl.sids);
+ ////娌℃湁鏇存柊鏁版嵁鍒欑洿鎺ラ��鍑�
+ //if (newEditDataString == editDataString && newEditDataString1 == newEditDataString2)
+ //{
+ // this.RemoveFromParent();
+ // return;
+ //}
groupControl.sids.Clear();
foreach (var light in groupControlLightList)
{
@@ -443,7 +514,7 @@
{
temp = groupControl;
}
- backActon?.Invoke(temp);
+ addActon?.Invoke(temp);
this.RemoveFromParent();
}
else
@@ -481,6 +552,12 @@
var groupControlTypes = Newtonsoft.Json.JsonConvert.DeserializeObject<List<GroupControlType>>(pack.Data.ToString());
if (groupControlTypes != null && groupControlTypes.Count > 0)
{
+ //groupControlType = new GroupControlType {
+ // type = "LIGHT",
+ // typeName ="鐏厜鎺у埗",
+ // spks = new List<string> { "light.switch" },
+ // spkAttrs = new List<string> { "on_off" }
+ //};
groupControlType = groupControlTypes[0];
Application.RunOnMainThread(() => {
LoadLightRow(lightList);
--
Gitblit v1.8.0