From f16e7e4df7e7813e4a3052dae752aae3e6937b30 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期五, 08 七月 2022 16:53:12 +0800
Subject: [PATCH] 自研可视对讲、毫米波

---
 HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage.cs |  167 ++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 121 insertions(+), 46 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage.cs b/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage.cs
index e683de0..208a481 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage.cs
@@ -94,23 +94,24 @@
             //鍒锋柊鐣岄潰鐘舵��
             this.RefreshFormStatu();
             //璇诲彇鐘舵��
-            new System.Threading.Thread(() =>
-            {
-                while (true)
-                {
-                    if(controlTime == DateTime.MinValue)
-                    {
-
-                    }
-                    else if (controlTime.AddSeconds(2)<DateTime.Now)
-                    {
                         Control.Ins.SendReadCommand(device);
-                        controlTime = DateTime.MinValue;
-                    }
-                    System.Threading.Thread.Sleep(1000);
-                }
-            })
-            { IsBackground = true }.Start();
+            //new System.Threading.Thread(() =>
+            //{
+            //    while (true)
+            //    {
+            //        if(controlTime == DateTime.MinValue)
+            //        {
+
+            //        }
+            //        else if (controlTime.AddSeconds(2)<DateTime.Now)
+            //        {
+            //            Control.Ins.SendReadCommand(device);
+            //            controlTime = DateTime.MinValue;
+            //        }
+            //        System.Threading.Thread.Sleep(1000);
+            //    }
+            //})
+            //{ IsBackground = true }.Start();
         }
 
         /// <summary>
@@ -118,7 +119,16 @@
         /// </summary>
         private void InitFrameWhiteContent1()
         {
-            temp = (int)Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp));
+            //鑾峰彇娓╁害鍊�
+            string setTempTemp = device.GetAttrState(FunctionAttributeKey.SetTemp);
+            temp = (int) Convert.ToDouble(setTempTemp);
+            if (temp <= 0)
+            {
+                //榛樿鍊兼敼鎴�16,2022骞�06鏈�10鏃�10:03:19 鎴愮敨瑕佹眰鐨�
+                temp = 16;
+                device.SetAttrState(FunctionAttributeKey.SetTemp, temp.ToString());
+            }
+           
             arcBar = new DiyArcSeekBar()
             {
                 Gravity = Gravity.CenterHorizontal,
@@ -147,7 +157,7 @@
             arcBar.IsOffline = device.GetAttrState(FunctionAttributeKey.OnOff) == "off";
             arcBar.MinValue = device.GetAttribute(FunctionAttributeKey.SetTemp).min;
             arcBar.MaxValue = device.GetAttribute(FunctionAttributeKey.SetTemp).max;
-            arcBar.Progress = (int)Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp));
+            arcBar.Progress = temp;
 
             btnTemp = new Button()
             {
@@ -158,7 +168,7 @@
                 TextColor = CSS_Color.FirstLevelTitleColor,
                 TextSize = 50,
                 IsBold = true,
-                Text = Convert.ToDouble( device.GetAttrState(FunctionAttributeKey.SetTemp)).ToString(),
+                Text = Convert.ToDouble(temp).ToString(),
                 TextAlignment = TextAlignment.Center,
             };
             FrameWhiteCentet1.AddChidren(btnTemp);
