From 944b87b6bcccb095cd73f13f4410fb20faf48f74 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期三, 25 十二月 2019 11:21:06 +0800
Subject: [PATCH] 2019.12.25

---
 ZigbeeApp/Shared/Phone/Device/Room/EditRoom.cs |  486 ++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 439 insertions(+), 47 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Room/EditRoom.cs b/ZigbeeApp/Shared/Phone/Device/Room/EditRoom.cs
old mode 100755
new mode 100644
index e28ed1a..15ae5d4
--- a/ZigbeeApp/Shared/Phone/Device/Room/EditRoom.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Room/EditRoom.cs
@@ -1,7 +1,9 @@
 锘縰sing System;
 using System.Collections.Generic;
+using System.Globalization;
 using Shared.Common;
 using Shared.Phone.Device.CommonForm;
+using Shared.Phone.UserCenter;
 using Shared.Phone.UserView;
 
 namespace Shared.Phone.Device.Room
@@ -17,13 +19,32 @@
         /// <summary>
         /// The room.
         /// </summary>
-        public  Shared.Common.Room room;
+        public Shared.Common.Room room;
 
         /// <summary>
         /// The action.
         /// </summary>
         public Action action;
 
+        /// <summary>
+        /// backGround
+        /// </summary>
+        private ImageView backGround;
+        /// <summary>
+        /// IconPathType
+        /// </summary>
+        public int IconPathType;
+        /// <summary>
+        /// OldBackgroundImagePath
+        /// </summary>
+        private string OldBackgroundImagePath;
+
+        /// <summary>
+        /// OldIconPathType
+        /// </summary>
+        public int OldIconPathType;
+
+        
         #endregion
 
         public EditRoom()
@@ -37,11 +58,25 @@
         public void Show(Shared.Common.Room r)
         {
             room = r;
-
+            IconPathType = r.BackgroundImageType;
+            OldIconPathType= r.BackgroundImageType;
+            if (IconPathType != 0)
+            {
+                OldBackgroundImagePath = r.BackgroundImage;
+            }
             AddTop();
 
             AddBodyView();
 
+        }
+
+        public override void RemoveFromParent()
+        {
+            HdlGatewayReceiveLogic.Current.RemoveEvent("TemperatrueDevice");
+            HdlGatewayReceiveLogic.Current.RemoveEvent("HumidityDevice");
+
+            CommonPage.Instance.IsDrawerLockMode = false;
+            base.RemoveFromParent();
         }
 
         #region Add____________________________________
@@ -74,26 +109,22 @@
             };
             AddChidren(bodyFrameLayout);
 
-            var imgFL = new FrameLayout
-            {
-                Y=Application.GetRealHeight(60),
-                Width=Application.GetMinRealAverage(916),
-                Height = Application.GetMinRealAverage(478),
-                Gravity=Gravity.CenterHorizontal,
-                BackgroundImagePath= "Room/Room_Rectangle.png"
-            };
-            bodyFrameLayout.AddChidren(imgFL);
-
-            var backGround = new Button()
+            backGround = new ImageView()
             {
                 Y = Application.GetRealHeight(60),
                 Width = Application.GetMinRealAverage(887),
                 Height = Application.GetMinRealAverage(444),
                 Gravity = Gravity.CenterHorizontal,
                 Radius = (uint)Application.GetRealHeight(CommonFormResouce.BigFormRadius),
-                UnSelectedImagePath = room.BackgroundImage
+                ImagePath = room.BackgroundImageType == 0 ? room.BackgroundImage : System.IO.Path.Combine(Config.Instance.FullPath, room.BackgroundImage)
             };
             bodyFrameLayout.AddChidren(backGround);
+            backGround.SetViewShadow(true);
+            if (room.BackgroundImageType != 0)
+            {
+                backGround.ImageBytes = Shared.IO.FileUtils.ReadFile(backGround.ImagePath);
+            }
+            backGround.MouseUpEventHandler += backGroundIMGHander;
 
             var infoFL = new FrameLayout
             {
@@ -102,11 +133,13 @@
                 BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
             };
             bodyFrameLayout.AddChidren(infoFL);
