From 6fa9d69da922c8049f5acfcbb9ce9fd26811024c Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期四, 16 四月 2020 17:10:57 +0800
Subject: [PATCH] 请合并代码

---
 ZigbeeApp/Shared/Phone/Device/Logic/TemplatePage.cs |  604 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 604 insertions(+), 0 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/TemplatePage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/TemplatePage.cs
new file mode 100755
index 0000000..9c244a8
--- /dev/null
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/TemplatePage.cs
@@ -0,0 +1,604 @@
+锘縰sing System;
+using System.Collections.Generic;
+using Newtonsoft.Json.Linq;
+using Shared;
+using Shared.Common;
+using Shared.Phone;
+using Shared.R;
+using ZigBee.Device;
+
+namespace Shared.Phone.Device.Logic
+{
+    public class TemplatePage : FrameLayout
+    {
+
+        public TemplatePage()
+        {
+            UserView.HomePage.Instance.RemoveViewByTag("Logic");
+            Tag = "Logic";
+        }
+        EditText logicTextBox;
+        /// <summary>
+        /// 鍥炬爣鐨勭储寮�
+        /// </summary>
+        public static string s;
+        public void Show()
+        {
+
+            #region  鏈�涓婇潰鐨勫竷灞�浠g爜
+            UserView.HomePage.Instance.ScrollEnabled = false;//閿佷綇宸︽粦
+            TopView view = new TopView();
+            this.AddChidren(view.TopRowView());
+            if (Common.Logic.CurrentLogic.LogicId != 0)
+            {
+                view.toptitleNameBtn.Text = Language.StringByID(MyInternationalizationString.editautomation);
+            }
+            else
+            {
+                view.toptitleNameBtn.Text = Language.StringByID(MyInternationalizationString.newautomation);
+            }
+            view.clickBtn.MouseDownEventHandler += (sender, e) =>
+            {
+                //UserView.HomePage.Instance.ScrollEnabled = true;//鎭㈠宸︽粦
+                RemoveFromParent();
+            };
+            #endregion
+
+            var middle = new VerticalScrolViewLayout
+            {
+                Y = view.topRowLayout.Bottom,
+                Height = Application.GetRealHeight(Method.H - 184 - 180),
+                BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
+            };
+            this.AddChidren(middle);
+
+            var logiciconfl = new FrameLayout
+            {
+                Height = Application.GetRealHeight(436 + 30),
+                BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
+            };
+            middle.AddChidren(logiciconfl);
+            var iconBtn = new Button
+            {
+                Width = Application.GetRealWidth(936),
+                Height = Application.GetRealHeight(436),
+                X = Application.GetRealWidth(72),
+                Y = Application.GetRealHeight(30),
+                UnSelectedImagePath = $"ZigeeLogic/logicbj{s}.png",
+            };
+            logiciconfl.AddChidren(iconBtn);
+
+
+            #region -----鑷姩鍖栧悕绉� 璁剧疆鍚嶇О-----
+            var logicnamefl = new FrameLayout
+            {
+                Height = Application.GetRealHeight(130),
+                BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
+            };
+            middle.AddChidren(logicnamefl);
+
+            var text = new Button
+            {
+                Width = Application.GetRealWidth(300),
+                Height = Application.GetRealHeight(60),
+                X = Application.GetRealWidth(58),
+                TextAlignment = TextAlignment.CenterLeft,
+                //Text = "鑷姩鍖栧悕绉�",
+                TextID = MyInternationalizationString.automationname,
+                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+                Y = Application.GetRealHeight(35),
+                TextSize = 15,
+            };
+            logicnamefl.AddChidren(text);
+
+            logicTextBox = new EditText
+            {
+                Y = Application.GetRealHeight(35),
+                Width = Application.GetRealWidth(1080 - 58 - 300),
+                Height = Application.GetRealHeight(60),
+                X = text.Right,
+                TextAlignment = TextAlignment.CenterLeft,
+                TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
+                TextSize = 14,
+                Text = Common.Logic.CurrentLogic.LogicName,
+                //TextID=MyInternationalizationString.automation1,
+            };
+            logicnamefl.AddChidren(logicTextBox);
+
+            var fraline = new FrameLayout
+            {
+                Height = Application.GetRealHeight(30),
+            };
+            middle.AddChidren(fraline);
+            #endregion
+
+            #region -----鏄剧ず閫昏緫鏉′欢-----
+
+
+            LogicView.Addview addconditionview = new LogicView.Addview();
+            addconditionview.iconBtn.Visible = true;
+            addconditionview.titleBtn.TextID = MyInternationalizationString.ifcondition;
+            middle.AddChidren(addconditionview.AddDeviceView());
+
+            ///娣诲姞鏉′欢鐨勭偣鍑讳簨浠�
+            addconditionview.clickBtn.MouseUpEventHandler += (sender, e) =>
+            {
+                if (Common.Logic.CurrentLogic.Conditions.Count == 1)
+                {
+                    ConditionView(false);
+                }
+                else
+                {
+                    var roomAndDeviceView = new RoomAndDeviceView();
+                    UserView.HomePage.Instance.AddChidren(roomAndDeviceView);
+                    UserView.HomePage.Instance.PageIndex += 1;
+                    roomAndDeviceView.IfType = "condition_mould";
+                    roomAndDeviceView.Show(Language.StringByID(MyInternationalizationString.addsensor));
+                }
+            };
+           
+            List<Dictionary<string, string>> ListConditions = new List<Dictionary<string, string>>();
+            ListConditions.Clear();
+            ListConditions.AddRange(Common.Logic.CurrentLogic.Conditions);
+            ListConditions.Add(new Dictionary<string, string>());
+            if (Common.Logic.CurrentLogic.Conditions.Count > 1)
+            {
+                var row = new FrameLayout
+                {
+                    Height = Application.GetRealHeight(60),
+                    BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
+                };
+                middle.AddChidren(row);
+                var relationship = new Button
+                {
+                    Width = Application.GetRealWidth(600),
+                    Height = Application.GetRealHeight(60),
+                    TextAlignment = TextAlignment.CenterLeft,
+                    X = Application.GetRealWidth(58),
+                    TextColor = ZigbeeColor.Current.LogicBtnCompleteColor,
+                };
+                row.AddChidren(relationship);
+                if (Common.Logic.CurrentLogic.Relationship == 0)
+                {
+                    relationship.Text = Language.StringByID(MyInternationalizationString.followingconditions) + Language.StringByID(MyInternationalizationString.Allconditions);
+                }
+                else
+                {
+                    relationship.Text = Language.StringByID(MyInternationalizationString.followingconditions) + Language.StringByID(MyInternationalizationString.anycondition);
+                }
+                EventHandler<MouseEventArgs> editclick = (sender, e) =>
+                {
+
+                    ConditionView(true);
+                };
+                row.MouseUpEventHandler += editclick;
+                relationship.MouseUpEventHandler += editclick;
+
+            }
+            for (int i = 0; i < ListConditions.Count; i++)
+            {
+                if (i == (ListConditions.Count - 1))
+                {
+                    LogicView.AddDeviceView addflview = new LogicView.AddDeviceView();
+                    addflview.titleBtn.TextID = MyInternationalizationString.addsensor;
+                    middle.AddChidren(addflview.AddFl());
+                    addflview.clickBtn.MouseUpEventHandler += (sender, e) =>
+                    {
+                        if (Common.Logic.CurrentLogic.Conditions.Count == 1)
+                        {
+                            ConditionView(false);
+                        }
+                        else
+                        {
+
+                            var roomAndDeviceView = new RoomAndDeviceView();
+                            UserView.HomePage.Instance.AddChidren(roomAndDeviceView);
+                            UserView.HomePage.Instance.PageIndex += 1;
+                            roomAndDeviceView.IfType = "condition_mould";
+                            roomAndDeviceView.Show(Language.StringByID(MyInternationalizationString.addsensor));
+                        }
+                    };
+                }
+                else
+                {
+                    SelectedDeviceView selecteddevice = new SelectedDeviceView();
+                    selecteddevice.Show(middle);
+                    selecteddevice.stateRow.AddRightView(selecteddevice.edit);
+                    selecteddevice.stateRow.AddRightView(selecteddevice.del);
+                    var Type = int.Parse(ListConditions[i]["Type"]);
+                    var conditions = ListConditions[i];
+                    switch (Type)
+                    {
+
+                        /// 1:璁惧鐘舵�佸彉鍖栨潯浠�;
+                        case 1:
+                            {
+                                var deviceinof = Method.GetCommonDevice(conditions["MacAddr"], conditions["Epoint"]);
+                                selecteddevice.deviceNameBtn.Visible = true;
+                                selecteddevice.deviceNameBtn.Text = LocalDevice.Current.GetDeviceEpointName(deviceinof);
+                                selecteddevice.regionNameBtn.Visible = true;
+                                Method.RoomNmae(selecteddevice.regionNameBtn, deviceinof);
+                                selecteddevice.iconBtn.UnSelectedImagePath ="ZigeeLogic/sensor13.png";
+                                switch (deviceinof.Type)
+                                {
+                                    case DeviceType.IASZone:
+                                        {
+                                            var iASZonedevice = deviceinof as IASZone;
+                                            var intvalue = conditions["AttriButeData1"];
+                                            switch (iASZonedevice.IasDeviceType)
+                                            {
+                                                case 13:
+                                                    {
+                                                        if (intvalue == "1")
+                                                        {
+                                                            selecteddevice.selecetddevicestateBtn.TextID = MyInternationalizationString.someone;
+                                                        }
+                                                        else
+                                                        {
+                                                            int minute = int.Parse(conditions["IgnoreTime"]) / 60;
+                                                            int second = int.Parse(conditions["IgnoreTime"]) % 60;
+                                                            if (minute != 0 && second != 0)
+                                                            {
+                                                                selecteddevice.selecetddevicestateBtn.Text = minute.ToString() + Language.StringByID(MyInternationalizationString.minute) + second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.unattendedtime1);
+
+                                                            }
+                                                            else
+                                                            {
+                                                                if (minute == 0 && second != 0)
+                                                                {
+                                                                    selecteddevice.selecetddevicestateBtn.Text = second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.unattendedtime1);
+
+                                                                }
+                                                                if (minute != 0 && second == 0)
+                                                                {
+                                                                    selecteddevice.selecetddevicestateBtn.Text = minute.ToString() + Language.StringByID(MyInternationalizationString.Minute) + Language.StringByID(MyInternationalizationString.unattendedtime1);
+
+                                                                }
+
+                                                            }
+                                                        }
+                                                    }
+                                                    break;
+                                            }
+                                        }
+                                        break;
+
+                                }
+
+                            }
+                            break;
+                    }
+                 
+                    ///缂栬緫
+                    selecteddevice.edit.MouseUpEventHandler += (sender, e) =>
+                    {
+                        var deviceinof = Method.GetCommonDevice(conditions["MacAddr"], conditions["Epoint"]);
+                        var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
+                        this.AddChidren(flMain);
+                        CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "condition_mould");
+
+                    };
+                    ///鍒犻櫎鎺т欢
+                    selecteddevice.del.MouseUpEventHandler += (sender, e) =>
+                    {
+
+                        var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Confirm,
+                   Language.StringByID(MyInternationalizationString.doyouwanttodelete),
+                   Language.StringByID(MyInternationalizationString.confrim));
+                        alert.Show();
+                        alert.ConfirmClickEvent += () =>
+                        {
+                            Common.Logic.CurrentLogic.Conditions.Remove(conditions);
+                            selecteddevice.selecetdFrameLayout.RemoveFromParent();
+                            //var templatePage = new TemplatePage();
+                            //UserView.HomePage.Instance.AddChidren(templatePage);
+                            //UserView.HomePage.Instance.PageIndex += 1;
+                            //templatePage.Show();
+                        };
+                    };
+                }
+            }
+
+
+            #endregion
+
+            #region  ----鏄剧ず鎵ц鐩爣----
+
+            LogicView.Addview addactionview = new LogicView.Addview();
+            addactionview.iconBtn.Visible = true;
+            addactionview.titleBtn.TextID = MyInternationalizationString.execute;
+            middle.AddChidren(addactionview.AddDeviceView());
+            addactionview.clickBtn.MouseUpEventHandler = (sender, e) =>
+            {
+                Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim();
+
+                var roomAndDeviceView = new RoomAndDeviceView();
+                UserView.HomePage.Instance.AddChidren(roomAndDeviceView);
+                UserView.HomePage.Instance.PageIndex += 1;
+                roomAndDeviceView.IfType = "action_mould";
+                roomAndDeviceView.Show(Language.StringByID(MyInternationalizationString.addlighting));
+            };
+
+            List<Dictionary<string, object>> ListActions = new List<Dictionary<string, object>>();
+            ListActions.Clear();
+            ListActions.AddRange(Common.Logic.CurrentLogic.Actions);
+            ListActions.Add(new Dictionary<string, object>());
+
+            for (int i = 0; i < ListActions.Count; i++)
+            {
+                if (i == (ListActions.Count - 1))
+                {
+                    LogicView.AddDeviceView addflview = new LogicView.AddDeviceView();
+                    addflview.titleBtn.TextID = MyInternationalizationString.addlighting;
+                    middle.AddChidren(addflview.AddFl());
+                    addflview.clickBtn.MouseUpEventHandler += (sender, e) =>
+                    {
+                        var roomAndDeviceView = new RoomAndDeviceView();
+                        UserView.HomePage.Instance.AddChidren(roomAndDeviceView);
+                        UserView.HomePage.Instance.PageIndex += 1;
+                        roomAndDeviceView.IfType = "action_mould";
+                        roomAndDeviceView.Show(Language.StringByID(MyInternationalizationString.addlighting));
+                    };
+
+                }
+                else
+                {
+
+                    SelectedDeviceView actiondevice = new SelectedDeviceView();
+                    actiondevice.Show(middle);
+                    actiondevice.stateRow.AddRightView(actiondevice.edit);
+                    actiondevice.stateRow.AddRightView(actiondevice.del);
+                    var linkType = int.Parse(ListActions[i]["LinkType"].ToString());
+                    var actions = ListActions[i];
+
+                    switch (linkType)
+                    {
+                        case 0:
+                            {
+                                var deviceinof = Method.GetCommonDevice(actions["DeviceAddr"].ToString(), actions["Epoint"].ToString());
+                                actiondevice.deviceNameBtn.Visible = true;
+                                actiondevice.deviceNameBtn.Text = LocalDevice.Current.GetDeviceEpointName(deviceinof);
+                                actiondevice.regionNameBtn.Visible = true;
+                                Method.RoomNmae(actiondevice.regionNameBtn, deviceinof);
+                                switch (deviceinof.Type)
+                                {
+                                    case DeviceType.OnOffOutput:
+                                        {
+                                            actiondevice.iconBtn.UnSelectedImagePath = "ZigeeLogic/light.png";
+
+                                            var TaskList = actions["TaskList"] as List<Dictionary<string, string>>;
+                                            if (TaskList == null)
+                                            {
+                                                continue;
+                                            }
+                                            foreach (var status in TaskList)
+                                            {
+                                                if (status["TaskType"].ToString() == "1")
+                                                {
+                                                    if (status["Data1"].ToString() == "0")
+                                                    {
+                                                        actiondevice.selecetddevicestateBtn.Text = Language.StringByID(MyInternationalizationString.close);
+
+                                                    }
+                                                    else if (status["Data1"].ToString() == "1")
+                                                    {
+                                                        actiondevice.selecetddevicestateBtn.Text = Language.StringByID(MyInternationalizationString.open);
+
+                                                    }
+                                                    else if (status["Data1"].ToString() == "2")
+                                                    {
+
+                                                        actiondevice.selecetddevicestateBtn.Text = Language.StringByID(MyInternationalizationString.onoff);
+                                                    }
+                                                }
+
+                                            }
+                                        }
+                                        break;
+                                  
+                                }
+                            }
+                            break;
+                    }
+                    ///缂栬緫
+                    actiondevice.edit.MouseUpEventHandler += (sender, e) => {
+                        var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
+                        this.AddChidren(flMain);
+                        var deviceinof = Method.GetCommonDevice(actions["DeviceAddr"].ToString(), actions["Epoint"].ToString());
+                        CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "action_mould");
+                    };
+                    ///鍒犻櫎鎺т欢
+                    actiondevice.del.MouseUpEventHandler += (sender, e) =>
+                    {
+
+
+                        var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Confirm,
+                     Language.StringByID(MyInternationalizationString.doyouwanttodelete),
+                     Language.StringByID(MyInternationalizationString.confrim));
+                        alert.Show();
+                        alert.ConfirmClickEvent += () =>
+                        {
+                            Common.Logic.CurrentLogic.Actions.Remove(actions);
+                            actiondevice.selecetdFrameLayout.RemoveFromParent();
+                            //var templatePage = new TemplatePage();
+                            //UserView.HomePage.Instance.AddChidren(templatePage);
+                            //UserView.HomePage.Instance.PageIndex += 1;
+                            //templatePage.Show();
+                        };
+                    };
+
+                }
+            }
+
+            #endregion
+
+            #region -----姣忓ぉ 璁剧疆鍛ㄦ湡-----
+
+            var fraHeight = new FrameLayout
+            {
+                Height = Application.GetRealHeight(30),
+            };
+            middle.AddChidren(fraHeight);
+
+
+            LogicView.Addview weekview = new LogicView.Addview();
+            weekview.iconBtn.Visible = true;
+            weekview.iconBtn.UnSelectedImagePath = "ZigeeLogic/next.png";
+            weekview.titleBtn.TextID = MyInternationalizationString.setupcycle;
+            middle.AddChidren(weekview.AddDeviceView());
+            var weekBtn = new Button
+            {
+                Width = Application.GetRealWidth(595),
+                Height = Application.GetRealHeight(60),
+                TextAlignment = TextAlignment.CenterRight,
+                //Text = "姣忓ぉ",
+                TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
+                TextID = MyInternationalizationString.everyday,
+                Y = Application.GetRealHeight(35 + 30),
+                X = weekview.titleBtn.Right,
+                TextSize = 14,
+            };
+            weekview.frameLayout.AddChidren(weekBtn);
+
+            Method.UpdateWeek(weekBtn, Common.Logic.CurrentLogic);
+            EventHandler<MouseEventArgs> cycleclick = (sender, e) =>
+            {
+                /*------淇濈暀姣忔湀,姣忓勾绫诲瀷*/
+                var cycle = new Cycle(() => { Method.UpdateWeek(weekBtn, Common.Logic.CurrentLogic); });
+                UserView.HomePage.Instance.AddChidren(cycle);
+                UserView.HomePage.Instance.PageIndex += 1;
+                cycle.Show();
+
+                //var cyclicCycle = new CyclicCycle(() => { UpdateWeek(btnweektext); });
+                //UserView.HomePage.Instance.AddChidren(cyclicCycle);
+                //UserView.HomePage.Instance.PageIndex += 1;
+                //cyclicCycle.Show();
+            };
+            weekBtn.MouseUpEventHandler += cycleclick;
+            weekview.clickBtn.MouseUpEventHandler += cycleclick;
+            #endregion
+
+            #region  ----鎺ㄩ�佽缃�----
+            Method.Push(middle);
+            #endregion
+
+            var saveBtn = new LogicView.SaveView();
+            saveBtn.frameLayout.Y = middle.Bottom;
+            saveBtn.frameLayout.Height = Application.GetRealHeight(180);
+            this.AddChidren(saveBtn.Show());
+            saveBtn.clickviewBtn.MouseUpEventHandler +=(sender, e) =>
+            {
+                var name = logicTextBox.Text.Trim();
+                Method.SaveLogic(LogicView.IfString._Logic, name, LogicView.IfString.Tag, Common.Logic.CurrentLogic);
+            };
+
+        }
+
+        void ConditionView(bool edit)
+        {
+            Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim();
+            #region  ------缁勫悎鏉′欢鐣岄潰甯冨眬閮ㄥ垎   
+            var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicTranslucentColor };
+            this.AddChidren(flMain);
+            CompleteView completeView = new CompleteView();
+            flMain.AddChidren(completeView.Show(2));
+            completeView.Btntitle.TextID = MyInternationalizationString.condition;
+            EventHandler<MouseEventArgs> clickcancel = (sender, e) =>
+            {
+                UserView.HomePage.Instance.ScrollEnabled = true;
+                flMain.RemoveFromParent();
+            };
+            flMain.MouseUpEventHandler += clickcancel;
+            completeView.Btncancel.MouseUpEventHandler += clickcancel;
+
+            //婊¤冻鎵�鏈夋潯浠�
+            mFunView allFunView = new mFunView();
+            allFunView.frameLayout.Y = Application.GetRealHeight(140 + 20);
+            completeView.Show(2).AddChidren(allFunView.Show());
+            allFunView.titleBtn.TextID = MyInternationalizationString.Allconditions;
+            //婊¤冻鍏朵腑涓�涓潯浠�
+            mFunView ormFunview = new mFunView();
+            ormFunview.frameLayout.Y = allFunView.frameLayout.Bottom;
+            completeView.Show(2).AddChidren(ormFunview.Show());
+            ormFunview.titleBtn.TextID = MyInternationalizationString.anycondition;
+            ormFunview.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor;
+            #endregion
+
+            ///婊¤冻鎵�鏈夋潯浠剁偣鍑讳簨浠�
+            allFunView.clickviewBtn.MouseUpEventHandler += (sedner, e) =>
+            {
+                allFunView.selectedIconBtn.Visible = true;
+                ormFunview.selectedIconBtn.Visible = false;
+                allFunView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
+                ormFunview.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
+            };
+            ///婊¤冻鍏朵腑涓�涓潯浠剁偣鍑讳簨浠�
+            ormFunview.clickviewBtn.MouseUpEventHandler += (sedner, e) =>
+            {
+                allFunView.selectedIconBtn.Visible = false;
+                ormFunview.selectedIconBtn.Visible = true;
+                allFunView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
+                ormFunview.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
+            };
+
+            if (edit)
+            {
+                if (Common.Logic.CurrentLogic.Relationship == 0)
+                {
+                    allFunView.selectedIconBtn.Visible = true;
+                    ormFunview.selectedIconBtn.Visible = false;
+                    allFunView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
+                    ormFunview.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
+                }
+                else
+                {
+                    allFunView.selectedIconBtn.Visible = false;
+                    ormFunview.selectedIconBtn.Visible = true;
+                    allFunView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
+                    ormFunview.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
+                }
+            }
+            completeView.Btncomplete.MouseUpEventHandler += (sender, e) =>
+            {
+                if (!allFunView.selectedIconBtn.Visible && !ormFunview.selectedIconBtn.Visible)
+                {
+                    ///鍙互鎻愮ず鏈�変腑鐘舵�侊紱
+                    return;
+                }
+                flMain.RemoveFromParent();
+
+                if (allFunView.selectedIconBtn.Visible)
+                {
+                    Common.Logic.CurrentLogic.Relationship = 0;
+
+                }
+                if (ormFunview.selectedIconBtn.Visible)
+                {
+                    Common.Logic.CurrentLogic.Relationship = 1;
+
+                }
+                if (edit)
+                {
+                    if (Common.Logic.CurrentLogic.LogicId != 0)
+                    {
+                        Send.LogicControlSwitch(Common.Logic.CurrentLogic);
+                    }
+
+                    var templatePage = new TemplatePage();
+                    UserView.HomePage.Instance.AddChidren(templatePage);
+                    UserView.HomePage.Instance.PageIndex += 1;
+                    templatePage.Show();
+                }
+                else
+                {
+                    var roomAndDeviceView = new RoomAndDeviceView();
+                    UserView.HomePage.Instance.AddChidren(roomAndDeviceView);
+                    UserView.HomePage.Instance.PageIndex += 1;
+                    roomAndDeviceView.IfType = "condition_mould";
+                    roomAndDeviceView.Show(Language.StringByID(MyInternationalizationString.addsensor));
+                }
+            };
+
+        }
+    }
+}

--
Gitblit v1.8.0