mac
2023-11-07 efd01cddef2e9d29907592cbed154fba548d7ede
HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAutomationListChoosePage.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using HDL_ON.DAL.Server;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
using HDL_ON.UI.UI2.Intelligence.Automation;
@@ -35,6 +36,7 @@
            {
                Y = Application.GetRealHeight(74),
                Height = Application.GetRealHeight(667-80),
                ScrollEnabled = false,
            };
            bodyView.AddChidren(contentView);
@@ -192,21 +194,71 @@
                var temp = scene.functions.Find((obj) => obj.sid == logicSid);
                if (temp != null)
                {
                    temp.status.Clear();
                    var kv = temp.status.Find((obj) => obj.key == "enable");
                    if (kv != null)
                    {
                        kv.value = "true";
                    }
                    else
                    {
                        temp.status.Add(new SceneFunctionStatus()
                        {
                            key = "enable",
                            value = "true",
                        });
                    }
                }
                else
                {
                    temp = new SceneFunction();
                    temp.type = "7";
                    temp.sid = logicSid;
                    temp.status.Add(new SceneFunctionStatus()
                    {
                        key = "enable",
                        value = "true"
                    });
                    scene.functions.Add(temp);
                }
                temp.status.Add(new SceneFunctionStatus()
                if (scene.userSceneId != null)
                {
                    key = "enable",
                    value = "true"
                });
                refreshAction();
                    var waitPage = new Loading();
                    bodyView.AddChidren(waitPage);
                    waitPage.Start("");
                    new System.Threading.Thread(() => {
                        try
                        {
                            var code = scene.EditScene();
                            Application.RunOnMainThread(() =>
                            {
                                if (code == "0")
                                {
                                    refreshAction();
                                }
                                else
                                {
                                    IMessageCommon.Current.ShowErrorInfoAlter(code);
                                }
                            });
                        }
                        catch { }
                        finally
                        {
                            Application.RunOnMainThread(() => {
                                if (waitPage != null)
                                {
                                    waitPage.RemoveFromParent();
                                    waitPage = null;
                                }
                            });
                        }
                    })
                    { IsBackground = true }.Start();
                }
                else
                {
                    refreshAction();
                }
            };
            btnOff.MouseUpEventHandler = (sender, e) =>
            {
@@ -214,21 +266,72 @@
                var temp = scene.functions.Find((obj) => obj.sid == logicSid);
                if (temp != null)
                {
                    temp.status.Clear();
                    var kv = temp.status.Find((obj) => obj.key == "enable");
                    if (kv != null)
                    {
                        kv.value = "false";
                    }
                    else
                    {
                        temp.status.Add(new SceneFunctionStatus()
                        {
                            key = "enable",
                            value = "false",
                        });
                    }
                }
                else
                {
                    temp = new SceneFunction();
                    temp.type = "7";
                    temp.sid = logicSid;
                    temp.status.Add(new SceneFunctionStatus()
                    {
                        key = "enable",
                        value = "false"
                    });
                    scene.functions.Add(temp);
                }
                temp.status.Add(new SceneFunctionStatus()
                if (scene.userSceneId != null)
                {
                    key = "enable",
                    value = "false"
                });
                refreshAction();
                    var waitPage = new Loading();
                    bodyView.AddChidren(waitPage);
                    waitPage.Start("");
                    new System.Threading.Thread(() => {
                        try
                        {
                            var code = scene.EditScene();
                            Application.RunOnMainThread(() =>
                            {
                                if (code == "0")
                                {
                                    refreshAction();
                                }
                                else
                                {
                                    IMessageCommon.Current.ShowErrorInfoAlter(code);
                                }
                            });
                        }
                        catch { }
                        finally
                        {
                            Application.RunOnMainThread(() => {
                                if (waitPage != null)
                                {
                                    waitPage.RemoveFromParent();
                                    waitPage = null;
                                }
                            });
                        }
                    })
                    { IsBackground = true }.Start();
                }
                else
                {
                    refreshAction();
                }
            };
        }