+            var rectCornerID = HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight;
+            infoFL.SetCornerWithSameRadius(Application.GetRealHeight(50), rectCornerID);
 
             var infoEdit = new Button
             {
                 X = Application.GetRealWidth(CommonFormResouce.X_Left),
-                Y=Application.GetRealHeight(80),
+                Y = Application.GetRealHeight(80),
                 Height = Application.GetRealHeight(60),
                 Width = Application.GetRealWidth(700),
                 TextID = R.MyInternationalizationString.EditInfo,
@@ -119,15 +152,22 @@
             var nameRow = new DeviceInfoEditRow(170);
             nameRow.Init();
             nameRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.RoomName)} :");
-            nameRow.SetPlaceHoldText(room.Name);
+            nameRow.SetTitle(room.Name);
             infoFL.AddChidren(nameRow);
+            if(room.IsLove)
+            {
+                nameRow.NameText.Enable = false;
+            }
 
             var floorRow = new DeviceInfoRow(308);
             floorRow.Init();
             floorRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.BelongFloor)} :");
+            if (Config.Instance.Home.FloorDics.Count > 0 && room.IsLove == false)
+            {
+                infoFL.AddChidren(floorRow);
+            }
             floorRow.SetTitle(room.FloorName);
-            infoFL.AddChidren(floorRow);
-            floorRow.NextBtn.MouseUpEventHandler += (sender, e) =>
+            floorRow.ClickBtn.MouseUpEventHandler += (sender, e) =>
             {
                 if (Config.Instance.Home.FloorDics != null)
                 {
@@ -140,75 +180,427 @@
                     }
 
                     PickerView.Show(floorNames, (index) =>
-                     {
-                         room.FloorId = floorIds[index];
-                         floorRow.SetTitle(room.FloorName);
-                     }, floorIds.IndexOf(room.FloorId), Language.StringByID(R.MyInternationalizationString.BelongFloor), Language.StringByID(R.MyInternationalizationString.Confrim), Language.StringByID(R.MyInternationalizationString.Cancel));
+                    {
+                        room.FloorId = floorIds[index];
+                        floorRow.SetTitle(room.FloorName);
+                    }, floorIds.IndexOf(room.FloorId), Language.StringByID(R.MyInternationalizationString.BelongFloor), Language.StringByID(R.MyInternationalizationString.Confrim), Language.StringByID(R.MyInternationalizationString.Cancel));
                 }
             };
+
 
             var temperatureRow = new DeviceInfoRow(446);
             temperatureRow.Init();
             temperatureRow.SetTipTitle(R.MyInternationalizationString.Temperature);
-            temperatureRow.SetTitle("26.8鈩�");
             temperatureRow.NameText.TextAlignment = TextAlignment.CenterRight;
             infoFL.AddChidren(temperatureRow);
-            temperatureRow.NextBtn.MouseUpEventHandler += (sender, e) =>
+            temperatureRow.ClickBtn.MouseUpEventHandler += (sender, e) =>
             {
                 var tem = new RoomTemperatureSetting { };
                 HomePage.Instance.AddChidren(tem);
                 HomePage.Instance.PageIndex += 1;
+                tem.tempDevice = Common.LocalDevice.Current.GetDevice(room.TemperatrueDevice);
                 tem.Show(room);
-                tem.action = (selectTemp) =>
+                tem.selectDeviceAction = (selectTemp) =>
                 {
+                    if (selectTemp == null)
+                    {
+                        return;
+                    }
+                    room.TemperatrueDevice = $"{selectTemp.DeviceAddr}{selectTemp.DeviceEpoint}";
+                    temperatureRow.SetTitle(R.MyInternationalizationString.Getting);
 
+                    HdlGatewayReceiveLogic.Current.RemoveEvent("TemperatrueDevice");
+                    HdlGatewayReceiveLogic.Current.AddAttributeEvent("TemperatrueDevice",  ReceiveComandDiv.A璁惧灞炴�т笂鎶�, (Action<ZigBee.Device.CommonDevice>)((report) =>
+                    {
+                        string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(report);
+                        if (room.TemperatrueDevice != mainKeys)
+                        {
+                            return;
+                        }
+                        //绉婚櫎鎺変簨浠�
+                        HdlGatewayReceiveLogic.Current.RemoveEvent("TemperatrueDevice");
+
+                        foreach (var data in report.DeviceStatusReport.AttriBute)
+                        {
+                            if (data.AttributeId == (int)ZigBee.Device.AttriButeId.MeasuredValue)
+                            {
+                                if (data.AttriButeData == 0)
+                                {
+                                    //0鈩�
+                                    temperatureRow.NameText.Text = "0.0鈩�";
+                                    room.Temperatrue = 0;
+                                }
+                                else if (data.AttriButeData > 32767)
+                                {
+                                    //璐熸暟(鐗规畩澶勭悊)
+                                    string strValue = (data.AttriButeData - 65536).ToString();
+                                    //灏忔暟鐐归渶瑕佷竴浣�
+                                    strValue = strValue.Substring(0, strValue.Length - 1);
+                                    temperatureRow.NameText.Text = strValue.Insert(strValue.Length - 1, ".") + "鈩�";
+                                    room.Temperatrue = int.Parse(strValue) * 0.1;
+                                }
+                                else
+                                {
+                                    //灏忔暟鐐归渶瑕佷竴浣�
+                                    string strValue = data.AttriButeData.ToString();
+                                    strValue = strValue.Substring(0, strValue.Length - 1);
+                                    temperatureRow.NameText.Text = strValue.Insert(strValue.Length - 1, ".") + "鈩�";
+                                    room.Temperatrue = int.Parse(strValue) *0.1;
+                                }
+                            }
+                        }
+                    }));
+                    //鍙戦�佽幏鍙栨俯搴︾殑鍛戒护
+                    (selectTemp as ZigBee.Device.TemperatureSensor).ReadTemperatureOrHumidity();
                 };
-
             };
