陈嘉乐
2021-03-09 83df0ebfbd306d0fb5a51a21a7ef2271c0c507ec
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs
@@ -4,13 +4,14 @@
using Shared;
namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice
{
    public class AddControlComplete:FrameLayout
    public class AddControlComplete : FrameLayout
    {
        public AddControlComplete()
        {
            Tag = "Pir";
        }
        public void Show() {
        public void Show(Control control, bool bool_library)
        {
            #region 界面布局
            this.BackgroundColor = CSS.CSS_Color.viewMiddle;
            PirDevice.View.TopView topView = new View.TopView();
@@ -18,16 +19,16 @@
            this.AddChidren(topView.FLayoutView());
            topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); };
            FrameLayout fLayout = new FrameLayout
            FrameLayout fLayout = new FrameLayout
            {
                Y =Application.GetRealHeight(64),
                Y = Application.GetRealHeight(64),
                BackgroundColor = CSS.CSS_Color.textWhiteColor,
                Height = Application.GetRealHeight(224),
                Width = Application.GetRealWidth(375),
            };
            this.AddChidren(fLayout);
            //
            Button iconBtn = new Button
            Button iconBtn = new Button
            {
                Y = Application.GetRealHeight(28),
                X = Application.GetRealWidth(137),
@@ -40,7 +41,7 @@
            //添加成功
            Button text1Btn = new Button
            {
                Width = Application.GetRealWidth(375-32),
                Width = Application.GetRealWidth(375 - 32),
                Height = Application.GetRealHeight(22),
                Y = Application.GetRealHeight(158),
                X = Application.GetRealWidth(16),
@@ -65,7 +66,7 @@
            fLayout.AddChidren(text2Btn);
            //所属分类
            View.PatchView fenlei = new View.PatchView();
            fenlei.frameLayout.Y = fLayout.Bottom+ Application.GetRealHeight(8);
            fenlei.frameLayout.Y = fLayout.Bottom + Application.GetRealHeight(8);
            this.AddChidren(fenlei.FLayoutView(false));
            fenlei.btnText1.TextID = StringId.suoshufenlei;
            fenlei.btnText2.TextID = StringId.dianqi;
@@ -74,7 +75,7 @@
            namePatchView.frameLayout.Y = fenlei.frameLayout.Bottom;
            this.AddChidren(namePatchView.FLayoutView());
            namePatchView.btnText1.TextID = StringId.yaokongqimingcheng;
            namePatchView.btnText2.TextID = StringId.dianqi;
            namePatchView.btnText2.Text = control.name;
            //所属区域
            View.PatchView quyuPatchView = new View.PatchView();
            quyuPatchView.frameLayout.Y = namePatchView.frameLayout.Bottom;
@@ -87,7 +88,7 @@
            {
                Y = quyuPatchView.frameLayout.Bottom + Application.GetRealHeight(125),
                X = Application.GetRealWidth(16),
                Width = Application.GetRealWidth(375-32),
                Width = Application.GetRealWidth(375 - 32),
                Height = Application.GetRealHeight(20),
                TextID = StringId.jixutianjia,
                TextSize = TextSize.text14,
@@ -102,28 +103,47 @@
            #endregion
            #region  界面点击事件
            //遥控器名称点击事件
            namePatchView.btnClick.MouseUpEventHandler += (sender,e) => { };
            namePatchView.btnClick.MouseUpEventHandler += (sender, e) => { };
            //所属区域点击事件
            quyuPatchView.btnClick.MouseUpEventHandler += (sender, e) => { };
            //继续添加点击事件
            addBtn.MouseUpEventHandler += (sender, e) => {
                View.TipView tipView = new View.TipView();
                tipView.InputBox("", (s) =>
            addBtn.MouseUpEventHandler += (sender, e) =>
            {
                if (bool_library)
                {
                    if (!string.IsNullOrEmpty(s))
                    {
                    this.RemoveFromParent();
                }
                else
                {
                    Method method = new Method();
                    method.AddControl(this, (controlDevice) => {
                        AddButton addButton = new AddButton();
                        MainPage.BasePageView.AddChidren(addButton);
                        addButton.Show();
                        addButton.Show(controlDevice);
                        MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                    }
                });
                    });
                }
            };
            //完成点击事件
            saveView.btnClick.MouseUpEventHandler += (sender, e) => {
            saveView.btnClick.MouseUpEventHandler += (sender, e) =>
            {
                MainPage.BasePageView.RemoveViewByTag("AddControl");
                MainPage.BasePageView.RemoveViewByTag("Pir");
                Entity.Function function = new Entity.Function();
                function.sid = control.sid;
                function.deviceId = control.deviceId;
                function.name = control.name;
                function.spk = control.spk;
                function.attributes.AddRange(function.attributes);
                if (null == Pir.currPir.FunctioList.Find((c) => c.sid == function.sid))
                {
                    Pir.currPir.FunctioList.Add(function);
                }
                //Entity.FunctionAttributes functionAttributes = new Entity.FunctionAttributes();
                //functionAttributes.key
            };
            #endregion
        }