From e75ccccb370b47305c6eadb321efb27c86cdd28b Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期二, 30 十一月 2021 09:57:24 +0800
Subject: [PATCH] 合并

---
 HDL_ON/UI/UI2/FuntionControlView/ArmCenter/PushConfigPage.cs |  196 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 196 insertions(+), 0 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/PushConfigPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/PushConfigPage.cs
new file mode 100644
index 0000000..cbcb003
--- /dev/null
+++ b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/PushConfigPage.cs
@@ -0,0 +1,196 @@
+锘縰sing System;
+using System.Collections.Generic;
+using HDL_ON.UI.UI2.Intelligence.Automation;
+using Shared;
+
+namespace HDL_ON.UI
+{
+    public class PushConfigPage : FrameLayout
+    {
+        FrameLayout bodyView;
+
+        public PushConfigPage()
+        {
+            bodyView = this;
+        }
+        public void Show(Entity.SecurityAlarm alarm)
+        {
+      
+            new TopViewDiv(bodyView, Language.StringByID(StringId.fasongtongzhi)).LoadTopView();
+
+            this.BackgroundColor = CSS.CSS_Color.BackgroundColor;
+
+            var viewLayout = new FrameLayout()
+            {
+                Y = Application.GetRealHeight(64),
+                Height = Application.GetRealHeight(527),
+            };
+            bodyView.AddChidren(viewLayout);
+
+            #region  閫氱煡鍐呭
+            UI2.Intelligence.Automation.LogicView.AddOutputInputTextView addInputTextView = new UI2.Intelligence.Automation.LogicView.AddOutputInputTextView();
+            addInputTextView.btnIf.TextID = StringId.tongzhineirong;
+            viewLayout.AddChidren(addInputTextView.FLayoutView(46, 12));
+            ///杈撳叆鎺ㄩ�佹枃鏈�
+            EditTextView textBox = new EditTextView//EditText
+            {
+                Y = Application.GetRealHeight(42),
+                X = Application.GetRealWidth(16),
+                Width = Application.GetRealWidth(343),
+                Height = Application.GetRealHeight(152),
+                TextAlignment = TextAlignment.TopLeft,
+                Radius = (uint)Application.GetRealHeight(12),
+                Text = alarm.noticeConfig.noticeContent,
+                TextSize = UI2.Intelligence.Automation.LogicView.TextSize.text14,
+                TextColor = CSS.CSS_Color.textColor,
+                PlaceholderText = Language.StringByID(StringId.xianzhichangdu),//"(100瀛椾互鍐�)",
+                PlaceholderTextColor = CSS.CSS_Color.textCancelColor,
+                BackgroundColor = CSS.CSS_Color.textWhiteColor,
+
+            };
+            viewLayout.AddChidren(textBox);
+            textBox.TextChangeEventHandler += (sender, e) =>
+            {
+                var leng = e.Length;
+                if (leng > 100)
+                {
+                    textBox.Text = e.Substring(0, 100);
+#if __Android__
+                    textBox.SetSelectionEnd();
+#endif
+
+                }
+
+            };
+            #endregion
+            #region  App鎺ㄩ��
+            UI2.Intelligence.Automation.LogicView.LogicTypeTitleView appPush = new UI2.Intelligence.Automation.LogicView.LogicTypeTitleView();
+            appPush.frameLayout.Y = Application.GetRealHeight(206);
+            appPush.frameLayout.Radius = (uint)Application.GetRealHeight(12);
+            appPush.btnText.TextID = StringId.apptuisong;
+            appPush.btnText.X = Application.GetRealWidth(12);
+            viewLayout.AddChidren(appPush.FLayoutView(false));
+            //瀹氫箟涓�涓眬閮ㄨ处鍙峰垪琛ㄧ敤鏉ヨ褰曢�変腑鏁版嵁;
+            List<string> selectedAccountList = new List<string>();
+            appPush.btnClick.MouseUpEventHandler += (sender, e) =>
+            {
+                var userList = new List<HDL_ON.Entity.ResidenceMemberInfo>();
+                Loading loading = new Loading();
+                this.AddChidren(loading);
+                loading.Start();
+                new System.Threading.Thread(() =>
+                {
+                    try
+                    {
+                        userList = Send.GetResidenceMemberAccount();
+
+                    }
+                    catch { }
+                    finally
+                    {
+                        Application.RunOnMainThread(() =>
+                        {
+                            loading.Hide();
+                            userList.Add(new Entity.ResidenceMemberInfo { childAccountId = UserInfo.Current.ID, childAccountPhone = UserInfo.Current.userMobileInfo, childAccountEmail = UserInfo.Current.userEmailInfo });
+                            //浣忓畢瀛愯处鍙峰垪琛�
+                            List<string> accountList = new List<string>();
+                            //涔嬪墠鐘舵�佸垪琛�
+                            List<string> stateList = new List<string>();
+                            for (int i = 0; i < userList.Count; i++)
+                            {
+                                var user = userList[i];
+                                accountList.Add(user.Account);
+                            }
+
+                            if (alarm.pushConfigs.Count > 0)
+                            {
+                                var list = alarm.pushConfigs[0].pushTarget;
+                                for (int i = 0; i < userList.Count; i++)
+                                {
+
+                                    var user = userList[i];
+                                    if (list.Contains(user.childAccountId))
+                                    {
+                                        stateList.Add(user.Account);
+                                    }
+
+                                }
+
+
+                            }
+
+                            PublicInterface view = new PublicInterface();
+                            view.FrameOrVvList(this, accountList, stateList, StringId.zhanghaoxuanze
+                               , (list) =>
+                               {
+                                   //娓呯┖鏃ф暟鎹垪琛�
+                                   selectedAccountList.Clear();
+                                   for (int i = 0; i < userList.Count; i++)
+                                   {
+                                       var user = userList[i];
+                                       if (list.Contains(user.Account))
+                                       {
+                                           selectedAccountList.Add(user.childAccountId);
+                                       }
+                                   }
+
+                               });
+                        });
+                    }
+                })
+                { IsBackground = true }.Start();
+            };
+
+            #endregion
+            #region  纭
+            UI2.Intelligence.Automation.LogicView.SaveView saveView = new UI2.Intelligence.Automation.LogicView.SaveView();
+            saveView.btnSave.TextID = StringId.queren;
+            saveView.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(24), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight);
+            this.AddChidren(saveView.FLayoutView());
+
+
+            saveView.btnClick.MouseUpEventHandler += (e, sen) =>
+            {
+                alarm.noticeConfig.noticeContent = textBox.Text.Trim();
+                if (selectedAccountList.Count > 0)
+                {
+                    alarm.pushConfigs.Clear();//娓呯┖鏃ф暟鎹垪琛�
+                    alarm.pushConfigs.Add(new Entity.SecurityPushConfig { pushTarget = selectedAccountList });
+                }
+                //璐﹀彿鍒楄〃涓虹┖榛樿鎺ㄩ�佸綋鍓嶈处鍙�
+                if (alarm.pushConfigs.Count == 0)
+                {
+                    //鍒濆鍖栧璞�
+                    Entity.SecurityPushConfig pushConfigs = new Entity.SecurityPushConfig();
+                    //榛樿娣诲姞鎺ㄩ�佸綋鍓嶈处鍙�
+                    pushConfigs.pushTarget.Add(UserInfo.Current.ID);
+                    alarm.pushConfigs.Add(pushConfigs);
+                }
+                this.RemoveFromParent();
+            };
+            #endregion
+
+        }
+
+        /// <summary>
+        /// 鎵嬫満璐﹀彿涓哄厛锛屾墜鏈鸿处鍙蜂负绌猴紝鍏舵鍒伴偖绠辫处鍙�
+        /// </summary>
+        private string Account
+        {
+            get
+            {
+                ///鎵嬫満璐﹀彿涓哄厛锛屾墜鏈鸿处鍙蜂负绌猴紝鍏舵鍒伴偖绠辫处鍙�;
+                if (!string.IsNullOrEmpty(UserInfo.Current.userMobileInfo))
+                {
+                    //榛樿鎺ㄩ�佸綋鍓嶆墜鏈鸿处鍙�
+                    return UserInfo.Current.userMobileInfo;
+                }
+                else
+                {
+                    //榛樿鎺ㄩ�佸綋鍓嶉偖绠辫处鍙�
+                    return UserInfo.Current.userEmailInfo;
+                }
+            }
+        }
+    }
+}

--
Gitblit v1.8.0