From a5b3c4bae726ef6770d4bfcbf2f4b50a37ed4a15 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期五, 06 三月 2020 15:31:36 +0800
Subject: [PATCH] 删除了郭雪城的 DeviceUi 这个类

---
 ZigbeeApp/Shared/Phone/Device/Logic/LogicDevicePage.cs |  127 +++++++++++++++++++++++++----------------
 1 files changed, 77 insertions(+), 50 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicDevicePage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicDevicePage.cs
index 1db0408..7ff994e 100755
--- a/ZigbeeApp/Shared/Phone/Device/Logic/LogicDevicePage.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/LogicDevicePage.cs
@@ -107,7 +107,8 @@
 
 
             ///娌℃湁鎴块棿鐩存帴杩斿洖鍘伙紱
-            if (Common.Room.Lists.Count == 0)
+            var listAllRoom = UserCenter.HdlRoomLogic.Current.GetAllListRooms();
+            if (listAllRoom.Count == 0)
             {
                 return;
             }
@@ -264,7 +265,7 @@
                 dropdown.Visible = false;
                 if (Config.Instance.Home.FloorDics.Count == 0)
                 {
-                    roomlists.AddRange(Common.Room.Lists);
+                    roomlists.AddRange(listAllRoom);
                 }
                 else
                 {
@@ -329,14 +330,15 @@
                     roomTextButton.IsSelected = false;
                     roomTextButton = roomnameBtn;
                     roomnameBtn.IsSelected = true;
-                    var list = new List<DeviceUI>();
-                    foreach (var device in room.DeviceUIList)
+                    var list = new List<CommonDevice>();
+                    foreach (var deviceKeys in room.ListDevice)
                     {
-                        if (device.CommonDevice == null)
+                        var device = LocalDevice.Current.GetDevice(deviceKeys);
+                        if (device == null)
                         {
                             continue;
                         }
-                        if (!deviceTypeList.Contains(device.CommonDevice.Type))
+                        if (!deviceTypeList.Contains(device.Type))
                         {
                             continue;
                         }
@@ -365,15 +367,16 @@
 
                     roomTextButton.IsSelected = false;
                     roomTextButton = roomnameBtn;
-                    roomnameBtn.IsSelected = true;
-                    var list = new List<DeviceUI>();
-                    foreach (var device in room.DeviceUIList)
+                    roomnameBtn.IsSelected = true;
+                    var list = new List<CommonDevice>();
+                    foreach (var deviceKeys in room.ListDevice)
                     {
-                        if (device.CommonDevice == null)
+                        var device = LocalDevice.Current.GetDevice(deviceKeys);
+                        if (device == null)
                         {
                             continue;
                         }
-                        if (!deviceTypeList.Contains(device.CommonDevice.Type))
+                        if (!deviceTypeList.Contains(device.Type))
                         {
                             continue;
                         }
@@ -402,29 +405,29 @@
         /// <summary>
         ///鍔犺浇璇ュ尯鍩熸墍鏈夎澶囩殑瑙嗗浘鏂规硶
         /// </summary>
-        void AllDeviceTypeView(List<DeviceUI> devicelist, HorizontalScrolViewLayout devicetypehorizontalScrol)
+        void AllDeviceTypeView(List<CommonDevice> devicelist, HorizontalScrolViewLayout devicetypehorizontalScrol)
         {
 
             List<string> devicetypelist = new List<string>();
             devicetypelist.Clear();
 
             #region  ------鎺掑垪璁惧绫诲瀷------
-            var lightjosn = devicelist.Find((device) => device.CommonDevice.Type == DeviceType.DimmableLight || device.CommonDevice.Type == DeviceType.OnOffOutput);
+            var lightjosn = devicelist.Find((device) => device.Type == DeviceType.DimmableLight || device.Type == DeviceType.OnOffOutput);
             if (lightjosn != null)
             {
                 devicetypelist.Add(Language.StringByID(MyInternationalizationString.Lights));
             }
-            var curtainjosn = devicelist.Find((device) => device.CommonDevice.Type == DeviceType.WindowCoveringDevice);
+            var curtainjosn = devicelist.Find((device) => device.Type == DeviceType.WindowCoveringDevice);
             if (curtainjosn != null)
             {
                 devicetypelist.Add(Language.StringByID(MyInternationalizationString.Curtains));
             }
-            var ac = devicelist.Find((device) => device.CommonDevice.Type == DeviceType.Thermostat);
+            var ac = devicelist.Find((device) => device.Type == DeviceType.Thermostat);
             if (ac != null)
             {
                 devicetypelist.Add(Language.StringByID(MyInternationalizationString.AC));
             }
-            var airSwitch = devicelist.Find((device) => device.CommonDevice.Type == DeviceType.AirSwitch);
+            var airSwitch = devicelist.Find((device) => device.Type == DeviceType.AirSwitch);
             if (airSwitch != null)
             {
                 devicetypelist.Add(Language.StringByID(MyInternationalizationString.Airswitch));
@@ -547,13 +550,12 @@
         /// 鍔犺浇璇ョ被鍨嬭澶囪鍥炬柟娉�
         /// </summary>
         /// <param name="devicelist">璁惧鍒楄〃</param>
-        void ActionDeviceView(List<DeviceType> deviceTypelist, List<DeviceUI> devicelist)
+        void ActionDeviceView(List<DeviceType> deviceTypelist, List<CommonDevice> devicelist)
         {
             middle.RemoveAll();
             foreach (var common in devicelist)
             {
-
-                if (deviceTypelist.Count != 0 && !deviceTypelist.Contains(common.CommonDevice.Type))
+                if (deviceTypelist.Count != 0 && !deviceTypelist.Contains(common.Type))
                 {
                     continue;
                 }
@@ -597,14 +599,14 @@
 
                 var devicename = new Button
                 {
-                    Text = common.CommonDevice.DeviceEpointName,
+                    Text = common.DeviceEpointName,
                     TextAlignment = TextAlignment.CenterLeft,
                     TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                     SelectedTextColor = ZigbeeColor.Current.LogicAddColor,
                     TextSize = 14,
                 };
                 deviceRow.AddChidren(devicename);
-                switch (common.CommonDevice.Type)
+                switch (common.Type)
                 {
 
                     case DeviceType.OnOffOutput:
@@ -654,7 +656,7 @@
 
                     var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
                     this.AddChidren(flMain);
-                    CurrentDeviceStateView(flMain, common.CommonDevice, false);
+                    CurrentDeviceStateView(flMain, common, false);
                 };
                 deviceFramelayout.MouseUpEventHandler += devicclick;
                 bjFramelayout.MouseUpEventHandler += devicclick;
@@ -1040,7 +1042,7 @@
                         };
                         openrowlayout.AddChidren(btnopen);
 
-                        var openBtnSelected = new SelectedButton(); 
+                        var openBtnSelected = new SelectedButton();
                         openrowlayout.AddChidren(openBtnSelected);
 
                         var horizontalSeekBarRow = new RowLayout
@@ -1049,7 +1051,7 @@
                             Width = Application.GetRealWidth(920),
                             Height = Application.GetRealHeight(160),
                             X = Application.GetRealWidth(80),
-                           LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
+                            LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
                         };
                         openframelayout.AddChidren(horizontalSeekBarRow);
                         var horizontalSeekBarVol = new DiyImageSeekBar
@@ -1064,7 +1066,7 @@
                             ThumbImagePath = "ZigeeLogic/progressbtn2.png",//杩涘害鏉℃寜閽浘鏍�
                             ThumbImageHeight = Application.GetRealHeight(56),//杩涘害鏉℃寜閽浘鏍囩殑楂樺害锛堥粯璁ゆ鏂瑰舰锛氬鍜岄珮涓�鏍凤級
                             ProgressTextColor = ZigbeeColor.Current.LogicBtnCancelColor,
-                            ProgressTextSize = 13,//鏄剧ず鐧惧垎姣斿瓧浣撳ぇ灏� 
+                            ProgressTextSize = 12,//鏄剧ず鐧惧垎姣斿瓧浣撳ぇ灏� 
                             SeekBarViewHeight = Application.GetRealHeight(10),//杩涘害鏉$殑楂樺害
 
                         };
@@ -1142,7 +1144,6 @@
                         int Progressvalue = 100;
                         EventHandler<int> progressclick = (sender, e) =>
                          {
-                             Console.WriteLine("12345");
                              SelectedDeviceStatusaction = "yes";
                              Progressvalue = horizontalSeekBarVol.Progress;
                              if (switchdictionary.ContainsKey("TaskType"))
@@ -1357,8 +1358,8 @@
                         openframelayout.AddChidren(horizontalSeekBarRow);
                         var horizontalSeekBarVol = new DiyImageSeekBar
                         {
-                            X = Application.GetRealWidth(80),
                             Y = openrowlayout.Bottom,
+                            X = Application.GetRealWidth(80),
                             Width = Application.GetRealWidth(920),
                             Height = Application.GetRealHeight(160),
                             IsProgressTextShow = true,//鏄剧ず鐧惧垎姣�
@@ -1366,9 +1367,9 @@
                             ProgressBarColor = ZigbeeColor.Current.LogicProgressColorSelected,//閫変腑杩涘害鏉¢鑹�
                             ThumbImagePath = "ZigeeLogic/progressbtn2.png",//杩涘害鏉℃寜閽浘鏍�
                             ThumbImageHeight = Application.GetRealHeight(56),//杩涘害鏉℃寜閽浘鏍囩殑楂樺害锛堥粯璁ゆ鏂瑰舰锛氬鍜岄珮涓�鏍凤級
-                            ProgressTextColor = ZigbeeColor.Current.LogicBtnCancelColor,
-                            ProgressTextSize = 14,//鏄剧ず鐧惧垎姣斿瓧浣撳ぇ灏� 
-                            SeekBarViewHeight = Application.GetRealHeight(10),//杩涘害鏉$殑楂樺害
+                            ProgressTextColor = ZigbeeColor.Current.LogicBtnCancelColor,//杩涘害鏉″師棰滆壊
+                            ProgressTextSize = 12,//鏄剧ず鐧惧垎姣斿瓧浣撳ぇ灏� 
+                            SeekBarViewHeight = Application.GetRealHeight(10),
                         };
                         openframelayout.AddChidren(horizontalSeekBarVol);
 
@@ -1747,7 +1748,7 @@
                         }
                     }
                     break;
-                    
+                ///绌鸿皟
                 case DeviceType.Thermostat:
                     {
 
@@ -1755,8 +1756,15 @@
                        var temperaturedictionary = new Dictionary<string, string>();
                        var modedictionary = new Dictionary<string, string>();
                         var speeddictionary = new Dictionary<string, string>();
+                        dictionary(temperaturedictionary, "TaskType", "5");
+                        dictionary(modedictionary, "TaskType", "5");
+                        dictionary(modedictionary, "Data1", "3");
+                        dictionary(speeddictionary, "TaskType", "5");
+                        dictionary(speeddictionary, "Data1", "6");
+                        taskListInfo.Add(temperaturedictionary);
+                        taskListInfo.Add(modedictionary);
+                        taskListInfo.Add(speeddictionary);
                         #endregion
-
                         #region  绌鸿皟View
 
                         devicefra.Y = Application.GetRealHeight(1920 - 600 - 210 - 160*2);
@@ -1803,11 +1811,12 @@
                         };
                         devicefra.AddChidren(PickerViewfra);
 
-
+                        //閬尅绌鸿皟婊戝姩view锛�
                         var pausePickerViewfra= new FrameLayout
                         {
                             Y = openframelayout.Bottom,
                             Height = Application.GetRealHeight(600),
+                            BackgroundColor=0x60ffffff,
                         };
                         devicefra.AddChidren(pausePickerViewfra);
 
@@ -1882,11 +1891,14 @@
                         var closeBtnSelected = new SelectedButton();
                         closerowlayout.AddChidren(closeBtnSelected);
                         #endregion
-                      
-                   
 
+                        //榛樿26,鑷姩,涓
+                        int indextemperature = 10, indexmode = 2, indexspeed = 1;
                         mUIPickerView.OnSelectChangeEvent += (s1, s2, s3) =>
                         {
+                            indextemperature = s1;
+                            indexmode = s2;
+                            indexspeed = s3;
                             if (openBtnSelected.Visible)
                             {
                                 SelectedDeviceStatusaction = "yes";
@@ -1898,20 +1910,23 @@
                                 dictionary(temperaturedictionary, "Data2", a.ToString());
 
                                 SpeedState(speedstring, speeddictionary);
-
-
                             }
                         };
-
-                        #endregion 
-                        //榛樿26,鑷姩,涓
-                        int indextemperature = 10, indexmode = 2, indexspeed = 1;
+                       mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnCancelColor, 0);
+                        mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnCancelColor, 1);
+                        mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnCancelColor, 2);
+                        #endregion
+                       
                         if (edit && TaskList != null)
                         {
+                       
                             foreach (var value in TaskList)
                             {
                                 if (TaskList.Count == 1)
                                 {
+                                    mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnCancelColor, 0);
+                                    mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnCancelColor, 1);
+                                    mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnCancelColor, 2);
                                     //鏁扮粍鍙湁涓�涓厓绱犺鏄庡綋鍓嶇┖璋冪姸鎬佷负鍏筹紱
                                     openBtnSelected.Visible = false;
                                     closeBtnSelected.Visible = true;
