WJC
2020-01-15 c6ff92e84b6cb2815cb98065ecb0ecf95d0689c3
ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs
@@ -763,7 +763,7 @@
                                                {
                                                    if (Common.Logic.CurrentLogic.Accounts[a]["UserId"] == conditions["AttriButeData2"])
                                                    {
                                                        devicestatus.Text = Common.Logic.CurrentLogic.Accounts[a]["Account"];
                                                        devicestatus.Text = Common.Logic.CurrentLogic.Accounts[a]["AccountName"];
                                                        break;
                                                    }
@@ -975,7 +975,7 @@
                                conditionIcon.UnSelectedImagePath = "ZigeeLogic/position.png";
                                var btnlocation = new Button
                                {
                                    Width = Application.GetRealWidth(700),
                                    Width = Application.GetRealWidth(250),
                                    TextAlignment = TextAlignment.CenterLeft,
                                    Gravity = Gravity.CenterVertical,
                                    TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
@@ -1002,11 +1002,11 @@
                                var locationstatus = new Button
                                {
                                    Width = Application.GetRealWidth(300),
                                    Width = Application.GetRealWidth(550),
                                    Height = Application.GetRealHeight(130),
                                    Gravity = Gravity.CenterVertical,
                                    TextAlignment = TextAlignment.CenterRight,
                                    X = Application.GetRealWidth(500),
                                    X = Application.GetRealWidth(250),
                                    TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
                                    TextSize = 14,
                                };
@@ -1040,20 +1040,19 @@
                    del.MouseUpEventHandler += (sender, e) =>
                    {
                        var alert = new Alert(Language.StringByID(MyInternationalizationString.tip), Language.StringByID(MyInternationalizationString.doyouwanttodelete),
                                              Language.StringByID(MyInternationalizationString.cancel), Language.StringByID(MyInternationalizationString.confrim));
                        alert.ResultEventHandler += (sender1, e1) =>
                        {
                            if (e1)
                            {
                                Common.Logic.CurrentLogic.Conditions.Remove(conditions);
                                var logicCommunalPage = new LogicCommunalPage();
                                UserView.HomePage.Instance.AddChidren(logicCommunalPage);
                                UserView.HomePage.Instance.PageIndex += 1;
                                logicCommunalPage.Show(() => { });
                            }
                        };
                        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);
                            var logicCommunalPage = new LogicCommunalPage();
                            UserView.HomePage.Instance.AddChidren(logicCommunalPage);
                            UserView.HomePage.Instance.PageIndex += 1;
                            logicCommunalPage.Show(() => { });
                        };
                    };
@@ -1790,21 +1789,19 @@
                    del.MouseUpEventHandler += (sender, e) =>
                    {
                        var alert = new Alert(Language.StringByID(MyInternationalizationString.tip), Language.StringByID(MyInternationalizationString.doyouwanttodelete),
                                               Language.StringByID(MyInternationalizationString.cancel), Language.StringByID(MyInternationalizationString.confrim));
                        alert.ResultEventHandler += (sender1, e1) =>
                        var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Confirm,
                       Language.StringByID(MyInternationalizationString.doyouwanttodelete),
                       Language.StringByID(MyInternationalizationString.confrim));
                       alert.Show();
                        alert.ConfirmClickEvent += () =>
                        {
                            if (e1)
                            {
                                Common.Logic.CurrentLogic.Actions.Remove(actions);
                                // devicesFrameLayout.RemoveFromParent();
                                var logicCommunalPage = new LogicCommunalPage();
                                UserView.HomePage.Instance.AddChidren(logicCommunalPage);
                                UserView.HomePage.Instance.PageIndex += 1;
                                logicCommunalPage.Show(() => { });
                            }
                            Common.Logic.CurrentLogic.Actions.Remove(actions);
                            // devicesFrameLayout.RemoveFromParent();
                            var logicCommunalPage = new LogicCommunalPage();
                            UserView.HomePage.Instance.AddChidren(logicCommunalPage);
                            UserView.HomePage.Instance.PageIndex += 1;
                            logicCommunalPage.Show(() => { });
                        };
                        alert.Show();
                    };
