From 0446b122504b83aef39087e91a960d53920bec05 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期二, 28 三月 2023 13:27:46 +0800
Subject: [PATCH] 2023年03月28日13:26:53

---
 HDL_ON/Entity/Function/Function.cs                                      |    4 
 HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/CommonMethod.cs          |  451 +++++++++++++++++
 HDL_ON/Common/Constant.cs                                               |    1 
 HDL_ON/Common/HDLCommon.cs                                              |    2 
 HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs       |    2 
 HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockListPage.cs |  222 ++++++++
 HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/StackTraceLog.cs         |   58 ++
 HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideDoorLockSend.cs      |  216 ++++++++
 HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockPage.cs     |  511 +++++++++++++++++++
 HDL_ON/HDL_ON.projitems                                                 |    6 
 HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/ObjectClass.cs           |   82 +++
 11 files changed, 1,553 insertions(+), 2 deletions(-)

diff --git a/HDL_ON/Common/Constant.cs b/HDL_ON/Common/Constant.cs
index 0dd7756..36d7dbc 100644
--- a/HDL_ON/Common/Constant.cs
+++ b/HDL_ON/Common/Constant.cs
@@ -309,6 +309,7 @@
         /// HDL鍙瀵硅
         /// </summary>
         HDL_INTERPHONE,
+        DOOR_BELL,
     }
 
     /// <summary>
diff --git a/HDL_ON/Common/HDLCommon.cs b/HDL_ON/Common/HDLCommon.cs
index befc921..df2cec0 100644
--- a/HDL_ON/Common/HDLCommon.cs
+++ b/HDL_ON/Common/HDLCommon.cs
@@ -397,7 +397,7 @@
                                 return;
                             }
                             ///瑙嗛闂ㄩ攣
-                            HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock.CommonMethod.Current.SkipRTVActivity(expantContent.devSerial, expantContent.deviceId,expantContent.spk,true);
+                            HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock.CommonMethod.Current.SkipRTVActivity(expantContent.devSerial, expantContent.deviceId,expantContent.spk);
                         }
                         catch { }
                     }
diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs
index 3252d44..4b0511a 100644
--- a/HDL_ON/Entity/Function/Function.cs
+++ b/HDL_ON/Entity/Function/Function.cs
@@ -1375,6 +1375,10 @@
         /// </summary>
         public const string DoorLock = "security.door";
         /// <summary>
+        /// 钀ょ煶瑙嗗睆闂ㄩ攣
+        /// </summary>
+        public const string VideoDoorLock = "security.door.ezviz";
+        /// <summary>
         /// 闂ㄩ攣spk鍒楄〃
         /// </summary>
         /// <returns></returns>