@@ -1925,6 +1940,9 @@
                                     openBtnSelected.Visible = true;
                                     closeBtnSelected.Visible = false;
                                     pausePickerViewfra.Height = Application.GetRealHeight(0);
+                                    mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnSelectedColor, 0);
+                                    mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnSelectedColor, 1);
+                                    mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnSelectedColor, 2);
                                 }
 
 
@@ -1998,7 +2016,7 @@
                                         }
                                         indexspeed = mList3.IndexOf(speedtext);
                                     }
-                                    //4---璁剧疆鍔犵儹搴︽暟;5---璁剧疆鍒跺喎銆侀櫎婀垮害鏁�;7---璁剧疆鑷姩搴︽暟
+                                    //4-璁剧疆鍔犵儹搴︽暟;5-璁剧疆鍒跺喎銆侀櫎婀垮害鏁�;7-璁剧疆鑷姩搴︽暟
                                     else if (value["Data1"] == "4" || value["Data1"] == "5" || value["Data1"] == "7")
                                     {
                                         var s = int.Parse(value["Data2"]) / 100;
@@ -2012,10 +2030,18 @@
                         }
                         ///鏇存柊鏈�鏂扮┖璋冪姸鎬侊紱
                         mUIPickerView.setCurrentItems(indextemperature, indexmode, indexspeed);
