From 25429f085093d89d543a0b90e30d0d62d1b7dac9 Mon Sep 17 00:00:00 2001
From: hxb <hxb@hdlchina.com.cn>
Date: 星期二, 30 八月 2022 09:37:38 +0800
Subject: [PATCH] 合并了IOS的代码

---
 ZigbeeApp/Shared/Phone/UserCenter/Suggestion/FeedbackForm.cs |   64 +++++++++++++++++--------------
 1 files changed, 35 insertions(+), 29 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Suggestion/FeedbackForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Suggestion/FeedbackForm.cs
index 0087924..ea66313 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Suggestion/FeedbackForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Suggestion/FeedbackForm.cs
@@ -53,8 +53,8 @@
             bodyFrameLayout.AddChidren(frameInput);
 
             //瀛楁暟
-            var btnFild = new NormalViewControl(120, 60, true);
-            btnFild.X = frameInput.Width - ControlCommonResourse.XXLeft - Application.GetRealWidth(120);
+            var btnFild = new NormalViewControl(150, 60, true);
+            btnFild.X = frameInput.Width - ControlCommonResourse.XXLeft - Application.GetRealWidth(150);
             btnFild.Y = Application.GetRealHeight(503);
             btnFild.TextColor = UserCenterColor.Current.TextGrayColor1;
             btnFild.TextSize = 12;
@@ -74,30 +74,44 @@
             txtInput.PlaceholderText = Language.StringByID(R.MyInternationalizationString.uYouSuggestionMsg);
             frameInput.AddChidren(txtInput);
             txtInput.InitIosPlaceholderUILabelWithHeight(Application.GetRealHeight(60));
-            txtInput.TextChangeEventHandler += (sender, txtvalue) =>
+            //杈撳叆鍊兼敼鍙樹簨浠�
+            Action<View, string> txtInputChangedEvent = (sender, txtValue) =>
             {
                 if (this.suggestionCount <= 0)
                 {
                     return;
                 }
 
-                int length = txtvalue.Length;
-                if (length > 500)
+                var newValue = txtValue;
+                //濡傛灉杈撳叆鐨勫��,宸茬粡澶т簬鎸囧畾鐨勬暟,鍒欐埅鍙�
+                if (newValue.Length > 500)
                 {
-                    if (btnSubmit.CanClick == true) { btnSubmit.CanClick = false; }
-                    btnFild.Text = "0";
-                    return;
+                    //鎴彇鎸囧畾鐨刡yte瀛楄妭
+                    newValue = newValue.Substring(0, 500);
+                    txtInput.Text = newValue;
+                    //灏嗗厜鏍囪嚦浜庢渶鍚�
+#if Android
+                    txtInput.SetSelectionEnd();
+#endif
                 }
+
+                int length = newValue.Length;
                 if (length == 0)
                 {
                     if (btnSubmit.CanClick == true) { btnSubmit.CanClick = false; }
                 }
                 else
                 {
-                    if (btnSubmit.CanClick == false) { btnSubmit.CanClick = true; }
+                    if (btnSubmit.CanClick == false)
+                    {
+                        //鍙樼伆鑹插瓧浣�
+                        btnFild.TextColor = UserCenterColor.Current.TextGrayColor1;
+                        btnSubmit.CanClick = true;
+                    }
                 }
                 btnFild.Text = (500 - length).ToString();
             };
+            txtInput.TextChangeEventHandler += txtInputChangedEvent;
 
             var framType = new FrameLayout();
             framType.Height = Application.GetRealHeight(150);
@@ -205,16 +219,16 @@
             frameEmail.BackgroundColor = UserCenterColor.Current.White;
             frameEmail.Y = framType.Bottom + Application.GetRealHeight(23);
             bodyFrameLayout.AddChidren(frameEmail);
-            //閭鍦板潃
-            var btnEmail = new NormalViewControl(220, 60, true);
-            btnEmail.X = ControlCommonResourse.XXLeft;
-            btnEmail.Gravity = Gravity.CenterVertical;
-            btnEmail.TextID = R.MyInternationalizationString.uEmailAddress;
-            frameEmail.AddChidren(btnEmail);
-            var txtEmail = new TextInputControl(500, 60, true);
+            //鑱旂郴鏂瑰紡
+            var btnContact = new NormalViewControl(220, 60, true);
+            btnContact.X = ControlCommonResourse.XXLeft;
+            btnContact.Gravity = Gravity.CenterVertical;
+            btnContact.TextID = R.MyInternationalizationString.uContactInformation;
+            frameEmail.AddChidren(btnContact);
+            var txtEmail = new TextInputControl(720, 60, true);
             txtEmail.X = Application.GetRealWidth(314);
             txtEmail.Gravity = Gravity.CenterVertical;
-            txtEmail.PlaceholderText = Language.StringByID(R.MyInternationalizationString.uPleaseInputYouEmailAddress);
+            txtEmail.PlaceholderText = Language.StringByID(R.MyInternationalizationString.uPleaseInputYourContactInformation);
             frameEmail.AddChidren(txtEmail);
 
             //鎻愪氦
@@ -233,13 +247,7 @@
                 this.UploadSuggestion(txtInput.Text, txtEmail.Text);
             };
 
-
-            var strFile = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Common.Config.Instance.Guid, DirNameResourse.SuggestionFile);
-            if (System.IO.File.Exists(strFile) == false)
-            {
-                return;
-            }
-            var data = UserCenterLogic.LoadFileContent(strFile);
+            var data = HdlFileLogic.Current.ReadFileTextContent(DirNameResourse.SuggestionFile);
             if (data != null)
             {
                 var strNowData = DateTime.Now.ToString("yyyyMMdd");
@@ -268,7 +276,7 @@
         /// <param name="email"></param>
         private void UploadSuggestion(string strContent, string email)
         {
-            HdlThreadLogic.Current.RunThread(async() =>
+            HdlThreadLogic.Current.RunThread(() =>
             {
                 var pra = new
                 {
@@ -278,15 +286,13 @@
                     OpinionFeedbackType = this.typeMode,
                     Email = email
                 };
-                var result = await UserCenterLogic.GetResultStatuByRequestHttps("App/AddOpinionFeedback", false, pra);
+                var result = UserCenterLogic.GetResultStatuByRequestHttps("App/AddOpinionFeedback", false, pra);
                 if (result == true)
                 {
                     //淇濆瓨娆℃暟
                     this.suggestionCount--;
-                    var strFile = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Common.Config.Instance.Guid, DirNameResourse.SuggestionFile);
-                    var byteData = System.Text.Encoding.UTF8.GetBytes(this.suggestionCount + DateTime.Now.ToString("yyyyMMdd"));
                     //鍐欏叆鍐呭
-                    Shared.IO.FileUtils.WriteFileByBytes(strFile, byteData);
+                    HdlFileLogic.Current.SaveTextToFile(DirNameResourse.SuggestionFile, this.suggestionCount + DateTime.Now.ToString("yyyyMMdd"));
 
                     HdlThreadLogic.Current.RunMain(() =>
                     {

--
Gitblit v1.8.0