+            if (string.IsNullOrEmpty(room.TemperatrueDevice) == false)
+            {
+                temperatureRow.SetTitle(R.MyInternationalizationString.Getting);
+                HdlGatewayReceiveLogic.Current.RemoveEvent("TemperatrueDevice");
+                HdlGatewayReceiveLogic.Current.AddAttributeEvent("TemperatrueDevice",  ReceiveComandDiv.A璁惧灞炴�т笂鎶�, (Action<ZigBee.Device.CommonDevice>)((report) =>
+                {
+                    string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(report);
+                    if (room.TemperatrueDevice != mainKeys)
+                    {
+                        return;
+                    }
+                    //绉婚櫎鎺変簨浠�
+                    HdlGatewayReceiveLogic.Current.RemoveEvent("TemperatrueDevice");
+
+                    foreach (var data in report.DeviceStatusReport.AttriBute)
+                    {
+                        if (data.AttributeId == (int)ZigBee.Device.AttriButeId.MeasuredValue)
+                        {
+                            if (data.AttriButeData == 0)
+                            {
+                                //0鈩�
+                                temperatureRow.NameText.Text = "0.0鈩�";
+                                room.Temperatrue = 0;
+                            }
+                            else if (data.AttriButeData > 32767)
+                            {
+                                //璐熸暟(鐗规畩澶勭悊)
+                                string strValue = (data.AttriButeData - 65536).ToString();
+                                //灏忔暟鐐归渶瑕佷竴浣�
+                                strValue = strValue.Substring(0, strValue.Length - 1);
+                                temperatureRow.NameText.Text = strValue.Insert(strValue.Length - 1, ".") + "鈩�";
+                                room.Temperatrue = int.Parse(strValue) * 0.1;
+                            }
+                            else
+                            {
+                                //灏忔暟鐐归渶瑕佷竴浣�
+                                string strValue = data.AttriButeData.ToString();
+                                strValue = strValue.Substring(0, strValue.Length - 1);
+                                temperatureRow.NameText.Text = strValue.Insert(strValue.Length - 1, ".") + "鈩�";
+                                room.Temperatrue = int.Parse(strValue) * 0.1;
+                            }
+                        }
+                    }
+                }));
+                //鍙戦�佽幏鍙栨俯搴︾殑鍛戒护
+                var dev = Common.LocalDevice.Current.GetDevice(room.TemperatrueDevice);
+                if (dev != null)
+                {
+                    (dev as ZigBee.Device.TemperatureSensor).ReadTemperatureOrHumidity();
+                }
+            }
+            else
+            {
+                temperatureRow.SetTitle(R.MyInternationalizationString.No);
+            }
 
 
             var humidityRow = new DeviceInfoRow(585);
             humidityRow.Init();
             humidityRow.SetTipTitle(R.MyInternationalizationString.Humidity);