diff --git a/HDL_ON/HDL_ON.projitems b/HDL_ON/HDL_ON.projitems
index 7f41d93..250013a 100644
--- a/HDL_ON/HDL_ON.projitems
+++ b/HDL_ON/HDL_ON.projitems
@@ -528,6 +528,12 @@
     <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Music\A31UsbMusicList.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Music\CommonMethod.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Music\A31FlieList.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\VideoDoorLock\VideDoorLockSend.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\VideoDoorLock\StackTraceLog.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\VideoDoorLock\ObjectClass.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\VideoDoorLock\CommonMethod.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\VideoDoorLock\VideoDoorLockPage.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\VideoDoorLock\VideoDoorLockListPage.cs" />
   </ItemGroup>
   <ItemGroup>
     <Folder Include="$(MSBuildThisFileDirectory)Entity\Device\" />
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
index 1c62cfb..2183231 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
@@ -628,7 +628,7 @@
                         view1.btnClick.MouseUpEventHandler += (sender, e) =>
                         {
                             this.identifier = "open_door";//寮�閿佷簨浠�
-                            this.VideoDoorLockAction(this, device, view1.btnState);
+                            //this.VideoDoorLockAction(this, device, view1.btnState);
                         };
                         if (edit)
                         {
diff --git a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/CommonMethod.cs b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/CommonMethod.cs
new file mode 100644
index 0000000..f68971a
--- /dev/null
+++ b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/CommonMethod.cs
@@ -0,0 +1,451 @@
+锘縰sing System;
+using HDL_ON.Entity;
+using System.Collections.Generic;
+using Shared;
+
+namespace HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock
+{
+    /// <summary>
+    /// 钀ょ煶瑙嗛闂ㄩ攣鍏叡鏂规硶绫�
+    /// </summary>
+    public class CommonMethod
+    {
+        private Loading loading;
+        /// <summary>
+        /// 璁板綍褰撳墠鐣岄潰绱㈠紩鍊�
+        /// </summary>
+        private int pageLayoutIndexValue;
+
+        private static CommonMethod commonMethod = null;
+        /// <summary>
+        /// 鑾峰彇瀵硅薄
+        /// </summary>
+        public static CommonMethod Current
+        {
+            get
+            {
+                if (commonMethod == null)
+                {
+                    commonMethod = new CommonMethod();
+                }
+
+                return commonMethod;
+
+            }
+
+        }
+
+        #region  --------- 璺宠浆鍒癆ndroid閭h竟鐨勬柟娉�(钀ょ煶瑙嗛闂ㄩ攣) --------
+        /// <summary>
+        /// 璇诲彇浜戠鐨勪笂璁惧鍒楄〃(android婧愮敓娣诲姞璁惧鍒颁簯绔垚鍔熷悗)
+        /// <paramref name="devSerial"/>璁惧搴忓垪鍙�</param>
+        /// </summary>
+        public void SkipAddDeviceActivity(string devSerial)
+        {
+#if __IOS__
+
+#else
+            this.InitializationAndroidData((isBools) =>
+            {
+                if (!isBools) {
+                    this.MainThread(()=> {
+                        this.ShowTip("鍏堣幏鍙栬悿鐭充簯瀛愯处鍙穞oken澶辫触銆�");
+
+                    });
+                }
+                HDLEzvizSdk.Instance.JumpToEZScanActivity(Application.Activity);
+                HDLEzvizSdk.SetAddCallback(new AndroidIHdlInterface((isBool, adnroidActionDevSerial) =>
+                {
+                    if (isBool)
+                    {
+
+                        var list = VideDoorLockSend.Current.GetVideoDoorLockDeviceList(SPK.VideoDoorLock);
+                        if (list.Count > 0)
+                        {
+                            var function = list.Find((o) => o.sid == adnroidActionDevSerial);
+                            if (function != null)
+                            {
+                                this.SaveFunctionFile(function);
+                            }
+                        }
+
+
+                    }
+
+                }));
+            });
+
+
+
+#endif
+
+        }
+        /// <summary>
+        /// 鎵撳紑瀹炴椂瑙嗛鐢婚潰
+        /// </summary>
+        /// <param name="deviceSerial">璁惧搴忓垪鍙�</param>
+        /// <param name="deviceId">璁惧id(浜戠涓奷eviceId)</param>
+        /// <param name="spk">璁惧spk(浜戦泙涓婂畾涔夊ソ鐨�)</param>
+        public void SkipRTVActivity(string deviceSerial, string deviceId, string spk)
+        {
+            #if __IOS__
+
+#else
+            this.InitializationAndroidData((isBools) =>
+            {
+                if (!isBools)
+                {
+                    this.MainThread(() => {
+                        this.ShowTip("鍏堣幏鍙栬悿鐭充簯瀛愯处鍙穞oken澶辫触銆�");
+
+                    });
+                }
+                Video.View.ShowDialog.Currnet.ClickBox(Language.StringByID(StringId.laizimenlinghujiao), (dialog) =>
+                {
+                    dialog.Close();
+                    HDLEzvizSdk.Instance.JumpToEZRealPlayActivity(Application.Activity,deviceId,deviceSerial,spk);
+                }, (dialog) =>
+                {
+                    dialog.Close();
+                });
+               
+            });
+          
+
+#endif
+        }
+        /// <summary>
+        /// 娴忚鍘嗗彶璁板綍
+        /// </summary>
+        public void SkipRecordActivity(string deviceId)
+        {
+            this.InitializationAndroidData((s)=> {
+
+
+                //HDLEzvizSdk.Instance.JumpLockHistoryActivity(Application.Activity, deviceId);
+
+            });
+            //鏈疄鐜�
+            //this.InitializationAndroidData();
+            //
+        }
+        /// <summary>
+        /// 涓存椂瀵嗙爜寮�闂�
+        /// <paramref name="deviceId"/>
+        /// </summary>
+        public void SkipPSWActivity(string deviceId)
+        {
+#if __IOS__
+
+#else
+            this.InitializationAndroidData((isBools) =>
+            {
+                if (!isBools)
+                {
+                    this.MainThread(() =>
+                    {
+                        this.ShowTip("鍏堣幏鍙栬悿鐭充簯瀛愯处鍙穞oken澶辫触銆�");
+
+                    });
+                }
+                HDLEzvizSdk.Instance.JumpTempPasswordActivity(Application.Activity, deviceId);
+
+            });
+#endif
+        }
+
+        /// <summary>
+        /// 鍒濆鍖栬悿鐭砈DK(瀹為檯灏辨槸浼犲弬鏁�,澶氭璋冪敤涔熸病鏈夊奖鍝�)
+        /// </summary>
+        public void InitializationAndroidData(Action<bool> action)
+        {
+           
+   
+            bool isBool = true;
+            this.SunThread(() =>
+            {
+                try
+                {
+                    //鍏堣幏鍙栬悿鐭充簯瀛愯处鍙穞oken
+                    var ezChildAccessToken = VideDoorLockSend.Current.GetEZGetChildToken();
+                    this.MainThread(() =>
+                    {
+                        if (string.IsNullOrEmpty(ezChildAccessToken))
+                        {
+                            //Token
+                            isBool = false;
+                            return;
+                        }
+                        Application.RunOnMainThread(() =>
+                        {
+#if __IOS__
+                                ////iOS
+                                ////鍒濆鍖栬悿鐭充簯SDK锛屼腑鏂囧浗鍐卥ey銆佽嫳鏂囨捣澶杒ey 寮�鍙戣�呰处鍙蜂娇鐢ㄥ簲鐢ㄥ寘鍚嶇敵璇风殑APPKEY锛屼笉鍚屽寘鍚嶅簲鐢ㄩ渶閰嶇疆涓嶅悓鐨凙PPKEY
+                                //EZSDK.IOS.EZSDK.SharedInstance().InitLibWithAppKey("1aa98a90489b4838b966b57018b4b04b", "1aa98a90489b4838b966b57018b4b04b");
+                                ////1.璁剧疆鎵�闇�娌充笢鐨凙ccessToken鍜孯efreshToken銆佸煙鍚嶅湴鍧�
+                                //EZSDK.IOS.EZSDK.SharedInstance().SetHDlAccessToken(UserVideoDoorLockInfo.Current.LoginTokenString, UserVideoDoorLockInfo.Current.RefreshToken);
+                                //EZSDK.IOS.EZSDK.SharedInstance().SetRequestHttpsHostAndPlatform(OnAppConfig.Instance.RequestHttpsHost, 1, DB_ResidenceData.Instance.CurrentRegion.id);
+                                ////2.璁剧疆钀ょ煶瀛愯处鍙风殑AccessToken鍒癝DK
+                                //EZSDK.IOS.EZSDK.SharedInstance().SetEZAccessToken(ezChildAccessToken);
+                                //////3.鎵撳紑鎽勫儚澶磋澶囧垪琛ㄩ〉闈�
+                                //EZSDK.IOS.EZSDK.SharedInstance().Go2EZvizMonitor();
+                                ////EZSDK.IOS.EZDeviceInfo info = new EZSDK.IOS.EZDeviceInfo();
+                                ////info.de
+                                ////EZSDK.IOS.EZSDK.Play(info);
+#else
+                            HDLEzvizSdk.Instance.Init(Application.Activity.Application, ezChildAccessToken, UserInfo.Current.LoginTokenString, UserInfo.Current.RefreshToken, OnAppConfig.Instance.RequestHttpsHost, "1aa98a90489b4838b966b57018b4b04b", 1, DB_ResidenceData.Instance.CurrentRegion.id);
+
+#endif
+                        });
+
+                    });
+
+                }
+                catch (Exception e)
+                {
+                }
+                finally
+                {
+                    this.MainThread(() =>
+                    {
+                        action?.Invoke(isBool);
+                    });
+                }
+            });
+        }
+
+        /// <summary>
+        /// 鏇存崲浣忓畢
+        /// </summary>
+        /// <param name="home">瀵硅薄</param>
+        public void ChangeCurrHome(RegionInfoRes home)
+        {
+            if (DB_ResidenceData.Instance.CurrentRegion.id == home.id || string.IsNullOrEmpty(home.id)) return;
+
+        }
+#endregion
+
+        /// <summary>
+        /// 钀ょ煶瑙嗛闂ㄩ攣鐨勫浘鏍�
+        /// <param name="comerom">鏉ヨ嚜閭i噷</param>
+        /// </summary>
+        public string GetVideoDoorLockIcon(Comerom comerom)
+        {
+            if (comerom == Comerom.collect)
+            {
+                return "FunctionIcon/DoorLock/VideoDoorLockOpen.png";
+            }
+            else
+            {
+                return "FunctionIcon/DoorLock/VideoDoorlockClose.png";
+            }
+
+        }
+#region  --------- 鍔熻兘鏂囦欢淇濆瓨锛屽垹闄� --------
+        /// <summary>
+        /// 淇濆瓨鏈湴鏂囦欢
+        /// </summary>
+        /// <param name="function">褰撳墠璁惧</param>
+        public void SaveFunctionFile(Function function)
+        {
+            if (function == null) return;
+            function.AssembleStatus();
+            function.SaveFunctionFile();
+            FunctionList.List.IniFunctionList(function.savePath, true);
+            MainPage.Log($"鏂囦欢淇濆瓨->{function.name}-->{function.spk}");
+        }
+
+        /// <summary>
+        /// 鍒犻櫎鏈湴鏂囦欢
+        /// </summary>
+        /// <param name="function">褰撳墠璁惧</param>
+        public void DeleteFunction(Function function)
+        {
+            if (function == null) return;
+            FunctionList.List.DeleteFunction(function);
+            MainPage.Log($"鏂囦欢鍒犻櫎->{function.name}-->{function.spk}");
+        }
+#endregion
+        /// <summary>
+        /// 鑾峰彇Loading瀵硅薄
+        /// </summary>
+        /// <returns></returns>
+        public Loading Loading
+        {
+            get
+            {
+                this.MainThread(() =>
+                {
+                    //if (loading != null && this.pageLayoutIndexValue == MainPage.BasePageView.ChildrenCount - 1)
+                    //{
+                    //    //闃叉浜岄噸娣诲姞瀵硅薄
+                    //    return;
+                    //}
+                    if (loading == null)//|| MainPage.BasePageView.ChildrenCount < 1)
+                    {
+                        loading = new Loading();
+                    }
+                    //loading.BringToFront();
+                    Application.MainPage.AddChidren(loading);
+                    //View view = MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1);
+                    //if (view is ViewGroup)
+                    //{
+                    //    pageLayoutIndexValue = MainPage.BasePageView.ChildrenCount - 1;
+                    //    ((ViewGroup)view).AddChidren(loading);
+                    //}
+                });
+                return loading;
+            }
+
+        }
+
+        /// <summary>
+        /// 鑾峰彇钀ょ煶瑙嗛闂ㄩ攣鍒楄〃
+        /// </summary>
+        /// <returns></returns>
+        public List<Function> GetVideoDoorLockList()
+        {
+            //var list = FunctionList.List.GetVideoDoorLockList();
+#if DEBUG
+            //list.Add(new Function { name = "瑙嗛闂ㄩ攣涓�", sid = "23456789", spk = SPK.VideoDoorLock });
+            //list.Add(new Function { name = "瑙嗛闂ㄩ攣浜�", sid = "2345678922", spk = SPK.VideoDoorLock });
+#endif
+            return new List<Function>();
+        }
+#region  ---------鑷畾涔夌嚎绋�(瀛愮嚎绋嬶紝涓荤嚎绋�)--------
+        /// <summary>
+        /// 瀛愮嚎绋�
+        /// </summary>
+        /// <paramref name="tipType"/>鏄惁瑕佹彁绀洪敊璇俊鎭�(榛樿鏄剧ず)<paramref>
+        /// <param name="action"></param>
+        public void SunThread(Action action, TipType tipType = TipType.confirmation)
+        {
+            new System.Threading.Thread(() =>
+            {
+                try
+                {
+                    action?.Invoke();
+                }
+                catch (Exception e)
+                {
+                    this.ShowAlert(e, tipType);
+                }
+            })
+            { IsBackground = true }.Start();
+
+        }
+        /// <summary>
+        /// 涓荤嚎绋�(UI鏇存柊)
+        /// </summary>
+        /// <paramref name="tipType"/>鏄惁瑕佹彁绀洪敊璇俊鎭�(榛樿鏄剧ず)<paramref>
+        /// <param name="action"></param>
+        public void MainThread(Action action, TipType tipType = TipType.confirmation)
+        {
+            Application.RunOnMainThread(() =>
+            {
+                try
+                {
+                    action?.Invoke();
+                }
+                catch (Exception e)
+                {
+                    this.ShowAlert(e, tipType);
+                }
+            });
+
+        }
+#endregion
+#region  --------- 鎻愮ず妗嗭紝纭妗� --------
+        /// <summary>
+        /// 瀵硅瘽妗�(鍙绋嬪簭鎶ラ敊鐨勬椂鍊欐墠鐢ㄥ埌)
+        /// </summary>
+        /// <paramref name="e"/>寮傚父瀵硅薄<paramref>
+        /// <paramref name="tipType"/>鏄惁瑕佹彁绀洪敊璇俊鎭�(榛樿鏄剧ず)<paramref>
+        private void ShowAlert(Exception e, TipType tipType)
+        {
+
+            if (tipType != TipType.confirmation)
+            {
+                return;
+            }
+            Application.RunOnMainThread(() =>
+            {
+                string msg = e.Message + "\r\n" + e.StackTrace;
+                Alert alert = new Alert("鎶辨瓑绋嬪簭鍑洪敊浜�.", "鎸塡"纭畾\"鑳借幏鍙栨洿璇︾粏鐨勯敊璇俊鎭�.", "鍙栨秷", "纭畾");
+                alert.Show();
+                alert.ResultEventHandler += (alerts, isBool) =>
+                {
+                    alert.Dismiss();
+                    if (isBool)
+                    {
+                        StackTraceLog stackTraceLog = new StackTraceLog(msg);
+                        stackTraceLog.Show();
+                    }
+                };
+            });
+        }
+        /// <summary>
+        /// 淇℃伅鎻愮ず绐楀彛锛岃嚜鍔ㄥ叧闂�
+        /// </summary>
+        /// <param name="msg">鎻愮ず閿欒鏂囨湰</param>
+        public void ShowTip(string msg, int time = 2)
+        {
+            Application.RunOnMainThread(() =>
+            {
+                new PublicAssmebly().TipMsgAutoClose(msg, false, time * 1000);
+            });
+        }
+#endregion
+        /// <summary>
+        /// 寮规绫诲瀷
+        /// </summary>
+        public enum TipType
+        {
+            none,//鏃犳彁绀�
+            flicker,//闂儊妗�
+            confirmation//纭妗�
+        }
+        /// <summary>
+        /// 琛ㄧず鏉ヨ嚜閭d釜鐣岄潰
+        /// </summary>
+        public enum Comerom
+        {
+            function,//鍔熻兘
+            collect,//鏀惰棌
+            room,//鎴块棿
+            push,//鎺ㄩ��
+        }
+#if __IOS__
+
+#else
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public class AndroidIHdlInterface : Java.Lang.Object, IHdlInterface
+        {
+
+            Action<bool,string> mAction;
+            public AndroidIHdlInterface(Action<bool,string> action)
+            {
+                mAction = action;
+            }
+            /// <summary>
+            /// 
+            /// </summary>
+            /// <param name="p0">true鏄叆缃戞垚鍔�(婧愮敓鍥炶皟杩斿洖)</param>
+            /// <param name="p1">璁惧鐨勫簭鍒楀寲(婧愮敓鍥炶皟杩斿洖)</param>
+            public void AddCallback(bool p0, string p1)
+            {
+                mAction?.Invoke(p0,p1);
+            }
+
+           
+        }
+
+#endif
+    }
+
+
+
+}
diff --git a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/ObjectClass.cs b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/ObjectClass.cs
new file mode 100644
index 0000000..5aa77bb
--- /dev/null
+++ b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/ObjectClass.cs
@@ -0,0 +1,82 @@
+锘縰sing System;
+namespace HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock
+{
+    public class ObjectClass
+    {
+
+
+    }
+    /// <summary>
+    /// 鐢ㄦ埛淇℃伅(钀ょ煶瑙嗛闂ㄩ攣) 
+    /// </summary>
+    public class UserVideoDoorLockInfo
+    {
+        /// <summary>
+        /// 鐢ㄦ埛id
+        /// </summary>
+        public string extUserId = string.Empty;
+        /// <summary>
+        /// 鐢ㄦ埛鍚嶇О
+        /// </summary>
+        public string extUserName = string.Empty;
+
+    }
+    /// <summary>
+    /// 闂ㄩ攣鐘舵��(钀ょ煶瑙嗛闂ㄩ攣)
+    /// </summary>
+    public class VideoDoorLockInfo
+    {
+        /// <summary>
+        /// 閿佺姸鎬侊紙lock:閿侊紱unlock:瑙i攣锛�
+        /// </summary>
+        public string lockStatus = string.Empty;
+        /// <summary>
+        /// 闂ㄧ姸鎬侊紙open锛氬紑锛沜lose锛氬叧锛�
+        /// </summary>
+        public string doorStatus = string.Empty;
+
+    }
+
+    /// <summary>
+    /// 鐢垫睜璇︽儏(钀ょ煶瑙嗛闂ㄩ攣)
+    /// </summary>
+    public class CellInfo
+    {
+        /// <summary>
+        /// 鐢甸噺
+        /// </summary>
+        public string remain = string.Empty;
+        /// <summary>
+        /// 鐢垫睜鍚嶇О
+        /// </summary>
+        public string name = string.Empty;
+
+    }
+    /// <summary>
+    /// 鎺ㄩ�佸唴瀹瑰璞�
+    /// </summary>
+    public class ExpantContent
+    {
+        /// <summary>
+        /// 璁惧搴忓垪鍙�
+        /// </summary>
+        public string devSerial = string.Empty;
+        /// <summary>
+        /// 璁惧id
+        /// </summary>
+        public string deviceId = string.Empty;
+        /// <summary>
+        /// 涓嶇煡閬撴槸鍟�
+        /// </summary>
+        public string interphoneTypeEnum = string.Empty;
+        /// <summary>
+        /// 涓嶇煡閬撴槸鍟�
+        /// </summary>
+        public string subToken = string.Empty;
+        /// <summary>
+        /// 浜戦泙涓婂畾涔夌殑璁惧spk
+        /// </summary>
+        public string spk = string.Empty;
+    }
+
+}
diff --git a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/StackTraceLog.cs b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/StackTraceLog.cs
new file mode 100644
index 0000000..05ad631
--- /dev/null
+++ b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/StackTraceLog.cs
@@ -0,0 +1,58 @@
+锘縰sing System;
+using HDL_ON.UI.CSS;
+using HDL_ON.UI.Music;
+using Shared;
+
+namespace HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock
+{
+    public class StackTraceLog
+    {
+        /// <summary>
+        /// 鍫嗗彔璺熻釜鏃ュ織
+        /// </summary>
+        public string msg;
+
+        public StackTraceLog(string msg)
+        {
+            this.msg = msg;
+        }
+        public void Show()
+        {
+
+            Dialog dialog = new Dialog()
+            {
+                BackgroundColor = CSS_Color.textWhiteColor,
+            };
+            dialog.Show();
+            TopView topView = new TopView();
+            topView.topNameBtn.Text="閿欒鏃ュ織淇℃伅";
+            dialog.AddChidren(topView.TopFLayoutView());
+            topView.clickBackBtn.MouseUpEventHandler += (sen, e) =>
+            {
+                dialog.Close();
+            };
+           
+            var middleFl = new FrameLayout
+            {
+                Y = topView.fLayout.Bottom,
+                Height = Application.GetRealHeight(H_W.H - H_W.T_Height),
+            };
+            dialog.AddChidren(middleFl);
+          
+            Button btnLogText = new Button 
+            {
+                //TextSize = TextSize.Text14,
+                TextColor = MusicColor.Text18Color,
+                Width = Application.GetRealWidth(H_W.W - 16 - 16),
+                Height = middleFl.Height,
+                X = Application.GetRealWidth(16),
+                Text = this.msg,
+                TextAlignment = TextAlignment.TopLeft,
+                IsMoreLines = true,
+            };
+            middleFl.AddChidren(btnLogText);
+
+
+        }
+    }
+}
diff --git a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideDoorLockSend.cs b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideDoorLockSend.cs
new file mode 100644
index 0000000..fe1a0f0
--- /dev/null
+++ b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideDoorLockSend.cs
@@ -0,0 +1,216 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Threading;
+using HDL_ON.DAL.Server;
+using HDL_ON.Entity;
+using Shared;
+using static HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock.CommonMethod;
+
+
+namespace HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock
+{
+    /// <summary>
+    /// 钀ょ煶瑙嗛闂ㄩ攣鏁版嵁鍙戦��
+    /// </summary>
+    public class VideDoorLockSend
+    {
+
+        private static VideDoorLockSend send = null;
+        /// <summary>
+        /// 鑾峰彇褰撳墠鐨勫璞� 
+        /// </summary>
+        public static VideDoorLockSend Current
+        {
+            get
+            {
+                if (send == null)
+                {
+                    send = new VideDoorLockSend();
+                }
+
+                return send;
+            }
+        }
+        /// <summary>
+        /// 瑙g粦璁惧(钀ょ煶瑙嗛闂ㄩ攣)
+        /// </summary>
+        /// <param name="function">褰撳墠鐨勮澶�</param>
+        /// <param name="action">鍥炶皟缁撴灉</param>
+        /// <param name="tipType">鏄惁闇�瑕佹彁绀�,榛樿鎻愮ず</param>
+        public void DelDevice(Function function, Action<bool> action, TipType tipType = TipType.flicker)
+        {
+            new Thread(() =>
+            {
+                try
+                {
+                    Dictionary<string, object> d = new Dictionary<string, object>();
+                    d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+                    d.Add("deviceSerial", function.sid);//绛夊悓闂ㄩ攣搴忓垪鍙�
+                    d.Add("platform", 1);//骞冲彴
+                    var responsePackNew = UI.Music.SendMethod.Current.RequestServerhomeId(d, NewAPI.Api_Post_DeleteDevice, "鍒犻櫎钀ょ煶闂ㄩ攣璁惧");
+                    if (!this.DataChecking(responsePackNew, tipType))
+                    {
+                        return;
+                    }
+
+                    if (function != null)
+                    {
+                        action?.Invoke(true);
+                    }
+                }
+                catch (Exception s)
+                {
+                }
+            })
+            { IsBackground = true }.Start();
+
+        }
+        /// <summary>
+        /// 鑾峰彇闂ㄩ攣鐘舵��(钀ょ煶瑙嗛闂ㄩ攣)
+        /// </summary>
+        /// <param name="function">褰撳墠鐨勮澶�</param>
+        /// <param name="tipType">鏄惁闇�瑕佹彁绀�,榛樿鎻愮ず</param>
+        /// <param name="return">杩斿洖缁撴灉涓嶄細涓簄ull</param>
+        public VideoDoorLockInfo GetVideoDoorLockState(Function function, TipType tipType = TipType.flicker)
+        {
+
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("deviceId", function.deviceId);
+            var responsePackNew = UI.Music.SendMethod.Current.RequestServerhomeId(d, NewAPI.Api_Post_Lockstatus, "鑾峰彇钀ょ煶瑙嗛闂ㄩ攣鐘舵��");
+            if (!this.DataChecking(responsePackNew,tipType))
+            {
+                return new VideoDoorLockInfo();
+            }
+
+            var videoDoorLockInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<VideoDoorLockInfo>(responsePackNew.Data.ToString());
+            if (videoDoorLockInfo == null)
+            {
+                return new VideoDoorLockInfo();
+            }
+            return videoDoorLockInfo;
+
+
+
+        }
+        /// <summary>
+        /// 鑾峰彇鐢垫睜鐢甸噺(钀ょ煶瑙嗛闂ㄩ攣)
+        /// </summary>
+        /// <param name="function">褰撳墠鐨勮澶�</param>
+        /// <param name="tipType">鏄惁闇�瑕佹彁绀�,榛樿鎻愮ず</param>
+        /// <param name="return">杩斿洖缁撴灉涓嶄細涓簄ull</param>
+        public CellInfo GetCellValue(Function function, TipType tipType = TipType.flicker)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("deviceId", function.deviceId);
+            var responsePackNew = UI.Music.SendMethod.Current.RequestServerhomeId(d, NewAPI.Api_Post_Details, "鑾峰彇钀ょ煶闂ㄩ攣璁惧鐢甸噺");
+            if (!this.DataChecking(responsePackNew,tipType))
+            {
+                return new CellInfo();
+            }
+            var cellInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<CellInfo>(responsePackNew.Data.ToString());
+            if (cellInfo == null)
+            {
+                return new CellInfo();
+            }
+
+            return cellInfo;
+
+        }
+        /// <summary>
+        /// 鑾峰彇闂ㄩ攣鐢ㄦ埛鍒楄〃(钀ょ煶瑙嗛闂ㄩ攣)
+        /// </summary>
+        /// <param name="function">褰撳墠鐨勮澶�</param>
+        /// <param name="tipType">鏄惁闇�瑕佹彁绀�,榛樿鎻愮ず</param>
+        /// <param name="return">杩斿洖缁撴灉涓嶄細涓簄ull</param>
+        public List<UserVideoDoorLockInfo> GetVideoDoorLockUserListInfo(Function function, TipType tipType = TipType.flicker)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("deviceId", function.deviceId);
+            var responsePackNew = UI.Music.SendMethod.Current.RequestServerhomeId(d, NewAPI.Api_Post_UserList, "鑾峰彇钀ょ煶闂ㄩ攣鐢ㄦ埛鍒楄〃");
+            if (!this.DataChecking(responsePackNew, tipType))
+            {
+                return new List<UserVideoDoorLockInfo>();
+            }
+            var list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<UserVideoDoorLockInfo>>(responsePackNew.Data.ToString());
+            if (list == null)
+            {
+                return new List<UserVideoDoorLockInfo>();
+            }
+            return list;
+        }
+        /// <summary>
+        /// 鑾峰彇闂ㄩ攣璁惧鍒楄〃(钀ょ煶瑙嗛闂ㄩ攣)
+        /// </summary>
+        /// <param name="spk">鎸囧畾spk鑾峰彇</param>
+        /// <param name="tipType">鏄惁闇�瑕佹彁绀�,榛樿鎻愮ず</param>
+        /// <returns>杩斿洖缁撴灉涓嶄細涓簄ull</returns>
+        public List<Function> GetVideoDoorLockDeviceList(string spk, TipType tipType = TipType.flicker)
+        {
+
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("spk", spk);
+            var responsePackNew = UI.Music.SendMethod.Current.RequestServerhomeId(d, NewAPI.Api_Post_UserList, "鑾峰彇钀ょ煶闂ㄩ攣璁惧鍒楄〃");
+            if (!this.DataChecking(responsePackNew, tipType))
+            {
+                return new List<Function>();
+            }
+            var list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Function>>(responsePackNew.Data.ToString());
+            if (list == null)
+            {
+                return new List<Function>();
+            }
+            return list;
+        }
+        /// <summary>
+        /// 鍏堣幏鍙栬悿鐭充簯瀛愯处鍙穞oken
+        /// </summary>
+        /// <param name="tipType">鏄惁闇�瑕佹彁绀�,榛樿鎻愮ず</param>
+        public string GetEZGetChildToken(TipType tipType = TipType.flicker)
+        {
+            //鍏堣幏鍙栬悿鐭充簯瀛愯处鍙穞oken
+            var responsePackNew = new HttpServerRequest().EZGetChildToken();
+            if (!this.DataChecking(responsePackNew, tipType))
+            {
+                return "";
+            }
+            return responsePackNew.Data.ToString();
+        }
+        /// <summary>
+        /// 妫�楠屾暟鎹洖澶嶆垚鍔熸垨鑰呭け璐�
+        /// </summary>
+        /// <param name="responsePackNew">鍥炲鏁版嵁瀵硅薄</param>
+        /// <param name="tipType">鏄惁闇�瑕佹彁绀�</param>
+        /// <returns></returns>
+        private bool DataChecking(ResponsePackNew responsePackNew, TipType tipType)
+        {
+            if (responsePackNew.Data == null || responsePackNew.Code != "0" || responsePackNew.Data.ToString() == "")
+            {
+                if (TipType.flicker == tipType)
+                {
+                    if (responsePackNew == null)
+                    {
+                        responsePackNew = new ResponsePackNew { message = "娌″洖澶�,璇风‘璁ょ綉缁滄槸鍚︽甯�.", Code = "-1", };
+                    }
+                    Application.RunOnMainThread(() =>
+                    {
+                        //new Tip()
+                        //{
+                        //    CloseTime = 1,
+                        //    Text = responsePackNew.message + "(" + responsePackNew.Code + ")",
+                        //    Direction = AMPopTipDirection.None,
+                        //}.Show(MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1));
+                        CommonMethod.Current.ShowTip(responsePackNew.message + "(" + responsePackNew.Code + ")");
+                    });
+                }
+                return false;
+            }
+            return true;
+        }
+
+
+    }
+}
diff --git a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockListPage.cs b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockListPage.cs
new file mode 100644
index 0000000..11c271d
--- /dev/null
+++ b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockListPage.cs
@@ -0,0 +1,222 @@
+锘縰sing Shared;
+using HDL_ON.Stan;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using HDL_ON.UI.CSS;
+using HDL_ON.Entity;
+
+namespace HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock
+{
+    /// <summary>
+    /// 瑙嗛闂ㄩ攣鍒楄〃鐣岄潰
+    /// </summary>
+    public class VideoDoorLockListPage : EditorCommonForm
+    {
+        #region 鈻� 鍙橀噺澹版槑___________________________
+
+        /// <summary>
+        /// 闂ㄩ攣璁惧鍒楄〃
+        /// </summary>
+        private List<Function> listDevice = new List<Function>();
+        /// <summary>
+        /// 鐢垫睜鎺т欢鍒楄〃(key:璁惧鐨剆id)
+        /// </summary>
+        private Dictionary<string, BatteryPersentControl> dicBatteryContr = new Dictionary<string, BatteryPersentControl>();
+        /// <summary>
+        /// 鍒楄〃鎺т欢
+        /// </summary>
+        private VerticalListControl listView = null;
+        /// <summary>
+        /// 鍒犻櫎璁惧鍚庨渶瑕佹洿鏂扮晫闈㈢殑鍥炶皟
+        /// </summary>
+        public Action action;
+
+
+        #endregion
+
+        #region 鈻� 鍒濆鍖朹____________________________
+
+        public VideoDoorLockListPage(Action action) {
+            this.action = action;
+        }
+        
+
+        /// <summary>
+        /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓)
+        /// </summary>
+        /// <param name="i_listDevice">闂ㄩ攣璁惧鍒楄〃</param>
+        public void ShowForm(List<Function> i_listDevice)
+        {
+            this.listDevice.AddRange(i_listDevice);
+            //鏅鸿兘闂ㄩ攣
+            base.SetTitleText(Language.StringByID(StringId.shipinmensuo));
+
+            //鍒濆鍖栦腑閮ㄤ俊鎭�
+            this.InitMiddleFrame();
+        }
+
+        /// <summary>
+        /// 鍒濆鍖栦腑閮ㄤ俊鎭�
+        /// </summary>
+        private void InitMiddleFrame()
+        {
+            //娓呯┖bodyFrame
+            this.ClearBodyFrame();
+
+            string nowSelectId = string.Empty;
+            //妤煎眰涓嬫媺鍥炬爣
+            var btnFloor = new NormalViewControl(500, Application.GetRealHeight(16), false);
+            var btnFloorIcon = new IconViewControl(16);
+            btnFloorIcon.X = HdlControlResourse.XXLeft;
+            btnFloorIcon.Y = Application.GetRealHeight(18);
+            btnFloorIcon.UnSelectedImagePath = "Public/DownIcon.png";
+            bodyFrameLayout.AddChidren(btnFloorIcon);
+            btnFloorIcon.ButtonClickEvent += (sender, e) =>
+            {
+                //鏄剧ず涓嬫媺鍒楄〃
+                var form = new FloorRoomSelectPopupView();
+                form.ShowDeviceFunctionView(btnFloor, this.listDevice, (selectId, listFunc) =>
+                {
+                    btnFloor.Width = btnFloor.GetRealWidthByText();//閲嶇疆鏂囨湰瀹藉害
+                    nowSelectId = selectId;
+                    //閲嶆柊鍒濆鍖栭棬閿佸垪琛ㄦ帶浠�
+                    this.InitDoorListControl(listFunc);
+
+                }, nowSelectId);
+            };
+            //妤煎眰
+            btnFloor.X = btnFloorIcon.Right + Application.GetRealWidth(2);
+            btnFloor.TextColor = CSS_Color.FirstLevelTitleColor;
+            btnFloor.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
+            btnFloor.Text = DB_ResidenceData.Instance.CurFloor.roomName;
+            //btnFloor.Width = btnFloor.GetRealWidthByText();
+            bodyFrameLayout.AddChidren(btnFloor);
+            //璁╁畠鐩稿鍥炬爣灞呬腑
+            btnFloor.Y = btnFloorIcon.Y + (btnFloorIcon.Height - btnFloor.Height) / 2;
+            btnFloor.ButtonClickEvent += (sender, e) =>
+            {
+                btnFloorIcon.ButtonClickEvent(null, null);
+            };
+
+            //鍒楄〃鎺т欢
+            this.listView = new VerticalListControl();
+            listView.Y = Application.GetRealHeight(53);
+            listView.Height = bodyFrameLayout.Height - Application.GetRealHeight(53);
+            bodyFrameLayout.AddChidren(listView);
+
+            //鍒濆鍖栭棬閿佸垪琛ㄦ帶浠�
+            this.InitDoorListControl(this.listDevice);
+        }
+
+        #endregion
+
+        #region 鈻� 娣诲姞闂ㄩ攣鎺т欢_______________________
+
+        /// <summary>
+        /// 鍒濆鍖栭棬閿佸垪琛ㄦ帶浠�
+        /// </summary>
+        private void InitDoorListControl(List<Function> i_listDevice)
+        {
+            this.listView.RemoveAll();
+            this.dicBatteryContr = new Dictionary<string, BatteryPersentControl>();
+
+            //鐢熸垚闂ㄩ攣鎺т欢
+            foreach (var device in i_listDevice)
+            {
+                this.AddDoorControl(device);
+            }
+        }
+
+        /// <summary>
+        /// 娣诲姞闂ㄩ攣鎺т欢
+        /// </summary>
+        /// <param name="i_device">闂ㄩ攣瀵硅薄</param>
+        private void AddDoorControl(Function i_device)
+        {
+            //鐧借壊鑳屾櫙瀹瑰櫒
+            var frameBack = new FrameLayoutStatuControl();
+            frameBack.Width = Application.GetRealWidth(343);
+            frameBack.Height = Application.GetRealHeight(96);
+            frameBack.Radius = (uint)Application.GetRealWidth(12);
+            frameBack.Gravity = Gravity.CenterHorizontal;
+            frameBack.BackgroundColor = CSS_Color.MainBackgroundColor;
+            this.listView.AddChidren(frameBack);
+            //闂ㄩ攣鍥炬爣
+            var btnIcon = new IconViewControl(32);
+            btnIcon.X = Application.GetRealWidth(10);
+            btnIcon.Y = Application.GetRealHeight(15);
+            btnIcon.UnSelectedImagePath = "FunctionIcon/DoorLock/DoorLock.png";
+            frameBack.AddChidren(btnIcon, ChidrenBindMode.BindEvent);
+            //璁惧鍚嶅瓧
+            var btnName = new Button();
+            btnName.X = btnIcon.Right + Application.GetRealWidth(12);
+            btnName.Y = Application.GetRealHeight(12);
+            btnName.Width = Application.GetRealWidth(150);
+            btnName.Height = Application.GetRealHeight(20);
+            btnName.TextColor = CSS_Color.FirstLevelTitleColor;
+            btnName.TextAlignment = TextAlignment.CenterLeft;
+            btnName.Text = i_device.name;
+            frameBack.AddChidren(btnName, ChidrenBindMode.BindEvent);
+            //鎴块棿
+            var btnRoom = new Button();
+            btnRoom.X = btnName.X;
+            btnRoom.Y = btnName.Bottom + Application.GetRealHeight(4);
+            btnRoom.Width = Application.GetRealWidth(150);
+            btnRoom.Height = Application.GetRealHeight(15);
+            btnRoom.TextColor = CSS_Color.PromptingColor1;
+            btnRoom.TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel;
+            btnRoom.TextAlignment = TextAlignment.CenterLeft;
+            btnRoom.Text = i_device.GetRoomListName();
+            frameBack.AddChidren(btnRoom, ChidrenBindMode.BindEvent);
+            //鐢垫睜鍥炬爣
+            var btnBattery = new BatteryPersentControl();
+            btnBattery.Y = Application.GetRealHeight(62);
+            //frameBack.AddChidren(btnBattery, ChidrenBindMode.BindEvent);
+            btnBattery.InitControl();
+            btnBattery.SetValue(80);
+            btnBattery.X = frameBack.Width - btnBattery.Width - Application.GetRealWidth(12);
+            this.dicBatteryContr[i_device.sid] = btnBattery;
+            frameBack.ButtonClickEvent += (sender, e) =>
+            {
+                
+                var form = new VideoDoorLockPage(i_device, btnName, btnRoom, CommonMethod.Comerom.function,()=> {
+                    this.CloseForm();
+                    this.action?.Invoke();
+                });
+                MainPage.BasePageView.AddChidren(form);
+                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                form.Show();
+              
+            };
+
+            //搴曢儴鍐嶅姞涓棿璺�
+            var frameSpace = new FrameLayout();
+            frameSpace.Height = Application.GetRealHeight(12);
+            this.listView.AddChidren(frameSpace);
+        }
+
+        #endregion
+
+
+        #region 鈻� 璁惧鐘舵�佹帹閫乢______________________
+
+        /// <summary>
+        /// 璁惧鐘舵�佹帹閫�
+        /// </summary>
+        /// <param name="i_LocalDevice"></param>
+        public override void DeviceStatuPush(Function i_LocalDevice)
+        {
+            //涓嶆槸鐩爣璁惧
+            if (this.dicBatteryContr.ContainsKey(i_LocalDevice.sid) == false)
+            {
+                return;
+            }
+
+        }
+
+        #endregion
+
+      
+    }
+}
diff --git a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockPage.cs b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockPage.cs
new file mode 100644
index 0000000..49bbbf1
--- /dev/null
+++ b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorLockPage.cs
@@ -0,0 +1,511 @@
+锘縰sing Shared;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using HDL_ON.UI.CSS;
+using HDL_ON.Entity;
+using HDL_ON.DriverLayer;
+using HDL_ON.UI.Music;
+using HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock;
+
+namespace HDL_ON.UI
+{
+    /// <summary>
+    /// 瑙嗛闂ㄩ攣鐨勬帶鍒剁晫闈�
+    /// </summary>
+    public class VideoDoorLockPage : FrameLayout
+    {
+        #region 鈻� 鍙橀噺澹版槑___________________________
+        /// <summary>
+        /// 璁惧
+        /// </summary>
+        private Function device;
+        /// <summary>
+        /// 涓婁竴绾х晫闈㈢殑璁惧鍚嶅瓧鎺т欢
+        /// </summary>
+        private Button btnDeviceName;
+        /// <summary>
+        /// 涓婁竴绾х晫闈㈢殑鎴块棿鍚嶅瓧鎺т欢
+        /// </summary>
+        private Button btnRoomName;
+        /// <summary>
+        /// 澶撮儴甯冨眬
+        /// </summary>
+        private TopView topView;
+        /// <summary>
+        /// 褰撳墠璁惧鍚嶇О
+        /// </summary>
+        private Button btnCurrDeviceName;
+        /// <summary>
+        /// 鍖哄煙
+        /// </summary>
+        private Button btnCurrDeviceRoom;
+        /// <summary>
+        /// 鐢甸噺鐖舵帶浠�
+        /// </summary>
+        private FrameLayout cellFrame;
+        /// <summary>
+        /// 鐢甸噺
+        /// </summary>
+        private Button btnCell;
+        /// <summary>
+        /// 鐢甸噺杩涘害鏉�
+        /// </summary>
+        private DiyArcSeekBar cellDiyArcSeekBar;
+        /// <summary>
+        ///鏀惰棌鍥炬爣
+        /// </summary>
+        private Button btnCollectIcon;
+        /// <summary>
+        /// 闂ㄩ攣鐘舵��
+        /// </summary>
+        private Button btnDoorLockIcon;
+        /// <summary>
+        /// 瀹炴椂瑙嗛
+        /// </summary>
+        private CustomFrameLayout rtvFL;
+        /// <summary>
+        /// 涓存椂瀵嗙爜
+        /// </summary>
+        private CustomFrameLayout pswFL;
+        /// <summary>
+        /// 鍘嗗彶璁板綍
+        /// </summary>
+        private CustomFrameLayout recordFL;
+
+        /// <summary>
+        /// 琛ㄧず鏉ヨ嚜閭d釜鐣岄潰
+        /// </summary>
+        private CommonMethod.Comerom comerom;
+        /// <summary>
+        /// 鍒犻櫎璁惧鍚庨渶瑕佹洿鏂扮晫闈㈢殑鍥炶皟
+        /// </summary>
+        public Action action;
+        #endregion
+
+
+        /// <summary>
+        /// 鏋勯�犲嚱鏁�
+        /// </summary>
+        /// <param name="function">璁惧</param>
+        /// <param name="btnDeviceName">涓婁竴绾х晫闈㈢殑璁惧鍚嶅瓧鎺т欢(娉�:涓嶈兘浼爊ull,娌℃湁鍙互浼爊ew Button())</param>
+        /// <param name="btnRoomName">涓婁竴绾х晫闈㈢殑鎴块棿鍚嶅瓧鎺т欢(娉�:涓嶈兘浼爊ull,娌℃湁鍙互浼爊ew Button())</param> 
+        public VideoDoorLockPage(Function function, Button btnDeviceName, Button btnRoomName, CommonMethod.Comerom comerom, Action action)
+        {
+            this.device = function;
+            this.btnDeviceName = btnDeviceName;
+            this.btnRoomName = btnRoomName;
+            this.comerom = comerom;
+            this.action = action;
+
+        }
+
+        public void Show()
+        {
+            //鍒濆鍖朥I
+            this.InitUI();
+            //鍒濆鍖栦簨浠�
+            this.EventListener();
+            //璇诲彇鏁版嵁
+            this.ReadData();
+
+        }
+
+
+        /// <summary>
+        /// 鍒濆鍖栫晫闈�
+        /// </summary>
+        private void InitUI()
+        {
+            #region   ---鐣岄潰甯冨眬---
+            this.BackgroundColor = MusicColor.ViewColor;
+            this.topView = new TopView();
+            this.topView.setBtn.Visible = true;
+            this.topView.topNameBtn.TextID = StringId.shipinmensuo;
+            this.AddChidren(topView.TopFLayoutView());
+            var middleFl = new FrameLayout
+            {
+                Y = topView.fLayout.Bottom,
+                Height = Application.GetRealHeight(H_W.H - H_W.T_Height),
+            };
+            this.AddChidren(middleFl);
+
+            var whiteFl = new FrameLayout
+            {
+                Y = Application.GetRealHeight(24),
+                X = Application.GetRealWidth(24),
+                Height = Application.GetRealHeight(526),
+                Width = Application.GetRealWidth(327),
+                BackgroundImagePath = "MusicIcon/playBj.png",
+                Name = "fl",
+            };
+            middleFl.AddChidren(whiteFl);
+
+            btnCollectIcon = new Button
+            {
+                X = Application.GetRealWidth(264),
+                Y = Application.GetRealHeight(14),
+                Width = Application.GetRealWidth(40),
+                Height = Application.GetRealWidth(40),
+                UnSelectedImagePath = "MusicIcon/collect.png",
+                SelectedImagePath = "MusicIcon/collectSelected.png",
+                IsSelected = this.device.collect,
+                Name = "collect"
+            };
+            whiteFl.AddChidren(btnCollectIcon);
+
+            btnCurrDeviceName = new Button
+            {
+                TextSize = TextSize.Text24,
+                TextColor = MusicColor.Text18Color,
+                Width = Application.GetRealWidth(160),
+                Height = Application.GetRealHeight(33),
+                Y = Application.GetRealHeight(16),
+                X = Application.GetRealWidth(16),
+                Text = this.device.name,
+                TextAlignment = TextAlignment.CenterLeft,
+            };
+            whiteFl.AddChidren(btnCurrDeviceName);
+
+
+            btnCurrDeviceRoom = new Button
+            {
+                TextSize = TextSize.Text12,
+                TextColor = MusicColor.MusicNoTxetColor,
+                Width = Application.GetRealWidth(160),
+                Height = Application.GetRealHeight(17),
+                Y = btnCurrDeviceName.Bottom + Application.GetRealHeight(4),
+                X = Application.GetRealWidth(16),
+                Text = this.device.GetRoomListName(),
+                TextAlignment = TextAlignment.CenterLeft,
+            };
+            whiteFl.AddChidren(btnCurrDeviceRoom);
+
+            cellFrame = new FrameLayout
+            {
+                X = btnCurrDeviceRoom.Right + Application.GetRealWidth(20),
+                Y = btnCurrDeviceName.Bottom + Application.GetRealHeight(5),
+                Width = Application.GetRealWidth(30),
+                Height = Application.GetRealHeight(16),
+            };
+            whiteFl.AddChidren(cellFrame);
+
+            cellDiyArcSeekBar = new DiyArcSeekBar
+            {
+                X = Application.GetRealWidth(3),
+                Y = Application.GetRealHeight(3),
+                Width = cellFrame.Width + Application.GetRealWidth(-6),
+                Height = cellFrame.Height + Application.GetRealHeight(-6),
+                Progress = 60,
+                ProgressBarColor = MusicColor.MusicNoTxetColor,
+                MaxValue = 100,
+                MinValue = 0,
+
+                //IsCanMove = false,
+                //IsCanScrolled=false,
+            };
+            //cellFrame.AddChidren(cellDiyArcSeekBar);
+
+            btnCell = new Button
+            {
+                TextSize = TextSize.Text10,
+                TextColor = MusicColor.TextColor,
+                Text = "60" + "%",
+                TextAlignment = TextAlignment.Center,
+                UnSelectedImagePath = "FunctionIcon/DoorLock/Cell.png",
+            };
+            cellFrame.AddChidren(btnCell); 
+
+
+             //闂ㄩ攣鐘舵��
+             btnDoorLockIcon = new Button
+            {
+                X = Application.GetRealWidth(65),
+                Y = Application.GetRealHeight(108),
+                Width = Application.GetRealWidth(198),
+                Height = Application.GetRealWidth(200),
+                UnSelectedImagePath = "FunctionIcon/DoorLock/UnLocked.png",
+                SelectedImagePath = "FunctionIcon/DoorLock/UnLocking.png",
+            };
+            whiteFl.AddChidren(btnDoorLockIcon);
+
+            this.CalculatedPosition();//閲嶆柊璁$畻瀹藉害
+
+            int heightY = btnDoorLockIcon.Bottom + Application.GetRealHeight(70);
+            //瀹炴椂瑙嗛
+            rtvFL = new CustomFrameLayout(CustomFrameLayout.widthFrameLayout, CustomFrameLayout.heightFrameLayout);
+            whiteFl.AddChidren(rtvFL);
+            rtvFL.Y = heightY;
+            rtvFL.X = Application.GetRealWidth(41);
+            rtvFL.AddImageView();
+            rtvFL.AddTextButtonView();
+            rtvFL.GetImageButton().UnSelectedImagePath = "FunctionIcon/DoorLock/RTV.png";
+            rtvFL.GetTextButton().TextID = StringId.shishishipin;
+            //鍘嗗彶璁板綍
+            recordFL = new CustomFrameLayout(CustomFrameLayout.widthFrameLayout, CustomFrameLayout.heightFrameLayout);
+            whiteFl.AddChidren(recordFL);
+            recordFL.Y = heightY;
+            recordFL.X = rtvFL.Right + Application.GetRealWidth(CustomFrameLayout.interval);
+            recordFL.AddImageView();
+            recordFL.AddTextButtonView();
+            recordFL.GetImageButton().UnSelectedImagePath = "FunctionIcon/DoorLock/HistoryList.png";
+            recordFL.GetTextButton().TextID = StringId.lishijilu;
+            //涓存椂瀵嗙爜
+            pswFL = new CustomFrameLayout(CustomFrameLayout.widthFrameLayout, CustomFrameLayout.heightFrameLayout);
+            whiteFl.AddChidren(pswFL);
+            pswFL.Y = heightY;
+            pswFL.X = recordFL.Right + Application.GetRealWidth(CustomFrameLayout.interval);
+            pswFL.AddImageView();
+            pswFL.AddTextButtonView();
+            pswFL.GetImageButton().UnSelectedImagePath = "FunctionIcon/DoorLock/OneOpenLock.png";
+            pswFL.GetTextButton().TextID = StringId.linshimima1;
+
+
+
+            #endregion
+
+
+        }
+        /// <summary>
+        /// 娉ㄥ唽浜嬩欢
+        /// </summary>
+        private void EventListener()
+        {
+            //杩斿洖
+            this.topView.clickBackBtn.MouseUpEventHandler += (sender, e) =>
+            {
+                this.RemoveFromParent();
+            };
+            //璁剧疆
+            this.topView.clickSetBtn.MouseUpEventHandler += (sender, e) =>
+            {
+                CommonMethod.Current.MainThread(() =>
+                {
+                    //璋冪敤绉�缁曠殑鐣岄潰
+                    var infoView = new UI.FunctionBaseInfoSetPage(this.device, () =>
+                     {
+                         if (this.btnDeviceName == null || this.btnRoomName == null || this.device == null)
+                         {
+                             return;
+                         }
+                         ////鍒锋柊鏄剧ず
+                         this.btnDeviceName.Text = this.device.name;
+                         this.btnRoomName.Text = this.device.GetRoomListName();
+                         this.btnCurrDeviceName.Text = this.device.name;
+                         this.btnCurrDeviceRoom.Text = this.device.GetRoomListName();
+                         this.CalculatedPosition();//閲嶆柊璁$畻瀹藉害
+
+                     });
+                    //infoView.actionDel += () =>
+                    //  {
+                    //      //瑙g粦璁惧鍚�
+                    //      this.RemoveFromParent();
+                    //      this.action?.Invoke();
+
+                    //  };
+                    MainPage.BasePageView.AddChidren(infoView);
+                    infoView.LoadPage();
+                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                });
+            };
+            //鏀惰棌
+            this.btnCollectIcon.MouseUpEventHandler += (sender, e) =>
+            {
+                btnCollectIcon.IsSelected = this.device.collect = !btnCollectIcon.IsSelected;
+                this.device.CollectFunction();
+            };
+            //瀹炴椂瑙嗛
+            this.rtvFL.SetClickListener((fl, btnStateImage, btnStateText) =>
+            {
+                CommonMethod.Current.SkipRTVActivity(this.device.sid, this.device.deviceId, this.device.spk);
+            });
+            //涓存椂瀵嗙爜
+            this.pswFL.SetClickListener((fl, btnStateImage, btnStateText) =>
+            {
+                CommonMethod.Current.SkipPSWActivity(this.device.deviceId);
+            });
+            //鍘嗗彶璁板綍
+            this.recordFL.SetClickListener((fl, btnStateImage, btnStateText) =>
+            {
+                CommonMethod.Current.SkipRecordActivity(this.device.deviceId);
+            });
+
+
+        }
+        /// <summary>
+        /// 鍒濆鏁版嵁
+        /// </summary>
+        private void ReadData()
+        {
+            CommonMethod.Current.Loading.Start();
+            CommonMethod.Current.SunThread(() =>
+            {
+                try
+                {
+                    var videoDoorLockInfo = VideDoorLockSend.Current.GetVideoDoorLockState(this.device);
+                    var cellInfo = VideDoorLockSend.Current.GetCellValue(this.device);
+                    CommonMethod.Current.MainThread(() =>
+                    {
+                        //this.cellDiyArcSeekBar.Progress = i;
+                        //鏇存柊鐢甸噺鍊�
+                        this.btnCell.Text = cellInfo.remain + "%";
+                        this.btnDoorLockIcon.IsSelected = videoDoorLockInfo.doorStatus == "open";
+                    });
+                }
+                catch { }
+                finally
+                {
+                    Application.RunOnMainThread(() =>
+                    {
+                        CommonMethod.Current.Loading.Hide();
+                    });
+                }
+            });
+        }
+
+        /// <summary>
+        /// 閲嶆柊璁$畻瀹藉害(璁惧鍚嶇О,鎴块棿鎺т欢)
+        /// </summary>
+        private void CalculatedPosition()
+        {
+            this.btnCurrDeviceName.Width = this.btnCurrDeviceName.GetTextWidth();
+            if (this.btnCurrDeviceName.GetTextWidth() > this.btnCollectIcon.X)
+            {
+                //閲嶆柊璁$畻瀹藉害
+                this.btnCurrDeviceName.Width = this.btnCollectIcon.X + Application.GetRealWidth(-10);
+            }
+            this.btnCurrDeviceRoom.Width = this.btnCurrDeviceRoom.GetTextWidth();
+            if (this.btnCurrDeviceRoom.GetTextWidth() > this.btnCollectIcon.X)
+            {
+                //閲嶆柊璁$畻瀹藉害
+                this.btnCurrDeviceRoom.Width = this.btnCollectIcon.X + Application.GetRealWidth(-20 - 10);
+            }
+            this.cellFrame.X = this.btnCurrDeviceRoom.Right + Application.GetRealWidth(20);
+        }
+
+    }
+    /// <summary>
+    /// 鑷繁寮勪竴涓狥rameLayout
+    /// </summary>
+    class CustomFrameLayout : FrameLayout
+    {
+        public const int widthFrameLayout = 48;
+        public const int heightFrameLayout = 53;
+        public const int yFrameLayout = 378;
+        public const int xFrameLayout = 41;
+        public const int interval = 51;//琛屼腑鐨勫垪闂撮殧鍊�
+
+        public CustomFrameLayout(int width, int height, int x = 0, int y = 0)
+        {
+            this.Width = Application.GetRealWidth(width);
+            this.Height = Application.GetRealHeight(height);
+            this.X = Application.GetRealWidth(x);
+            this.Y = Application.GetRealHeight(y);
+
+        }
+        Button btnStateImage = new Button
+        {
+            Width = Application.GetRealWidth(32),
+            Height = Application.GetRealWidth(32),
+            Gravity = Gravity.TopCenter,
+            Name = "btnStateImage",
+
+        };
+        Button btnStateText = new Button
+        {
+            Y = Application.GetRealHeight(4),
+            Width = Application.GetRealWidth(100),
+            Height = Application.GetRealWidth(20),
+            TextID = StringId.dangqianmenweiguan,
+            TextSize = TextSize.Text12,
+            TextColor = MusicColor.TextCancelColor,
+            TextAlignment = TextAlignment.Center,
+            Gravity = Gravity.CenterHorizontal,
+            Name = "btnStateText"
+        };
+        public void AddImageView()
+        {
+            this.AddChidren(btnStateImage);
+
+        }
+        public void AddTextButtonView()
+        {
+            btnStateText.Y += btnStateImage.Bottom;
+            this.AddChidren(btnStateText);
+        }
+        public Button GetImageButton()
+        {
+            //if (!this.AddWithout(this.btnStateImage))
+            //{
+            //    this.AddImageView();
+            //}
+            return this.btnStateImage;
+        }
+        public Button GetTextButton()
+        {
+            //if (!this.AddWithout(this.btnStateText))
+            //{
+            //    this.AddTextButtonView();
+            //}
+            return this.btnStateText;
+        }
+
+        /// <summary>
+        /// 浜嬩欢鐩戝惉鏂规硶
+        /// </summary>
+        /// <param name="action">鍥炶皟(绗竴涓槸鐖剁被瀵硅薄;绗簩涓槸鍥炬爣瀵硅薄;绗笁涓槸鐘舵�佸璞�</param>
+        /// <param name="button1">娉ㄦ剰:鍦⊿etClickListener()鍓嶉潰璋冪敤AddImageView()鎵嶆湁鏁�</param>
+        /// <param name="button2">娉ㄦ剰:鍦⊿etClickListener()鍓嶉潰璋冪敤AddImageView()鎵嶆湁鏁�</param>
+        public void SetClickListener(Action<FrameLayout, Button, Button> action)
+        {
+            EventHandler<MouseEventArgs> click = (sender, e) =>
+                    {
+                        action?.Invoke(this, btnStateImage, btnStateText);
+                    };
+            this.MouseUpEventHandler += click;
+            btnStateImage.MouseUpEventHandler += click;
+            btnStateText.MouseUpEventHandler += click;
+
+        }
+
+
+
+        /// <summary>
+        /// 鍦ㄧ埗甯冨眬鏌ユ壘瀛愭帶浠舵槸鍚﹀瓨鍦�
+        /// </summary>
+        /// <param name="btn">鏌ユ壘瀵硅薄</param>
+        /// <returns>瀛樺湪涓簍rue,鍚﹀垯涓篺alse</returns>
+        private bool AddWithout(View btn)
+        {
+
+            if (this.ChildrenCount <= 0 || btn == null)
+            {
+                return false;
+            }
+            for (int i = 0; i < this.ChildrenCount; i++)
+            {
+                View view = this.GetChildren(i);
+                if (view == null)
+                {
+                    continue;
+                }
+                if (view is Button)
+                {
+                    if (view.Name == btn.Name)
+                    {
+                        return true;
+                    }
+                }
+
+            }
+            return false;
+
+        }
+
+
+
+
+    }
+
+
+}

--
Gitblit v1.8.0