-
+                     
                         ///纭浜嬩欢
                         EventHandler<MouseEventArgs> openclick = (sender, e) =>
                         {
+                            mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnSelectedColor, 0);
+                            mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnSelectedColor, 1);
+                            mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnSelectedColor, 2);
+                            mUIPickerView.setCurrentItems(indextemperature, indexmode, indexspeed);
+                            pausePickerViewfra.Height = Application.GetRealHeight(0);
+                            SelectedDeviceStatusaction = "yes";
+                            openBtnSelected.Visible = true;
+                            closeBtnSelected.Visible = false;
                             //娓呴櫎涔嬪墠鏁版嵁锛�
                             taskListInfo.Clear();
                             //鍔犺浇鏂版暟鎹紱
@@ -2027,10 +2053,7 @@
                             taskListInfo.Add(temperaturedictionary);
                             taskListInfo.Add(modedictionary);
                             taskListInfo.Add(speeddictionary);
-                            pausePickerViewfra.Height = Application.GetRealHeight(0);
-                            SelectedDeviceStatusaction = "yes";
-                            openBtnSelected.Visible = true;
-                            closeBtnSelected.Visible = false;
+                          
                             var temperature = mList1[indextemperature].Split(' ')[0];
                             var modestring = mList2[indexmode].Split(' ')[0];
                             var speedstring = mList3[indexspeed].Split(' ')[0];
@@ -2049,6 +2072,10 @@
                         ///鍙栨秷浜嬩欢
                         EventHandler<MouseEventArgs> closeclick = (sender, e) =>
                         {
+                            mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnCancelColor, 0);
+                            mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnCancelColor, 1);
+                            mUIPickerView.setTextColorCenter(ZigbeeColor.Current.LogicBtnCancelColor, 2);
+                            mUIPickerView.setCurrentItems(indextemperature, indexmode, indexspeed);
                             //娓呴櫎涔嬪墠鏁版嵁锛�
                             taskListInfo.Clear();
                             dictionary(modedictionary, "TaskType", "5");
@@ -2083,9 +2110,9 @@
                 {
                     if (!edit)
                     {
-                        var alert = new Alert(Language.StringByID(MyInternationalizationString.Prompt),
-                                               Language.StringByID(MyInternationalizationString.selectdevicestatuscondition),
-                                               Language.StringByID(MyInternationalizationString.confrim));
+                        var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal,
+                               Language.StringByID(MyInternationalizationString.selectdevicestatuscondition),
+                              Language.StringByID(MyInternationalizationString.confrim));
                         alert.Show();
                         return;
                     }

--
Gitblit v1.8.0