-            humidityRow.SetTitle("66.5%");
             humidityRow.NameText.TextAlignment = TextAlignment.CenterRight;
             infoFL.AddChidren(humidityRow);
-            humidityRow.NextBtn.MouseUpEventHandler += (sender, e) =>
+            humidityRow.ClickBtn.MouseUpEventHandler += (sender, e) =>
             {
                 var tem = new RoomHumiditySetting { };
                 HomePage.Instance.AddChidren(tem);
                 HomePage.Instance.PageIndex += 1;
+                tem.tempDevice = Common.LocalDevice.Current.GetDevice(room.HumidityDevice);
                 tem.Show(room);
-                tem.action = (selectTemp) =>
+                tem.selectDeviceAction = (selectTemp) =>
                 {
+                    if (selectTemp == null)
+                    {
+                        return;
+                    }
+                    room.HumidityDevice = $"{selectTemp.DeviceAddr}{selectTemp.DeviceEpoint}";
+                    humidityRow.SetTitle(R.MyInternationalizationString.Getting);
 
+                    HdlGatewayReceiveLogic.Current.RemoveEvent("HumidityDevice");
+                    HdlGatewayReceiveLogic.Current.AddAttributeEvent("HumidityDevice",  ReceiveComandDiv.A璁惧灞炴�т笂鎶�, (report) =>
+                    {
+                        string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(report);
+                        if (room.HumidityDevice != mainKeys)
+                        {
+                            return;
+                        }
+                        //绉婚櫎鎺変簨浠�
+                        HdlGatewayReceiveLogic.Current.RemoveEvent("HumidityDevice");
+                        foreach (var data in report.DeviceStatusReport.AttriBute)
+                        {
+                            if (data.AttributeId == (int)ZigBee.Device.AttriButeId.MeasuredValue)
+                            {
+                                if (data.AttriButeData == 0)
+                                {
+                                    //0
+                                    humidityRow.NameText.Text = "0.0%";
+                                    room.Humidity = 0;
+                                }
+                                else
+                                {
+                                    //灏忔暟鐐归渶瑕佷竴浣�(婀垮害娌℃湁璐熸暟)
+                                    string strValue = data.AttriButeData.ToString();
+                                    strValue = strValue.Substring(0, strValue.Length - 1);
+                                    humidityRow.NameText.Text = strValue.Insert(strValue.Length - 1, ".") + "%";
+                                    room.Humidity = int.Parse(strValue) * 0.1;
+                                }
+                            }
+                        }
+                    });
+                    //鍙戦�佽幏鍙栨箍搴︾殑鍛戒护
+                    (selectTemp as ZigBee.Device.TemperatureSensor).ReadTemperatureOrHumidity();
                 };
             };
-
-            var shareRow = new DeviceInfoRow(723);
-            shareRow.Init();
-            shareRow.SetTipTitle(R.MyInternationalizationString.Share);
-            shareRow.SetTitle("2 浜�");
-            shareRow.NameText.TextAlignment = TextAlignment.CenterRight;
-            infoFL.AddChidren(shareRow);
-            shareRow.NextBtn.MouseUpEventHandler += (sender, e) =>
+            if (string.IsNullOrEmpty(room.HumidityDevice) == false)
             {
-                var tem = new RoomShareSetting { };
-                HomePage.Instance.AddChidren(tem);
-                HomePage.Instance.PageIndex += 1;
-                tem.Show(room);
-                tem.action = (selectTemp) =>
+                humidityRow.SetTitle(R.MyInternationalizationString.Getting);
+                HdlGatewayReceiveLogic.Current.RemoveEvent("HumidityDevice");
+                HdlGatewayReceiveLogic.Current.AddAttributeEvent("HumidityDevice",  ReceiveComandDiv.A璁惧灞炴�т笂鎶�, (report) =>
                 {
+                    string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(report);
+                    if (room.HumidityDevice != mainKeys)
+                    {
+                        return;
+                    }
+                    //绉婚櫎鎺変簨浠�
+                    HdlGatewayReceiveLogic.Current.RemoveEvent("HumidityDevice");
+                    foreach (var data in report.DeviceStatusReport.AttriBute)
+                    {
+                        if (data.AttributeId == (int)ZigBee.Device.AttriButeId.MeasuredValue)
+                        {
+                            if (data.AttriButeData == 0)
+                            {
+                                //0
+                                humidityRow.NameText.Text = "0.0%";
+                                room.Humidity = 0;
+                            }
+                            else
+                            {
+                                //灏忔暟鐐归渶瑕佷竴浣�(婀垮害娌℃湁璐熸暟)
+                                string strValue = data.AttriButeData.ToString();
+                                strValue = strValue.Substring(0, strValue.Length - 1);
+                                humidityRow.NameText.Text = strValue.Insert(strValue.Length - 1, ".") + "%";
+                                room.Humidity = int.Parse(strValue) * 0.1;
+                            }
+                        }
+                    }
+                });
+                //鍙戦�佽幏鍙栨箍搴︾殑鍛戒护
+                var dev = Common.LocalDevice.Current.GetDevice(room.HumidityDevice);
+                if (dev != null)
+                {
+                    (dev as ZigBee.Device.TemperatureSensor).ReadTemperatureOrHumidity();
+                }
+            }
+            else
+            {
+                humidityRow.SetTitle(R.MyInternationalizationString.No);
+            }
 
