From 9f326f4000847e6167d8166fa2f6a66f53cb3734 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期四, 17 十二月 2020 09:07:13 +0800
Subject: [PATCH] 新云端Ver1.3

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/DataCorrectionForm.cs |   91 ++++++++++++++++++++++++++++++++++++---------
 1 files changed, 73 insertions(+), 18 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/DataCorrectionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/DataCorrectionForm.cs
index d0abc06..591b6fa 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/DataCorrectionForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/DataCorrectionForm.cs
@@ -21,6 +21,14 @@
         /// 鏍℃婀垮害鍊�
         /// </summary>
         double correctHValue = 0;
+        /// <summary>
+        /// 鏈夋晥鏂囨湰
+        /// </summary>
+        private string invalidText1 = "";
+        /// <summary>
+        /// 鏈夋晥鏂囨湰
+        /// </summary>
+        private string invalidText2 = "";
         #endregion
 
         #region 鈻� 鍒濆鍖朹___________________________ 
@@ -145,12 +153,14 @@
                 {
                     devicePic.UnSelectedImagePath = "Device/SensorTemperature.png";
                     btnName.Text = Language.StringByID(R.MyInternationalizationString.Temperature) + "  (鈩�)";
+                    invalidText1 = btnNum.Text;
                 }
                 else
                 {
                     line2.Visible = false;
                     devicePic.UnSelectedImagePath = "Device/SensorHumidity.png";
                     btnName.Text = Language.StringByID(R.MyInternationalizationString.Humidity) + "  (%)";
+                    invalidText2 = btnNum.Text;
                 }
 
                 btnNum.TextChangeEventHandler += (sender, e) =>
@@ -179,35 +189,66 @@
                             correctHValue = curV;
                         }
                     }
+                    if (curIndex == 0)
+                    {
+                        invalidText1 = btnNum.Text;
+                    }
+                    else
+                    {
+                        invalidText2 = btnNum.Text;
+                    }
+                   
                 };
 
                 btnReduction.MouseDownEventHandler += async (sender, e) =>
                 {
-                    double vTemp = double.Parse(btnNum.Text);
-                    vTemp -= 0.1;
-                    btnNum.Text = vTemp.ToString();
+                    if(!string.IsNullOrEmpty(btnNum.Text))
+                    {
+                        double vTemp = double.Parse(btnNum.Text);
+                        vTemp -= 0.1;
+                        btnNum.Text = vTemp.ToString();
+                        if (curIndex == 0)
+                        {
+                            correctTValue = double.Parse(btnNum.Text);
+                        }
+                        else
+                        {
+                            correctHValue = double.Parse(btnNum.Text);
+                        }
+                    }
                     if (curIndex == 0)
-                    {
-                        correctTValue = double.Parse(btnNum.Text);
+                    {
+                        invalidText1 = btnNum.Text;
                     }
                     else
-                    {
-                        correctHValue = double.Parse(btnNum.Text);
-                    }
+                    {
+                        invalidText2 = btnNum.Text;
+                    }
                 };
 
                 btnAdd.MouseDownEventHandler += async (sender, e) =>
                 {
-                    double vTemp = double.Parse(btnNum.Text);
-                    vTemp += 0.1;
-                    btnNum.Text = vTemp.ToString();
+                    if (!string.IsNullOrEmpty(btnNum.Text))
+                    {
+                        double vTemp = double.Parse(btnNum.Text);
+                        vTemp += 0.1;
+                        btnNum.Text = vTemp.ToString();
+                        if (curIndex == 0)
+                        {
+                            correctTValue = double.Parse(btnNum.Text);
+                        }
+                        else
+                        {
+                            correctHValue = double.Parse(btnNum.Text);
+                        }
+                    }
                     if (curIndex == 0)
-                    {
-                        correctTValue = double.Parse(btnNum.Text);
+                    {
+                        invalidText1 = btnNum.Text;
                     }
                     else
-                    {
-                        correctHValue = double.Parse(btnNum.Text);
+                    {
+                        invalidText2 = btnNum.Text;
                     }
                 };
             }
@@ -281,6 +322,22 @@
             {
                 try
                 {
+                    if (string.IsNullOrEmpty(invalidText1) )
+                    {
+                        Application.RunOnMainThread(() =>
+                        {
+                            new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.TNumTip), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
+                        });
+                        return;
+                    }
+                    if ( string.IsNullOrEmpty(invalidText2))
+                    {
+                        Application.RunOnMainThread(() =>
+                        {
+                            new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.HNumTip), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
+                        });
+                        return;
+                    }
                     Application.RunOnMainThread(() =>
                     {
                         CommonPage.Loading.Start();
@@ -340,8 +397,6 @@
                 catch { }
             });
         }
-        #endregion
-
-
+        #endregion  
     }
 }

--
Gitblit v1.8.0