@@ -358,6 +368,15 @@
                 };
                 EventHandler<MouseEventArgs> eventHandler1 = (sender, e) =>
                 {
+                    //if (!device.online)
+                    //{
+                    //    new Tip()
+                    //    {
+                    //        CloseTime = 1,
+                    //        Text = Language.StringByID(StringId.DeviceOfflineCannotOption),
+                    //        Direction = AMPopTipDirection.None,
+                    //    }.Show(MainPage.BaseView);
+                    //}
                     btnModeIcon.IsSelected = btnModeText.IsSelected = true;
                     device.SetAttrState(FunctionAttributeKey.Mode, m);
                     btnMode.UnSelectedImagePath = acFunction.GetModeIconPath(m);
@@ -485,6 +504,15 @@
                 };
                 EventHandler<MouseEventArgs> eventHandler1 = (sender, e) =>
                 {
+                    //if (!device.online)
+                    //{
+                    //    new Tip()
+                    //    {
+                    //        CloseTime = 1,
+                    //        Text = Language.StringByID(StringId.DeviceOfflineCannotOption),
+                    //        Direction = AMPopTipDirection.None,
+                    //    }.Show(MainPage.BaseView);
+                    //}
                     btnModeIcon.IsSelected = btnModeText.IsSelected = true;
                     device.SetAttrState(FunctionAttributeKey.Swing, m);
                     btnSwing.UnSelectedImagePath = acFunction.GetSwingIconPath(m);
@@ -600,6 +628,15 @@
                 };
                 EventHandler<MouseEventArgs> eventHandler1 = (sender, e) =>
                 {
+                    //if (!device.online)
+                    //{
+                    //    new Tip()
+                    //    {
+                    //        CloseTime = 1,
+                    //        Text = Language.StringByID(StringId.DeviceOfflineCannotOption),
+                    //        Direction = AMPopTipDirection.None,
+                    //    }.Show(MainPage.BaseView);
+                    //}
                     btnFanIcon.IsSelected = btnFanText.IsSelected = true;
                     device.SetAttrState(FunctionAttributeKey.FanSpeed, m);
                     btnWindSpeed.UnSelectedImagePath = acFunction.GetFanIconPath(m);
@@ -787,6 +824,15 @@
 
                 btn.MouseUpEventHandler = (sender, e) =>
                 {
+                    //if (!device.online)
+                    //{
+                    //    new Tip()
+                    //    {
+                    //        CloseTime = 1,
+                    //        Text = Language.StringByID(StringId.DeviceOfflineCannotOption),
+                    //        Direction = AMPopTipDirection.None,
+                    //    }.Show(MainPage.BaseView);
+                    //}
                     Dictionary<string, string> d = new Dictionary<string, string>();
                     d.Add(attr.key, "");
                     Control.Ins.SendWriteCommand(device, d);
@@ -841,11 +887,20 @@
         {
             btnMinus.MouseUpEventHandler = (sender, e) =>
             {
+                //if (!device.online)
+                //{
+                //    new Tip()
+                //    {
+                //        CloseTime = 1,
+                //        Text = Language.StringByID(StringId.DeviceOfflineCannotOption),
+                //        Direction = AMPopTipDirection.None,
+                //    }.Show(MainPage.BaseView);
+                //}
                 if (device.trait_on_off.curValue.ToString() == "off" || device.GetAttrState(FunctionAttributeKey.Mode) == "fan")
                 {
                     return;
                 }
-                
+
                 if (temp <= device.GetAttribute(FunctionAttributeKey.SetTemp).min)
                 {
                     return;
@@ -862,6 +917,15 @@
             };
             btnPlus.MouseUpEventHandler = (sender, e) =>
             {
+                //if (!device.online)
+                //{
+                //    new Tip()
+                //    {
+                //        CloseTime = 1,
+                //        Text = Language.StringByID(StringId.DeviceOfflineCannotOption),
+                //        Direction = AMPopTipDirection.None,
+                //    }.Show(MainPage.BaseView);
+                //}
                 if (device.trait_on_off.curValue.ToString() == "off" || device.GetAttrState(FunctionAttributeKey.Mode) == "fan")
                 {
                     return;
@@ -879,31 +943,33 @@
                 d.Add(FunctionAttributeKey.SetTemp, temp.ToString());
                 Control.Ins.SendWriteCommand(device, d);
             };
-            arcBar.OnStopTrackingTouchEvent = (sender, e) =>
+            //if (device.online)
             {
-                temp = arcBar.Progress;
-                device.SetAttrState(FunctionAttributeKey.SetTemp, arcBar.Progress.ToString());
-                btnTemp.Text = arcBar.Progress.ToString();
-                controlTime = DateTime.Now;
-                System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
-                d.Add(FunctionAttributeKey.SetTemp, arcBar.Progress.ToString());
-                Control.Ins.SendWriteCommand(device, d);
-            };
-            arcBar.OnProgressChangedEvent = (sender, e) =>
-            {
-                device.SetAttrState(FunctionAttributeKey.SetTemp, e.ToString());
-                btnTemp.Text = e.ToString();
-            };
-            //arcBar.MouseDownEventHandler = (sender, e) => {
-            //    Console.WriteLine("ddd");
-            //    MainPage.BasePageView.ScrollEnabled =false;
-            //};
-            //arcBar.MouseUpEventHandler = (sender, e) => {
-            //    Console.WriteLine("ddd2");
-            //    MainPage.BasePageView.ScrollEnabled = true;
-            //};
+                arcBar.OnStopTrackingTouchEvent = (sender, e) =>
+                {
+                    temp = arcBar.Progress;
+                    device.SetAttrState(FunctionAttributeKey.SetTemp, arcBar.Progress.ToString());
+                    btnTemp.Text = arcBar.Progress.ToString();
+                    controlTime = DateTime.Now;
+                    System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+                    d.Add(FunctionAttributeKey.SetTemp, arcBar.Progress.ToString());
+                    Control.Ins.SendWriteCommand(device, d);
+                };
+                arcBar.OnProgressChangedEvent = (sender, e) =>
+                {
+                    device.SetAttrState(FunctionAttributeKey.SetTemp, e.ToString());
+                    btnTemp.Text = e.ToString();
+                };
+                //arcBar.MouseDownEventHandler = (sender, e) => {
+                //    Console.WriteLine("ddd");
+                //    MainPage.BasePageView.ScrollEnabled =false;
+                //};
+                //arcBar.MouseUpEventHandler = (sender, e) => {
+                //    Console.WriteLine("ddd2");
+                //    MainPage.BasePageView.ScrollEnabled = true;
+                //};
+            }
         }
-
 
         /// <summary>
         /// 鎺у埗妯″紡浜嬩欢
@@ -938,6 +1004,15 @@
 
             btnSwitch.MouseUpEventHandler = (sender, e) =>
             {
+                //if (!device.online)
+                //{
+                //    new Tip()
+                //    {
+                //        CloseTime = 1,
+                //        Text = Language.StringByID(StringId.DeviceOfflineCannotOption),
+                //        Direction = AMPopTipDirection.None,
+                //    }.Show(MainPage.BaseView);
+                //}
                 btnSwitch.IsSelected = !btnSwitch.IsSelected;
                 device.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
                 if (device.trait_on_off.curValue.ToString() == "on")
@@ -976,15 +1051,15 @@
                 }
                 else
                 {
-                    btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.RoomTemp))) + "掳C";
+                    btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.RoomTemp).Replace(",", "."))) + "掳C";
                     btnMode.SelectedImagePath = acFunction.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode));
                     btnSwing.SelectedImagePath = acFunction.GetSwingIconPath(device.GetAttrState(FunctionAttributeKey.Swing));
                     btnWindSpeed.SelectedImagePath = acFunction.GetFanIconPath(device.GetAttrState(FunctionAttributeKey.FanSpeed));
                     btnMode.UnSelectedImagePath = acFunction.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode), false);
                     btnSwing.UnSelectedImagePath = acFunction.GetSwingIconPath(device.GetAttrState(FunctionAttributeKey.Swing), false);
                     btnWindSpeed.UnSelectedImagePath = acFunction.GetFanIconPath(device.GetAttrState(FunctionAttributeKey.FanSpeed), false);
-                    temp = Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp)));
-
+                    temp = Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp).Replace(",", ".")));
+                   
 
                     arcBar.Progress = temp;
                     btnTemp.Text = temp.ToString() ;

--
Gitblit v1.8.0