-                };
+            if (Config.Instance.Home.FloorDics.Count == 0 || room.IsLove)
+            {
+                temperatureRow.Y = Application.GetRealHeight(308);
+                humidityRow.Y= Application.GetRealHeight(446);
+            }
 
-            };
-
-
-            var confirm = new Device.CommonForm.CompleteButton(1700, 700, 127);
+            var confirm = new Device.CommonForm.CompleteButton(1700, 900, 127);
             confirm.SetTitle(R.MyInternationalizationString.Confrim);
             AddChidren(confirm);
+            confirm.MouseUpEventHandler += (sender, e) =>
+            {
+                var tradeTime = DateTime.Now.ToString("yyyyMMddHHmmss", DateTimeFormatInfo.InvariantInfo);
+                var fileName = $"RoomIcon_{tradeTime}.png";
+                room.Name = nameRow.NameText.Text.Trim();
+                if (OldIconPathType != 0)
+                {
+                    Shared.IO.FileUtils.DeleteFile(System.IO.Path.Combine(Config.Instance.FullPath,OldBackgroundImagePath));
+                }
+                if (IconPathType == 0)
+                {
+                    room.BackgroundImage = backGround.ImagePath;
+                }
+                else
+                {
+                    Shared.IO.FileUtils.WriteFileByBytes(System.IO.Path.Combine(Config.Instance.FullPath, fileName), backGround.ImageBytes);
+                    room.BackgroundImage = fileName;
+                }
+                room.BackgroundImageType = IconPathType;
+                room.Save();
+                action?.Invoke();
+                RemoveFromParent();
+            };
+        }
 
