wei
2021-07-06 533735b4bbaea0f7a87ccd3d1781ea7d469f75b5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
using System;
using Shared;
using System.Collections.Generic;
using HDL_ON.UI.UI2.PersonalCenter.PirDevice.View;
 
namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice
{
    public class EditControl : FrameLayout
    {
        public EditControl()
        {
            Tag = "PirView";
        }
        public void Show(Entity.Function control, Action<Entity.Function> action)
        {
            #region 界面布局
            this.BackgroundColor = CSS.CSS_Color.viewMiddle;
            PirDevice.View.TopView topView = new View.TopView();
            topView.topNameBtn.TextID = StringId.pipeiyaokongqi;
            this.AddChidren(topView.FLayoutView());
            topView.clickBackBtn.MouseUpEventHandler += (e, sen) =>
            {
                action(control);
                RemoveFromParent();
            };
            topView.topNameBtn.TextID = StringId.bianjixinxi;
            FrameLayout viewLayout = new FrameLayout
            {
                Y = Application.GetRealHeight(64),
                Width = Application.GetRealWidth(375),
                Height = Application.GetRealHeight(667 - 64),
                BackgroundColor = CSS.CSS_Color.viewMiddle,
            };
            this.AddChidren(viewLayout);
            //遥控器名称:
            FrameLayout50 editNameFLayout = new FrameLayout50();
            editNameFLayout.btnText.Text = Language.StringByID(StringId.yaokongqimingcheng) + ":";
            editNameFLayout.btnEditText.Text = control.name;
            editNameFLayout.btnNextIcon.Height = Application.GetRealWidth(28);
            editNameFLayout.btnNextIcon.Width = Application.GetRealWidth(28);
            editNameFLayout.btnNextIcon.UnSelectedImagePath = "LogicIcon/editname.png";
            viewLayout.AddChidren(editNameFLayout.FLayoutView());
            //遥控器所属区域:
            FrameLayout50 areaFLayout = new FrameLayout50();
            areaFLayout.btnText.Text = Language.StringByID(StringId.yaokongqiquyu);
            areaFLayout.btnEditText.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(control);
            areaFLayout.frameLayout.Y = editNameFLayout.frameLayout.Bottom;
            viewLayout.AddChidren(areaFLayout.FLayoutView());
            #endregion
            #region
            //修改名称点击事件
            editNameFLayout.btnClick.MouseUpEventHandler += (sender, e) =>
            {
                List<string> list = new List<string>();
 
                for (int i = 0; i < Pir.currPir.FunctioList.Count; i++)
                {
                    list.Add(Pir.currPir.FunctioList[i].name);
                }
                PirMethod method = new PirMethod();
                method.EditControlName(StringId.editName, list, control.name, (name, dialog) =>
                {
                    PirMethod.ThreadSend(new Control { deviceId = control.deviceId, name = name }, (responsePackNew) =>
                    {
                        dialog.Close();
                        editNameFLayout.btnEditText.Text = name;
                        control.name = name;
 
                    }, "修改名称", "dialog", null, dialog);
 
                }, () => { });
            };
            //遥控器所属区域选中事件
            areaFLayout.btnClick.MouseUpEventHandler += (sender, e) =>
            {
                PirMethod method = new PirMethod();
                method.ManagementPosition(control, () =>
                {
                    //更新区域
                    areaFLayout.btnEditText.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(control);
                });
            };
            #endregion
        }
    }
}