@@ -1986,18 +1983,38 @@
            btncustompush.MouseUpEventHandler += customclick;
            custompushback.MouseUpEventHandler += customclick;
            custompushRowLayout.MouseUpEventHandler += customclick;
            btnswitch.MouseUpEventHandler += (sender1, e1) =>
            bool tag = false;//标记开关状态;
            btnswitch.MouseUpEventHandler +=(sender1, e1) =>
              {
                  btnswitch.IsSelected = !btnswitch.IsSelected;
                  if (btnswitch.IsSelected)
                  {
                      tag = true;
                      custompushFrameLayout.Height = Application.GetRealHeight(160);
                      Common.Logic.CurrentLogic.LogicIsCustomPushText = 1;
                  }
                  else
                  {
                      tag = false;
                      custompushFrameLayout.Height = Application.GetRealHeight(0);
                      Common.Logic.CurrentLogic.LogicIsCustomPushText = 0;
                  }
                  Send.Zj(tag,Common.Logic.CurrentLogic);
              };
            if (Common.Logic.CurrentLogic.LogicIsCustomPushText == 0)
            {
                btnswitch.IsSelected = !btnswitch.IsSelected;
                if (btnswitch.IsSelected)
                {
                    custompushFrameLayout.Height = Application.GetRealHeight(160);
                }
                else
                {
                    custompushFrameLayout.Height = Application.GetRealHeight(0);
                }
            };
                tag = false;
                btnswitch.IsSelected = false;
                custompushFrameLayout.Height = Application.GetRealHeight(0);
            }
            else
            {
                tag = true;
                btnswitch.IsSelected = true;
                custompushFrameLayout.Height = Application.GetRealHeight(160);
            }
            #endregion
@@ -2007,15 +2024,19 @@
                var name = logicTextBox.Text.Trim();
                if (string.IsNullOrEmpty(logicTextBox.Text.Trim()))
                {
                    new Alert(Language.StringByID(MyInternationalizationString.Tip), Language.StringByID(MyInternationalizationString.PleaseEnterLogicName), Language.StringByID(MyInternationalizationString.Close)).Show();
                    var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal,
                      Language.StringByID(MyInternationalizationString.PleaseEnterLogicName),
                      Language.StringByID(MyInternationalizationString.confrim));
                    alert.Show();
                    return;
                }
                var logicname = Common.Logic.LogicList.Find((logic) => Common.Logic.CurrentLogic.LogicId != logic.LogicId && logic.LogicName == name);
                if (logicname != null)
                {
                    new Alert(Language.StringByID(MyInternationalizationString.Tip), Language.StringByID(MyInternationalizationString.Rename), Language.StringByID(MyInternationalizationString.Close)).Show();
                    return;
                }
                ///先隐藏判断名字相同的功能;
                //var logicname = Common.Logic.LogicList.Find((logic) => Common.Logic.CurrentLogic.LogicId != logic.LogicId && logic.LogicName == name);
                //if (logicname != null)
                //{
                //    new Alert(Language.StringByID(MyInternationalizationString.Tip), Language.StringByID(MyInternationalizationString.Rename), Language.StringByID(MyInternationalizationString.Close)).Show();
                //    return;
                //}
                Common.Logic.CurrentLogic.LogicName = name;
                bool succeed = false;
@@ -2030,6 +2051,10 @@
                        succeed = true;
                        Common.Logic.CurrentLogic.LogicId = logicifon.LogicId;
                        Common.Logic.LogicList.Add(Common.Logic.CurrentLogic);
                        if (tag)
                        {
                            Send.Zj(tag, Common.Logic.CurrentLogic);
                        }
                    }
                }
                else
@@ -2589,5 +2614,9 @@
            { IsBackground = true }.Start();
        }
    }
}