+        /// <summary>
+        /// 閫夋嫨鑳屾櫙鍥�
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void backGroundIMGHander(object sender, MouseEventArgs e)
+        {
+            if (room != null && room.IsSharedRoom)
+            {
+                RoomCommon.ShowTipRoomIsShared();
+                return;
+            }
+
+            int selectRow_Height = 150;
+            int selectRow_Width = 1034;
+            var selectFL = new FrameLayout()
+            {
+                BackgroundColor = ZigbeeColor.Current.GXCDailogBackGroundColor
+            };
+            AddChidren(selectFL);
+
+            var itemFL = new FrameLayout()
+            {
+                Y = Application.GetRealHeight(1276),
+                Height = Application.GetRealHeight(450),
+                Width = Application.GetRealWidth(selectRow_Width),
+                Gravity = Gravity.CenterHorizontal,
+                Radius = (uint)Application.GetRealHeight(35),
+                BackgroundColor = ZigbeeColor.Current.GXCTextWhiteColor
+            };
+            selectFL.AddChidren(itemFL);
+            //itemFL.Animate = Animate.DownToUp;
+
+            var selectLocalPicture = new Button()
+            {
+                Height = Application.GetRealHeight(selectRow_Height) - 1,
+                TextID = R.MyInternationalizationString.LocalPicture,
+                TextColor = ZigbeeColor.Current.GXCTextSelectedColor4,
+                TextSize = 17
+            };
+            itemFL.AddChidren(selectLocalPicture);
+            var selectLocalLine = new Button()
+            {
+                Y = selectLocalPicture.Bottom,
+                Height = 1,
+                BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor2
+            };
+            itemFL.AddChidren(selectLocalLine);
+
+            var selectPhotographBtn = new Button()
+            {
+                Y = selectLocalLine.Bottom,
+                Height = Application.GetRealHeight(selectRow_Height) - 1,
+                TextID = R.MyInternationalizationString.Photograph,
+                TextColor = ZigbeeColor.Current.GXCTextSelectedColor4,
+                TextSize = 17
+            };
+            itemFL.AddChidren(selectPhotographBtn);
+            var selectPhotographLine = new Button()
+            {
+                Y = selectPhotographBtn.Bottom,
+                Height = 1,
+                BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor2,
+            };
+            itemFL.AddChidren(selectPhotographLine);
+
+            var selectAblumsBtn = new Button()
+            {
+                Y = selectPhotographLine.Bottom,
+                Height = Application.GetRealHeight(selectRow_Height) - 1,
+                TextID = R.MyInternationalizationString.MyAblums,
+                TextColor = ZigbeeColor.Current.GXCTextSelectedColor4,
+                TextSize = 17
+            };
+            itemFL.AddChidren(selectAblumsBtn);
+
+            var cancelBtn = new Button()
+            {
+                Y = Application.GetRealHeight(1742),
+                Height = Application.GetRealHeight(selectRow_Height),
+                Width = Application.GetRealWidth(selectRow_Width),
+                Gravity = Gravity.CenterHorizontal,
+                TextID = R.MyInternationalizationString.Cancel,
+                TextColor = ZigbeeColor.Current.GXCTextSelectedColor4,
+                BackgroundColor = ZigbeeColor.Current.GXCTextWhiteColor,
+                Radius = (uint)Application.GetRealHeight(35),
+                TextSize = 17
+            };
+            selectFL.AddChidren(cancelBtn);
+
+            selectLocalPicture.MouseUpEventHandler += (send, ee) =>
+            {
+                selectFL.RemoveFromParent();
+                var localPic = new AddRoomSelectPicByLocal();
+                Shared.Phone.UserView.HomePage.Instance.AddChidren(localPic);
+                Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
+                localPic.Show();
+                localPic.action = (imgPath) =>
+                {
+                    IconPathType = 0;
+                    backGround.ImageBytes = null;
+                    backGround.ImagePath = imgPath;
+                };
+            };
+            selectPhotographBtn.MouseUpEventHandler += (send, ee) =>
+            {
+                selectFL.RemoveFromParent();
+                var tradeTime = DateTime.Now.ToString("yyyyMMddHHmmss", DateTimeFormatInfo.InvariantInfo);
+                var fileName = $"RoomIcon_{tradeTime}.png";
+                //閫氳繃鐩告満鎷嶇収瑁佸壀
+                CropImage.TakePicture((imagePath) =>
+                {
+                    if (IconPathType != 0)
+                    {
+                        Global.DeleteFilebyHomeId(backGround.ImagePath);
+                    }
+
+                    IconPathType = 1;
+                    backGround.ImageBytes = Shared.IO.FileUtils.ReadFile(imagePath);
+                    backGround.ImagePath = imagePath;
+                    System.IO.File.Delete(imagePath);
+
+                }, fileName, 2, 1);
+            };
+
+            selectAblumsBtn.MouseUpEventHandler += (send, ee) =>
+            {
+                selectFL.RemoveFromParent();
+                var tradeTime = DateTime.Now.ToString("yyyyMMddHHmmss", DateTimeFormatInfo.InvariantInfo);
+                var fileName = $"RoomIcon_{tradeTime}.png";
+                //浠庣浉鍐岄�夋嫨鍥剧墖瑁佸壀
+                CropImage.SelectPicture((imagePath) =>
+                {
+                    if (IconPathType != 0)
+                    {
+                        Global.DeleteFilebyHomeId(backGround.ImagePath);
+                    }
+
+                    IconPathType = 2;
+                    backGround.ImageBytes = Shared.IO.FileUtils.ReadFile(imagePath);
+                    backGround.ImagePath = imagePath;
+                    System.IO.File.Delete(imagePath);
+
+                }, fileName, 2, 1);
+            };
+
+            cancelBtn.MouseUpEventHandler += (send, ee) =>
+            {
+                selectFL.RemoveFromParent();
+            };
+            selectFL.MouseUpEventHandler += (send, ee) =>
+            {
+                selectFL.RemoveFromParent();
+            };
         }
 
         #endregion

--
Gitblit v1.8.0