wxr
2023-11-23 90d4fdb42a7f4818897ff76def0a151a99d2d9e1
2.4.2Google
20个文件已修改
28597 ■■■■■ 已修改文件
HDL-ON_Android/FengLinVideo/Form/MonitorFragment.cs 372 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/FengLinVideo/Form/ReverseCallFragment.cs 782 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/HDL-ON_Android.csproj 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Properties/AndroidManifest.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Resources/Resource.designer.cs 23144 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/VideoActivity.cs 842 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Common/ApiUtlis.cs 52 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Common/HDLCommon.cs 44 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/ThirdPartySdk/ESOnVideo.cs 60 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/ThirdPartySdk/HDLLinphone.cs 1622 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Entity/DB_ResidenceData.cs 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Entity/Enumerative/MyEnum.cs 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI0-Public/TopViewDiv.cs 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs 117 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPage.cs 78 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/Visitor/LpTimeDialogCallBak.cs 66 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/Visitor/LpTipDialogCallBack.cs 62 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/Visitor/VisitorHistoryPage.cs 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/Visitor/VisitorQRCodePage.cs 1258 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/CommonMethod.cs 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/FengLinVideo/Form/MonitorFragment.cs
@@ -1,210 +1,210 @@

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using Android.App;
using Android.Content;
using Android.Icu.Text;
using Android.OS;
using Android.Runtime;
using Android.Util;
using Android.Views;
using Android.Widget;
using Com.ETouchSky;
using Com.Tool;
using HDL_ON.DAL.Server;
using HDL_ON_Android.FengLinVideo.Interface;
using Java.Util;
using Org.Json;
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Threading;
//using Android.App;
//using Android.Content;
//using Android.Icu.Text;
//using Android.OS;
//using Android.Runtime;
//using Android.Util;
//using Android.Views;
//using Android.Widget;
//using Com.ETouchSky;
//using Com.Tool;
//using HDL_ON.DAL.Server;
//using HDL_ON_Android.FengLinVideo.Interface;
//using Java.Util;
//using Org.Json;
namespace HDL_ON_Android.FengLinVideo.Form
{
    public class MonitorFragment : Fragment, View.IOnClickListener, VideoState
    {
//namespace HDL_ON_Android.FengLinVideo.Form
//{
//    public class MonitorFragment : Fragment, View.IOnClickListener, VideoState
//    {
        private View mView;
        private VideoPhone mPhone;
//        private View mView;
//        private VideoPhone mPhone;
        // 截图
        private LinearLayout screenshotLayout;
        private ImageView screenImage;
        private TextView ScreenText;
//        // 截图
//        private LinearLayout screenshotLayout;
//        private ImageView screenImage;
//        private TextView ScreenText;
        //开锁
        private LinearLayout unlockLayout;
        private ImageView unlockImag;
        private TextView unlockText;
//        //开锁
//        private LinearLayout unlockLayout;
//        private ImageView unlockImag;
//        private TextView unlockText;
        // 更新线程
        public static Thread thread = null;
//        // 更新线程
//        public static Thread thread = null;
        public MonitorFragment(VideoPhone phone)
        {
            this.mPhone = phone;
        }
//        public MonitorFragment(VideoPhone phone)
//        {
//            this.mPhone = phone;
//        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            mView = inflater.Inflate(Resource.Layout.fragment_monitor, container, false);
//        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
//        {
//            mView = inflater.Inflate(Resource.Layout.fragment_monitor, container, false);
            IniView();
//            IniView();
            return mView;
        }
//            return mView;
//        }
        private void IniView()
        {
            screenshotLayout = (LinearLayout)mView.FindViewById(Resource.Id.icon_sceenshotLayout);
            screenImage = (ImageView)mView.FindViewById(Resource.Id.icon_sceenshotImg);
            ScreenText = (TextView)mView.FindViewById(Resource.Id.icon_sceenshotText);
//        private void IniView()
//        {
//            screenshotLayout = (LinearLayout)mView.FindViewById(Resource.Id.icon_sceenshotLayout);
//            screenImage = (ImageView)mView.FindViewById(Resource.Id.icon_sceenshotImg);
//            ScreenText = (TextView)mView.FindViewById(Resource.Id.icon_sceenshotText);
            unlockLayout = (LinearLayout)mView.FindViewById(Resource.Id.icon_unlockLayout);
            unlockImag = (ImageView)mView.FindViewById(Resource.Id.icon_unlockImg);
            unlockText = (TextView)mView.FindViewById(Resource.Id.icon_unlockText);
//            unlockLayout = (LinearLayout)mView.FindViewById(Resource.Id.icon_unlockLayout);
//            unlockImag = (ImageView)mView.FindViewById(Resource.Id.icon_unlockImg);
//            unlockText = (TextView)mView.FindViewById(Resource.Id.icon_unlockText);
            unlockLayout.SetOnClickListener(this);
            screenshotLayout.SetOnClickListener(this);
        }
//            unlockLayout.SetOnClickListener(this);
//            screenshotLayout.SetOnClickListener(this);
//        }
        /// <summary>
        /// 开锁
        /// </summary>
        private void Unlock()
        {
            if (mPhone != null)
            {
                try
                {
                    unlockImag.Selected = true;
                    JSONObject ht = new JSONObject();
                    ht.Put("command", "open");//固定参数
                    ht.Put("room_id", VideoActivity.Roomno);
                    ht.Put("devType", 7);
                    mPhone.SendCustomData(ht.ToString());
                }
                catch { }
            }
        }
//        /// <summary>
//        /// 开锁
//        /// </summary>
//        private void Unlock()
//        {
//            if (mPhone != null)
//            {
//                try
//                {
//                    unlockImag.Selected = true;
//                    JSONObject ht = new JSONObject();
//                    ht.Put("command", "open");//固定参数
//                    ht.Put("room_id", VideoActivity.Roomno);
//                    ht.Put("devType", 7);
//                    mPhone.SendCustomData(ht.ToString());
//                }
//                catch { }
//            }
//        }
        /// <summary>
        /// 更新开锁按钮状态
        /// </summary>
        private void UpdataUnlockState()
        {
            try
            {
                //开锁成功,15秒内不给再点击按钮
                unlockLayout.Enabled = false;
                if (thread != null)
                {
                    try
                    {
                        thread.Interrupt();
                    }
                    catch { }
                    thread = null;
                }
//        /// <summary>
//        /// 更新开锁按钮状态
//        /// </summary>
//        private void UpdataUnlockState()
//        {
//            try
//            {
//                //开锁成功,15秒内不给再点击按钮
//                unlockLayout.Enabled = false;
//                if (thread != null)
//                {
//                    try
//                    {
//                        thread.Interrupt();
//                    }
//                    catch { }
//                    thread = null;
//                }
                thread = new Thread(() =>
                {
                    try
                    {
                        Thread.Sleep(15 * 1000);
//                thread = new Thread(() =>
//                {
//                    try
//                    {
//                        Thread.Sleep(15 * 1000);
                        Activity.RunOnUiThread(() =>
                        {
                            if (unlockLayout != null)
                                unlockLayout.Enabled = true;
                        });
                    }
                    catch { }
                });
//                        Activity.RunOnUiThread(() =>
//                        {
//                            if (unlockLayout != null)
//                                unlockLayout.Enabled = true;
//                        });
//                    }
//                    catch { }
//                });
                thread.Start();
            }
            catch { }
        }
//                thread.Start();
//            }
//            catch { }
//        }
        public void OnClick(View v)
        {
            //
            if (v.Equals(unlockLayout))
            {
                if (mPhone != null)
                    Unlock();
            }
            else if (v.Equals(screenshotLayout))
            {
//        public void OnClick(View v)
//        {
//            //
//            if (v.Equals(unlockLayout))
//            {
//                if (mPhone != null)
//                    Unlock();
//            }
//            else if (v.Equals(screenshotLayout))
//            {
                //有视频过来可调用此接口进行拍照
                if (mPhone != null)
                {
                    // 内部储存/DCIM/Camera/.....jpg
                    screenImage.Selected = true;
                    SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
                    string time = format.Format(new Date(SystemClock.CurrentThreadTimeMillis()));
                    string ss = Android.OS.Environment.ExternalStorageDirectory.Path + "/DCIM/Camera";
                    string path = ss + "/" + time + ".jpg";
                    mPhone.Snap(path);
                    //2021-09-01 增加发送广播,通知刷新图库的显示
                    HDLONUtils.SendBroadcastScanFile(this.Context, path);
                }
            }
        }
//                //有视频过来可调用此接口进行拍照
//                if (mPhone != null)
//                {
//                    // 内部储存/DCIM/Camera/.....jpg
//                    screenImage.Selected = true;
//                    SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
//                    string time = format.Format(new Date(SystemClock.CurrentThreadTimeMillis()));
//                    string ss = Android.OS.Environment.ExternalStorageDirectory.Path + "/DCIM/Camera";
//                    string path = ss + "/" + time + ".jpg";
//                    mPhone.Snap(path);
//                    //2021-09-01 增加发送广播,通知刷新图库的显示
//                    HDLONUtils.SendBroadcastScanFile(this.Context, path);
//                }
//            }
//        }
        /// <summary>
        /// 通话状态回调方法
        /// </summary>
        /// <param name="msg"></param>
        public void OnPhoneEvent(string msg)
        {
            try
            {
                //
                TextProtocol tp = new TextProtocol();
                tp.Parse(msg);
                string event1 = tp.GetString("event");
//        /// <summary>
//        /// 通话状态回调方法
//        /// </summary>
//        /// <param name="msg"></param>
//        public void OnPhoneEvent(string msg)
//        {
//            try
//            {
//                //
//                TextProtocol tp = new TextProtocol();
//                tp.Parse(msg);
//                string event1 = tp.GetString("event");
                switch (event1)
                {
                    case "EVT_HangUp"://挂断
                        Activity.Finish();
                        break;
                    case "EVT_RECV_CUSTOM_DATA":
                        UpdataUnlockState();
                        break;
                    case "EVT_SnapAck":
                        int error = tp.GetInt("error");
                        string filePath = tp.GetString("filePath");
                        if (error == 0)
                        {
                            screenImage.Selected = true;
                        }
                        else
                        {
                            screenImage.Selected = false;
                        }
                        break;
                }
            }
            catch { }
        }
//                switch (event1)
//                {
//                    case "EVT_HangUp"://挂断
//                        Activity.Finish();
//                        break;
//                    case "EVT_RECV_CUSTOM_DATA":
//                        UpdataUnlockState();
//                        break;
//                    case "EVT_SnapAck":
//                        int error = tp.GetInt("error");
//                        string filePath = tp.GetString("filePath");
//                        if (error == 0)
//                        {
//                            screenImage.Selected = true;
//                        }
//                        else
//                        {
//                            screenImage.Selected = false;
//                        }
//                        break;
//                }
//            }
//            catch { }
//        }
        public override void OnDestroy()
        {
            base.OnDestroy();
//        public override void OnDestroy()
//        {
//            base.OnDestroy();
            if (thread != null)
            {
                try
                {
                    thread.Interrupt();
                }
                catch { }
                thread = null;
            }
        }
    }
}
//            if (thread != null)
//            {
//                try
//                {
//                    thread.Interrupt();
//                }
//                catch { }
//                thread = null;
//            }
//        }
//    }
//}
HDL-ON_Android/FengLinVideo/Form/ReverseCallFragment.cs
@@ -1,442 +1,442 @@

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using Android.App;
using Android.Content;
using Android.Icu.Text;
using Android.OS;
using Android.Runtime;
using Android.Util;
using Android.Views;
using Android.Widget;
using Com.ETouchSky;
using Com.Tool;
using HDL_ON.Common;
using HDL_ON.DAL.Server;
using HDL_ON_Android.FengLinVideo.Interface;
using Java.Util;
using Org.Json;
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Threading;
//using Android.App;
//using Android.Content;
//using Android.Icu.Text;
//using Android.OS;
//using Android.Runtime;
//using Android.Util;
//using Android.Views;
//using Android.Widget;
//using Com.ETouchSky;
//using Com.Tool;
//using HDL_ON.Common;
//using HDL_ON.DAL.Server;
//using HDL_ON_Android.FengLinVideo.Interface;
//using Java.Util;
//using Org.Json;
namespace HDL_ON_Android.FengLinVideo.Form
{
    public class ReverseCallFragment : Fragment, View.IOnClickListener, VideoState
    {
        private VideoPhone mPhone;
        private string param = "";
        private bool isCalling = false;
//namespace HDL_ON_Android.FengLinVideo.Form
//{
//    public class ReverseCallFragment : Fragment, View.IOnClickListener, VideoState
//    {
//        private VideoPhone mPhone;
//        private string param = "";
//        private bool isCalling = false;
        private View mView;
//        private View mView;
        private ImageView screenshotImg;// 截图
        private ImageView unlockImg;// 开锁
        private LinearLayout answerLayout; // 接听
        private ImageView hangupImg; // 接听
        private ImageView answerImg;// 挂断
        private TextView hangupText;
//        private ImageView screenshotImg;// 截图
//        private ImageView unlockImg;// 开锁
//        private LinearLayout answerLayout; // 接听
//        private ImageView hangupImg; // 接听
//        private ImageView answerImg;// 挂断
//        private TextView hangupText;
        private TextView tvTip;
//        private TextView tvTip;
        private System.Threading.Timer timer = null;
        private int Time = 0;
//        private System.Threading.Timer timer = null;
//        private int Time = 0;
        public ReverseCallFragment(VideoPhone _phone, string _param)
        {
            this.mPhone = _phone;
            this.param = _param;
        }
//        public ReverseCallFragment(VideoPhone _phone, string _param)
//        {
//            this.mPhone = _phone;
//            this.param = _param;
//        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            mView = inflater.Inflate(Resource.Layout.fragment_call, container, false);
//        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
//        {
//            mView = inflater.Inflate(Resource.Layout.fragment_call, container, false);
            IniView();
            ReverseCall(param);
//            IniView();
//            ReverseCall(param);
            return mView;
        }
//            return mView;
//        }
        private void IniView()
        {
            screenshotImg = (ImageView)mView.FindViewById(Resource.Id.callScreenshotImg);//
            unlockImg = (ImageView)mView.FindViewById(Resource.Id.callUnlockImg);//
            tvTip = (TextView)mView.FindViewById(Resource.Id.callTipText);
            answerLayout = (LinearLayout)mView.FindViewById(Resource.Id.callAnswerLayout);
            hangupImg = (ImageView)mView.FindViewById(Resource.Id.callHangupImg);
            answerImg = (ImageView)mView.FindViewById(Resource.Id.callAnswerImg);
            hangupText = (TextView)mView.FindViewById(Resource.Id.callHangupText);
//        private void IniView()
//        {
//            screenshotImg = (ImageView)mView.FindViewById(Resource.Id.callScreenshotImg);//
//            unlockImg = (ImageView)mView.FindViewById(Resource.Id.callUnlockImg);//
//            tvTip = (TextView)mView.FindViewById(Resource.Id.callTipText);
//            answerLayout = (LinearLayout)mView.FindViewById(Resource.Id.callAnswerLayout);
//            hangupImg = (ImageView)mView.FindViewById(Resource.Id.callHangupImg);
//            answerImg = (ImageView)mView.FindViewById(Resource.Id.callAnswerImg);
//            hangupText = (TextView)mView.FindViewById(Resource.Id.callHangupText);
            screenshotImg.SetOnClickListener(this);
            unlockImg.SetOnClickListener(this);
            hangupImg.SetOnClickListener(this);
            answerImg.SetOnClickListener(this);
//            screenshotImg.SetOnClickListener(this);
//            unlockImg.SetOnClickListener(this);
//            hangupImg.SetOnClickListener(this);
//            answerImg.SetOnClickListener(this);
            hangupText.SetText(GetString(Resource.String.video_not_answer), null);
            tvTip.SetText(GetString(Resource.String.calling), null);
        }
//            hangupText.SetText(GetString(Resource.String.video_not_answer), null);
//            tvTip.SetText(GetString(Resource.String.calling), null);
//        }
        /// <summary>
        /// 一般是推送过的来电信息时调用此接口打开视频窗口。然后可调用mPhone.acceptRing(param);接收来电信息
        /// </summary>
        /// <param name="param"></param>
        private void ReverseCall(string param)
        {
            if (mPhone != null)
            {
                mPhone.ReverseCall(param);
            }
        }
//        /// <summary>
//        /// 一般是推送过的来电信息时调用此接口打开视频窗口。然后可调用mPhone.acceptRing(param);接收来电信息
//        /// </summary>
//        /// <param name="param"></param>
//        private void ReverseCall(string param)
//        {
//            if (mPhone != null)
//            {
//                mPhone.ReverseCall(param);
//            }
//        }
        /// <summary>
        /// 开锁
        /// </summary>
        private void Unlock()
        {
            //开锁,当收到来电信息时可进行开锁操作
            if (mPhone != null)
            {
                try
                {
                    unlockImg.Selected = true;
                    JSONObject ht = new JSONObject();
                    ht.Put("command", "open");//固定参数
                    ht.Put("room_id", 123); //动态参数 ,传递开门的房间号。这个开门口记录就能记录谁开的门
                    ht.Put("devType", 7); //固定参数
                    mPhone.SendCustomData(ht.ToString());
                }
                catch (Exception e)
                {
                    string erro = e.Message;
                }
            }
        }
//        /// <summary>
//        /// 开锁
//        /// </summary>
//        private void Unlock()
//        {
//            //开锁,当收到来电信息时可进行开锁操作
//            if (mPhone != null)
//            {
//                try
//                {
//                    unlockImg.Selected = true;
//                    JSONObject ht = new JSONObject();
//                    ht.Put("command", "open");//固定参数
//                    ht.Put("room_id", 123); //动态参数 ,传递开门的房间号。这个开门口记录就能记录谁开的门
//                    ht.Put("devType", 7); //固定参数
//                    mPhone.SendCustomData(ht.ToString());
//                }
//                catch (Exception e)
//                {
//                    string erro = e.Message;
//                }
//            }
//        }
        public static Thread unlockThread = null;//公开出来,关闭activity的时候要结束这个线程,不然会引起崩溃
        /// <summary>
        /// 更新开锁按钮状态,开锁成功,15秒内不给再点击按钮
        /// </summary>
        private void UpdataUnlockState()
        {
            try
            {
                if (unlockImg == null) return;
//        public static Thread unlockThread = null;//公开出来,关闭activity的时候要结束这个线程,不然会引起崩溃
//        /// <summary>
//        /// 更新开锁按钮状态,开锁成功,15秒内不给再点击按钮
//        /// </summary>
//        private void UpdataUnlockState()
//        {
//            try
//            {
//                if (unlockImg == null) return;
                unlockImg.Enabled = false;
//                unlockImg.Enabled = false;
                unlockThread = new Thread(() =>
                  {
                      try
                      {
                          Thread.Sleep(15 * 1000);
//                unlockThread = new Thread(() =>
//                  {
//                      try
//                      {
//                          Thread.Sleep(15 * 1000);
                          
                      Activity.RunOnUiThread(() =>
                      {
                          try {
                              if (unlockImg != null)
                                  unlockImg.Enabled = true;
                          }
                          catch { }
                      });
//                      Activity.RunOnUiThread(() =>
//                      {
//                          try {
//                              if (unlockImg != null)
//                                  unlockImg.Enabled = true;
//                          }
//                          catch { }
//                      });
                      }
                      catch { }
                  });//.Start();
//                      }
//                      catch { }
//                  });//.Start();
                unlockThread.Start();
//                unlockThread.Start();
                PostUnlock();
            }
            catch { }
        }
//                PostUnlock();
//            }
//            catch { }
//        }
        private string GetTime(int time)
        {
//        private string GetTime(int time)
//        {
            int m = time / 60;
            int s = time % 60;
//            int m = time / 60;
//            int s = time % 60;
            return UnitFormat(m) + ":" + UnitFormat(s);
//            return UnitFormat(m) + ":" + UnitFormat(s);
        }
//        }
        private static string UnitFormat(int i)
        {
            string retStr = null;
            if (i >= 0 && i < 10)
                retStr = "0" + i;
            else
                retStr = "" + i;
            return retStr;
        }
//        private static string UnitFormat(int i)
//        {
//            string retStr = null;
//            if (i >= 0 && i < 10)
//                retStr = "0" + i;
//            else
//                retStr = "" + i;
//            return retStr;
//        }
        /// <summary>
        /// 通话记录计时器,从拉流成功开始计算时间
        /// </summary>
        private void TimeStarts()
        {
            try
            {
                if (timer != null)
                    timer.Dispose();
//        /// <summary>
//        /// 通话记录计时器,从拉流成功开始计算时间
//        /// </summary>
//        private void TimeStarts()
//        {
//            try
//            {
//                if (timer != null)
//                    timer.Dispose();
                TimerCallback timerCallback = new TimerCallback(Tick);
                timer = new System.Threading.Timer(timerCallback, null, 0, 1000);
//                TimerCallback timerCallback = new TimerCallback(Tick);
//                timer = new System.Threading.Timer(timerCallback, null, 0, 1000);
            }
            catch (Exception) { }
        }
//            }
//            catch (Exception) { }
//        }
        private void TimeEnd()
        {
            Time = 0;
//        private void TimeEnd()
//        {
//            Time = 0;
            if (timer != null)
            {
                timer.Dispose();
                timer = null;
            }
        }
//            if (timer != null)
//            {
//                timer.Dispose();
//                timer = null;
//            }
//        }
        public void Tick(Object state)
        {
            try
            {
                Activity.RunOnUiThread(() =>
                {
                    try
                    {
                        Time++;
                        if (tvTip != null)
                            tvTip.SetText(GetTime(Time), null);
                    }
                    catch { }
                });
            }
            catch { }
        }
//        public void Tick(Object state)
//        {
//            try
//            {
//                Activity.RunOnUiThread(() =>
//                {
//                    try
//                    {
//                        Time++;
//                        if (tvTip != null)
//                            tvTip.SetText(GetTime(Time), null);
//                    }
//                    catch { }
//                });
//            }
//            catch { }
//        }
        /// <summary>
        /// 通话消息回调方法
        /// </summary>
        /// <param name="msg"></param>
        public void OnPhoneEvent(string msg)
        {
            try
            {
                //
                TextProtocol tp = new TextProtocol();
                tp.Parse(msg);
                string event1 = tp.GetString("event");
//        /// <summary>
//        /// 通话消息回调方法
//        /// </summary>
//        /// <param name="msg"></param>
//        public void OnPhoneEvent(string msg)
//        {
//            try
//            {
//                //
//                TextProtocol tp = new TextProtocol();
//                tp.Parse(msg);
//                string event1 = tp.GetString("event");
                switch (event1)
                {
                    case "EVT_RECV_CUSTOM_DATA":// 开锁成功
                        string data = tp.GetString("data");
                        UpdataUnlockState();
                        break;
                    case "EVT_StartStream":// 拉流成功,开始记录通话时间
                        isCalling = true;
                        TimeStarts();
                        hangupText.SetText(GetString(Resource.String.video_hang_up), null);
                        break;
                    case "EVT_StopStream":
                        if (isCalling == false)
                            PostReject();// 拒接
                        else
                            PostHangup();// 正常挂断
                        break;
                    case "EVT_SnapAck":
                        int error = tp.GetInt("error");
                        string filePath = tp.GetString("filePath");
                        if (error == 0)
                        {
                            screenshotImg.Selected = true;
                            PostScreenshot(filePath);
                        }
                        else
                        {
                            screenshotImg.Selected = false;
                        }
                        break;
                }
            }
            catch (Exception e)
            {
                string error = e.Message;
            }
        }
//                switch (event1)
//                {
//                    case "EVT_RECV_CUSTOM_DATA":// 开锁成功
//                        string data = tp.GetString("data");
//                        UpdataUnlockState();
//                        break;
//                    case "EVT_StartStream":// 拉流成功,开始记录通话时间
//                        isCalling = true;
//                        TimeStarts();
//                        hangupText.SetText(GetString(Resource.String.video_hang_up), null);
//                        break;
//                    case "EVT_StopStream":
//                        if (isCalling == false)
//                            PostReject();// 拒接
//                        else
//                            PostHangup();// 正常挂断
//                        break;
//                    case "EVT_SnapAck":
//                        int error = tp.GetInt("error");
//                        string filePath = tp.GetString("filePath");
//                        if (error == 0)
//                        {
//                            screenshotImg.Selected = true;
//                            PostScreenshot(filePath);
//                        }
//                        else
//                        {
//                            screenshotImg.Selected = false;
//                        }
//                        break;
//                }
//            }
//            catch (Exception e)
//            {
//                string error = e.Message;
//            }
//        }
        public void OnClick(View v)
        {
            if (v.Equals(answerImg))
            {
                //接收来电
                if (mPhone != null)
                {
                    if (mPhone.IsRinging)
                    {
                        string UserData = "user text";
                        //注意:RequestAudio 请求对方音频,RequestVideo请求对方视频 SendAudio发送本地音频 SendVideo 发送本地视频 一般门口不接收到视频,所以最好设置0,减少流量消耗
                        string param = string.Format("RequestAudio=1\r\n" + "RequestVideo=1\r\n" + "SendAudio=1\r\n" + "SendVideo=1r\n" + "UserData=%s\r\n", UserData);
                        mPhone.AcceptRing(param);
                        answerLayout.Visibility = ViewStates.Gone;
                        PostAnswer();
                    }
                }
            }
            else if (v.Equals(hangupImg))
            {
                if (mPhone != null)
                {
                    mPhone.HangUp();
                    TimeEnd();
                }
                Activity.Finish();
            }
            else if (v.Equals(screenshotImg))
            {
                //有视频过来可调用此接口进行拍照
                if (mPhone != null)
                {
                    // 内部储存/DCIM/Camera/.....jpg
                    screenshotImg.Selected = true;
                    SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
                    string time = format.Format(new Date(SystemClock.CurrentThreadTimeMillis()));
                    string ss = Android.OS.Environment.ExternalStorageDirectory.Path + "/DCIM/Camera";
                    string path = ss + "/" + time + ".jpg";
                    mPhone.Snap(path);
                    //2021-09-01 增加发送广播,通知刷新图库的显示
                    HDLONUtils.SendBroadcastScanFile(this.Context, path);
                }
            }
            else if (v.Equals(unlockImg))
            {
                Unlock();
            }
        }
//        public void OnClick(View v)
//        {
//            if (v.Equals(answerImg))
//            {
//                //接收来电
//                if (mPhone != null)
//                {
//                    if (mPhone.IsRinging)
//                    {
//                        string UserData = "user text";
//                        //注意:RequestAudio 请求对方音频,RequestVideo请求对方视频 SendAudio发送本地音频 SendVideo 发送本地视频 一般门口不接收到视频,所以最好设置0,减少流量消耗
//                        string param = string.Format("RequestAudio=1\r\n" + "RequestVideo=1\r\n" + "SendAudio=1\r\n" + "SendVideo=1r\n" + "UserData=%s\r\n", UserData);
//                        mPhone.AcceptRing(param);
//                        answerLayout.Visibility = ViewStates.Gone;
//                        PostAnswer();
//                    }
//                }
//            }
//            else if (v.Equals(hangupImg))
//            {
//                if (mPhone != null)
//                {
//                    mPhone.HangUp();
//                    TimeEnd();
//                }
//                Activity.Finish();
//            }
//            else if (v.Equals(screenshotImg))
//            {
//                //有视频过来可调用此接口进行拍照
//                if (mPhone != null)
//                {
//                    // 内部储存/DCIM/Camera/.....jpg
//                    screenshotImg.Selected = true;
//                    SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
//                    string time = format.Format(new Date(SystemClock.CurrentThreadTimeMillis()));
//                    string ss = Android.OS.Environment.ExternalStorageDirectory.Path + "/DCIM/Camera";
//                    string path = ss + "/" + time + ".jpg";
//                    mPhone.Snap(path);
//                    //2021-09-01 增加发送广播,通知刷新图库的显示
//                    HDLONUtils.SendBroadcastScanFile(this.Context, path);
//                }
//            }
//            else if (v.Equals(unlockImg))
//            {
//                Unlock();
//            }
//        }
        /// <summary>
        /// post 截图
        /// </summary>
        /// <param name="path">截图保留的路径</param>
        private void PostScreenshot(string path)
        {
            new Thread(() =>
            {
                try
                {
                    string[] str = path.Split("/");
                    string img_name = str.GetValue(str.Length - 1).ToString().Replace(".jpg", "");
                    byte[] images = FileUtlis.Files.ReadFileForPath(path);
                    Dictionary<string, object> d = new Dictionary<string, object>();
                    d.Add("callId", VideoActivity.CallId);
                    d.Add("images", images);
                    d.Add("imagesName", "_Android.jpg");
                    string jsonString = HttpUtil.GetSignRequestJson(d);
//        /// <summary>
//        /// post 截图
//        /// </summary>
//        /// <param name="path">截图保留的路径</param>
//        private void PostScreenshot(string path)
//        {
//            new Thread(() =>
//            {
//                try
//                {
//                    string[] str = path.Split("/");
//                    string img_name = str.GetValue(str.Length - 1).ToString().Replace(".jpg", "");
//                    byte[] images = FileUtlis.Files.ReadFileForPath(path);
//                    Dictionary<string, object> d = new Dictionary<string, object>();
//                    d.Add("callId", VideoActivity.CallId);
//                    d.Add("images", images);
//                    d.Add("imagesName", "_Android.jpg");
//                    string jsonString = HttpUtil.GetSignRequestJson(d);
                    string url = "/home-wisdom/app/fl/vi/screenshot";
                    ResponsePackNew response = HttpUtil.RequestHttpsPost(url, jsonString);
                    Log.Info("FengLinVideo", "Post Screenshot Response code=" + response.Code);
                }
                catch { }
//                    string url = "/home-wisdom/app/fl/vi/screenshot";
//                    ResponsePackNew response = HttpUtil.RequestHttpsPost(url, jsonString);
//                    Log.Info("FengLinVideo", "Post Screenshot Response code=" + response.Code);
//                }
//                catch { }
            }).Start();
        }
//            }).Start();
//        }
        /// <summary>
        /// post 接听电话记录
        /// </summary>
        private void PostAnswer()
        {
            new Thread(() =>
            {
                try
                {
                    Dictionary<string, object> d = new Dictionary<string, object>();
                    d.Add("uuid", VideoActivity.UUId);//丰林请求的唯一id string
                    d.Add("cmtID", VideoActivity.CmtID);//丰林社区id string
                    d.Add("roomno", VideoActivity.Roomno);//丰林房间号 string
                    d.Add("unitno", VideoActivity.Unitno);//丰林楼栋号 string
                    d.Add("HomeID", VideoActivity.HomeID);//丰林住宅id string
                    d.Add("callId", VideoActivity.CallId);//呼叫记录id int
                    string jsonString = HttpUtil.GetSignRequestJson(d);
//        /// <summary>
//        /// post 接听电话记录
//        /// </summary>
//        private void PostAnswer()
//        {
//            new Thread(() =>
//            {
//                try
//                {
//                    Dictionary<string, object> d = new Dictionary<string, object>();
//                    d.Add("uuid", VideoActivity.UUId);//丰林请求的唯一id string
//                    d.Add("cmtID", VideoActivity.CmtID);//丰林社区id string
//                    d.Add("roomno", VideoActivity.Roomno);//丰林房间号 string
//                    d.Add("unitno", VideoActivity.Unitno);//丰林楼栋号 string
//                    d.Add("HomeID", VideoActivity.HomeID);//丰林住宅id string
//                    d.Add("callId", VideoActivity.CallId);//呼叫记录id int
//                    string jsonString = HttpUtil.GetSignRequestJson(d);
                    string url = "/home-wisdom/app/fl/vi/answer";
                    ResponsePackNew response = HttpUtil.RequestHttpsPost(url, jsonString);
                    Log.Info("FengLinVideo", "Post Answer Response code=" + response.Code);
                }
                catch { }
//                    string url = "/home-wisdom/app/fl/vi/answer";
//                    ResponsePackNew response = HttpUtil.RequestHttpsPost(url, jsonString);
//                    Log.Info("FengLinVideo", "Post Answer Response code=" + response.Code);
//                }
//                catch { }
            }).Start();
        }
//            }).Start();
//        }
        /// <summary>
        /// post 挂断电话记录
        /// </summary>
        private void PostHangup()
        {
            new Thread(() =>
            {
                try
                {
                    Dictionary<string, object> d = new Dictionary<string, object>();
                    d.Add("callId", VideoActivity.CallId);//呼叫记录id int
                    d.Add("callDuration", Time);//通话时长(秒) int
                    string jsonString = HttpUtil.GetSignRequestJson(d);
//        /// <summary>
//        /// post 挂断电话记录
//        /// </summary>
//        private void PostHangup()
//        {
//            new Thread(() =>
//            {
//                try
//                {
//                    Dictionary<string, object> d = new Dictionary<string, object>();
//                    d.Add("callId", VideoActivity.CallId);//呼叫记录id int
//                    d.Add("callDuration", Time);//通话时长(秒) int
//                    string jsonString = HttpUtil.GetSignRequestJson(d);
                    string url = "/home-wisdom/app/fl/vi/hang-up";
                    ResponsePackNew response = HttpUtil.RequestHttpsPost(url, jsonString);
                    Log.Info("FengLinVideo", "Post Hangup Response code=" + response.Code);
                }
                catch { }
//                    string url = "/home-wisdom/app/fl/vi/hang-up";
//                    ResponsePackNew response = HttpUtil.RequestHttpsPost(url, jsonString);
//                    Log.Info("FengLinVideo", "Post Hangup Response code=" + response.Code);
//                }
//                catch { }
            }).Start();
        }
//            }).Start();
//        }
        /// <summary>
        /// post 拒接记录
        /// </summary>
        private void PostReject()
        {
            new Thread(() =>
            {
                try
                {
                    Dictionary<string, object> d = new Dictionary<string, object>();
                    d.Add("callId", VideoActivity.CallId);//呼叫记录id int
                    string jsonString = HttpUtil.GetSignRequestJson(d);
//        /// <summary>
//        /// post 拒接记录
//        /// </summary>
//        private void PostReject()
//        {
//            new Thread(() =>
//            {
//                try
//                {
//                    Dictionary<string, object> d = new Dictionary<string, object>();
//                    d.Add("callId", VideoActivity.CallId);//呼叫记录id int
//                    string jsonString = HttpUtil.GetSignRequestJson(d);
                    string url = "/home-wisdom/app/fl/vi/reject";
                    ResponsePackNew response = HttpUtil.RequestHttpsPost(url, jsonString);
                    Log.Info("FengLinVideo", "Post Reject Response code=" + response.Code);
                }
                catch { }
//                    string url = "/home-wisdom/app/fl/vi/reject";
//                    ResponsePackNew response = HttpUtil.RequestHttpsPost(url, jsonString);
//                    Log.Info("FengLinVideo", "Post Reject Response code=" + response.Code);
//                }
//                catch { }
            }).Start();
        }
//            }).Start();
//        }
        /// <summary>
        /// post 开锁记录
        /// </summary>
        private void PostUnlock()
        {
            new Thread(() =>
            {
                try
                {
                    Dictionary<string, object> d = new Dictionary<string, object>();
                    d.Add("callId", VideoActivity.CallId);//呼叫记录id int
                    string jsonString = HttpUtil.GetSignRequestJson(d);
//        /// <summary>
//        /// post 开锁记录
//        /// </summary>
//        private void PostUnlock()
//        {
//            new Thread(() =>
//            {
//                try
//                {
//                    Dictionary<string, object> d = new Dictionary<string, object>();
//                    d.Add("callId", VideoActivity.CallId);//呼叫记录id int
//                    string jsonString = HttpUtil.GetSignRequestJson(d);
                    string url = "/home-wisdom/app/fl/vi/unlock";
                    ResponsePackNew response = HttpUtil.RequestHttpsPost(url, jsonString);
                    Log.Info("FengLinVideo", "Post Reject Response code=" + response.Code);
                }
                catch { }
//                    string url = "/home-wisdom/app/fl/vi/unlock";
//                    ResponsePackNew response = HttpUtil.RequestHttpsPost(url, jsonString);
//                    Log.Info("FengLinVideo", "Post Reject Response code=" + response.Code);
//                }
//                catch { }
            }).Start();
        }
    }
}
//            }).Start();
//        }
//    }
//}
HDL-ON_Android/HDL-ON_Android.csproj
@@ -67,6 +67,7 @@
    <AndroidSigningKeyPass>85521566</AndroidSigningKeyPass>
    <AndroidSigningKeyAlias>on_plus</AndroidSigningKeyAlias>
    <AndroidSupportedAbis>arm64-v8a</AndroidSupportedAbis>
    <AndroidPackageFormat>aab</AndroidPackageFormat>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="Shared.Droid.JPush">
@@ -143,29 +144,11 @@
    <Reference Include="AndriodBluetoothLibrary">
      <HintPath>..\DLL\Android\AndriodBluetoothLibrary.dll</HintPath>
    </Reference>
    <Reference Include="cloudp2p">
      <HintPath>..\DLL\FL\Android\cloudp2p.dll</HintPath>
    </Reference>
    <Reference Include="corelooper">
      <HintPath>..\DLL\FL\Android\corelooper.dll</HintPath>
    </Reference>
    <Reference Include="crypt">
      <HintPath>..\DLL\FL\Android\crypt.dll</HintPath>
    </Reference>
    <Reference Include="http">
      <HintPath>..\DLL\FL\Android\http.dll</HintPath>
    </Reference>
    <Reference Include="VideoLibs">
      <HintPath>..\DLL\FL\Android\VideoLibs.dll</HintPath>
    </Reference>
    <Reference Include="videophone">
      <HintPath>..\DLL\FL\Android\videophone.dll</HintPath>
    </Reference>
    <Reference Include="UMSdkDroid">
      <HintPath>..\DLL\UMeng\UMSdkDroid.dll</HintPath>
    </Reference>
    <Reference Include="Shared.Droid.HDLLinphone">
      <HintPath>..\DLL\Linphone\Android\Shared.Droid.HDLLinphone.dll</HintPath>
    </Reference>
    <Reference Include="Mono.Android.Export" />
    <Reference Include="ScanSdk">
@@ -186,14 +169,8 @@
    <Reference Include="LcPullToRefreshRecyclerView">
      <HintPath>..\DLL\LC\Android\LcPullToRefreshRecyclerView.dll</HintPath>
    </Reference>
    <Reference Include="ZxingSDK">
      <HintPath>..\DLL\LC\Android\ZxingSDK.dll</HintPath>
    </Reference>
    <Reference Include="LcVideoSdk">
      <HintPath>..\DLL\LC\Android\LcVideoSdk.dll</HintPath>
    </Reference>
    <Reference Include="HdlEzvizDroid">
      <HintPath>..\DLL\HdlEzvizDroid.dll</HintPath>
    </Reference>
    <Reference Include="Shared.Droid">
      <HintPath>..\DLL\Android\Shared.Droid.dll</HintPath>
HDL-ON_Android/Properties/AndroidManifest.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="2.4.2" package="com.hdl.onpro" xmlns:tools="http://schemas.android.com/tools" android:versionCode="202311151">
    <uses-sdk android:minSdkVersion="26" android:targetSdkVersion="29" />
    <uses-sdk android:minSdkVersion="26" android:targetSdkVersion="31" />
    <uses-permission android:name="android.permission.RECEIVE_SMS" />
    <!--友盟-->
    <!--<uses-sdk android:minSdkVersion="8"></uses-sdk>-->
HDL-ON_Android/Resources/Resource.designer.cs
Diff too large
HDL-ON_Android/VideoActivity.cs
@@ -1,471 +1,471 @@

using System;
using System.Collections.Generic;
using System.Threading;
using Android;
using Android.App;
using Android.Content;
using Android.Content.PM;
using Android.Graphics;
using Android.OS;
using Android.Runtime;
using Android.Support.V4.App;
using Android.Support.V4.Content;
using Android.Util;
using Android.Views;
using Android.Widget;
using Com.ETouchSky;
using Com.Tool;
using GateWay.Droid.FengLinVideo.widget;
using HDL_ON.Common;
using HDL_ON.DAL.Server;
using HDL_ON_Android.FengLinVideo.Form;
//using System;
//using System.Collections.Generic;
//using System.Threading;
//using Android;
//using Android.App;
//using Android.Content;
//using Android.Content.PM;
//using Android.Graphics;
//using Android.OS;
//using Android.Runtime;
//using Android.Support.V4.App;
//using Android.Support.V4.Content;
//using Android.Util;
//using Android.Views;
//using Android.Widget;
//using Com.ETouchSky;
//using Com.Tool;
//using GateWay.Droid.FengLinVideo.widget;
//using HDL_ON.Common;
//using HDL_ON.DAL.Server;
//using HDL_ON_Android.FengLinVideo.Form;
namespace HDL_ON_Android
{
    [Activity(Label = "VideoActivity", WindowSoftInputMode = SoftInput.AdjustResize, LaunchMode = LaunchMode.SingleInstance, ConfigurationChanges = (ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden | ConfigChanges.LayoutDirection | ConfigChanges.Locale | ConfigChanges.Orientation | ConfigChanges.ScreenSize), Theme = "@style/MyTheme1", ScreenOrientation = ScreenOrientation.Portrait)]
    public class VideoActivity : Activity, View.IOnClickListener, ISurfaceHolderCallback, VideoPhoneJni.ICallBack, TipDiaglog.OnConfirmClickListener
    {
        private static Activity activity;
        private VideoPhone mPhone;
        private ISurfaceHolder mRemoteSurfaceHolder;
        private FrameLayout mRemoteFrameContainer;
        private SurfaceView mSurfaceRemote;
//namespace HDL_ON_Android
//{
//    [Activity(Label = "VideoActivity", WindowSoftInputMode = SoftInput.AdjustResize, LaunchMode = LaunchMode.SingleInstance, ConfigurationChanges = (ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden | ConfigChanges.LayoutDirection | ConfigChanges.Locale | ConfigChanges.Orientation | ConfigChanges.ScreenSize), Theme = "@style/MyTheme1", ScreenOrientation = ScreenOrientation.Portrait)]
//    public class VideoActivity : Activity, View.IOnClickListener, ISurfaceHolderCallback, VideoPhoneJni.ICallBack, TipDiaglog.OnConfirmClickListener
//    {
//        private static Activity activity;
//        private VideoPhone mPhone;
//        private ISurfaceHolder mRemoteSurfaceHolder;
//        private FrameLayout mRemoteFrameContainer;
//        private SurfaceView mSurfaceRemote;
        private ImageView ivBack;
        private TextView tvName;
        private MonitorFragment monitorFragment = null;
        private ReverseCallFragment reverseCallFragment = null;
//        private ImageView ivBack;
//        private TextView tvName;
//        private MonitorFragment monitorFragment = null;
//        private ReverseCallFragment reverseCallFragment = null;
        public static string ESVideoUUID = "JJY000019VPLLF";//室外机UUID,例:JJY000007FSEYX  f5f6fa
        public static string DeviceName;//室外机的名称,例,室外机
        public static bool IsCollect;//是否收藏
        public static int Tpye = 0;//类型,0 监控,1反呼
//        public static string ESVideoUUID = "JJY000019VPLLF";//室外机UUID,例:JJY000007FSEYX  f5f6fa
//        public static string DeviceName;//室外机的名称,例,室外机
//        public static bool IsCollect;//是否收藏
//        public static int Tpye = 0;//类型,0 监控,1反呼
        public static string UUId;
        public static string CallId;//callId 呼叫记录id
        public static string CmtID;//cmtID 丰林社区号
        public static string Roomno;//roomno 丰林房间号
        public static string Unitno;//unitno 丰林楼栋号 string
        public static string HomeID;//HomeID 丰林住宅id
//        public static string UUId;
//        public static string CallId;//callId 呼叫记录id
//        public static string CmtID;//cmtID 丰林社区号
//        public static string Roomno;//roomno 丰林房间号
//        public static string Unitno;//unitno 丰林楼栋号 string
//        public static string HomeID;//HomeID 丰林住宅id
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
//        protected override void OnCreate(Bundle savedInstanceState)
//        {
//            base.OnCreate(savedInstanceState);
            try
            {
                activity = this;
//            try
//            {
//                activity = this;
                ESVideoUUID = Intent.GetStringExtra("ESVideoUUID");//室外机UUID,例:JJY000007FSEYX
                DeviceName = Intent.GetStringExtra("DeviceName");//室外机的名称,例,室外机
                UUId = Intent.GetStringExtra("uuid");//
                CallId = Intent.GetStringExtra("callId");
                CmtID = Intent.GetStringExtra("cmtID");
                Roomno = Intent.GetStringExtra("roomno");
                Unitno = Intent.GetStringExtra("unitno");
                HomeID = Intent.GetStringExtra("HomeID");
//                ESVideoUUID = Intent.GetStringExtra("ESVideoUUID");//室外机UUID,例:JJY000007FSEYX
//                DeviceName = Intent.GetStringExtra("DeviceName");//室外机的名称,例,室外机
//                UUId = Intent.GetStringExtra("uuid");//
//                CallId = Intent.GetStringExtra("callId");
//                CmtID = Intent.GetStringExtra("cmtID");
//                Roomno = Intent.GetStringExtra("roomno");
//                Unitno = Intent.GetStringExtra("unitno");
//                HomeID = Intent.GetStringExtra("HomeID");
                IsCollect = Intent.GetBooleanExtra("IsCollect", false);//是否收藏
                Tpye = Intent.GetIntExtra("Type", 0);//类型,0 监控,1反呼
//                IsCollect = Intent.GetBooleanExtra("IsCollect", false);//是否收藏
//                Tpye = Intent.GetIntExtra("Type", 0);//类型,0 监控,1反呼
                SetContentView(Resource.Layout.activity_video_phone);
//                SetContentView(Resource.Layout.activity_video_phone);
                IniView();
                IniData();
//                IniView();
//                IniData();
                if (Tpye == 0)
                {
                    Monitor(ESVideoUUID); //监控
//                if (Tpye == 0)
//                {
//                    Monitor(ESVideoUUID); //监控
                    monitorFragment = new MonitorFragment(mPhone);
                    FragmentManager.BeginTransaction().Replace(Resource.Id.content, monitorFragment).Commit();
                }
                else
                {
                    string param = "address=" + ESVideoUUID + ",tag=mobile://123,";
                    reverseCallFragment = new ReverseCallFragment(mPhone, param);
                    FragmentManager.BeginTransaction().Replace(Resource.Id.content, reverseCallFragment).Commit();
                }
            }
            catch {}
        }
//                    monitorFragment = new MonitorFragment(mPhone);
//                    FragmentManager.BeginTransaction().Replace(Resource.Id.content, monitorFragment).Commit();
//                }
//                else
//                {
//                    string param = "address=" + ESVideoUUID + ",tag=mobile://123,";
//                    reverseCallFragment = new ReverseCallFragment(mPhone, param);
//                    FragmentManager.BeginTransaction().Replace(Resource.Id.content, reverseCallFragment).Commit();
//                }
//            }
//            catch {}
//        }
        /// <summary>
        /// 必要的一些权限
        /// </summary>
        private void Permissions()
        {
            string[] mPermissionList = new string[]
            {
                Manifest.Permission.WriteExternalStorage,
                Manifest.Permission.ReadExternalStorage,
                Manifest.Permission.Camera,
                Manifest.Permission.RecordAudio
            };
//        /// <summary>
//        /// 必要的一些权限
//        /// </summary>
//        private void Permissions()
//        {
//            string[] mPermissionList = new string[]
//            {
//                Manifest.Permission.WriteExternalStorage,
//                Manifest.Permission.ReadExternalStorage,
//                Manifest.Permission.Camera,
//                Manifest.Permission.RecordAudio
//            };
            foreach (string permissions in mPermissionList)
            {
                if (ContextCompat.CheckSelfPermission(this, permissions) != 0)
                {
                    ActivityCompat.RequestPermissions(this, new string[] { permissions }, 1);
                }
            }
        }
//            foreach (string permissions in mPermissionList)
//            {
//                if (ContextCompat.CheckSelfPermission(this, permissions) != 0)
//                {
//                    ActivityCompat.RequestPermissions(this, new string[] { permissions }, 1);
//                }
//            }
//        }
        /// <summary>
        /// 隐藏底部导航栏——虚拟按键
        /// </summary>
        private void HideVirtualButtons()
        {
            WindowManagerLayoutParams windowManager = Window.Attributes;
            var uiOptions = (int)Window.DecorView.SystemUiVisibility;
            var newUiOptions = (int)uiOptions;
            newUiOptions = (int)SystemUiFlags.HideNavigation | (int)SystemUiFlags.Immersive | (int)SystemUiFlags.ImmersiveSticky;
            windowManager.SystemUiVisibility = (StatusBarVisibility)newUiOptions;
            Window.Attributes = windowManager;
        }
//        /// <summary>
//        /// 隐藏底部导航栏——虚拟按键
//        /// </summary>
//        private void HideVirtualButtons()
//        {
//            WindowManagerLayoutParams windowManager = Window.Attributes;
//            var uiOptions = (int)Window.DecorView.SystemUiVisibility;
//            var newUiOptions = (int)uiOptions;
//            newUiOptions = (int)SystemUiFlags.HideNavigation | (int)SystemUiFlags.Immersive | (int)SystemUiFlags.ImmersiveSticky;
//            windowManager.SystemUiVisibility = (StatusBarVisibility)newUiOptions;
//            Window.Attributes = windowManager;
//        }
        /// <summary>
        /// 监控
        /// </summary>
        /// <param name="address"></param>
        private void Monitor(string address)
        {
            //监视功能 从平台拉取监视列表,调用此接口可以一台一台监视
            if (mPhone != null)
            {
                //此参数 可以向门口机设备传递数据,
                //注意:RequestAudio 请求对方音频,RequestVideo请求对方视频 SendAudio发送本地音频 SendVideo 发送本地视频 一般门口不接收到视频,所以最好设置0,减少流量消耗
                string UserData = "";
                string param = "SendAudio=0\r\n" + "SendVideo=0\r\n" + "RequestAudio=0\r\n" + "RequestVideo=0\r\n" + "UserData=" + UserData + "\r\n";
                mPhone.Monitor(address, param);
            }
        }
//        /// <summary>
//        /// 监控
//        /// </summary>
//        /// <param name="address"></param>
//        private void Monitor(string address)
//        {
//            //监视功能 从平台拉取监视列表,调用此接口可以一台一台监视
//            if (mPhone != null)
//            {
//                //此参数 可以向门口机设备传递数据,
//                //注意:RequestAudio 请求对方音频,RequestVideo请求对方视频 SendAudio发送本地音频 SendVideo 发送本地视频 一般门口不接收到视频,所以最好设置0,减少流量消耗
//                string UserData = "";
//                string param = "SendAudio=0\r\n" + "SendVideo=0\r\n" + "RequestAudio=0\r\n" + "RequestVideo=0\r\n" + "UserData=" + UserData + "\r\n";
//                mPhone.Monitor(address, param);
//            }
//        }
        private void IniView()
        {
            mRemoteFrameContainer = (FrameLayout)FindViewById(Resource.Id.remoteFrame);
//        private void IniView()
//        {
//            mRemoteFrameContainer = (FrameLayout)FindViewById(Resource.Id.remoteFrame);
            ivBack = (ImageView)FindViewById(Resource.Id.videoBackImg);
            tvName = (TextView)FindViewById(Resource.Id.nameText);
//            ivBack = (ImageView)FindViewById(Resource.Id.videoBackImg);
//            tvName = (TextView)FindViewById(Resource.Id.nameText);
            tvName.SetText(DeviceName, null);
//            tvName.SetText(DeviceName, null);
            ivBack.SetOnClickListener(this);
        }
//            ivBack.SetOnClickListener(this);
//        }
        private void IniData()
        {
            try
            {
                if (mPhone == null)
                {
                    string _params = "port=8554\r\n" + "packcode=1021df37c2abe546a4541ca2c4a9c910\r\n"; //初始化对讲端口,默认就好,跟门口机设置要匹配,注意新接口需要增加packcode参数,需要把你们的包名发过来
                    mPhone = new VideoPhone(this, this, _params);
//        private void IniData()
//        {
//            try
//            {
//                if (mPhone == null)
//                {
//                    string _params = "port=8554\r\n" + "packcode=1021df37c2abe546a4541ca2c4a9c910\r\n"; //初始化对讲端口,默认就好,跟门口机设置要匹配,注意新接口需要增加packcode参数,需要把你们的包名发过来
//                    mPhone = new VideoPhone(this, this, _params);
                    if (mRemoteSurfaceHolder != null)
                    {
                        mPhone.SetRemoteSurfaceHolder(mRemoteSurfaceHolder, "mRemoteSurfaceHolder!=null"); //设置来电窗口
                    }
//                    if (mRemoteSurfaceHolder != null)
//                    {
//                        mPhone.SetRemoteSurfaceHolder(mRemoteSurfaceHolder, "mRemoteSurfaceHolder!=null"); //设置来电窗口
//                    }
                    ViewGroup v = (ViewGroup)FindViewById(Resource.Id.locaVideo);
                    mPhone.SetLocalVideoContainer(v);//设置本地视频窗口,一定要调用,不然后会出现没声音
                }
                else
                {
                    mPhone.StopStream();
                    mPhone.Release();
                    mPhone = null;
                }
            }
            catch { }
        }
//                    ViewGroup v = (ViewGroup)FindViewById(Resource.Id.locaVideo);
//                    mPhone.SetLocalVideoContainer(v);//设置本地视频窗口,一定要调用,不然后会出现没声音
//                }
//                else
//                {
//                    mPhone.StopStream();
//                    mPhone.Release();
//                    mPhone = null;
//                }
//            }
//            catch { }
//        }
        protected override void OnResume()
        {
            base.OnResume();
//        protected override void OnResume()
//        {
//            base.OnResume();
            HideVirtualButtons();
//            HideVirtualButtons();
            Permissions();
//            Permissions();
            if (mPhone != null)
            {
                mPhone.OnActivityResume();
            }
        }
//            if (mPhone != null)
//            {
//                mPhone.OnActivityResume();
//            }
//        }
        protected override void OnPause()
        {
            base.OnPause();
            if (mPhone != null)
            {
                //mPhone.OnActivityPause();
            }
        }
//        protected override void OnPause()
//        {
//            base.OnPause();
//            if (mPhone != null)
//            {
//                //mPhone.OnActivityPause();
//            }
//        }
        protected override void OnDestroy()
        {
            base.OnDestroy();
            if (mPhone != null)
            {
                mPhone.HangUp();
                mPhone.Release();
                mPhone = null;
                //mPhone.OnActivityDestroy();
            }
//        protected override void OnDestroy()
//        {
//            base.OnDestroy();
//            if (mPhone != null)
//            {
//                mPhone.HangUp();
//                mPhone.Release();
//                mPhone = null;
//                //mPhone.OnActivityDestroy();
//            }
            if (ReverseCallFragment.unlockThread != null)
            {
                try
                {
                    //
                    ReverseCallFragment.unlockThread.Interrupt();
                }
                catch { }
                ReverseCallFragment.unlockThread = null;
            }
//            if (ReverseCallFragment.unlockThread != null)
//            {
//                try
//                {
//                    //
//                    ReverseCallFragment.unlockThread.Interrupt();
//                }
//                catch { }
//                ReverseCallFragment.unlockThread = null;
//            }
            if (MonitorFragment.thread != null)
            {
                try
                {
                    //
                    MonitorFragment.thread.Interrupt();
                }
                catch { }
                MonitorFragment.thread = null;
            }
        }
//            if (MonitorFragment.thread != null)
//            {
//                try
//                {
//                    //
//                    MonitorFragment.thread.Interrupt();
//                }
//                catch { }
//                MonitorFragment.thread = null;
//            }
//        }
        public override void OnBackPressed()
        {
            if (mPhone != null)
                mPhone.HangUp();
//        public override void OnBackPressed()
//        {
//            if (mPhone != null)
//                mPhone.HangUp();
            Finish();
        }
//            Finish();
//        }
        public void OnClick(View v)
        {
            if (v.Equals(ivBack))
            {
                if (mPhone != null)
                    mPhone.HangUp();
//        public void OnClick(View v)
//        {
//            if (v.Equals(ivBack))
//            {
//                if (mPhone != null)
//                    mPhone.HangUp();
                Finish();
            }
        }
//                Finish();
//            }
//        }
        /// <summary>
        /// show出视频画面
        /// 不能用View.INVISIBLE来完全隐藏,否则MediaCodec.configure会报ava.lang.IllegalArgumentException: The surface has been released
        /// </summary>
        private void ShowRemoteVideo()
        {
            try
            {
                if (mSurfaceRemote != null)
                {
                    return;
                }
                mSurfaceRemote = new SurfaceView(this, null);
                ISurfaceHolder holder = mSurfaceRemote.Holder;
                holder.AddCallback(this);//ISurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS
                holder.SetType(SurfaceType.PushBuffers);
//        /// <summary>
//        /// show出视频画面
//        /// 不能用View.INVISIBLE来完全隐藏,否则MediaCodec.configure会报ava.lang.IllegalArgumentException: The surface has been released
//        /// </summary>
//        private void ShowRemoteVideo()
//        {
//            try
//            {
//                if (mSurfaceRemote != null)
//                {
//                    return;
//                }
//                mSurfaceRemote = new SurfaceView(this, null);
//                ISurfaceHolder holder = mSurfaceRemote.Holder;
//                holder.AddCallback(this);//ISurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS
//                holder.SetType(SurfaceType.PushBuffers);
                //发现第一次show时会闪屏一下,后面hide再show时不会闪屏
                FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
                //v.setId(View.generateViewId());
                mSurfaceRemote.LayoutParameters = lp;
                mRemoteFrameContainer.AddView(mSurfaceRemote);
            }
            catch { }
        }
//                //发现第一次show时会闪屏一下,后面hide再show时不会闪屏
//                FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
//                //v.setId(View.generateViewId());
//                mSurfaceRemote.LayoutParameters = lp;
//                mRemoteFrameContainer.AddView(mSurfaceRemote);
//            }
//            catch { }
//        }
        /// <summary>
        /// 关闭画面
        /// </summary>
        private void HideRemoteVideo()
        {
            try
            {
                if (mSurfaceRemote != null)
                {
                    mRemoteFrameContainer.RemoveView(mSurfaceRemote);
                    mSurfaceRemote = null;
                }
            }
            catch { }
        }
//        /// <summary>
//        /// 关闭画面
//        /// </summary>
//        private void HideRemoteVideo()
//        {
//            try
//            {
//                if (mSurfaceRemote != null)
//                {
//                    mRemoteFrameContainer.RemoveView(mSurfaceRemote);
//                    mSurfaceRemote = null;
//                }
//            }
//            catch { }
//        }
        /// <summary>
        /// 弹出已挂断提示
        /// </summary>
        private void ShowTipDialog(string title, string text, string btnText, bool isClose)
        {
            try
            {
                TipDiaglog diaglog = new TipDiaglog(this);
                diaglog.SetAutoClose(isClose);
                diaglog.SetTitleText(title);//"提示"
                diaglog.SetContentText(text);//"已挂断"
                diaglog.SetConfirmText(btnText);//"确认"
                diaglog.SetCanceledOnTouchOutside(false);
                diaglog.Show();
                diaglog.Create();
                diaglog.SetConfirmClickListener(this);
            }
            catch (Exception e)
            {
                string ss = e.Message;
            }
        }
//        /// <summary>
//        /// 弹出已挂断提示
//        /// </summary>
//        private void ShowTipDialog(string title, string text, string btnText, bool isClose)
//        {
//            try
//            {
//                TipDiaglog diaglog = new TipDiaglog(this);
//                diaglog.SetAutoClose(isClose);
//                diaglog.SetTitleText(title);//"提示"
//                diaglog.SetContentText(text);//"已挂断"
//                diaglog.SetConfirmText(btnText);//"确认"
//                diaglog.SetCanceledOnTouchOutside(false);
//                diaglog.Show();
//                diaglog.Create();
//                diaglog.SetConfirmClickListener(this);
//            }
//            catch (Exception e)
//            {
//                string ss = e.Message;
//            }
//        }
        public void SurfaceChanged(ISurfaceHolder holder, [GeneratedEnum] Format format, int width, int height)
        {
            mRemoteSurfaceHolder = holder;
            if (mPhone != null)
            {
                mPhone.SetRemoteSurfaceHolder(holder, "surfaceChanged");
            }
        }
//        public void SurfaceChanged(ISurfaceHolder holder, [GeneratedEnum] Format format, int width, int height)
//        {
//            mRemoteSurfaceHolder = holder;
//            if (mPhone != null)
//            {
//                mPhone.SetRemoteSurfaceHolder(holder, "surfaceChanged");
//            }
//        }
        public void SurfaceCreated(ISurfaceHolder holder)
        {
            mRemoteSurfaceHolder = holder;
            if (mPhone != null)
            {
                mPhone.SetRemoteSurfaceHolder(holder, "surfaceCreated");
            }
        }
//        public void SurfaceCreated(ISurfaceHolder holder)
//        {
//            mRemoteSurfaceHolder = holder;
//            if (mPhone != null)
//            {
//                mPhone.SetRemoteSurfaceHolder(holder, "surfaceCreated");
//            }
//        }
        public void SurfaceDestroyed(ISurfaceHolder holder)
        {
            mRemoteSurfaceHolder = null;
            if (mPhone != null)
            {
                mPhone.SetRemoteSurfaceHolder(null, "surfaceDestroyed");
            }
        }
//        public void SurfaceDestroyed(ISurfaceHolder holder)
//        {
//            mRemoteSurfaceHolder = null;
//            if (mPhone != null)
//            {
//                mPhone.SetRemoteSurfaceHolder(null, "surfaceDestroyed");
//            }
//        }
        /// <summary>
        /// 开始拉流
        /// 注意:由于android框架限制,要满足如下条件才能开流:activity要在前台,并且surfaceview可用
        /// </summary>
        /// <param name="reason"></param>
        private void StartStream(String reason)
        {
            if (mPhone != null)
            {
                try
                {
                    //开流之前可配置视频尺寸,码率,帧率 针对的是本地
                    //mPhone.SetVideoSize(640, 480);//1920x1080,1280x720,640x480
                    //mPhone.SetBps(1.5 * 1024 * 1024);
                    //mPhone.SetFps(30);
                    mPhone.StartStream();
                }
                catch { }
            }
        }
//        /// <summary>
//        /// 开始拉流
//        /// 注意:由于android框架限制,要满足如下条件才能开流:activity要在前台,并且surfaceview可用
//        /// </summary>
//        /// <param name="reason"></param>
//        private void StartStream(String reason)
//        {
//            if (mPhone != null)
//            {
//                try
//                {
//                    //开流之前可配置视频尺寸,码率,帧率 针对的是本地
//                    //mPhone.SetVideoSize(640, 480);//1920x1080,1280x720,640x480
//                    //mPhone.SetBps(1.5 * 1024 * 1024);
//                    //mPhone.SetFps(30);
//                    mPhone.StartStream();
//                }
//                catch { }
//            }
//        }
        /// <summary>
        /// 通话状态回调方法
        /// </summary>
        /// <param name="msg"></param>
        public void OnPhoneEvent(string msg)
        {
            try
            {
                if (monitorFragment != null)
                {
                    monitorFragment.OnPhoneEvent(msg);
                }
//        /// <summary>
//        /// 通话状态回调方法
//        /// </summary>
//        /// <param name="msg"></param>
//        public void OnPhoneEvent(string msg)
//        {
//            try
//            {
//                if (monitorFragment != null)
//                {
//                    monitorFragment.OnPhoneEvent(msg);
//                }
                if (reverseCallFragment != null)
                {
                    reverseCallFragment.OnPhoneEvent(msg);
                }
//                if (reverseCallFragment != null)
//                {
//                    reverseCallFragment.OnPhoneEvent(msg);
//                }
                TextProtocol tp = new TextProtocol();
                tp.Parse(msg);
                string event1 = tp.GetString("event");
                Log.Info("FengLinVideo", "OnPhoneEvent event=" + event1);
                switch (event1)
                {
                    case "EVT_Ringing":
                        mPhone.RequestCallerSendVideo();
                        ShowRemoteVideo();
                        break;
                    case "EVT_Connected":
                        if (!mPhone.IsStreamRunning)
                        {
                            //由于android框架限制,要满足如下条件才能开流: activity要在前台,并且surfaceview可用
                            StartStream("EVT_Connected");
                        }
                        ShowRemoteVideo();
                        break;
                    case "EVT_StartStream":
                        StartStream("EVT_StreamStream");
                        break;
                    case "EVT_StopStream":
                        mPhone.StopStream();
                        break;
                    case "EVT_MonitorConnected":
                        if (!mPhone.IsStreamRunning)
                        {
                            StartStream("EVT_MonitorConnected");
                        }
                        ShowRemoteVideo();
                        break;
                    case "EVT_HangUp":
                        HideRemoteVideo();
                        if (mPhone != null)
                        {
                            mPhone.StopStream();
                        }
                        //Toast.MakeText(this, GetString(Resource.String.end_call), ToastLength.Short).Show();
                        this.Finish();
                        //ShowTipDialog(tip, hang_up, confirm, true);
                        break;
                    case "EVT_RECV_CUSTOM_DATA":
                        string data = tp.GetString("data");
                        Toast.MakeText(this, GetString(Resource.String.video_success), ToastLength.Short).Show();
                        break;
                    case "EVT_SnapAck":
                        int error = tp.GetInt("error");
                        string filePath = tp.GetString("filePath");
                        if (error == 0)
                        {
                            Toast.MakeText(this, GetString(Resource.String.video_success), ToastLength.Short).Show();
                        }
                        else
                        {
                            Toast.MakeText(this, GetString(Resource.String.video_fail), ToastLength.Short).Show();
                        }
                        break;
                }
            }
            catch { }
        }
//                TextProtocol tp = new TextProtocol();
//                tp.Parse(msg);
//                string event1 = tp.GetString("event");
//                Log.Info("FengLinVideo", "OnPhoneEvent event=" + event1);
//                switch (event1)
//                {
//                    case "EVT_Ringing":
//                        mPhone.RequestCallerSendVideo();
//                        ShowRemoteVideo();
//                        break;
//                    case "EVT_Connected":
//                        if (!mPhone.IsStreamRunning)
//                        {
//                            //由于android框架限制,要满足如下条件才能开流: activity要在前台,并且surfaceview可用
//                            StartStream("EVT_Connected");
//                        }
//                        ShowRemoteVideo();
//                        break;
//                    case "EVT_StartStream":
//                        StartStream("EVT_StreamStream");
//                        break;
//                    case "EVT_StopStream":
//                        mPhone.StopStream();
//                        break;
//                    case "EVT_MonitorConnected":
//                        if (!mPhone.IsStreamRunning)
//                        {
//                            StartStream("EVT_MonitorConnected");
//                        }
//                        ShowRemoteVideo();
//                        break;
//                    case "EVT_HangUp":
//                        HideRemoteVideo();
//                        if (mPhone != null)
//                        {
//                            mPhone.StopStream();
//                        }
//                        //Toast.MakeText(this, GetString(Resource.String.end_call), ToastLength.Short).Show();
//                        this.Finish();
//                        //ShowTipDialog(tip, hang_up, confirm, true);
//                        break;
//                    case "EVT_RECV_CUSTOM_DATA":
//                        string data = tp.GetString("data");
//                        Toast.MakeText(this, GetString(Resource.String.video_success), ToastLength.Short).Show();
//                        break;
//                    case "EVT_SnapAck":
//                        int error = tp.GetInt("error");
//                        string filePath = tp.GetString("filePath");
//                        if (error == 0)
//                        {
//                            Toast.MakeText(this, GetString(Resource.String.video_success), ToastLength.Short).Show();
//                        }
//                        else
//                        {
//                            Toast.MakeText(this, GetString(Resource.String.video_fail), ToastLength.Short).Show();
//                        }
//                        break;
//                }
//            }
//            catch { }
//        }
        public void OnRecvAudioFrame(byte[] p0)
        {
            //throw new NotImplementedException();
        }
//        public void OnRecvAudioFrame(byte[] p0)
//        {
//            //throw new NotImplementedException();
//        }
        public void OnRecvVideoFrame(byte[] p0)
        {
            //throw new NotImplementedException();
        }
//        public void OnRecvVideoFrame(byte[] p0)
//        {
//            //throw new NotImplementedException();
//        }
        public void onSureClick(TipDiaglog dialoog, View v, bool bol)
        {
            dialoog.Dismiss();
            if (bol)
                this.Finish();
        }
    }
}
//        public void onSureClick(TipDiaglog dialoog, View v, bool bol)
//        {
//            dialoog.Dismiss();
//            if (bol)
//                this.Finish();
//        }
//    }
//}
HDL_ON/Common/ApiUtlis.cs
@@ -337,33 +337,33 @@
                                //======================获取Sip账号并且初始化SDK可视对讲设备列表====================
                                //如果检测线程没启动,才继续下面操作 因为App有可能刚启动马上收到推送了,然后才执行到这里
                                if (HDLLinphone.Current.CheckIncomingCallThreadIsNull())
                                {
                                //if (HDLLinphone.Current.CheckIncomingCallThreadIsNull())
                                //{
                                    
                                    //当前住宅是HDL可视对讲类型的设备
                                    if (isInterphoneType_HDL)
                                    {
                                        //HDLLinphone可视对讲,获取Sip账号并初始化SDK
                                        HDLCallVideoInfo callVideoInfo = new HDLCallVideoInfo();
                                        callVideoInfo.HomeId = DB_ResidenceData.Instance.CurrentRegion.id;
                                        callVideoInfo.InterphoneType = InterphoneType.HDL.ToString();
                                        HDLLinphone.Current.GetHDLSipInfoAndInitSDK(callVideoInfo);
                                    }
                                    else if (isInterphoneType_FREEVIEW)
                                    {
                                        //HDLLinphone可视对讲,获取Sip账号并初始化SDK
                                        HDLCallVideoInfo callVideoInfo = new HDLCallVideoInfo();
                                        callVideoInfo.HomeId = DB_ResidenceData.Instance.CurrentRegion.id;
                                        callVideoInfo.InterphoneType = InterphoneType.FREEVIEW.ToString();
                                        HDLLinphone.Current.GetHDLSipInfoAndInitSDK(callVideoInfo);
                                    }
                                    else
                                    {
                                        Utlis.WriteLine("当前住宅不支持HDL可视对讲,退出登录所有账号");
                                        //当前住宅不支持HDL可视对讲
                                        HDLLinphone.Current.LogoutAllAccount();
                                    }
                                }
                                //    //当前住宅是HDL可视对讲类型的设备
                                //    if (isInterphoneType_HDL)
                                //    {
                                //        //HDLLinphone可视对讲,获取Sip账号并初始化SDK
                                //        HDLCallVideoInfo callVideoInfo = new HDLCallVideoInfo();
                                //        callVideoInfo.HomeId = DB_ResidenceData.Instance.CurrentRegion.id;
                                //        callVideoInfo.InterphoneType = InterphoneType.HDL.ToString();
                                //        HDLLinphone.Current.GetHDLSipInfoAndInitSDK(callVideoInfo);
                                //    }
                                //    else if (isInterphoneType_FREEVIEW)
                                //    {
                                //        //HDLLinphone可视对讲,获取Sip账号并初始化SDK
                                //        HDLCallVideoInfo callVideoInfo = new HDLCallVideoInfo();
                                //        callVideoInfo.HomeId = DB_ResidenceData.Instance.CurrentRegion.id;
                                //        callVideoInfo.InterphoneType = InterphoneType.FREEVIEW.ToString();
                                //        HDLLinphone.Current.GetHDLSipInfoAndInitSDK(callVideoInfo);
                                //    }
                                //    else
                                //    {
                                //        Utlis.WriteLine("当前住宅不支持HDL可视对讲,退出登录所有账号");
                                //        //当前住宅不支持HDL可视对讲
                                //        HDLLinphone.Current.LogoutAllAccount();
                                //    }
                                //}
HDL_ON/Common/HDLCommon.cs
@@ -373,32 +373,32 @@
                        else if (interphoneTypeEnum == InterphoneType.HDL.ToString())
                        {
                            //HDL Linphone 狄耐克
                            eSVideoInfo.HomeId = jpushMessageInfo.HomeId;
                            eSVideoInfo.callId = json["callId"].ToString();
                            eSVideoInfo.Lc_DeviceId = json["deviceId"].ToString();
                            eSVideoInfo.DeviceName = json["deviceName"].ToString();
                            eSVideoInfo.deviceSipAccount = json["deviceSipAccount"].ToString();
                            eSVideoInfo.spk = json["spk"].ToString();
                            //eSVideoInfo.HomeId = jpushMessageInfo.HomeId;
                            //eSVideoInfo.callId = json["callId"].ToString();
                            //eSVideoInfo.Lc_DeviceId = json["deviceId"].ToString();
                            //eSVideoInfo.DeviceName = json["deviceName"].ToString();
                            //eSVideoInfo.deviceSipAccount = json["deviceSipAccount"].ToString();
                            //eSVideoInfo.spk = json["spk"].ToString();
                            //ShowAlert("狄耐克门口机呼叫");
                            //打开呼叫页面
                            HDLLinphone.Current.ShowESVideoIntercom(eSVideoInfo, InterphoneType.HDL.ToString());
                            ////ShowAlert("狄耐克门口机呼叫");
                            ////打开呼叫页面
                            //HDLLinphone.Current.ShowESVideoIntercom(eSVideoInfo, InterphoneType.HDL.ToString());
                            return;
                        }
                        else if (interphoneTypeEnum == InterphoneType.FREEVIEW.ToString())
                        {
                            //全视通 Linphone 狄耐克
                            eSVideoInfo.HomeId = jpushMessageInfo.HomeId;
                            eSVideoInfo.callId = json["callId"].ToString();
                            eSVideoInfo.Lc_DeviceId = json["deviceId"].ToString();
                            eSVideoInfo.DeviceName = json["deviceName"].ToString();
                            eSVideoInfo.deviceSipAccount = json["deviceSipAccount"].ToString();
                            eSVideoInfo.spk = json["spk"].ToString();
                            //eSVideoInfo.HomeId = jpushMessageInfo.HomeId;
                            //eSVideoInfo.callId = json["callId"].ToString();
                            //eSVideoInfo.Lc_DeviceId = json["deviceId"].ToString();
                            //eSVideoInfo.DeviceName = json["deviceName"].ToString();
                            //eSVideoInfo.deviceSipAccount = json["deviceSipAccount"].ToString();
                            //eSVideoInfo.spk = json["spk"].ToString();
                            //ShowAlert("狄耐克门口机呼叫");
                            //打开呼叫页面
                            HDLLinphone.Current.ShowESVideoIntercom(eSVideoInfo, InterphoneType.FREEVIEW.ToString());
                            return;
                            ////ShowAlert("狄耐克门口机呼叫");
                            ////打开呼叫页面
                            //HDLLinphone.Current.ShowESVideoIntercom(eSVideoInfo, InterphoneType.FREEVIEW.ToString());
                            //return;
                        }
                        //3.打开呼叫页面
@@ -513,7 +513,7 @@
                    DB_ResidenceData.Instance.EixtAccount();
                    MainPage.Log("退出账号清空数据");
                    //4.注销HDLSIP账号登录 2021-08-20
                    HDLLinphone.Current.LogoutAllAccount();
                    //HDLLinphone.Current.LogoutAllAccount();
                    MainPage.Log("注销HDLSIP账号登录");
#if __IOS__
@@ -775,8 +775,8 @@
                                        ((BaseActivity)Shared.Application.Activity).SetPermission(result =>
                                        {
                                            //2023年03月29日13:08:35 修改
                                            Com.Videogo.Hdl.HDLEzvizSdk.Instance.Init(Application.Activity.Application, ezChildAccessToken, UserInfo.Current.LoginTokenString, UserInfo.Current.RefreshToken, OnAppConfig.Instance.RequestHttpsHost, "1aa98a90489b4838b966b57018b4b04b", 1, DB_ResidenceData.Instance.CurrentRegion.id);
                                            Com.Videogo.Hdl.HDLEzvizSdk.Instance.JumpToCameraListActivity(Shared.Application.Activity, list);
                                            //Com.Videogo.Hdl.HDLEzvizSdk.Instance.Init(Application.Activity.Application, ezChildAccessToken, UserInfo.Current.LoginTokenString, UserInfo.Current.RefreshToken, OnAppConfig.Instance.RequestHttpsHost, "1aa98a90489b4838b966b57018b4b04b", 1, DB_ResidenceData.Instance.CurrentRegion.id);
                                            //Com.Videogo.Hdl.HDLEzvizSdk.Instance.JumpToCameraListActivity(Shared.Application.Activity, list);
                                            //if (result)
                                            //{
                                            //    Android.Content.Intent intent = new Android.Content.Intent();
HDL_ON/DAL/ThirdPartySdk/ESOnVideo.cs
@@ -108,7 +108,7 @@
            else if (interphoneType == InterphoneType.HDL.ToString())
            {
                //HDLLinphone 狄耐克
                HDLLinphone.Current.ShowESVideoMonitor(mESVideoInfo, interphoneType);
                //HDLLinphone.Current.ShowESVideoMonitor(mESVideoInfo, interphoneType);
            } else if (interphoneType == InterphoneType.FREEVIEW.ToString())
            {
                //全视通监视
@@ -140,16 +140,16 @@
            else if (interphoneType == InterphoneType.FLVI.ToString())
            {
                intent = new Intent(Shared.Application.Activity, typeof(HDL_ON_Android.VideoActivity));
                intent.PutExtra("ESVideoUUID", mESVideoInfo.ESVideoUUID);
                intent.PutExtra("uuid", mESVideoInfo.uuid);
                intent.PutExtra("DeviceName", mESVideoInfo.DeviceName);
                intent.PutExtra("cmtID", mESVideoInfo.cmtID);
                intent.PutExtra("roomno", mESVideoInfo.roomno);
                intent.PutExtra("unitno", mESVideoInfo.unitno);
                intent.PutExtra("HomeID", PirSend.HomeId);
                intent.PutExtra("callId", mESVideoInfo.callId);
                intent.PutExtra("Type", 0);
                //intent = new Intent(Shared.Application.Activity, typeof(HDL_ON_Android.VideoActivity));
                //intent.PutExtra("ESVideoUUID", mESVideoInfo.ESVideoUUID);
                //intent.PutExtra("uuid", mESVideoInfo.uuid);
                //intent.PutExtra("DeviceName", mESVideoInfo.DeviceName);
                //intent.PutExtra("cmtID", mESVideoInfo.cmtID);
                //intent.PutExtra("roomno", mESVideoInfo.roomno);
                //intent.PutExtra("unitno", mESVideoInfo.unitno);
                //intent.PutExtra("HomeID", PirSend.HomeId);
                //intent.PutExtra("callId", mESVideoInfo.callId);
                //intent.PutExtra("Type", 0);
@@ -158,14 +158,14 @@
            else if (interphoneType == InterphoneType.HDL.ToString())
            {
                //HDLLinphone 狄耐克
                HDLLinphone.Current.ShowESVideoMonitor(mESVideoInfo, InterphoneType.HDL.ToString());
                //HDLLinphone.Current.ShowESVideoMonitor(mESVideoInfo, InterphoneType.HDL.ToString());
            }
            else if (interphoneType == InterphoneType.FREEVIEW.ToString())
            {
                string sip_account = "sip:D" + mESVideoInfo.deviceCode + "@139.159.157.75:46000";
                //string sip_account = "sip:D" + mESVideoInfo.deviceCode + "@139.159.157.75:46000";
                mESVideoInfo.deviceSipAccount = sip_account;
                HDLLinphone.Current.ShowESVideoMonitor(mESVideoInfo, InterphoneType.FREEVIEW.ToString());
                //mESVideoInfo.deviceSipAccount = sip_account;
                //HDLLinphone.Current.ShowESVideoMonitor(mESVideoInfo, InterphoneType.FREEVIEW.ToString());
            }
            else
            {
@@ -291,10 +291,10 @@
                        {
                            var ezChildAccessToken = result.Data.ToString();
                            Com.Videogo.Hdl.HDLEzvizSdk.Instance.Init(Application.Activity.Application, ezChildAccessToken, UserInfo.Current.LoginTokenString, UserInfo.Current.RefreshToken, OnAppConfig.Instance.RequestHttpsHost, "1aa98a90489b4838b966b57018b4b04b", 1, DB_ResidenceData.Instance.CurrentRegion.id);
                            //Com.Videogo.Hdl.HDLEzvizSdk.Instance.Init(Application.Activity.Application, ezChildAccessToken, UserInfo.Current.LoginTokenString, UserInfo.Current.RefreshToken, OnAppConfig.Instance.RequestHttpsHost, "1aa98a90489b4838b966b57018b4b04b", 1, DB_ResidenceData.Instance.CurrentRegion.id);
                            Com.Videogo.Hdl.HDLEzvizSdk.Instance.JumpToEZRealPlayActivity(Application.Activity,
                                mESVideoInfo.Lc_DeviceId, mESVideoInfo.DeviceSerial, mESVideoInfo.spk, mESVideoInfo.msgId);
                            //Com.Videogo.Hdl.HDLEzvizSdk.Instance.JumpToEZRealPlayActivity(Application.Activity,
                            //    mESVideoInfo.Lc_DeviceId, mESVideoInfo.DeviceSerial, mESVideoInfo.spk, mESVideoInfo.msgId);
                        }
                        //intent.SetComponent(new Android.Content.ComponentName(Shared.Application.Activity, "com.videogo.MainActivity"));
@@ -311,19 +311,19 @@
            }
            else if (interphoneType == InterphoneType.FLVI.ToString())
            {
                //待删减不必要参数
                intent = new Intent(Shared.Application.Activity, typeof(HDL_ON_Android.VideoActivity));
                intent.PutExtra("ESVideoUUID", mESVideoInfo.ESVideoUUID);
                intent.PutExtra("uuid", mESVideoInfo.uuid);
                intent.PutExtra("DeviceName", mESVideoInfo.DeviceName);
                intent.PutExtra("cmtID", mESVideoInfo.cmtID);
                intent.PutExtra("roomno", mESVideoInfo.roomno);
                intent.PutExtra("unitno", mESVideoInfo.unitno);
                intent.PutExtra("HomeID", PirSend.HomeId);
                intent.PutExtra("callId", mESVideoInfo.callId);
                intent.PutExtra("Type", 1);
                ////待删减不必要参数
                //intent = new Intent(Shared.Application.Activity, typeof(HDL_ON_Android.VideoActivity));
                //intent.PutExtra("ESVideoUUID", mESVideoInfo.ESVideoUUID);
                //intent.PutExtra("uuid", mESVideoInfo.uuid);
                //intent.PutExtra("DeviceName", mESVideoInfo.DeviceName);
                //intent.PutExtra("cmtID", mESVideoInfo.cmtID);
                //intent.PutExtra("roomno", mESVideoInfo.roomno);
                //intent.PutExtra("unitno", mESVideoInfo.unitno);
                //intent.PutExtra("HomeID", PirSend.HomeId);
                //intent.PutExtra("callId", mESVideoInfo.callId);
                //intent.PutExtra("Type", 1);
                Shared.Application.Activity.StartActivity(intent);
                //Shared.Application.Activity.StartActivity(intent);
            }
            else
            {
HDL_ON/DAL/ThirdPartySdk/HDLLinphone.cs
@@ -1,936 +1,936 @@
using System;
using System.Collections.Generic;
using System.Threading;
//using System;
//using System.Collections.Generic;
//using System.Threading;
using HDL_ON;
using HDL_ON.DAL.Server;
using HDL_ON.Entity;
//using HDL_ON;
//using HDL_ON.DAL.Server;
//using HDL_ON.Entity;
#if __Android__
using Android.App;
using Android.Content;
using Android.Graphics;
using Android.Widget;
using Com.Hdl.Hdllinphonesdk;
#else
using Foundation;
using UIKit;
using Shared.IOS.HDLLinphoneSDK;
#endif
//#if __Android__
//using Android.App;
//using Android.Content;
//using Android.Graphics;
//using Android.Widget;
////using Com.Hdl.Hdllinphonesdk;
//#else
//using Foundation;
//using UIKit;
//using Shared.IOS.HDLLinphoneSDK;
//#endif
namespace Shared
{
    /// <summary>
    /// 目前是每个住宅对应一个SIP账号,切换住宅需要重新获取SIP账号
    /// </summary>
    public class HDLLinphone
    {
        /// <summary>
        ///
        /// </summary>
        public HDLLinphone()
        {
//namespace Shared
//{
//    /// <summary>
//    /// 目前是每个住宅对应一个SIP账号,切换住宅需要重新获取SIP账号
//    /// </summary>
//    public class HDLLinphone
//    {
//        /// <summary>
//        ///
//        /// </summary>
//        public HDLLinphone()
//        {
           
        }
        /// <summary>
        ///
        /// </summary>
        private static HDLLinphone m_Current = null;
        /// <summary>
        ///
        /// </summary>
        public static HDLLinphone Current
        {
            get
            {
                if (m_Current == null)
                {
                    m_Current = new HDLLinphone();
                }
                return m_Current;
            }
        }
//        }
//        /// <summary>
//        ///
//        /// </summary>
//        private static HDLLinphone m_Current = null;
//        /// <summary>
//        ///
//        /// </summary>
//        public static HDLLinphone Current
//        {
//            get
//            {
//                if (m_Current == null)
//                {
//                    m_Current = new HDLLinphone();
//                }
//                return m_Current;
//            }
//        }
     
        /// <summary>
        /// 当前住宅是否支持可视对讲
        /// </summary>
        public bool IsEnable = false;
        /// <summary>
        /// 当前视频通话是否为自研
        /// </summary>
        public bool IsSelfResearch = false;
        /// <summary>
        /// 是否自动跳转呼叫页面,
        /// false:收到推送并且已经收到sip呼叫才跳转呼叫页面
        /// true:原生收到呼叫马上跳转呼叫页面,不等待推送过来
        /// </summary>
        bool IsAutoJumpCallView = true;
        /// <summary>
        /// 是否初始化了SDK
        /// </summary>
        bool IsInitSdk;
        /// <summary>
        /// 当前登录的Sip账号
        /// </summary>
        HDLSipInfo currentHDLSipInfo;
        /// <summary>
        /// 可视对讲设备参数
        /// </summary>
        HDLCallVideoInfo mHDLCallVideoInfo;
//        /// <summary>
//        /// 当前住宅是否支持可视对讲
//        /// </summary>
//        public bool IsEnable = false;
//        /// <summary>
//        /// 当前视频通话是否为自研
//        /// </summary>
//        public bool IsSelfResearch = false;
//        /// <summary>
//        /// 是否自动跳转呼叫页面,
//        /// false:收到推送并且已经收到sip呼叫才跳转呼叫页面
//        /// true:原生收到呼叫马上跳转呼叫页面,不等待推送过来
//        /// </summary>
//        bool IsAutoJumpCallView = true;
//        /// <summary>
//        /// 是否初始化了SDK
//        /// </summary>
//        bool IsInitSdk;
//        /// <summary>
//        /// 当前登录的Sip账号
//        /// </summary>
//        HDLSipInfo currentHDLSipInfo;
//        /// <summary>
//        /// 可视对讲设备参数
//        /// </summary>
//        HDLCallVideoInfo mHDLCallVideoInfo;
        #region ■  --  初始化SDK_______________________________
        /// <summary>
        /// 初始化SDK
        /// </summary>
        void InitLinphone()
        {
            //防止重复初始化
            if (IsInitSdk) return;
//        #region ■  --  初始化SDK_______________________________
//        /// <summary>
//        /// 初始化SDK
//        /// </summary>
//        void InitLinphone()
//        {
//            //防止重复初始化
//            if (IsInitSdk) return;
            IsInitSdk = true;
//            IsInitSdk = true;
#if __IOS__
//#if __IOS__
            Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().InitalLinPhone();
            //设置收到来电后、是否需自动跳转呼叫页面方案
            Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().IsAutoJumpCallView = IsAutoJumpCallView;
            //设置Listener监听(Shared.IOS.HDLLinphoneSDK)
            mOnHDLLinphoneCallDelegate = new OnHDLLinphoneCallDelegate(this);
            Console.WriteLine(UserInfo.Current.ID);
            Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().HdlLinphoneCallDelegate = mOnHDLLinphoneCallDelegate;
#else
            HDLLinphoneKit.Instance.InitLinphone(Application.Activity);
            //设置收到来电后、是否需自动跳转呼叫页面方案
            HDLLinphoneKit.Instance.AutoJumpCallView = IsAutoJumpCallView;
            //设置Listener监听
            setOnHDLLinphoneCallListener();
#endif
        }
//            Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().InitalLinPhone();
//            //设置收到来电后、是否需自动跳转呼叫页面方案
//            Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().IsAutoJumpCallView = IsAutoJumpCallView;
//            //设置Listener监听(Shared.IOS.HDLLinphoneSDK)
//            mOnHDLLinphoneCallDelegate = new OnHDLLinphoneCallDelegate(this);
//            Console.WriteLine(UserInfo.Current.ID);
//            Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().HdlLinphoneCallDelegate = mOnHDLLinphoneCallDelegate;
//#else
//            HDLLinphoneKit.Instance.InitLinphone(Application.Activity);
//            //设置收到来电后、是否需自动跳转呼叫页面方案
//            HDLLinphoneKit.Instance.AutoJumpCallView = IsAutoJumpCallView;
//            //设置Listener监听
//            setOnHDLLinphoneCallListener();
//#endif
//        }
        /// <summary>
        /// 设置sip登录账号
        /// </summary>
        /// <param name="mHDLSipInfo"></param>
        public void SetAccountAndLogin(HDLSipInfo mHDLSipInfo, string mInterphoneType)
        {
//        /// <summary>
//        /// 设置sip登录账号
//        /// </summary>
//        /// <param name="mHDLSipInfo"></param>
//        public void SetAccountAndLogin(HDLSipInfo mHDLSipInfo, string mInterphoneType)
//        {
            this.currentHDLSipInfo = mHDLSipInfo;
//            this.currentHDLSipInfo = mHDLSipInfo;
            if (mHDLSipInfo == null) {
                //new alert
                return;
            }
//            if (mHDLSipInfo == null) {
//                //new alert
//                return;
//            }
            //登录sip服务器
#if __IOS__
            Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().Login(mHDLSipInfo.sipAccount, mHDLSipInfo.sipPasswd, mHDLSipInfo.realm);
#else
            if (mInterphoneType == InterphoneType.FREEVIEW.ToString())
            {
                HDLLinphoneKit.Instance.SetAccountAndLogin(
                    mHDLSipInfo.sipAccount,
                    mHDLSipInfo.sipPasswd,
                    mHDLSipInfo.realm,
                    //"sip:139.159.157.75:47000;transport=udp",
                    HDLLinphoneKit.InterPhoneTypeFreeview
                    );
            }
            else
            {
                HDLLinphoneKit.Instance.SetAccountAndLogin(
                   mHDLSipInfo.sipAccount,
                   mHDLSipInfo.sipPasswd,
                   mHDLSipInfo.realm,
                   //mHDLSipInfo.proxy+ ";transport=udp",
                   //"sip:139.159.157.75:47000;transport=udp",
                   HDLLinphoneKit.InterPhoneTypeHdl
                   );
            }
#endif
        }
//            //登录sip服务器
//#if __IOS__
//            Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().Login(mHDLSipInfo.sipAccount, mHDLSipInfo.sipPasswd, mHDLSipInfo.realm);
//#else
//            if (mInterphoneType == InterphoneType.FREEVIEW.ToString())
//            {
//                HDLLinphoneKit.Instance.SetAccountAndLogin(
//                    mHDLSipInfo.sipAccount,
//                    mHDLSipInfo.sipPasswd,
//                    mHDLSipInfo.realm,
//                    //"sip:139.159.157.75:47000;transport=udp",
//                    HDLLinphoneKit.InterPhoneTypeFreeview
//                    );
//            }
//            else
//            {
//                HDLLinphoneKit.Instance.SetAccountAndLogin(
//                   mHDLSipInfo.sipAccount,
//                   mHDLSipInfo.sipPasswd,
//                   mHDLSipInfo.realm,
//                   //mHDLSipInfo.proxy+ ";transport=udp",
//                   //"sip:139.159.157.75:47000;transport=udp",
//                   HDLLinphoneKit.InterPhoneTypeHdl
//                   );
//            }
//#endif
//        }
        /// <summary>
        /// 注销所有账号
        /// </summary>
        public void LogoutAllAccount() {
            //没初始化过则返回
            if (!IsInitSdk) return;
//        /// <summary>
//        /// 注销所有账号
//        /// </summary>
//        public void LogoutAllAccount() {
//            //没初始化过则返回
//            if (!IsInitSdk) return;
            this.currentHDLSipInfo = null;
            this.mHDLCallVideoInfo = null;
#if __IOS__
//            this.currentHDLSipInfo = null;
//            this.mHDLCallVideoInfo = null;
//#if __IOS__
            Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().LogoutAllLinphoneUser();
#else
            if (HDLLinphoneKit.Instance != null)
            {
                HDLLinphoneKit.Instance.Logout();
            }
            else
            {
//            Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().LogoutAllLinphoneUser();
//#else
//            if (HDLLinphoneKit.Instance != null)
//            {
//                HDLLinphoneKit.Instance.Logout();
//            }
//            else
//            {
            }
#endif
        }
//            }
//#endif
//        }
        /// <summary>
        /// 清除配置表
        /// </summary>
        public void ClearProxyConfig()
        {
#if __IOS__
//        /// <summary>
//        /// 清除配置表
//        /// </summary>
//        public void ClearProxyConfig()
//        {
//#if __IOS__
            Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().ClearAllConfigs();
#else
            HDLLinphoneKit.Instance.ClearProxyConfig();
#endif
        }
//            Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().ClearAllConfigs();
//#else
//            HDLLinphoneKit.Instance.ClearProxyConfig();
//#endif
//        }
        #endregion
//        #endregion
        #region ■  --  获取sip账号_______________________________
        /// <summary>
        /// 获取当前住宅的SIP账号
        /// </summary>
        public HDLSipInfo GetHDLSipInfo(string homeId)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", homeId);
//        #region ■  --  获取sip账号_______________________________
//        /// <summary>
//        /// 获取当前住宅的SIP账号
//        /// </summary>
//        public HDLSipInfo GetHDLSipInfo(string homeId)
//        {
//            Dictionary<string, object> d = new Dictionary<string, object>();
//            d.Add("homeId", homeId);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            var resultObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_VideoDevice_GetSipAccount, requestJson);
//            var requestJson = HttpUtil.GetSignRequestJson(d);
//            var resultObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_VideoDevice_GetSipAccount, requestJson);
            if (resultObj.Code == StateCode.SUCCESS)
            {
                if (string.IsNullOrEmpty(resultObj.Data.ToString()))
                {
                    //控的话代表当前住宅不支持
                    return null;
                }
                else
                {
                    var info = Newtonsoft.Json.JsonConvert.DeserializeObject<HDLSipInfo>(resultObj.Data.ToString());
                    return info;
                }
            }
            else
            {
                return null;
            }
//            if (resultObj.Code == StateCode.SUCCESS)
//            {
//                if (string.IsNullOrEmpty(resultObj.Data.ToString()))
//                {
//                    //控的话代表当前住宅不支持
//                    return null;
//                }
//                else
//                {
//                    var info = Newtonsoft.Json.JsonConvert.DeserializeObject<HDLSipInfo>(resultObj.Data.ToString());
//                    return info;
//                }
//            }
//            else
//            {
//                return null;
//            }
        }
//        }
        /// <summary>
        /// 请求服务器获取当前住宅Sip账号信息并初始化LinphoneSDK和登录
        /// </summary>
        /// <param name="homeId"></param>
        public void GetHDLSipInfoAndInitSDK(HDLCallVideoInfo mHDLCallVideoInfo, bool clearCallInfo = true)
        {
            try
            {
                //先清空呼叫和监视设备信息
                if (clearCallInfo)
                {
                    //InitCallInfo(null);//造成接收呼叫时开锁开锁异常
                }
//        /// <summary>
//        /// 请求服务器获取当前住宅Sip账号信息并初始化LinphoneSDK和登录
//        /// </summary>
//        /// <param name="homeId"></param>
//        public void GetHDLSipInfoAndInitSDK(HDLCallVideoInfo mHDLCallVideoInfo, bool clearCallInfo = true)
//        {
//            try
//            {
//                //先清空呼叫和监视设备信息
//                if (clearCallInfo)
//                {
//                    //InitCallInfo(null);//造成接收呼叫时开锁开锁异常
//                }
                HDLSipInfo mHDLSipInfo = GetHDLSipInfo(mHDLCallVideoInfo.HomeId);
                if (mHDLSipInfo != null)
                {
                    Application.RunOnMainThread(() =>
                    {
                        try
                        {
                            InitLinphone();
                        }
                        catch (Exception ex)
                        {
                            MainPage.Log($"InitLinphone exception : {ex.Message}");
                        }
                        mHDLSipInfo.homeId = mHDLCallVideoInfo.HomeId;
                        try {
                            SetAccountAndLogin(mHDLSipInfo, mHDLCallVideoInfo.InterphoneType);
                        }
                        catch (Exception ex)
                        {
                            MainPage.Log($"SetAccountAndLogin exception : {ex.Message}");
                        }
                        Utlis.WriteLine("CALL 获取SIP账号成功:" + mHDLSipInfo.sipAccount);
                    });
                }
                else
                {
                    //Application.RunOnMainThread(() =>
                    //{
                    //    new Alert("", $"获取Sip账号信息失败.", "确定").Show();
                    //});
                }
            }
            catch { }
//                HDLSipInfo mHDLSipInfo = GetHDLSipInfo(mHDLCallVideoInfo.HomeId);
//                if (mHDLSipInfo != null)
//                {
//                    Application.RunOnMainThread(() =>
//                    {
//                        try
//                        {
//                            InitLinphone();
//                        }
//                        catch (Exception ex)
//                        {
//                            MainPage.Log($"InitLinphone exception : {ex.Message}");
//                        }
//                        mHDLSipInfo.homeId = mHDLCallVideoInfo.HomeId;
//                        try {
//                            SetAccountAndLogin(mHDLSipInfo, mHDLCallVideoInfo.InterphoneType);
//                        }
//                        catch (Exception ex)
//                        {
//                            MainPage.Log($"SetAccountAndLogin exception : {ex.Message}");
//                        }
//                        Utlis.WriteLine("CALL 获取SIP账号成功:" + mHDLSipInfo.sipAccount);
//                    });
//                }
//                else
//                {
//                    //Application.RunOnMainThread(() =>
//                    //{
//                    //    new Alert("", $"获取Sip账号信息失败.", "确定").Show();
//                    //});
//                }
//            }
//            catch { }
        }
        #endregion
//        }
//        #endregion
        #region ■  -- 动作回调和原生交互,提交记录到云端_______________________________
//        #region ■  -- 动作回调和原生交互,提交记录到云端_______________________________
       
        /// <summary>
        /// 初始化呼叫参数
        /// </summary>
        /// <param name="mHDLCallVideoInfo"></param>
        /// <param name="mInterphoneType"></param>
        void InitCallInfo(HDLCallVideoInfo mHDLCallVideoInfo)
        {
            this.mHDLCallVideoInfo = mHDLCallVideoInfo;
        }
//        /// <summary>
//        /// 初始化呼叫参数
//        /// </summary>
//        /// <param name="mHDLCallVideoInfo"></param>
//        /// <param name="mInterphoneType"></param>
//        void InitCallInfo(HDLCallVideoInfo mHDLCallVideoInfo)
//        {
//            this.mHDLCallVideoInfo = mHDLCallVideoInfo;
//        }
        /// <summary>
        /// 判断callId是否为空
        /// </summary>
        /// <returns></returns>
        bool CheckmHDLCallVideoInfoIsNullOrEmpty()
        {
            return (mHDLCallVideoInfo == null || string.IsNullOrEmpty(mHDLCallVideoInfo.CallId));
        }
//        /// <summary>
//        /// 判断callId是否为空
//        /// </summary>
//        /// <returns></returns>
//        bool CheckmHDLCallVideoInfoIsNullOrEmpty()
//        {
//            return (mHDLCallVideoInfo == null || string.IsNullOrEmpty(mHDLCallVideoInfo.CallId));
//        }
        /// <summary>
        /// 截图成功 暂时废弃
        /// </summary>
        public void ScreenshotSuccessfulAction(byte[] dataBytes)
        {
            //Utlis.WriteLine("ScreenshotSuccessfulAction");
//        /// <summary>
//        /// 截图成功 暂时废弃
//        /// </summary>
//        public void ScreenshotSuccessfulAction(byte[] dataBytes)
//        {
//            //Utlis.WriteLine("ScreenshotSuccessfulAction");
            if (CheckmHDLCallVideoInfoIsNullOrEmpty()) return;
//            if (CheckmHDLCallVideoInfoIsNullOrEmpty()) return;
            new Thread(() =>
            {
                //var imageName = Guid.NewGuid().ToString();
                Dictionary<string, object> dic = new Dictionary<string, object>();
                dic.Add("callId", mHDLCallVideoInfo.CallId);
                dic.Add("images", dataBytes);
#if __IOS__
                dic.Add("imagesName", "_IOS.jpg");
#else
                dic.Add("imagesName", "_Android.jpg");
#endif
//            new Thread(() =>
//            {
//                //var imageName = Guid.NewGuid().ToString();
//                Dictionary<string, object> dic = new Dictionary<string, object>();
//                dic.Add("callId", mHDLCallVideoInfo.CallId);
//                dic.Add("images", dataBytes);
//#if __IOS__
//                dic.Add("imagesName", "_IOS.jpg");
//#else
//                dic.Add("imagesName", "_Android.jpg");
//#endif
                var requestJson = HttpUtil.GetSignRequestJson(dic);
                var revertObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_FL_Screenshot, requestJson);
                if (revertObj.Code == StateCode.SUCCESS)
                {
                    //Utlis.WriteLine("POST 截图上传成功");
                }
                else
                {
                    Utlis.WriteLine("POST 截图上传失败 code: " + revertObj.Code);
                }
//                var requestJson = HttpUtil.GetSignRequestJson(dic);
//                var revertObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_FL_Screenshot, requestJson);
//                if (revertObj.Code == StateCode.SUCCESS)
//                {
//                    //Utlis.WriteLine("POST 截图上传成功");
//                }
//                else
//                {
//                    Utlis.WriteLine("POST 截图上传失败 code: " + revertObj.Code);
//                }
            })
            { IsBackground = false }.Start();
//            })
//            { IsBackground = false }.Start();
        }
//        }
        //DateTime UnlockDateTime = DateTime.MinValue;
        #endregion
//        //DateTime UnlockDateTime = DateTime.MinValue;
//        #endregion
        #region ■  --  新接听和开锁接口_______________________________
        /// <summary>
        /// 可视对讲开锁
        /// </summary>
        public void HDLUnlockAction()
        {
            //Utlis.WriteLine("UnlockAction");
//        #region ■  --  新接听和开锁接口_______________________________
//        /// <summary>
//        /// 可视对讲开锁
//        /// </summary>
//        public void HDLUnlockAction()
//        {
//            //Utlis.WriteLine("UnlockAction");
            if (mHDLCallVideoInfo == null) return;
//            if (mHDLCallVideoInfo == null) return;
            new Thread(() =>
            {
                Dictionary<string, object> dic = new Dictionary<string, object>();
                dic.Add("deviceId", mHDLCallVideoInfo.DeviceId);//设备id
                dic.Add("callId", mHDLCallVideoInfo.CallId);//当前呼叫id
                dic.Add("interphoneType", mHDLCallVideoInfo.InterphoneType);//可视对讲厂家类型
                dic.Add("homeId", mHDLCallVideoInfo.HomeId);//住宅ID
                var requestJson = HttpUtil.GetSignRequestJson(dic);
                var revertObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_VideoDevice_OpenDoorbell, requestJson);
//            new Thread(() =>
//            {
//                Dictionary<string, object> dic = new Dictionary<string, object>();
//                dic.Add("deviceId", mHDLCallVideoInfo.DeviceId);//设备id
//                dic.Add("callId", mHDLCallVideoInfo.CallId);//当前呼叫id
//                dic.Add("interphoneType", mHDLCallVideoInfo.InterphoneType);//可视对讲厂家类型
//                dic.Add("homeId", mHDLCallVideoInfo.HomeId);//住宅ID
//                var requestJson = HttpUtil.GetSignRequestJson(dic);
//                var revertObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_VideoDevice_OpenDoorbell, requestJson);
                Application.RunOnMainThread(() =>
                {
                    if(revertObj == null)
                    {
                        return;
                    }
//                Application.RunOnMainThread(() =>
//                {
//                    if(revertObj == null)
//                    {
//                        return;
//                    }
#if __IOS__
                    if (revertObj.Code == StateCode.SUCCESS)
                    {
                        //和原生监控界面交互、发送开锁成功通知
                        NSNotificationCenter.DefaultCenter.PostNotificationName("lcCallDelegateOpenDoorSuccess", null);
                    }
                    else
                    {
                        Utlis.WriteLine("POST 开锁失败 code: " + revertObj.Code);
                    }
#else
                    if (revertObj.Code == StateCode.SUCCESS)
                    {
                        HDLLinphoneKit.Instance.OnOpenSuccess();
                    }
                    else
                    {
                        Utlis.WriteLine("POST 开锁失败 code: " + revertObj.Code);
                        HDLLinphoneKit.Instance.OnOpenError(revertObj.message);
                    }
#endif
//#if __IOS__
//                    if (revertObj.Code == StateCode.SUCCESS)
//                    {
//                        //和原生监控界面交互、发送开锁成功通知
//                        NSNotificationCenter.DefaultCenter.PostNotificationName("lcCallDelegateOpenDoorSuccess", null);
//                    }
//                    else
//                    {
//                        Utlis.WriteLine("POST 开锁失败 code: " + revertObj.Code);
//                    }
//#else
//                    if (revertObj.Code == StateCode.SUCCESS)
//                    {
//                        HDLLinphoneKit.Instance.OnOpenSuccess();
//                    }
//                    else
//                    {
//                        Utlis.WriteLine("POST 开锁失败 code: " + revertObj.Code);
//                        HDLLinphoneKit.Instance.OnOpenError(revertObj.message);
//                    }
//#endif
                });
//                });
            })
            { IsBackground = false }.Start();
        }
//            })
//            { IsBackground = false }.Start();
//        }
        /// <summary>
        /// 更改通话状态
        /// </summary>
        public void HDLUpdateCallStatus(CallStatusType callStatusType, InterphoneType interphoneType, int callDuration = 0)
        {
//        /// <summary>
//        /// 更改通话状态
//        /// </summary>
//        public void HDLUpdateCallStatus(CallStatusType callStatusType, InterphoneType interphoneType, int callDuration = 0)
//        {
            if (CheckmHDLCallVideoInfoIsNullOrEmpty()) return;
//            if (CheckmHDLCallVideoInfoIsNullOrEmpty()) return;
            new Thread(() =>
            {
                Dictionary<string, object> dic = new Dictionary<string, object>();
                dic.Add("callId", mHDLCallVideoInfo.CallId);//呼叫id
                dic.Add("callStatus", callStatusType.ToString());//可用值:MISSED,RECEIVED,REJECT
                dic.Add("interphoneTypeEnum", interphoneType.ToString());
                if (callStatusType == CallStatusType.RECEIVED && callDuration > 0)
                {
                    dic.Add("callDuration", callDuration);//通话时长(秒)
                }
//            new Thread(() =>
//            {
//                Dictionary<string, object> dic = new Dictionary<string, object>();
//                dic.Add("callId", mHDLCallVideoInfo.CallId);//呼叫id
//                dic.Add("callStatus", callStatusType.ToString());//可用值:MISSED,RECEIVED,REJECT
//                dic.Add("interphoneTypeEnum", interphoneType.ToString());
//                if (callStatusType == CallStatusType.RECEIVED && callDuration > 0)
//                {
//                    dic.Add("callDuration", callDuration);//通话时长(秒)
//                }
                var requestJson = HttpUtil.GetSignRequestJson(dic);
                var revertObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_VideoDevice_UpdateCallStatus, requestJson);
                if (revertObj.Code == StateCode.SUCCESS)
                {
//                var requestJson = HttpUtil.GetSignRequestJson(dic);
//                var revertObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_VideoDevice_UpdateCallStatus, requestJson);
//                if (revertObj.Code == StateCode.SUCCESS)
//                {
                }
                else
                {
                    Utlis.WriteLine("POST 更新状态失败 code: " + revertObj.Code);
                }
//                }
//                else
//                {
//                    Utlis.WriteLine("POST 更新状态失败 code: " + revertObj.Code);
//                }
            })
            { IsBackground = false }.Start();
//            })
//            { IsBackground = false }.Start();
        }
        #endregion
//        }
//        #endregion
     
        #region ■  --  跳转监控页面_______________________________
        /// <summary>
        /// 跳转监控页面
        /// </summary>
        /// <param name="mESVideoInfo"></param>
        public void ShowESVideoMonitor(ESVideoInfo mESVideoInfo,string mInterphoneType)
        {
            InitLinphone();
            //sip账号为空
            if (string.IsNullOrEmpty(mESVideoInfo.deviceSipAccount))
            {
//        #region ■  --  跳转监控页面_______________________________
//        /// <summary>
//        /// 跳转监控页面
//        /// </summary>
//        /// <param name="mESVideoInfo"></param>
//        public void ShowESVideoMonitor(ESVideoInfo mESVideoInfo,string mInterphoneType)
//        {
//            InitLinphone();
//            //sip账号为空
//            if (string.IsNullOrEmpty(mESVideoInfo.deviceSipAccount))
//            {
                HDLCommon.Current.ShowAlert(Language.StringByID(StringId.shebeibucunzai));
                return;
            }
            HDLCallVideoInfo mHDLCallVideoInfo = new HDLCallVideoInfo();
            mHDLCallVideoInfo.HomeId = mESVideoInfo.HomeId;
            mHDLCallVideoInfo.DeviceId = mESVideoInfo.Lc_DeviceId;
            mHDLCallVideoInfo.DeviceName = mESVideoInfo.DeviceName;
            mHDLCallVideoInfo.InterphoneType = mInterphoneType;
            mHDLCallVideoInfo.DeviceSipAccount = mESVideoInfo.deviceSipAccount;//监视主动呼叫门口机时用到
            InitCallInfo(mHDLCallVideoInfo);
//                HDLCommon.Current.ShowAlert(Language.StringByID(StringId.shebeibucunzai));
//                return;
//            }
//            HDLCallVideoInfo mHDLCallVideoInfo = new HDLCallVideoInfo();
//            mHDLCallVideoInfo.HomeId = mESVideoInfo.HomeId;
//            mHDLCallVideoInfo.DeviceId = mESVideoInfo.Lc_DeviceId;
//            mHDLCallVideoInfo.DeviceName = mESVideoInfo.DeviceName;
//            mHDLCallVideoInfo.InterphoneType = mInterphoneType;
//            mHDLCallVideoInfo.DeviceSipAccount = mESVideoInfo.deviceSipAccount;//监视主动呼叫门口机时用到
//            InitCallInfo(mHDLCallVideoInfo);
#if __IOS__
//#if __IOS__
            if (mHDLCallVideoInfo.spk == "door.gate")
            {
                Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().CallHDLSRWithUserName(mHDLCallVideoInfo.DeviceSipAccount, mHDLCallVideoInfo.DeviceName);
            }else{
                Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().CallWithUserName(mHDLCallVideoInfo.DeviceSipAccount, mHDLCallVideoInfo.DeviceName);
            }
//            if (mHDLCallVideoInfo.spk == "door.gate")
//            {
//                Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().CallHDLSRWithUserName(mHDLCallVideoInfo.DeviceSipAccount, mHDLCallVideoInfo.DeviceName);
//            }else{
//                Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().CallWithUserName(mHDLCallVideoInfo.DeviceSipAccount, mHDLCallVideoInfo.DeviceName);
//            }
            
#else
            //1.先呼叫设备
            Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.CallTo(mHDLCallVideoInfo.DeviceSipAccount, true);
            //2.跳转打开监控页面
            var intent = new Intent(Shared.Application.Activity, typeof(Com.Hdl.Hdllinphonesdk.Activity.HDLLinphoneMonitorActivity)); ;
            intent.PutExtra(HDLLinphoneKit.KeyTitleName, mHDLCallVideoInfo.DeviceName);//传入设备名称为显示标题
            Shared.Application.Activity.StartActivity(intent);
#endif
//#else
//            //1.先呼叫设备
//            Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.CallTo(mHDLCallVideoInfo.DeviceSipAccount, true);
//            //2.跳转打开监控页面
//            var intent = new Intent(Shared.Application.Activity, typeof(Com.Hdl.Hdllinphonesdk.Activity.HDLLinphoneMonitorActivity)); ;
//            intent.PutExtra(HDLLinphoneKit.KeyTitleName, mHDLCallVideoInfo.DeviceName);//传入设备名称为显示标题
//            Shared.Application.Activity.StartActivity(intent);
//#endif
        }
        #endregion
//        }
//        #endregion
        #region ■  --  跳转呼叫页面_______________________________
        /// <summary>
        /// 收到推送,后判断呼叫住宅是否为当前住宅,不是的话重新获取SIP账号并登录
        /// </summary>
        /// <param name="mESVideoInfo"></param>
        public void ShowESVideoIntercom(ESVideoInfo mESVideoInfo,string mInterphoneType)
        {
            InitLinphone();
//        #region ■  --  跳转呼叫页面_______________________________
//        /// <summary>
//        /// 收到推送,后判断呼叫住宅是否为当前住宅,不是的话重新获取SIP账号并登录
//        /// </summary>
//        /// <param name="mESVideoInfo"></param>
//        public void ShowESVideoIntercom(ESVideoInfo mESVideoInfo,string mInterphoneType)
//        {
//            InitLinphone();
            HDLCallVideoInfo mHDLCallVideoInfo = new HDLCallVideoInfo();
            mHDLCallVideoInfo.CallId = mESVideoInfo.callId;
            mHDLCallVideoInfo.HomeId = mESVideoInfo.HomeId;
            mHDLCallVideoInfo.DeviceId = mESVideoInfo.Lc_DeviceId;
            mHDLCallVideoInfo.DeviceName = mESVideoInfo.DeviceName;
            mHDLCallVideoInfo.InterphoneType = mInterphoneType;
            mHDLCallVideoInfo.DeviceSipAccount = mESVideoInfo.deviceSipAccount;
            mHDLCallVideoInfo.spk = mESVideoInfo.spk;
            InitCallInfo(mHDLCallVideoInfo);
//            HDLCallVideoInfo mHDLCallVideoInfo = new HDLCallVideoInfo();
//            mHDLCallVideoInfo.CallId = mESVideoInfo.callId;
//            mHDLCallVideoInfo.HomeId = mESVideoInfo.HomeId;
//            mHDLCallVideoInfo.DeviceId = mESVideoInfo.Lc_DeviceId;
//            mHDLCallVideoInfo.DeviceName = mESVideoInfo.DeviceName;
//            mHDLCallVideoInfo.InterphoneType = mInterphoneType;
//            mHDLCallVideoInfo.DeviceSipAccount = mESVideoInfo.deviceSipAccount;
//            mHDLCallVideoInfo.spk = mESVideoInfo.spk;
//            InitCallInfo(mHDLCallVideoInfo);
            //当前呼叫来电的住宅和之前注册登录的住宅一致的情况下
            if (currentHDLSipInfo != null && currentHDLSipInfo.homeId == mESVideoInfo.HomeId)
            {
                Utlis.WriteLine("CALL 收到推送 推送住宅和之前注册登录的住宅一致");
                CheckCallStateAndGotoPage();
            }
            else
            {
                //注意:之前没登录SIP账号或者住宅不一致的情况下需要重新获取SIP账号
                //获取呼叫住宅的SIP账号并登录
                Utlis.WriteLine("CALL 收到推送 其他住宅,重新获取呼叫住宅的SIP账号并登录");
                new Thread(() =>
                {
                    GetHDLSipInfoAndInitSDK(mHDLCallVideoInfo, false);
                })
                { IsBackground = false }.Start();
//            //当前呼叫来电的住宅和之前注册登录的住宅一致的情况下
//            if (currentHDLSipInfo != null && currentHDLSipInfo.homeId == mESVideoInfo.HomeId)
//            {
//                Utlis.WriteLine("CALL 收到推送 推送住宅和之前注册登录的住宅一致");
//                CheckCallStateAndGotoPage();
//            }
//            else
//            {
//                //注意:之前没登录SIP账号或者住宅不一致的情况下需要重新获取SIP账号
//                //获取呼叫住宅的SIP账号并登录
//                Utlis.WriteLine("CALL 收到推送 其他住宅,重新获取呼叫住宅的SIP账号并登录");
//                new Thread(() =>
//                {
//                    GetHDLSipInfoAndInitSDK(mHDLCallVideoInfo, false);
//                })
//                { IsBackground = false }.Start();
                //
                CheckCallStateAndGotoPage();
//                //
//                CheckCallStateAndGotoPage();
            }
//            }
        }
//        }
        /// <summary>
        /// 检测来电状态,判断是否马上打开呼叫页面,如果还没来电则开启线程检测等待
        /// </summary>
        /// <param name="mESVideoInfo"></param>
        public void CheckCallStateAndGotoPage()
        {
            if (mHDLCallVideoInfo.spk == "door.gate")
            {
#if __IOS__
                //自研可视对讲
                Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().GotoHDLSRLinphoneIntercomVC(mHDLCallVideoInfo.DeviceName, mHDLCallVideoInfo.DeviceSipAccount);
#else
                var intent = new Intent(Shared.Application.Activity, typeof(Com.Hdl.Hdllinphonesdk.Activity.HDLLinphoneReverseCallActivity));
                if (mHDLCallVideoInfo != null)
                {
                    //intent.PutExtra(HDLLinphoneKit.KeyTitleName, mHDLCallVideoInfo.DeviceName);
                    intent.PutExtra("lpTitleName", mHDLCallVideoInfo.DeviceName);
                    intent.PutExtra("lpSipAccount", mHDLCallVideoInfo.DeviceSipAccount);
                }
                Shared.Application.Activity.StartActivity(intent);
#endif
            }
            else {
                //狄耐克可视对讲
                //如果开启了自动跳转方案,则无需继续下面处理、无需手动跳转
                if (IsAutoJumpCallView) return;
                //先结束掉之前的线程
                EndCheckIncomingCallThread();
                //检测是否来电了如果是直接调整呼叫页面如果不是则开启线程等待判断(Shared.IOS.HDLLinphoneSDK)
                if (IsIncomingReceivedCallState())
                {
                    Utlis.WriteLine("CALL 已经来电了。。。打开呼叫页面");
                    GoToHDLLinphoneIntercomActivity();
                }
                else
                {
                    //如果还没来电 开启线程检测
                    StartCheckIncomingCallThread();
                }
            }
//        /// <summary>
//        /// 检测来电状态,判断是否马上打开呼叫页面,如果还没来电则开启线程检测等待
//        /// </summary>
//        /// <param name="mESVideoInfo"></param>
//        public void CheckCallStateAndGotoPage()
//        {
//            if (mHDLCallVideoInfo.spk == "door.gate")
//            {
//#if __IOS__
//                //自研可视对讲
//                Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().GotoHDLSRLinphoneIntercomVC(mHDLCallVideoInfo.DeviceName, mHDLCallVideoInfo.DeviceSipAccount);
//#else
//                var intent = new Intent(Shared.Application.Activity, typeof(Com.Hdl.Hdllinphonesdk.Activity.HDLLinphoneReverseCallActivity));
//                if (mHDLCallVideoInfo != null)
//                {
//                    //intent.PutExtra(HDLLinphoneKit.KeyTitleName, mHDLCallVideoInfo.DeviceName);
//                    intent.PutExtra("lpTitleName", mHDLCallVideoInfo.DeviceName);
//                    intent.PutExtra("lpSipAccount", mHDLCallVideoInfo.DeviceSipAccount);
//                }
//                Shared.Application.Activity.StartActivity(intent);
//#endif
//            }
//            else {
//                //狄耐克可视对讲
//                //如果开启了自动跳转方案,则无需继续下面处理、无需手动跳转
//                if (IsAutoJumpCallView) return;
//                //先结束掉之前的线程
//                EndCheckIncomingCallThread();
//                //检测是否来电了如果是直接调整呼叫页面如果不是则开启线程等待判断(Shared.IOS.HDLLinphoneSDK)
//                if (IsIncomingReceivedCallState())
//                {
//                    Utlis.WriteLine("CALL 已经来电了。。。打开呼叫页面");
//                    GoToHDLLinphoneIntercomActivity();
//                }
//                else
//                {
//                    //如果还没来电 开启线程检测
//                    StartCheckIncomingCallThread();
//                }
//            }
        }
//        }
        /// <summary>
        /// 是否来电状态(Shared.IOS.HDLLinphoneSDK)
        /// </summary>
        /// <returns></returns>
        bool IsIncomingReceivedCallState()
        {
#if __IOS__
            return Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().IsIncomingReceivedCallState;
#else
            return HDLLinphoneKit.Instance.IsIncomingReceivedCallState;
#endif
        }
//        /// <summary>
//        /// 是否来电状态(Shared.IOS.HDLLinphoneSDK)
//        /// </summary>
//        /// <returns></returns>
//        bool IsIncomingReceivedCallState()
//        {
//#if __IOS__
//            return Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().IsIncomingReceivedCallState;
//#else
//            return HDLLinphoneKit.Instance.IsIncomingReceivedCallState;
//#endif
//        }
        /// <summary>
        /// 跳转打开原生的呼叫页面
        /// </summary>
        void GoToHDLLinphoneIntercomActivity() {
//        /// <summary>
//        /// 跳转打开原生的呼叫页面
//        /// </summary>
//        void GoToHDLLinphoneIntercomActivity() {
#if __IOS__
//#if __IOS__
            Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().GotoHDLLinphoneIntercomVC(mHDLCallVideoInfo.DeviceName);
//            Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().GotoHDLLinphoneIntercomVC(mHDLCallVideoInfo.DeviceName);
#else
            var intent = new Intent(Shared.Application.Activity, typeof(Com.Hdl.Hdllinphonesdk.Activity.HDLLinphoneIntercomActivity));
            if (mHDLCallVideoInfo != null)
            {
                //intent.PutExtra(HDLLinphoneKit.KeyTitleName, mHDLCallVideoInfo.DeviceName);
                intent.PutExtra(HDLLinphoneKit.KeyTitleName, mHDLCallVideoInfo.CallId);
            }
            Shared.Application.Activity.StartActivity(intent);
#endif
//#else
//            var intent = new Intent(Shared.Application.Activity, typeof(Com.Hdl.Hdllinphonesdk.Activity.HDLLinphoneIntercomActivity));
//            if (mHDLCallVideoInfo != null)
//            {
//                //intent.PutExtra(HDLLinphoneKit.KeyTitleName, mHDLCallVideoInfo.DeviceName);
//                intent.PutExtra(HDLLinphoneKit.KeyTitleName, mHDLCallVideoInfo.CallId);
//            }
//            Shared.Application.Activity.StartActivity(intent);
//#endif
        }
//        }
        /// <summary>
        /// 检测来电线程
        /// </summary>
        Thread checkIncomingCallThread = null;
        /// <summary>
        /// 检测线程持续时间
        /// </summary>
        const int MAX_THREAD_TIME = 30;
        /// <summary>
        /// 线程结束
        /// </summary>
        int threadTime = MAX_THREAD_TIME;
        /// <summary>
        /// 开启检测来电线程
        /// </summary>
        void StartCheckIncomingCallThread()
        {
            try
            {
                Utlis.WriteLine("CALL 还没来电,开启线程");
                threadTime = MAX_THREAD_TIME;
                //结束之前的线程
                EndCheckIncomingCallThread();
                //新建线程
                checkIncomingCallThread = new Thread(() =>
                    {
                        try
                        {
                            //15S后自动结束线程
                            while (threadTime > 0)
                            {
                                threadTime--;
                                Utlis.WriteLine("CALL 检测中...." + threadTime);
                                Thread.Sleep(1000);
                                //来电了,跳转呼叫页面(Shared.IOS.HDLLinphoneSDK)
                                if (IsIncomingReceivedCallState())
                                {
                                    Utlis.WriteLine("CALL 来电了。。。打开呼叫页面");
                                    threadTime = 0;//跳出循环,关闭线程
                                    Application.RunOnMainThread(() =>
                                    {
                                        GoToHDLLinphoneIntercomActivity();
                                    });
//        /// <summary>
//        /// 检测来电线程
//        /// </summary>
//        Thread checkIncomingCallThread = null;
//        /// <summary>
//        /// 检测线程持续时间
//        /// </summary>
//        const int MAX_THREAD_TIME = 30;
//        /// <summary>
//        /// 线程结束
//        /// </summary>
//        int threadTime = MAX_THREAD_TIME;
//        /// <summary>
//        /// 开启检测来电线程
//        /// </summary>
//        void StartCheckIncomingCallThread()
//        {
//            try
//            {
//                Utlis.WriteLine("CALL 还没来电,开启线程");
//                threadTime = MAX_THREAD_TIME;
//                //结束之前的线程
//                EndCheckIncomingCallThread();
//                //新建线程
//                checkIncomingCallThread = new Thread(() =>
//                    {
//                        try
//                        {
//                            //15S后自动结束线程
//                            while (threadTime > 0)
//                            {
//                                threadTime--;
//                                Utlis.WriteLine("CALL 检测中...." + threadTime);
//                                Thread.Sleep(1000);
//                                //来电了,跳转呼叫页面(Shared.IOS.HDLLinphoneSDK)
//                                if (IsIncomingReceivedCallState())
//                                {
//                                    Utlis.WriteLine("CALL 来电了。。。打开呼叫页面");
//                                    threadTime = 0;//跳出循环,关闭线程
//                                    Application.RunOnMainThread(() =>
//                                    {
//                                        GoToHDLLinphoneIntercomActivity();
//                                    });
                                }
                            }
//                                }
//                            }
                          
                          
                        }
                        catch { }
                    });
                //开启线程
                checkIncomingCallThread.Start();
            }
            catch { }
        }
//                        }
//                        catch { }
//                    });
//                //开启线程
//                checkIncomingCallThread.Start();
//            }
//            catch { }
//        }
        /// <summary>
        /// 结束线程
        /// </summary>
        void EndCheckIncomingCallThread()
        {
            if (checkIncomingCallThread != null)
            {
                try
                {
                    checkIncomingCallThread.Interrupt();
                }
                catch {
//        /// <summary>
//        /// 结束线程
//        /// </summary>
//        void EndCheckIncomingCallThread()
//        {
//            if (checkIncomingCallThread != null)
//            {
//                try
//                {
//                    checkIncomingCallThread.Interrupt();
//                }
//                catch {
                }
//                }
                checkIncomingCallThread = null;
                Utlis.WriteLine("CALL 先结束线程");
            }
        }
//                checkIncomingCallThread = null;
//                Utlis.WriteLine("CALL 先结束线程");
//            }
//        }
        /// <summary>
        /// 判断线程是否启动了
        /// </summary>
        /// <returns></returns>
        public bool CheckIncomingCallThreadIsNull()
        {
            return checkIncomingCallThread == null || checkIncomingCallThread.ThreadState != ThreadState.Running;
        }
//        /// <summary>
//        /// 判断线程是否启动了
//        /// </summary>
//        /// <returns></returns>
//        public bool CheckIncomingCallThreadIsNull()
//        {
//            return checkIncomingCallThread == null || checkIncomingCallThread.ThreadState != ThreadState.Running;
//        }
        #endregion
//        #endregion
        #region ■  --  Android相关操作_______________________________
//        #region ■  --  Android相关操作_______________________________
#if __Android__
//#if __Android__
        /// <summary>
        /// 接听、挂断、开锁等动作监听处理
        /// </summary>
        private class HDLLinphoneCallListener : Java.Lang.Object, Com.Hdl.Hdllinphonesdk.Callback.IOnHDLLinphoneCallListener
        {
            [Weak] HDLLinphone hdlLinphone;
//        /// <summary>
//        /// 接听、挂断、开锁等动作监听处理
//        /// </summary>
//        private class HDLLinphoneCallListener : Java.Lang.Object, Com.Hdl.Hdllinphonesdk.Callback.IOnHDLLinphoneCallListener
//        {
//            [Weak] HDLLinphone hdlLinphone;
            public HDLLinphoneCallListener(HDLLinphone mHDLLinphone)
            {
                hdlLinphone = mHDLLinphone;
            }
//            public HDLLinphoneCallListener(HDLLinphone mHDLLinphone)
//            {
//                hdlLinphone = mHDLLinphone;
//            }
            //showToast
            void showToast(string text)
            {
                Toast.MakeText(Application.Activity, text, ToastLength.Short).Show();
            }
            /// <summary>
            /// 接听事件
            /// </summary>
            public void OnAnswerAction()
            {
                //showToast("接听");
                hdlLinphone.HDLUpdateCallStatus(CallStatusType.RECEIVED, InterphoneType.HDL);
            }
            /// <summary>
            /// 挂断事件
            /// </summary>
            /// <param name="callDuration"></param>
            public void OnHangUpAction(int callDuration)
            {
//            //showToast
//            void showToast(string text)
//            {
//                Toast.MakeText(Application.Activity, text, ToastLength.Short).Show();
//            }
//            /// <summary>
//            /// 接听事件
//            /// </summary>
//            public void OnAnswerAction()
//            {
//                //showToast("接听");
//                hdlLinphone.HDLUpdateCallStatus(CallStatusType.RECEIVED, InterphoneType.HDL);
//            }
//            /// <summary>
//            /// 挂断事件
//            /// </summary>
//            /// <param name="callDuration"></param>
//            public void OnHangUpAction(int callDuration)
//            {
                //showToast("挂断 通话时长:" + callDuration);
                hdlLinphone.HDLUpdateCallStatus(CallStatusType.RECEIVED, InterphoneType.HDL, callDuration);
            }
//                //showToast("挂断 通话时长:" + callDuration);
//                hdlLinphone.HDLUpdateCallStatus(CallStatusType.RECEIVED, InterphoneType.HDL, callDuration);
//            }
            /// <summary>
            /// 拒接事件
            /// </summary>
            public void OnRejectCallAction()
            {
                //showToast("拒接");
                hdlLinphone.HDLUpdateCallStatus(CallStatusType.REJECT, InterphoneType.HDL);
            }
//            /// <summary>
//            /// 拒接事件
//            /// </summary>
//            public void OnRejectCallAction()
//            {
//                //showToast("拒接");
//                hdlLinphone.HDLUpdateCallStatus(CallStatusType.REJECT, InterphoneType.HDL);
//            }
            /// <summary>
            /// 截图成功事件
            /// </summary>
            /// <param name="p0"></param>
            public void OnScreenshotSuccessfulAction(Bitmap imgBitmap)
            {
                //showToast("截图成功");
            }
//            /// <summary>
//            /// 截图成功事件
//            /// </summary>
//            /// <param name="p0"></param>
//            public void OnScreenshotSuccessfulAction(Bitmap imgBitmap)
//            {
//                //showToast("截图成功");
//            }
            /// <summary>
            /// 开锁事件
            /// </summary>
            public void OnUnlockAction()
            {
                hdlLinphone.HDLUnlockAction();
            }
//            /// <summary>
//            /// 开锁事件
//            /// </summary>
//            public void OnUnlockAction()
//            {
//                hdlLinphone.HDLUnlockAction();
//            }
            /// <summary>
            /// 来电事件
            /// </summary>
            /// <param name="userName"></param>
            public void OnIncomingCall(string userName)
            {
                Utlis.WriteLine("OnIncomingCall :" + userName);
            }
        }
//            /// <summary>
//            /// 来电事件
//            /// </summary>
//            /// <param name="userName"></param>
//            public void OnIncomingCall(string userName)
//            {
//                Utlis.WriteLine("OnIncomingCall :" + userName);
//            }
//        }
        /// <summary>
        /// 设置原生的Listener监听
        /// </summary>
        void setOnHDLLinphoneCallListener()
        {
            HDLLinphoneKit.Instance.OnHDLLinphoneCallListener = new HDLLinphoneCallListener(this);
        }
//        /// <summary>
//        /// 设置原生的Listener监听
//        /// </summary>
//        void setOnHDLLinphoneCallListener()
//        {
//            HDLLinphoneKit.Instance.OnHDLLinphoneCallListener = new HDLLinphoneCallListener(this);
//        }
        /// <summary>
        /// 清楚通知栏所有通知
        /// </summary>
        void CancelAllNotification()
        {
            NotificationManager nMgr = (NotificationManager)Application.Activity.GetSystemService(Context.NotificationService);
            nMgr.CancelAll();
        }
//        /// <summary>
//        /// 清楚通知栏所有通知
//        /// </summary>
//        void CancelAllNotification()
//        {
//            NotificationManager nMgr = (NotificationManager)Application.Activity.GetSystemService(Context.NotificationService);
//            nMgr.CancelAll();
//        }
#endif
        #endregion
//#endif
//        #endregion
        #region ■  --  iOS相关操作_______________________________
//        #region ■  --  iOS相关操作_______________________________
#if __IOS__
//#if __IOS__
        #region OnHDLLinphoneCallDelegate
        /// <summary>
        ///
        /// </summary>
        OnHDLLinphoneCallDelegate mOnHDLLinphoneCallDelegate;
//        #region OnHDLLinphoneCallDelegate
//        /// <summary>
//        ///
//        /// </summary>
//        OnHDLLinphoneCallDelegate mOnHDLLinphoneCallDelegate;
        /// <summary>
        ///
        /// </summary>
        public class OnHDLLinphoneCallDelegate : HDLLinphoneCallDelegate
        {
            [Weak] HDLLinphone hdlLinphone;
//        /// <summary>
//        ///
//        /// </summary>
//        public class OnHDLLinphoneCallDelegate : HDLLinphoneCallDelegate
//        {
//            [Weak] HDLLinphone hdlLinphone;
            public OnHDLLinphoneCallDelegate(HDLLinphone mHDLLinphone)
            {
                this.hdlLinphone = mHDLLinphone;
            }
//            public OnHDLLinphoneCallDelegate(HDLLinphone mHDLLinphone)
//            {
//                this.hdlLinphone = mHDLLinphone;
//            }
            /// <summary>
            /// 接听
            /// </summary>
            public override void OnAnswerAction()
            {
                hdlLinphone.HDLUpdateCallStatus(CallStatusType.RECEIVED, InterphoneType.HDL);
            }
//            /// <summary>
//            /// 接听
//            /// </summary>
//            public override void OnAnswerAction()
//            {
//                hdlLinphone.HDLUpdateCallStatus(CallStatusType.RECEIVED, InterphoneType.HDL);
//            }
            /// <summary>
            /// 挂断
            /// </summary>
            /// <param name="callDuration"></param>
            public override void OnHangUpAction(int callDuration)
            {
                hdlLinphone.HDLUpdateCallStatus(CallStatusType.RECEIVED, InterphoneType.HDL, callDuration);
            }
//            /// <summary>
//            /// 挂断
//            /// </summary>
//            /// <param name="callDuration"></param>
//            public override void OnHangUpAction(int callDuration)
//            {
//                hdlLinphone.HDLUpdateCallStatus(CallStatusType.RECEIVED, InterphoneType.HDL, callDuration);
//            }
            /// <summary>
            /// 拒接
            /// </summary>
            public override void OnRejectCallAction()
            {
                hdlLinphone.HDLUpdateCallStatus(CallStatusType.REJECT, InterphoneType.HDL);
            }
//            /// <summary>
//            /// 拒接
//            /// </summary>
//            public override void OnRejectCallAction()
//            {
//                hdlLinphone.HDLUpdateCallStatus(CallStatusType.REJECT, InterphoneType.HDL);
//            }
            /// <summary>
            /// 截图成功
            /// </summary>
            /// <param name = "image" ></ param >
            public  void OnScreenshotSuccessfulAction(UIImage image)
            {
                //NSData imageData = UIImagePNGRepresentation(image); UIImage
                NSData imageData = image.AsPNG();
                byte[] dataBytes = new byte[imageData.Length];
                System.Runtime.InteropServices.Marshal.Copy(imageData.Bytes, dataBytes, 0, Convert.ToInt32(imageData.Length));
                //image.g
                //hdlLinphone.ScreenshotSuccessfulAction(dataBytes);
            }
//            /// <summary>
//            /// 截图成功
//            /// </summary>
//            /// <param name = "image" ></ param >
//            public  void OnScreenshotSuccessfulAction(UIImage image)
//            {
//                //NSData imageData = UIImagePNGRepresentation(image); UIImage
//                NSData imageData = image.AsPNG();
//                byte[] dataBytes = new byte[imageData.Length];
//                System.Runtime.InteropServices.Marshal.Copy(imageData.Bytes, dataBytes, 0, Convert.ToInt32(imageData.Length));
//                //image.g
//                //hdlLinphone.ScreenshotSuccessfulAction(dataBytes);
//            }
            /// <summary>
            /// 开锁成功
            /// </summary>
            public override void OnUnlockAction()
            {
                hdlLinphone.HDLUnlockAction();
            }
//            /// <summary>
//            /// 开锁成功
//            /// </summary>
//            public override void OnUnlockAction()
//            {
//                hdlLinphone.HDLUnlockAction();
//            }
            /// <summary>
            /// 来电中...
            /// </summary>
            public override void OnIncomingCall(string userName)
            {
                Utlis.WriteLine("OnIncomingCall :" + userName);
            }
//            /// <summary>
//            /// 来电中...
//            /// </summary>
//            public override void OnIncomingCall(string userName)
//            {
//                Utlis.WriteLine("OnIncomingCall :" + userName);
//            }
        }
//        }
        #endregion
#endif
//        #endregion
//#endif
        #endregion
//        #endregion
    }
//    }
    /// <summary>
    /// SIP可视对讲参数
    /// </summary>
    public class HDLCallVideoInfo
    {
        /// <summary>
        /// 设备序列号,通讯必要字段
        /// </summary>
        public string DeviceId = string.Empty;
        /// <summary>
        /// 设备名称
        /// </summary>
        public string DeviceName = string.Empty;
        /// <summary>
        /// 设备Sip账号
        /// </summary>
        public string DeviceSipAccount = string.Empty;
        /// <summary>
        /// 呼叫记录Id
        /// </summary>
        public string CallId = string.Empty;
        /// <summary>
        /// 住宅Id
        /// </summary>
        public string HomeId = string.Empty;
        /// <summary>
        /// 类型
        /// </summary>
        public string InterphoneType;
        /// <summary>
        /// spk
        /// </summary>
        public string spk="";
//    /// <summary>
//    /// SIP可视对讲参数
//    /// </summary>
//    public class HDLCallVideoInfo
//    {
//        /// <summary>
//        /// 设备序列号,通讯必要字段
//        /// </summary>
//        public string DeviceId = string.Empty;
//        /// <summary>
//        /// 设备名称
//        /// </summary>
//        public string DeviceName = string.Empty;
//        /// <summary>
//        /// 设备Sip账号
//        /// </summary>
//        public string DeviceSipAccount = string.Empty;
//        /// <summary>
//        /// 呼叫记录Id
//        /// </summary>
//        public string CallId = string.Empty;
//        /// <summary>
//        /// 住宅Id
//        /// </summary>
//        public string HomeId = string.Empty;
//        /// <summary>
//        /// 类型
//        /// </summary>
//        public string InterphoneType;
//        /// <summary>
//        /// spk
//        /// </summary>
//        public string spk="";
    }
//    }
    /// <summary>
    /// SIP账号相关信息
    /// </summary>
    public class HDLSipInfo
    {
        /// <summary>
        /// Sip服务器
        /// </summary>
        public string proxy { get; set; }
        /// <summary>
        /// 设备域
        /// </summary>
        public string realm { get; set; }
        /// <summary>
        /// sip账号
        /// </summary>
        public string sipAccount { get; set; }
        /// <summary>
        /// sipPasswd    sip密码
        /// </summary>
        public string sipPasswd { get; set; }
        /// <summary>
        /// 住宅ID
        /// </summary>
        public string homeId;
    }
//    /// <summary>
//    /// SIP账号相关信息
//    /// </summary>
//    public class HDLSipInfo
//    {
//        /// <summary>
//        /// Sip服务器
//        /// </summary>
//        public string proxy { get; set; }
//        /// <summary>
//        /// 设备域
//        /// </summary>
//        public string realm { get; set; }
//        /// <summary>
//        /// sip账号
//        /// </summary>
//        public string sipAccount { get; set; }
//        /// <summary>
//        /// sipPasswd    sip密码
//        /// </summary>
//        public string sipPasswd { get; set; }
//        /// <summary>
//        /// 住宅ID
//        /// </summary>
//        public string homeId;
//    }
}
//}
HDL_ON/Entity/DB_ResidenceData.cs
@@ -74,12 +74,9 @@
                                    ShowFunction.FreshAir,ShowFunction.DoorLock,
                                    ShowFunction.Panel,
                                    ShowFunction.Sensor,ShowFunction.VideoIntercom,
                                    ShowFunction.SecurityCenter,ShowFunction.Acst,
                                    ShowFunction.SecurityCenter,
                                    ShowFunction.MechanicalArm ,
                                    ShowFunction.SecurityMonitoring,
                                    ShowFunction.VideoDoorLock,
                                    ShowFunction.Series,
                                    ShowFunction.Aks,
                    };
                }
                return dddd;
HDL_ON/Entity/Enumerative/MyEnum.cs
@@ -164,7 +164,6 @@
        /// <summary>
        /// 安防监控
        /// </summary>
        SecurityMonitoring = 0x20,
        /// <summary>
        /// 可视对讲
        /// </summary>
@@ -176,7 +175,6 @@
        /// <summary>
        /// 绿建科技系统
        /// </summary>
        Acst = 0x23,
        /// <summary>
        /// 机械臂
        /// </summary>
@@ -188,15 +186,10 @@
        /// <summary>
        /// 萤石视频门锁
        /// </summary>
        VideoDoorLock = 0x26,
        /// <summary>
        /// 跑马灯(序列)
        /// </summary>
        Series = 0x27,
        /// <summary>
        /// 影音中控
        /// </summary>
        Aks = 0x28,
    }
HDL_ON/UI/UI0-Public/TopViewDiv.cs
@@ -84,6 +84,9 @@
        /// <param name="tilte"></param>
        public void LoadTopView(uint color = CSS_Color.TopViewColor)//,Action<List<Function> action
        {
#if __ANDROID__
            maginY = 0;
#endif
            contentView = new FrameLayout()
            {
                Height = Application.GetRealHeight(64+ maginY),
HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs
@@ -745,12 +745,6 @@
                        break;
                    case ShowFunction.Panel:
                        break;
                    case ShowFunction.SecurityMonitoring:
                        if (!MainPage.NoLoginMode)
                        {
                            functionCount = 1;
                        }
                        break;
                    case ShowFunction.Sensor:
                        functionCount = FunctionList.List.GetArmSensorList().Count;
                        break;
@@ -762,23 +756,6 @@
                        break;
                    case ShowFunction.SecurityCenter:
                        functionCount = FunctionList.List.securities.Count;
                        break;
                    case ShowFunction.Acst:
                        functionCount = FunctionList.List.GetAcstParentList().Count;
                        functionOnCount = FunctionList.List.GetAcstParentList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
                        break;
                    case ShowFunction.VideoDoorLock:
                        functionCount = FunctionList.List.GetVideoDoorLockList().Count;
                        functionOnCount = FunctionList.List.GetAcstParentList().FindAll((obj) => obj.GetAttrState("status").ToString() == "open"
                            || obj.GetAttrState("status").ToString() == "normal_open").Count;
                        break;
                    case ShowFunction.Aks:
                        functionCount = FunctionList.List.GetVideoControlsList().Count;
#if DEBUG
                        functionCount = 1;
#endif
                        functionOnCount = 1;
                        break;
@@ -838,17 +815,15 @@
                //不需要显示设备开状态数量;
                Button btnFunctionCount=null;
                if (item != ShowFunction.Aks
                    && item != ShowFunction.VideoDoorLock
                    && item != ShowFunction.Environmental
                if (
                    item != ShowFunction.Environmental
                    && item != ShowFunction.Sensor
                    && item != ShowFunction.VideoIntercom
                    && item != ShowFunction.SecurityMonitoring
                    && item != ShowFunction.FreshAir
                    && item != ShowFunction.Music
                    && item != ShowFunction.EnergyMonitoring
                    && item != ShowFunction.SecurityCenter
                    && item != ShowFunction.Acst && item != ShowFunction.IpCam
                    && item != ShowFunction.IpCam
                    && functionCount != 0)
                {
                    btnFunctionCount = new Button()
@@ -1134,13 +1109,6 @@
                    case ShowFunction.Panel:
                        btnName.TextID = StringId.Panel;
                        break;
                    case ShowFunction.SecurityMonitoring:
                        btnName.TextID = StringId.EZVIZ;
                        btnFunctionViewBg.MouseUpEventHandler = (sender, e) =>
                        {
                            HDLCommon.Current.Go2EZvizMonitor(bodyView);
                        };
                        break;
                    case ShowFunction.Sensor:
                        btnName.TextID = StringId.Sensor;
                        functionPageTitleId = StringId.Sensor;
@@ -1163,91 +1131,16 @@
                            MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                        };
                        break;
                    case ShowFunction.Acst:
                        btnName.TextID = StringId.Acst;
                        Button btnJMLogo = new Button()
                        {
                            Y = specialList.Contains(index) ? Application.GetRealWidth(147) : Application.GetRealWidth(104),
                            UnSelectedImagePath = "FunctionIcon/Acst/LvJianLogo.png",
                            Width = Application.GetRealWidth(105),
                            Height = Application.GetRealWidth(57),
                        };
                        functionView.AddChidren(btnJMLogo);
                        //Button btnAcstPower = new Button()
                        //{
                        //    X = Application.GetRealWidth(120),
                        //    Y = specialList.Contains(index) ? Application.GetRealWidth(160) : Application.GetRealWidth(117),
                        //    Width = Application.GetRealWidth(32),
                        //    Height = Application.GetRealWidth(32),
                        //    SelectedImagePath = "Public/PowerOpen.png",
                        //    UnSelectedImagePath = "Public/PowerClose.png",
                        //    IsSelected = functionOnCount > 0,
                        //    Tag = item + "_AllControl",
                        //};
                        //functionView.AddChidren(btnAcstPower);
                        //btnAcstPower.MouseUpEventHandler = (sender, e) =>
                        //{
                        //    btnAcstPower.IsSelected = !btnAcstPower.IsSelected;
                        //    string onoff = btnAcstPower.IsSelected ? "on" : "off";
                        //    Dictionary<string, string> d = new Dictionary<string, string>();
                        //    d.Add(FunctionAttributeKey.OnOff, onoff);
                        //    foreach (var temp in FunctionList.List.GetAcstParentList())
                        //    {
                        //        Control.Ins.SendWriteCommand(temp, d);
                        //    }
                        //};
                        btnFunctionViewBg.MouseUpEventHandler = (sender, e) =>
                        {
                            var page = new AcstParentPage();
                            MainPage.BasePageView.AddChidren(page);
                            page.LoadPage();
                            MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                        };
                        break;
                    case ShowFunction.VideoDoorLock:
                        //萤石视频门锁
                        btnName.TextID = StringId.yingshishipinmensuo;
                        btnFunctionViewBg.MouseUpEventHandler = (sender, e) =>
                        {
                            var list =CommonMethod.Current.GetVideoDoorLockList();
                            var form = new VideoDoorLockListPage(()=> {
                                UpdateBottomView();
                            });
                            form.AddForm(list);
                        };
                        break;
                    case ShowFunction.Aks:
                        btnFunctionViewBg.UnSelectedImagePath = "FunctionIcon/FunctionBg/AksFunctionBg.png";
                        //埃克斯影音中控
                        btnName.TextID = StringId.jiatingyingyuan;
                        btnFunctionViewBg.MouseUpEventHandler = (sender, e) =>
                        {
                            var list = HDL_ON.UI.UI2.FuntionControlView.Aks.AksCommonMethod.Current.GetVideoControlsList();
                            var form = new HDL_ON.UI.UI2.FuntionControlView.Aks.AksListPage(() => {
                                UpdateBottomView();
                            });
                            form.AddForm(list);
                        };
                        break;
                }
                //界面跳转--音乐跳转自己的界面--环境跳转自己的界面--(萤石视频门锁)跳转自己的界面--埃克斯影音中控
                if (item != ShowFunction.VideoDoorLock
                     && item != ShowFunction.Aks
                    && item != ShowFunction.Music
                if ( item != ShowFunction.Music
                    && item != ShowFunction.Environmental
                    && item != ShowFunction.SecurityMonitoring
                    && item != ShowFunction.DoorLock
                    //&& ShowFunction.EnergyMonitoring != item
                    && ShowFunction.VideoIntercom != item
                    && ShowFunction.SecurityCenter != item
                    && ShowFunction.Series != item
                    && ShowFunction.Acst != item)
                    )
                {
                    btnFunctionViewBg.MouseUpEventHandler = (sender, e) =>
                    {
HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPage.cs
@@ -709,52 +709,52 @@
#region 个人选项-访客管理
            if (Entity.DB_ResidenceData.Instance.SupportVisitorManage)//判断是否支持访客管理
            {
                optionListView.AddChidren(new Button() { X = Application.GetRealWidth(16), Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor });
//                optionListView.AddChidren(new Button() { X = Application.GetRealWidth(16), Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor });
                visitorManagementView = new FrameLayout()
                {
                    Height = Application.GetRealHeight(50),
                };
                optionListView.AddChidren(visitorManagementView);
//                visitorManagementView = new FrameLayout()
//                {
//                    Height = Application.GetRealHeight(50),
//                };
//                optionListView.AddChidren(visitorManagementView);
                var btnVisitorManagementRight = new Button()
                {
                    X = Application.GetRealWidth(339),
                    Gravity = Gravity.CenterVertical,
                    Width = Application.GetMinRealAverage(16),
                    Height = Application.GetMinRealAverage(16),
                    UnSelectedImagePath = "Public/Right.png",
                };
                visitorManagementView.AddChidren(btnVisitorManagementRight);
//                var btnVisitorManagementRight = new Button()
//                {
//                    X = Application.GetRealWidth(339),
//                    Gravity = Gravity.CenterVertical,
//                    Width = Application.GetMinRealAverage(16),
//                    Height = Application.GetMinRealAverage(16),
//                    UnSelectedImagePath = "Public/Right.png",
//                };
//                visitorManagementView.AddChidren(btnVisitorManagementRight);
                btnisitorVManagementText = new Button()
                {
                    X = Application.GetRealWidth(16),
                    TextAlignment = TextAlignment.CenterLeft,
                    TextColor = CSS_Color.FirstLevelTitleColor,
                    TextSize = CSS_FontSize.SubheadingFontSize,
                    TextID = StringId.VisitorManage,
                };
                visitorManagementView.AddChidren(btnisitorVManagementText);
//                btnisitorVManagementText = new Button()
//                {
//                    X = Application.GetRealWidth(16),
//                    TextAlignment = TextAlignment.CenterLeft,
//                    TextColor = CSS_Color.FirstLevelTitleColor,
//                    TextSize = CSS_FontSize.SubheadingFontSize,
//                    TextID = StringId.VisitorManage,
//                };
//                visitorManagementView.AddChidren(btnisitorVManagementText);
                btnisitorVManagementText.MouseUpEventHandler = (sender, e) =>
                {
//                btnisitorVManagementText.MouseUpEventHandler = (sender, e) =>
//                {
#if __IOS__
                    ////刷新接口请求所需要的参数
                    //Foundation.NSDictionary info = new Foundation.NSDictionary("regionUrl", HttpUtil.GlobalRequestHttpsHost, "token", UserInfo.Current.LoginTokenString, "appkey", "HDL-HOME-APP-TEST", "secret", "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss", "refreshToken", UserInfo.Current.RefreshToken);
                    //Shared.IOS.HDLFVSDK.Video.RefreshInfo(info);
                    //////跳转访客管理界面
                    //Shared.IOS.HDLFVSDK.Video.ShowVisitorManager();
#else
                    var page = new VisitorQRCodePage();
                    MainPage.BasePageView.AddChidren(page);
                    page.LoadPage();
                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
#endif
                };
//#if __IOS__
//                    ////刷新接口请求所需要的参数
//                    //Foundation.NSDictionary info = new Foundation.NSDictionary("regionUrl", HttpUtil.GlobalRequestHttpsHost, "token", UserInfo.Current.LoginTokenString, "appkey", "HDL-HOME-APP-TEST", "secret", "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss", "refreshToken", UserInfo.Current.RefreshToken);
//                    //Shared.IOS.HDLFVSDK.Video.RefreshInfo(info);
//                    //////跳转访客管理界面
//                    //Shared.IOS.HDLFVSDK.Video.ShowVisitorManager();
//#else
//                    //var page = new VisitorQRCodePage();
//                    //MainPage.BasePageView.AddChidren(page);
//                    //page.LoadPage();
//                    //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
//#endif
//                };
            }
HDL_ON/UI/UI2/4-PersonalCenter/Visitor/LpTimeDialogCallBak.cs
@@ -1,37 +1,37 @@
#if __Android__
using System;
using Com.Hdl.Hdllinphonesdk.Dialog;
using Java.Interop;
//#if __Android__
//using System;
//using Com.Hdl.Hdllinphonesdk.Dialog;
//using Java.Interop;
namespace HDL_ON.UI.UI2.PersonalCenter.Visitor
{
    public class LpTimeDialogCallBak : Java.Lang.Object, LpTimeDialog.IClickListenerInterface
    {
        public string Time;
        private Action<string> action;
        public LpTimeDialogCallBak(Action<string> _action)
        {
            this.action = _action;
        }
//namespace HDL_ON.UI.UI2.PersonalCenter.Visitor
//{
//    public class LpTimeDialogCallBak : Java.Lang.Object, LpTimeDialog.IClickListenerInterface
//    {
//        public string Time;
//        private Action<string> action;
//        public LpTimeDialogCallBak(Action<string> _action)
//        {
//            this.action = _action;
//        }
        public void OnCancelClick(LpTimeDialog dialog)
        {
            dialog.Dismiss();
        }
//        public void OnCancelClick(LpTimeDialog dialog)
//        {
//            dialog.Dismiss();
//        }
        public void OnConfirmClick(LpTimeDialog dialog, string time)
        {
            dialog.Dismiss();
            action.Invoke(time);
        }
    }
}
#else
//        public void OnConfirmClick(LpTimeDialog dialog, string time)
//        {
//            dialog.Dismiss();
//            action.Invoke(time);
//        }
//    }
//}
//#else
namespace HDL_ON.UI.UI2.PersonalCenter.Visitor
{
    public class LpTimeDialogCallBak
    {
    }
}
#endif
//namespace HDL_ON.UI.UI2.PersonalCenter.Visitor
//{
//    public class LpTimeDialogCallBak
//    {
//    }
//}
//#endif
HDL_ON/UI/UI2/4-PersonalCenter/Visitor/LpTipDialogCallBack.cs
@@ -1,35 +1,35 @@

#if __Android__
using System;
using Com.Hdl.Hdllinphonesdk.Dialog;
namespace HDL_ON.UI.UI2.PersonalCenter.Visitor
{
    public class LpTipDialogCallBack : Java.Lang.Object, LpTipDialog.IClickListenerInterface
    {
        Action action;
        public LpTipDialogCallBack(Action _action)
        {
            this.action = _action;
        }
//#if __Android__
//using System;
//using Com.Hdl.Hdllinphonesdk.Dialog;
//namespace HDL_ON.UI.UI2.PersonalCenter.Visitor
//{
//    public class LpTipDialogCallBack : Java.Lang.Object, LpTipDialog.IClickListenerInterface
//    {
//        Action action;
//        public LpTipDialogCallBack(Action _action)
//        {
//            this.action = _action;
//        }
        public void CancelClick(LpTipDialog dialog)
        {
            dialog.Dismiss();
        }
//        public void CancelClick(LpTipDialog dialog)
//        {
//            dialog.Dismiss();
//        }
        public void SureClick(LpTipDialog dialog)
        {
            dialog.Dismiss();
            action.Invoke();
        }
    }
}
//        public void SureClick(LpTipDialog dialog)
//        {
//            dialog.Dismiss();
//            action.Invoke();
//        }
//    }
//}
#else
namespace HDL_ON.UI.UI2.PersonalCenter.Visitor
{
    public class LpTipDialogCallBack
    {
    }
}
#endif
//#else
//namespace HDL_ON.UI.UI2.PersonalCenter.Visitor
//{
//    public class LpTipDialogCallBack
//    {
//    }
//}
//#endif
HDL_ON/UI/UI2/4-PersonalCenter/Visitor/VisitorHistoryPage.cs
@@ -103,10 +103,10 @@
                {
#if __IOS__
#else
                    VisitorQRCodePage page = new VisitorQRCodePage(action, temPwd);
                    MainPage.BasePageView.AddChidren(page);
                    page.LoadPage();
                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                    //VisitorQRCodePage page = new VisitorQRCodePage(action, temPwd);
                    //MainPage.BasePageView.AddChidren(page);
                    //page.LoadPage();
                    //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
#endif
                };
                bodyScrolView.AddChidren(itemLayout);
HDL_ON/UI/UI2/4-PersonalCenter/Visitor/VisitorQRCodePage.cs
@@ -1,678 +1,678 @@
#if __Android__
//#if __Android__
using System;
using HDL_ON.UI.CSS;
using Shared;
using HDL_ON.DAL.Server;
using System.Collections.Generic;
using Com.Hdl.Hdllinphonesdk.Utils;
using Com.Hdl.Hdllinphonesdk.Dialog;
//using System;
//using HDL_ON.UI.CSS;
//using Shared;
//using HDL_ON.DAL.Server;
//using System.Collections.Generic;
//using Com.Hdl.Hdllinphonesdk.Utils;
//using Com.Hdl.Hdllinphonesdk.Dialog;
namespace HDL_ON.UI.UI2.PersonalCenter.Visitor
{
    public class VisitorQRCodePage : FrameLayout
    {
        FrameLayout bodyView;
        VerticalScrolViewLayout bodyScrolView;
        private EditText phoneNumberEditText;// 电话号码EditText
        private EditText pwdEditText;// 密码EditText
        private Button randomBtn;//随机密码Btn
        private FrameLayout codeLayout;
        private ImageView codeIV;// 二维码
        private Button codeSaveTipBtn;
        private Button codeTip;//二维码有效期提示
        private Button visitorVoucherBtn;
        private VisitorTempPassword tempPassword;
//namespace HDL_ON.UI.UI2.PersonalCenter.Visitor
//{
//    public class VisitorQRCodePage : FrameLayout
//    {
//        FrameLayout bodyView;
//        VerticalScrolViewLayout bodyScrolView;
//        private EditText phoneNumberEditText;// 电话号码EditText
//        private EditText pwdEditText;// 密码EditText
//        private Button randomBtn;//随机密码Btn
//        private FrameLayout codeLayout;
//        private ImageView codeIV;// 二维码
//        private Button codeSaveTipBtn;
//        private Button codeTip;//二维码有效期提示
//        private Button visitorVoucherBtn;
//        private VisitorTempPassword tempPassword;
        Action backAction;// 后退按键,刷新UI
//        Action backAction;// 后退按键,刷新UI
        public VisitorQRCodePage()
        {
            bodyView = this;
        }
//        public VisitorQRCodePage()
//        {
//            bodyView = this;
//        }
        public VisitorQRCodePage(Action action,VisitorTempPassword pwd)
        {
            bodyView = this;
            this.tempPassword = pwd;
            backAction = action;
        }
//        public VisitorQRCodePage(Action action,VisitorTempPassword pwd)
//        {
//            bodyView = this;
//            this.tempPassword = pwd;
//            backAction = action;
//        }
        public override void RemoveFromParent()
        {
            this.tempPassword = null;
            backAction?.Invoke();
            base.RemoveFromParent();
        }
//        public override void RemoveFromParent()
//        {
//            this.tempPassword = null;
//            backAction?.Invoke();
//            base.RemoveFromParent();
//        }
        public void LoadPage()
        {
#region 顶部导航栏
            if (tempPassword == null || tempPassword.id == null)
            {
                tempPassword = new VisitorTempPassword();
//        public void LoadPage()
//        {
//#region 顶部导航栏
//            if (tempPassword == null || tempPassword.id == null)
//            {
//                tempPassword = new VisitorTempPassword();
                Action click = () =>
                {
                    Action action = () =>
                    {
                        LoadPage();
                    };
                    VisitorHistoryPage page = new VisitorHistoryPage(action);
                    MainPage.BasePageView.AddChidren(page);
                    page.LoadPage();
                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                };
//                Action click = () =>
//                {
//                    Action action = () =>
//                    {
//                        LoadPage();
//                    };
//                    VisitorHistoryPage page = new VisitorHistoryPage(action);
//                    MainPage.BasePageView.AddChidren(page);
//                    page.LoadPage();
//                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
//                };
                bodyView.BackgroundColor = CSS_Color.BackgroundColor;
                new TopViewDiv(bodyView, Language.StringByID(StringId.VisitorInvitation))
                    .LoadTopView_SettingText(click, Language.StringByID(StringId.VisitorRecord));
            }
            else
            {
                bodyView.BackgroundColor = CSS_Color.BackgroundColor;
                new TopViewDiv(bodyView, Language.StringByID(StringId.VisitorInvitation)).LoadTopView();
            }
#endregion
//                bodyView.BackgroundColor = CSS_Color.BackgroundColor;
//                new TopViewDiv(bodyView, Language.StringByID(StringId.VisitorInvitation))
//                    .LoadTopView_SettingText(click, Language.StringByID(StringId.VisitorRecord));
//            }
//            else
//            {
//                bodyView.BackgroundColor = CSS_Color.BackgroundColor;
//                new TopViewDiv(bodyView, Language.StringByID(StringId.VisitorInvitation)).LoadTopView();
//            }
//#endregion
            bodyScrolView = new VerticalScrolViewLayout()
            {
                Y = Application.GetRealHeight(64),
                VerticalScrollBarEnabled = false,
                BackgroundColor = CSS_Color.MainBackgroundColor,
            };
            bodyView.AddChidren(bodyScrolView);
//            bodyScrolView = new VerticalScrolViewLayout()
//            {
//                Y = Application.GetRealHeight(64),
//                VerticalScrollBarEnabled = false,
//                BackgroundColor = CSS_Color.MainBackgroundColor,
//            };
//            bodyView.AddChidren(bodyScrolView);
            // 提示文字
            bodyScrolView.AddChidren(new Button()
            {
                Text = Language.StringByID(StringId.VisitorTip),
                IsMoreLines = true,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                TextColor = CSS_Color.PromptingColor1,
                TextAlignment = TextAlignment.Center,
                Padding = new Padding(0, Application.GetRealWidth(20), 0, Application.GetRealWidth(20)),
                Height = Application.GetRealHeight(60),
            });
//            // 提示文字
//            bodyScrolView.AddChidren(new Button()
//            {
//                Text = Language.StringByID(StringId.VisitorTip),
//                IsMoreLines = true,
//                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
//                TextColor = CSS_Color.PromptingColor1,
//                TextAlignment = TextAlignment.Center,
//                Padding = new Padding(0, Application.GetRealWidth(20), 0, Application.GetRealWidth(20)),
//                Height = Application.GetRealHeight(60),
//            });
#region 手机号
            bodyScrolView.AddChidren(new Button()
            {
                Text = Language.StringByID(StringId.PhoneNumber),
                Y = Application.GetRealWidth(10),
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextColor = CSS_Color.FirstLevelTitleColor,
                Height = Application.GetRealHeight(20),
                Padding = new Padding(0, Application.GetRealWidth(20), 0, Application.GetRealWidth(20)),
                TextAlignment = TextAlignment.CenterLeft,
            });
//#region 手机号
//            bodyScrolView.AddChidren(new Button()
//            {
//                Text = Language.StringByID(StringId.PhoneNumber),
//                Y = Application.GetRealWidth(10),
//                TextSize = CSS_FontSize.SubheadingFontSize,
//                TextColor = CSS_Color.FirstLevelTitleColor,
//                Height = Application.GetRealHeight(20),
//                Padding = new Padding(0, Application.GetRealWidth(20), 0, Application.GetRealWidth(20)),
//                TextAlignment = TextAlignment.CenterLeft,
//            });
            phoneNumberEditText = new EditText()
            {
                Height = Application.GetRealHeight(45),
                X = Application.GetRealWidth(20),
                Width = Application.GetRealWidth(335),
                TextSize = CSS_FontSize.TextFontSize,
                TextColor = CSS_Color.FirstLevelTitleColor,
//            phoneNumberEditText = new EditText()
//            {
//                Height = Application.GetRealHeight(45),
//                X = Application.GetRealWidth(20),
//                Width = Application.GetRealWidth(335),
//                TextSize = CSS_FontSize.TextFontSize,
//                TextColor = CSS_Color.FirstLevelTitleColor,
                PlaceholderText = Language.StringByID(StringId.InputPhoneNumberOfTheVisitor),
                Text = tempPassword.phone,
                IsNumberKeyboardType = true,
                PlaceholderTextColor = CSS_Color.PromptingColor1,
            };
            bodyScrolView.AddChidren(phoneNumberEditText);
            //phoneNumberEditText.Foucs = true;
//                PlaceholderText = Language.StringByID(StringId.InputPhoneNumberOfTheVisitor),
//                Text = tempPassword.phone,
//                IsNumberKeyboardType = true,
//                PlaceholderTextColor = CSS_Color.PromptingColor1,
//            };
//            bodyScrolView.AddChidren(phoneNumberEditText);
//            //phoneNumberEditText.Foucs = true;
            // 分割线
            bodyScrolView.AddChidren(new Button()
            {
                X = Application.GetRealWidth(20),
                Width = Application.GetRealWidth(335),
                Height = Application.GetRealHeight(1),
                BackgroundColor = CSS_Color.DividingLineColor,
            });
#endregion
//            // 分割线
//            bodyScrolView.AddChidren(new Button()
//            {
//                X = Application.GetRealWidth(20),
//                Width = Application.GetRealWidth(335),
//                Height = Application.GetRealHeight(1),
//                BackgroundColor = CSS_Color.DividingLineColor,
//            });
//#endregion
#region 动态密码
            bodyScrolView.AddChidren(new Button() { Height = Application.GetRealWidth(10), });
            bodyScrolView.AddChidren(new Button()
            {
                Text = Language.StringByID(StringId.linshimima),
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextColor = CSS_Color.FirstLevelTitleColor,
                Height = Application.GetRealHeight(20),
                Padding = new Padding(0, Application.GetRealWidth(20), 0, Application.GetRealWidth(20)),
                TextAlignment = TextAlignment.CenterLeft,
            });
//#region 动态密码
//            bodyScrolView.AddChidren(new Button() { Height = Application.GetRealWidth(10), });
//            bodyScrolView.AddChidren(new Button()
//            {
//                Text = Language.StringByID(StringId.linshimima),
//                TextSize = CSS_FontSize.SubheadingFontSize,
//                TextColor = CSS_Color.FirstLevelTitleColor,
//                Height = Application.GetRealHeight(20),
//                Padding = new Padding(0, Application.GetRealWidth(20), 0, Application.GetRealWidth(20)),
//                TextAlignment = TextAlignment.CenterLeft,
//            });
            FrameLayout pwdLayout = new FrameLayout()
            {
                Height = Application.GetRealHeight(40),
            };
//            FrameLayout pwdLayout = new FrameLayout()
//            {
//                Height = Application.GetRealHeight(40),
//            };
            // 密码输入框
            pwdEditText = new EditText()
            {
                X = Application.GetRealWidth(20),
                TextSize = CSS_FontSize.TextFontSize,
                TextColor = CSS_Color.FirstLevelTitleColor,
                Width = Application.GetRealWidth(335),
                PlaceholderText = Language.StringByID(StringId.Input6_DigitsTemporaryPassword),
                IsNumberKeyboardType = true,
                PlaceholderTextColor = CSS_Color.PromptingColor1,
            };
            pwdLayout.AddChidren(pwdEditText);
//            // 密码输入框
//            pwdEditText = new EditText()
//            {
//                X = Application.GetRealWidth(20),
//                TextSize = CSS_FontSize.TextFontSize,
//                TextColor = CSS_Color.FirstLevelTitleColor,
//                Width = Application.GetRealWidth(335),
//                PlaceholderText = Language.StringByID(StringId.Input6_DigitsTemporaryPassword),
//                IsNumberKeyboardType = true,
//                PlaceholderTextColor = CSS_Color.PromptingColor1,
//            };
//            pwdLayout.AddChidren(pwdEditText);
            //随机密码Btn
            randomBtn = new Button()
            {
                X = Application.GetRealWidth(275),
                Width = Application.GetRealWidth(80),
                Text = Language.StringByID(StringId.RandomGeneration),
                TextAlignment = TextAlignment.CenterRight,
                TextColor = CSS_Color.MainColor,
                TextSize = CSS_FontSize.TextFontSize,
            };
            pwdLayout.AddChidren(randomBtn);
            bodyScrolView.AddChidren(pwdLayout);
//            //随机密码Btn
//            randomBtn = new Button()
//            {
//                X = Application.GetRealWidth(275),
//                Width = Application.GetRealWidth(80),
//                Text = Language.StringByID(StringId.RandomGeneration),
//                TextAlignment = TextAlignment.CenterRight,
//                TextColor = CSS_Color.MainColor,
//                TextSize = CSS_FontSize.TextFontSize,
//            };
//            pwdLayout.AddChidren(randomBtn);
//            bodyScrolView.AddChidren(pwdLayout);
            // 分割线
            bodyScrolView.AddChidren(new Button()
            {
                X = Application.GetRealWidth(20),
                Width = Application.GetRealWidth(335),
                Height = Application.GetRealHeight(1),
                BackgroundColor = CSS_Color.DividingLineColor,
            });
#endregion
//            // 分割线
//            bodyScrolView.AddChidren(new Button()
//            {
//                X = Application.GetRealWidth(20),
//                Width = Application.GetRealWidth(335),
//                Height = Application.GetRealHeight(1),
//                BackgroundColor = CSS_Color.DividingLineColor,
//            });
//#endregion
#region 二维码生效时间
            FrameLayout startLayout = new FrameLayout()
            {
                Height = Application.GetRealHeight(40),
                Y = Application.GetRealWidth(10),
            };
//#region 二维码生效时间
//            FrameLayout startLayout = new FrameLayout()
//            {
//                Height = Application.GetRealHeight(40),
//                Y = Application.GetRealWidth(10),
//            };
            startLayout.AddChidren(new Button()
            {
                Text = Language.StringByID(StringId.EffectiveTime),
                X = Application.GetRealWidth(20),
                Width = Application.GetRealWidth(130),
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextAlignment = TextAlignment.CenterLeft,
                Enable = false,
            });
            Button startTimeText = new Button()
            {
                X = Application.GetRealWidth(159),
                Width = Application.GetRealWidth(150),
                TextAlignment = TextAlignment.CenterRight,
                TextSize = CSS_FontSize.TextFontSize,
                TextColor = CSS_Color.FirstLevelTitleColor,
            };
            if (tempPassword.tempPwd == null || tempPassword.tempPwd == "")
            {
                startTimeText.Text = "";// System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            }
            else
            {
                startTimeText.Text = tempPassword.validBeginTime;
            }
//            startLayout.AddChidren(new Button()
//            {
//                Text = Language.StringByID(StringId.EffectiveTime),
//                X = Application.GetRealWidth(20),
//                Width = Application.GetRealWidth(130),
//                TextSize = CSS_FontSize.SubheadingFontSize,
//                TextColor = CSS_Color.FirstLevelTitleColor,
//                TextAlignment = TextAlignment.CenterLeft,
//                Enable = false,
//            });
//            Button startTimeText = new Button()
//            {
//                X = Application.GetRealWidth(159),
//                Width = Application.GetRealWidth(150),
//                TextAlignment = TextAlignment.CenterRight,
//                TextSize = CSS_FontSize.TextFontSize,
//                TextColor = CSS_Color.FirstLevelTitleColor,
//            };
//            if (tempPassword.tempPwd == null || tempPassword.tempPwd == "")
//            {
//                startTimeText.Text = "";// System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
//            }
//            else
//            {
//                startTimeText.Text = tempPassword.validBeginTime;
//            }
            startLayout.AddChidren(startTimeText);
            startLayout.AddChidren(new Button()
            {
                X = Application.GetRealWidth(339),
                Gravity = Gravity.CenterVertical,
                Width = Application.GetMinRealAverage(16),
                Height = Application.GetMinRealAverage(16),
                UnSelectedImagePath = "Public/Right.png",
                Enable = false,
            });
            Button startTimeBtn = new Button();
            startLayout.AddChidren(startTimeBtn);
            // dialog回调
            Action<string> startTimeAction = (str) =>
            {
                startTimeText.Text = str + ":00";
            };
            startTimeBtn.MouseUpEventHandler += (sender, e) =>
            {
                try
                {
                    new LpTimeDialog(Application.Activity, new LpTimeDialogCallBak(startTimeAction)).Show();
                }
                catch (Exception ex)
                {
                    string error = ex.Message;
                }
            };
            bodyScrolView.AddChidren(startLayout);
            // 分割线
            bodyScrolView.AddChidren(new Button()
            {
                X = Application.GetRealWidth(20),
                Width = Application.GetRealWidth(335),
                Height = Application.GetRealHeight(1),
                BackgroundColor = CSS_Color.DividingLineColor,
            });
//            startLayout.AddChidren(startTimeText);
//            startLayout.AddChidren(new Button()
//            {
//                X = Application.GetRealWidth(339),
//                Gravity = Gravity.CenterVertical,
//                Width = Application.GetMinRealAverage(16),
//                Height = Application.GetMinRealAverage(16),
//                UnSelectedImagePath = "Public/Right.png",
//                Enable = false,
//            });
//            Button startTimeBtn = new Button();
//            startLayout.AddChidren(startTimeBtn);
//            // dialog回调
//            Action<string> startTimeAction = (str) =>
//            {
//                startTimeText.Text = str + ":00";
//            };
//            startTimeBtn.MouseUpEventHandler += (sender, e) =>
//            {
//                try
//                {
//                    new LpTimeDialog(Application.Activity, new LpTimeDialogCallBak(startTimeAction)).Show();
//                }
//                catch (Exception ex)
//                {
//                    string error = ex.Message;
//                }
//            };
//            bodyScrolView.AddChidren(startLayout);
//            // 分割线
//            bodyScrolView.AddChidren(new Button()
//            {
//                X = Application.GetRealWidth(20),
//                Width = Application.GetRealWidth(335),
//                Height = Application.GetRealHeight(1),
//                BackgroundColor = CSS_Color.DividingLineColor,
//            });
#endregion
//#endregion
#region 二维码失效时间
            FrameLayout endLayout = new FrameLayout()
            {
                Height = Application.GetRealHeight(40),
                Y = Application.GetRealWidth(10),
            };
//#region 二维码失效时间
//            FrameLayout endLayout = new FrameLayout()
//            {
//                Height = Application.GetRealHeight(40),
//                Y = Application.GetRealWidth(10),
//            };
            endLayout.AddChidren(new Button()
            {
                Text = Language.StringByID(StringId.FailureTime),
                X = Application.GetRealWidth(20),
                Width = Application.GetRealWidth(130),
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextAlignment = TextAlignment.CenterLeft,
                Enable = false,
            });
            Button endTimeText = new Button()
            {
                X = Application.GetRealWidth(159),
                Width = Application.GetRealWidth(150),
                TextAlignment = TextAlignment.CenterRight,
                TextSize = CSS_FontSize.TextFontSize,
                TextColor = CSS_Color.FirstLevelTitleColor,
                Enable = false,
            };
            if (tempPassword.tempPwd == null || tempPassword.tempPwd == "")
            {
                endTimeText.Text = "";// System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            }
            else
            {
                endTimeText.Text = tempPassword.validEndTime;
            }
            endLayout.AddChidren(endTimeText);
            endLayout.AddChidren(new Button()
            {
                X = Application.GetRealWidth(339),
                Gravity = Gravity.CenterVertical,
                Width = Application.GetMinRealAverage(16),
                Height = Application.GetMinRealAverage(16),
                UnSelectedImagePath = "Public/Right.png",
                Enable = false,
            });
            Button endTimeBtn = new Button();
            endLayout.AddChidren(endTimeBtn);
            bodyScrolView.AddChidren(endLayout);
            // 分割线
            bodyScrolView.AddChidren(new Button()
            {
                X = Application.GetRealWidth(20),
                Width = Application.GetRealWidth(335),
                Height = Application.GetRealHeight(1),
                BackgroundColor = CSS_Color.DividingLineColor,
            });
            // dialog回调
            Action<string> endTimeAction = (str) =>
            {
                endTimeText.Text = str + ":00";
            };
            endTimeBtn.MouseUpEventHandler += (sender, e) =>
            {
                try
                {
                    new LpTimeDialog(Application.Activity, new LpTimeDialogCallBak(endTimeAction)).Show();
                }
                catch (Exception ex)
                {
                    string error = ex.Message;
                }
            };
#endregion
//            endLayout.AddChidren(new Button()
//            {
//                Text = Language.StringByID(StringId.FailureTime),
//                X = Application.GetRealWidth(20),
//                Width = Application.GetRealWidth(130),
//                TextSize = CSS_FontSize.SubheadingFontSize,
//                TextColor = CSS_Color.FirstLevelTitleColor,
//                TextAlignment = TextAlignment.CenterLeft,
//                Enable = false,
//            });
//            Button endTimeText = new Button()
//            {
//                X = Application.GetRealWidth(159),
//                Width = Application.GetRealWidth(150),
//                TextAlignment = TextAlignment.CenterRight,
//                TextSize = CSS_FontSize.TextFontSize,
//                TextColor = CSS_Color.FirstLevelTitleColor,
//                Enable = false,
//            };
//            if (tempPassword.tempPwd == null || tempPassword.tempPwd == "")
//            {
//                endTimeText.Text = "";// System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
//            }
//            else
//            {
//                endTimeText.Text = tempPassword.validEndTime;
//            }
//            endLayout.AddChidren(endTimeText);
//            endLayout.AddChidren(new Button()
//            {
//                X = Application.GetRealWidth(339),
//                Gravity = Gravity.CenterVertical,
//                Width = Application.GetMinRealAverage(16),
//                Height = Application.GetMinRealAverage(16),
//                UnSelectedImagePath = "Public/Right.png",
//                Enable = false,
//            });
//            Button endTimeBtn = new Button();
//            endLayout.AddChidren(endTimeBtn);
//            bodyScrolView.AddChidren(endLayout);
//            // 分割线
//            bodyScrolView.AddChidren(new Button()
//            {
//                X = Application.GetRealWidth(20),
//                Width = Application.GetRealWidth(335),
//                Height = Application.GetRealHeight(1),
//                BackgroundColor = CSS_Color.DividingLineColor,
//            });
//            // dialog回调
//            Action<string> endTimeAction = (str) =>
//            {
//                endTimeText.Text = str + ":00";
//            };
//            endTimeBtn.MouseUpEventHandler += (sender, e) =>
//            {
//                try
//                {
//                    new LpTimeDialog(Application.Activity, new LpTimeDialogCallBak(endTimeAction)).Show();
//                }
//                catch (Exception ex)
//                {
//                    string error = ex.Message;
//                }
//            };
//#endregion
#region 二维码
            bodyScrolView.AddChidren(new Button() { Height = Application.GetRealWidth(33), });
            codeLayout = new FrameLayout()
            {
                X = Application.GetRealWidth(117),
                Width = Application.GetRealWidth(142),
                Height = Application.GetRealWidth(142),
            };
            bodyScrolView.AddChidren(codeLayout);
//#region 二维码
//            bodyScrolView.AddChidren(new Button() { Height = Application.GetRealWidth(33), });
//            codeLayout = new FrameLayout()
//            {
//                X = Application.GetRealWidth(117),
//                Width = Application.GetRealWidth(142),
//                Height = Application.GetRealWidth(142),
//            };
//            bodyScrolView.AddChidren(codeLayout);
            // 二维码ImagView
            codeIV = new ImageView()
            {
                BackgroundColor = CSS_Color.BackgroundColor,
            };
            codeLayout.AddChidren(codeIV);
//            // 二维码ImagView
//            codeIV = new ImageView()
//            {
//                BackgroundColor = CSS_Color.BackgroundColor,
//            };
//            codeLayout.AddChidren(codeIV);
            bodyScrolView.AddChidren(new Button() { Height = Application.GetRealWidth(20), });
            codeSaveTipBtn = new Button()
            {
                X = Application.GetRealWidth(16),
                Width = Application.GetRealWidth(343),
                Height = Application.GetRealWidth(20),
                Text = Language.StringByID(StringId.LongPressQRCodeSave),
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.FirstLevelTitleColor,
                Visible = false,
            };
            bodyScrolView.AddChidren(codeSaveTipBtn);
#endregion
//            bodyScrolView.AddChidren(new Button() { Height = Application.GetRealWidth(20), });
//            codeSaveTipBtn = new Button()
//            {
//                X = Application.GetRealWidth(16),
//                Width = Application.GetRealWidth(343),
//                Height = Application.GetRealWidth(20),
//                Text = Language.StringByID(StringId.LongPressQRCodeSave),
//                TextAlignment = TextAlignment.Center,
//                TextColor = CSS_Color.FirstLevelTitleColor,
//                Visible = false,
//            };
//            bodyScrolView.AddChidren(codeSaveTipBtn);
//#endregion
            bodyScrolView.AddChidren(new Button() { Height = Application.GetRealWidth(28), });
            visitorVoucherBtn = new Button()
            {
                X = Application.GetRealWidth(78),
                Width = Application.GetRealWidth(220),
                Height = Application.GetRealWidth(44),
                BackgroundColor = CSS_Color.MainColor,
                Radius = (uint)Application.GetRealWidth(44),
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.textWhiteColor,
            };
            bodyScrolView.AddChidren(visitorVoucherBtn);
//            bodyScrolView.AddChidren(new Button() { Height = Application.GetRealWidth(28), });
//            visitorVoucherBtn = new Button()
//            {
//                X = Application.GetRealWidth(78),
//                Width = Application.GetRealWidth(220),
//                Height = Application.GetRealWidth(44),
//                BackgroundColor = CSS_Color.MainColor,
//                Radius = (uint)Application.GetRealWidth(44),
//                TextSize = CSS_FontSize.SubheadingFontSize,
//                TextAlignment = TextAlignment.Center,
//                TextColor = CSS_Color.textWhiteColor,
//            };
//            bodyScrolView.AddChidren(visitorVoucherBtn);
            Action voucher_action = () =>
            {
                if (codeIV.ImageBytes == null)
                {
                    // 请求服务端,生成临时密码
                    tempPassword.homeId = Entity.DB_ResidenceData.Instance.CurrentRegion.id;
                    tempPassword.phone = phoneNumberEditText.Text;
                    tempPassword.tempPwd = pwdEditText.Text;
                    tempPassword.validBeginTime = startTimeText.Text;
                    tempPassword.validEndTime = endTimeText.Text;
                    tempPassword.useCount = 1000;
                    CreateVisitorPassword(tempPassword);
                }
                else
                {
                    // 删除访客临时密码
                    DelVisitorPassword(tempPassword);
                }
            };
            visitorVoucherBtn.MouseUpEventHandler += (sender, e) =>
            {
                if (startTimeText.Text.Trim() == "")
                {
                    var tip_dialog = new Tip()
                    {
                        Text = Language.StringByID(StringId.VisitorStartTime),
                        CloseTime = 2,
                        Direction = AMPopTipDirection.None
                    };
                    tip_dialog.Show(MainPage.BaseView);
                    return;
                }
//            Action voucher_action = () =>
//            {
//                if (codeIV.ImageBytes == null)
//                {
//                    // 请求服务端,生成临时密码
//                    tempPassword.homeId = Entity.DB_ResidenceData.Instance.CurrentRegion.id;
//                    tempPassword.phone = phoneNumberEditText.Text;
//                    tempPassword.tempPwd = pwdEditText.Text;
//                    tempPassword.validBeginTime = startTimeText.Text;
//                    tempPassword.validEndTime = endTimeText.Text;
//                    tempPassword.useCount = 1000;
//                    CreateVisitorPassword(tempPassword);
//                }
//                else
//                {
//                    // 删除访客临时密码
//                    DelVisitorPassword(tempPassword);
//                }
//            };
//            visitorVoucherBtn.MouseUpEventHandler += (sender, e) =>
//            {
//                if (startTimeText.Text.Trim() == "")
//                {
//                    var tip_dialog = new Tip()
//                    {
//                        Text = Language.StringByID(StringId.VisitorStartTime),
//                        CloseTime = 2,
//                        Direction = AMPopTipDirection.None
//                    };
//                    tip_dialog.Show(MainPage.BaseView);
//                    return;
//                }
                if (endTimeText.Text.Trim() == "")
                {
                    var tip_dialog = new Tip()
                    {
                        Text = Language.StringByID(StringId.VisitorEndTime),
                        CloseTime = 2,
                        Direction = AMPopTipDirection.None
                    };
                    tip_dialog.Show(MainPage.BaseView);
                    return;
                }
//                if (endTimeText.Text.Trim() == "")
//                {
//                    var tip_dialog = new Tip()
//                    {
//                        Text = Language.StringByID(StringId.VisitorEndTime),
//                        CloseTime = 2,
//                        Direction = AMPopTipDirection.None
//                    };
//                    tip_dialog.Show(MainPage.BaseView);
//                    return;
//                }
                if (phoneNumberEditText.Text.Trim() == "" || phoneNumberEditText.Text.Trim().Length != 11)
                {
                    var tip_dialog = new Tip()
                    {
                        Text = Language.StringByID(StringId.PhoneNumberErrorTip),
                        CloseTime = 2,
                        Direction = AMPopTipDirection.None
                    };
                    tip_dialog.Show(MainPage.BaseView);
                    phoneNumberEditText.Foucs = true;
                    return;
                }
//                if (phoneNumberEditText.Text.Trim() == "" || phoneNumberEditText.Text.Trim().Length != 11)
//                {
//                    var tip_dialog = new Tip()
//                    {
//                        Text = Language.StringByID(StringId.PhoneNumberErrorTip),
//                        CloseTime = 2,
//                        Direction = AMPopTipDirection.None
//                    };
//                    tip_dialog.Show(MainPage.BaseView);
//                    phoneNumberEditText.Foucs = true;
//                    return;
//                }
                if (pwdEditText.Text.Trim() == "" || pwdEditText.Text.Trim().Length != 6)
                {
                    var tip_dialog = new Tip()
                    {
                        Text = Language.StringByID(StringId.Input6_DigitsTemporaryPassword),
                        CloseTime = 2,
                        Direction = AMPopTipDirection.None
                    };
                    tip_dialog.Show(MainPage.BaseView);
                    pwdEditText.Foucs = true;
                    return;
                }
//                if (pwdEditText.Text.Trim() == "" || pwdEditText.Text.Trim().Length != 6)
//                {
//                    var tip_dialog = new Tip()
//                    {
//                        Text = Language.StringByID(StringId.Input6_DigitsTemporaryPassword),
//                        CloseTime = 2,
//                        Direction = AMPopTipDirection.None
//                    };
//                    tip_dialog.Show(MainPage.BaseView);
//                    pwdEditText.Foucs = true;
//                    return;
//                }
                string tip = "";
                string message = "";
                if (codeIV.ImageBytes == null)
                {
                    tip = Language.StringByID(StringId.tip);
                    message = Language.StringByID(StringId.VisitorTipContent);
                }
                else
                {
                    tip = Language.StringByID(StringId.tip);
                    message = Language.StringByID(StringId.VisitorDelTipContent);
                }
                new LpTipDialog(Application.Activity, tip, message, new LpTipDialogCallBack(voucher_action)).Show();
            };
//                string tip = "";
//                string message = "";
//                if (codeIV.ImageBytes == null)
//                {
//                    tip = Language.StringByID(StringId.tip);
//                    message = Language.StringByID(StringId.VisitorTipContent);
//                }
//                else
//                {
//                    tip = Language.StringByID(StringId.tip);
//                    message = Language.StringByID(StringId.VisitorDelTipContent);
//                }
//                new LpTipDialog(Application.Activity, tip, message, new LpTipDialogCallBack(voucher_action)).Show();
//            };
            //将二维码保存到本地相册
            codeIV.MouseLongEventHandler += (sender, e) =>
            {
#if __Android__
                bool bol = HDLImageUtils.SaveImageToGallery(Application.Activity,
                    Scan.BytesFromText(tempPassword.tempPwd, codeIV.Width, codeIV.Height));
//            //将二维码保存到本地相册
//            codeIV.MouseLongEventHandler += (sender, e) =>
//            {
//#if __Android__
//                bool bol = HDLImageUtils.SaveImageToGallery(Application.Activity,
//                    Scan.BytesFromText(tempPassword.tempPwd, codeIV.Width, codeIV.Height));
                string msg = "";
                if (bol)
                {
                    msg = Language.StringByID(StringId.SavedSuccessfully);
                }
                else
                {
                    msg = Language.StringByID(StringId.saveFail);
                }
//                string msg = "";
//                if (bol)
//                {
//                    msg = Language.StringByID(StringId.SavedSuccessfully);
//                }
//                else
//                {
//                    msg = Language.StringByID(StringId.saveFail);
//                }
                var tip_dialog = new Tip()
                {
                    Text = msg,
                    CloseTime = 2,
                    Direction = AMPopTipDirection.None
                };
                tip_dialog.Show(MainPage.BaseView);
#endif
            };
//                var tip_dialog = new Tip()
//                {
//                    Text = msg,
//                    CloseTime = 2,
//                    Direction = AMPopTipDirection.None
//                };
//                tip_dialog.Show(MainPage.BaseView);
//#endif
//            };
            if (tempPassword != null && tempPassword.id != null && tempPassword.id != "")
            {
                pwdEditText.Text = tempPassword.tempPwd;
                pwdEditText.PlaceholderText = Language.StringByID(StringId.TemporaryPasswordInvalid);
                pwdEditText.Enable = false;
                phoneNumberEditText.Enable = false;
                randomBtn.Visible = false;
                startTimeBtn.Enable = false;
                endTimeBtn.Enable = false;
            }
            else
            {
                pwdEditText.FoucsChanged = (sender, e) =>
                {
                    if (!pwdEditText.Foucs)
                    {
                        // 6位密码验证
                        var tip_dialog = new Tip()
                        {
                            Text = Language.StringByID(StringId.Input6_DigitsTemporaryPassword),
                            CloseTime = 2,
                            Direction = AMPopTipDirection.None
                        };
                        tip_dialog.Show(MainPage.BaseView);
                    }
                };
//            if (tempPassword != null && tempPassword.id != null && tempPassword.id != "")
//            {
//                pwdEditText.Text = tempPassword.tempPwd;
//                pwdEditText.PlaceholderText = Language.StringByID(StringId.TemporaryPasswordInvalid);
//                pwdEditText.Enable = false;
//                phoneNumberEditText.Enable = false;
//                randomBtn.Visible = false;
//                startTimeBtn.Enable = false;
//                endTimeBtn.Enable = false;
//            }
//            else
//            {
//                pwdEditText.FoucsChanged = (sender, e) =>
//                {
//                    if (!pwdEditText.Foucs)
//                    {
//                        // 6位密码验证
//                        var tip_dialog = new Tip()
//                        {
//                            Text = Language.StringByID(StringId.Input6_DigitsTemporaryPassword),
//                            CloseTime = 2,
//                            Direction = AMPopTipDirection.None
//                        };
//                        tip_dialog.Show(MainPage.BaseView);
//                    }
//                };
                randomBtn.MouseUpEventHandler += (sender, e) =>
                {
                    string tPwd = getRandomPwd();
                    pwdEditText.Text = tPwd;
                };
//                randomBtn.MouseUpEventHandler += (sender, e) =>
//                {
//                    string tPwd = getRandomPwd();
//                    pwdEditText.Text = tPwd;
//                };
                phoneNumberEditText.FoucsChanged = (sender, e) =>
                {
                    if (!phoneNumberEditText.Foucs)
                    {
                        //手机号码错误提示
                        if (!Utlis.CheckPhoneNumber(phoneNumberEditText.Text.Trim(), "86"))
                        {
                            var tip_dialog = new Tip()
                            {
                                Text = Language.StringByID(StringId.PhoneNumberErrorTip),
                                CloseTime = 2,
                                Direction = AMPopTipDirection.None
                            };
                            tip_dialog.Show(MainPage.BaseView);
                        }
                    }
                };
            }
//                phoneNumberEditText.FoucsChanged = (sender, e) =>
//                {
//                    if (!phoneNumberEditText.Foucs)
//                    {
//                        //手机号码错误提示
//                        if (!Utlis.CheckPhoneNumber(phoneNumberEditText.Text.Trim(), "86"))
//                        {
//                            var tip_dialog = new Tip()
//                            {
//                                Text = Language.StringByID(StringId.PhoneNumberErrorTip),
//                                CloseTime = 2,
//                                Direction = AMPopTipDirection.None
//                            };
//                            tip_dialog.Show(MainPage.BaseView);
//                        }
//                    }
//                };
//            }
            RefreshVisitorVoucherBtn();
        }
//            RefreshVisitorVoucherBtn();
//        }
        /// <summary>
        /// 刷新VisitorVoucherBtn状态
        /// </summary>
        private void RefreshVisitorVoucherBtn()
        {
            if (tempPassword == null) return;
//        /// <summary>
//        /// 刷新VisitorVoucherBtn状态
//        /// </summary>
//        private void RefreshVisitorVoucherBtn()
//        {
//            if (tempPassword == null) return;
            if (tempPassword.tempPwd != null && tempPassword.tempPwd != "")
            {
                codeIV.ImageBytes = Scan.BytesFromText(tempPassword.tempPwd, codeIV.Width, codeIV.Height);
                //判断二维码是否失效
                DateTime endTime = DateTime.Parse(tempPassword.validEndTime);
                DateTime currentTime = DateTime.Now;
                if (currentTime > endTime || !tempPassword.status)
                {
                    // 二维码有效期提示
                    codeTip = new Button()
                    {
                        TextAlignment = TextAlignment.Center,
                        TextColor = CSS_Color.textWhiteColor,
                        BackgroundColor = CSS_Color.DialogTransparentColor1,
                        Text = Language.StringByID(StringId.QRcodeIsInvalid),
                    };
                    codeLayout.AddChidren(codeTip);
                    visitorVoucherBtn.Visible = false;
                }
                visitorVoucherBtn.Text = Language.StringByID(StringId.CancleVisitorCredentials);
            }
            else
            {
                visitorVoucherBtn.Visible = true;
                visitorVoucherBtn.Text = Language.StringByID(StringId.GenerateVisitorCredentials);
            }
        }
//            if (tempPassword.tempPwd != null && tempPassword.tempPwd != "")
//            {
//                codeIV.ImageBytes = Scan.BytesFromText(tempPassword.tempPwd, codeIV.Width, codeIV.Height);
//                //判断二维码是否失效
//                DateTime endTime = DateTime.Parse(tempPassword.validEndTime);
//                DateTime currentTime = DateTime.Now;
//                if (currentTime > endTime || !tempPassword.status)
//                {
//                    // 二维码有效期提示
//                    codeTip = new Button()
//                    {
//                        TextAlignment = TextAlignment.Center,
//                        TextColor = CSS_Color.textWhiteColor,
//                        BackgroundColor = CSS_Color.DialogTransparentColor1,
//                        Text = Language.StringByID(StringId.QRcodeIsInvalid),
//                    };
//                    codeLayout.AddChidren(codeTip);
//                    visitorVoucherBtn.Visible = false;
//                }
//                visitorVoucherBtn.Text = Language.StringByID(StringId.CancleVisitorCredentials);
//            }
//            else
//            {
//                visitorVoucherBtn.Visible = true;
//                visitorVoucherBtn.Text = Language.StringByID(StringId.GenerateVisitorCredentials);
//            }
//        }
        /// <summary>
        /// 添加临时密码(访客凭证)
        /// </summary>
        /// <param name="homeId">住宅id</param>
        /// <param name="phone">访客手机号</param>
        /// <param name="tempPwd">临时密码</param>
        /// <param name="validBeginTime">开始时间</param>
        /// <param name="validEndTime">结束时间</param>
        /// <param name="useCount">使用次数,默认一个数值大一些的</param>
        /// <returns></returns>
        private bool CreateVisitorPassword(VisitorTempPassword pwd)
        {
            var result = false;
            Dictionary<string, object> dictionary = new Dictionary<string, object>();
            dictionary.Add("homeId", pwd.homeId);
            dictionary.Add("phone", pwd.phone);
            dictionary.Add("tempPwd", pwd.tempPwd);
            dictionary.Add("validBeginTime", pwd.validBeginTime);
            dictionary.Add("validEndTime", pwd.validEndTime);
            dictionary.Add("useCount", pwd.useCount);
//        /// <summary>
//        /// 添加临时密码(访客凭证)
//        /// </summary>
//        /// <param name="homeId">住宅id</param>
//        /// <param name="phone">访客手机号</param>
//        /// <param name="tempPwd">临时密码</param>
//        /// <param name="validBeginTime">开始时间</param>
//        /// <param name="validEndTime">结束时间</param>
//        /// <param name="useCount">使用次数,默认一个数值大一些的</param>
//        /// <returns></returns>
//        private bool CreateVisitorPassword(VisitorTempPassword pwd)
//        {
//            var result = false;
//            Dictionary<string, object> dictionary = new Dictionary<string, object>();
//            dictionary.Add("homeId", pwd.homeId);
//            dictionary.Add("phone", pwd.phone);
//            dictionary.Add("tempPwd", pwd.tempPwd);
//            dictionary.Add("validBeginTime", pwd.validBeginTime);
//            dictionary.Add("validEndTime", pwd.validEndTime);
//            dictionary.Add("useCount", pwd.useCount);
            var requestJson = HttpUtil.GetSignRequestJson(dictionary);
            var pack = HttpUtil.RequestHttpsPost(NewAPI.API_POST_ADD_TEMP_PASSWORD, requestJson);
            if (pack != null)
            {
                if (pack.Code == StateCode.SUCCESS)
                {
                    pwd.id = pack.Data.ToString();
                    codeIV.ImageBytes = Scan.BytesFromText(pwdEditText.Text, codeIV.Width, codeIV.Height);
                    codeSaveTipBtn.Visible = true;
                    RefreshVisitorVoucherBtn();
                }
                else {
                    var tip_dialog = new Tip()
                    {
                        Text = pack.message,
                        CloseTime = 2,
                        Direction = AMPopTipDirection.None
                    };
                    tip_dialog.Show(MainPage.BaseView);
                }
            }
            return result;
        }
//            var requestJson = HttpUtil.GetSignRequestJson(dictionary);
//            var pack = HttpUtil.RequestHttpsPost(NewAPI.API_POST_ADD_TEMP_PASSWORD, requestJson);
//            if (pack != null)
//            {
//                if (pack.Code == StateCode.SUCCESS)
//                {
//                    pwd.id = pack.Data.ToString();
//                    codeIV.ImageBytes = Scan.BytesFromText(pwdEditText.Text, codeIV.Width, codeIV.Height);
//                    codeSaveTipBtn.Visible = true;
//                    RefreshVisitorVoucherBtn();
//                }
//                else {
//                    var tip_dialog = new Tip()
//                    {
//                        Text = pack.message,
//                        CloseTime = 2,
//                        Direction = AMPopTipDirection.None
//                    };
//                    tip_dialog.Show(MainPage.BaseView);
//                }
//            }
//            return result;
//        }
        /// <summary>
        /// 删除临时密码(访客凭证)
        /// </summary>
        /// <param name="home_id">住宅id</param>
        /// <param name="pwd_id">临时密码id</param>
        private bool DelVisitorPassword(VisitorTempPassword pwd)
        {
            Dictionary<string, object> dictionary = new Dictionary<string, object>();
            dictionary.Add("homeId", pwd.homeId);
            dictionary.Add("id", pwd.id);
            var result = false;
            var requestJson = HttpUtil.GetSignRequestJson(dictionary);
            var pack = HttpUtil.RequestHttpsPost(NewAPI.API_POST_DEL_TEMP_PASSWORD, requestJson);
            if (pack != null)
            {
                if (pack.Code == StateCode.SUCCESS)
                {
                    // 关闭当前界面
                    RemoveFromParent();
                }
            }
            RefreshVisitorVoucherBtn();
            return result;
        }
//        /// <summary>
//        /// 删除临时密码(访客凭证)
//        /// </summary>
//        /// <param name="home_id">住宅id</param>
//        /// <param name="pwd_id">临时密码id</param>
//        private bool DelVisitorPassword(VisitorTempPassword pwd)
//        {
//            Dictionary<string, object> dictionary = new Dictionary<string, object>();
//            dictionary.Add("homeId", pwd.homeId);
//            dictionary.Add("id", pwd.id);
//            var result = false;
//            var requestJson = HttpUtil.GetSignRequestJson(dictionary);
//            var pack = HttpUtil.RequestHttpsPost(NewAPI.API_POST_DEL_TEMP_PASSWORD, requestJson);
//            if (pack != null)
//            {
//                if (pack.Code == StateCode.SUCCESS)
//                {
//                    // 关闭当前界面
//                    RemoveFromParent();
//                }
//            }
//            RefreshVisitorVoucherBtn();
//            return result;
//        }
        /// <summary>
        /// 生成6位随机密码
        /// </summary>
        /// <returns></returns>
        private string getRandomPwd()
        {
            string pwd = "";
            for (int i = 0; i < 6; i++)
            {
                int math = new Random().Next(0, 9);
                pwd += math;
            }
            return pwd;
        }
    }
}
#else
using Shared;
//        /// <summary>
//        /// 生成6位随机密码
//        /// </summary>
//        /// <returns></returns>
//        private string getRandomPwd()
//        {
//            string pwd = "";
//            for (int i = 0; i < 6; i++)
//            {
//                int math = new Random().Next(0, 9);
//                pwd += math;
//            }
//            return pwd;
//        }
//    }
//}
//#else
//using Shared;
namespace HDL_ON.UI.UI2.PersonalCenter.Visitor
{
    public class VisitorQRCodePage : FrameLayout
    { }
}
#endif
//namespace HDL_ON.UI.UI2.PersonalCenter.Visitor
//{
//    public class VisitorQRCodePage : FrameLayout
//    { }
//}
//#endif
HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/CommonMethod.cs
@@ -6,7 +6,6 @@
#if __IOS__
using Foundation;
#else
using Com.Videogo.Hdl;
#endif
namespace HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock
@@ -16,7 +15,7 @@
    /// </summary>
    public class CommonMethod
    {
        private Loading loading;
        /// <summary>
        /// 记录当前界面索引值
@@ -76,16 +75,6 @@
                        EZSDK.IOS.EZSDK.SharedInstance().AddEzvizMonitorWithDeviceType(spk);
#else
                    HDLEzvizSdk.Instance.JumpToEZScanActivity(Application.Activity, spk,list);
                        HDLEzvizSdk.SetAddCallback(new
                            AndroidIHdlInterface((isBool, serials) =>
                    {
                        if (isBool)
                        {
                            this.GetYingshiDeviceList(serials);
                        }
                    }));
#endif
                    });
@@ -167,7 +156,6 @@
            EZSDK.IOS.EZSDK.SharedInstance().PlayWithDeviceSerial(deviceSerial, deviceId, spk);
#else
            HDLEzvizSdk.Instance.JumpToEZRealPlayActivity(Application.Activity,deviceId,deviceSerial,spk,"");
#endif
@@ -187,7 +175,6 @@
            EZSDK.IOS.EZSDK.SharedInstance().PlayWithDeviceSerial(deviceSerial, deviceId, spk, msgId);
#else
            HDLEzvizSdk.Instance.JumpToEZRealPlayActivity(Application.Activity,deviceId,deviceSerial,spk,msgId);
#endif
@@ -206,7 +193,6 @@
                    //打开萤石历史记录界面
                    EZSDK.IOS.EZSDK.SharedInstance().ToDeviceMsgListView(deviceId);
#else
                HDLEzvizSdk.Instance.JumpLockHistoryActivity(Application.Activity, deviceId);
#endif
                });
            });
@@ -226,7 +212,6 @@
                    //打开萤石临时密码界面
                    EZSDK.IOS.EZSDK.SharedInstance().ToTemPassView(deviceId);
#else
                HDLEzvizSdk.Instance.JumpTempPasswordActivity(Application.Activity, deviceId);
#endif
                });
            });
@@ -256,10 +241,10 @@
                        }
                        string appKey = "1aa98a90489b4838b966b57018b4b04b";//正式服务器
                        //if (OnAppConfig.Instance.RequestHttpsHost == "https://test-gz.hdlcontrol.com")
                        //{
                        //    appKey = "941b1b72b6294998acfd36c14931b675";//用在测试服务器推送的
                        //}
                                                                           //if (OnAppConfig.Instance.RequestHttpsHost == "https://test-gz.hdlcontrol.com")
                                                                           //{
                                                                           //    appKey = "941b1b72b6294998acfd36c14931b675";//用在测试服务器推送的
                                                                           //}
#if __IOS__
@@ -278,7 +263,6 @@
                        //EZSDK.IOS.EZSDK.Play(info);
#else
                            HDLEzvizSdk.Instance.Init(Application.Activity.Application, ezChildAccessToken, UserInfo.Current.LoginTokenString, UserInfo.Current.RefreshToken, OnAppConfig.Instance.RequestHttpsHost, appKey, 1, DB_ResidenceData.Instance.CurrentRegion.id);
#endif
@@ -310,8 +294,7 @@
            if (DB_ResidenceData.Instance.CurrentRegion.id == home.id || string.IsNullOrEmpty(home.id)) return;
#if __IOS__
#else
                HDLEzvizSdk.Instance.SetHomeId(home.id);
#endif
        }
@@ -355,7 +338,7 @@
                    {
                        return;
                    }
                    if ( expantContent.spk != SPK.VideoDoorLock)
                    if (expantContent.spk != SPK.VideoDoorLock)
                    {
                        return;
                    }
@@ -383,9 +366,10 @@
                        //开门推送
                        this.UpdateDoorLockState(PushMessageType.Prompt);
                    }
                }catch(Exception ex)
                }
                catch (Exception ex)
                {
                }
            });
@@ -500,7 +484,7 @@
        }
        #region  ---------自定义线程(子线程,主线程)--------
        /// <summary>
        /// 子线程
@@ -585,7 +569,7 @@
            });
        }
        #endregion
        /// <summary>
        /// 弹框类型
@@ -634,12 +618,12 @@
        /// <summary>
        /// 专门定义给安卓回调用,没有特殊含义
        /// </summary>
        public class AndroidIHdlInterface : Java.Lang.Object, IHdlInterface
        public class AndroidIHdlInterface : Java.Lang.Object//, IHdlInterface
        {
            Action<bool,string> mAction;
            Action<bool, string> mAction;
            Action<string> mDoorlockAnswer;
            public AndroidIHdlInterface(Action<bool,string> action)
            public AndroidIHdlInterface(Action<bool, string> action)
            {
                mAction = action;
            }
@@ -650,7 +634,7 @@
            /// <param name="p1">设备的序列化(源生回调返回)</param>
            public void AddCallback(bool p0, string p1)
            {
                mAction?.Invoke(p0,p1);
                mAction?.Invoke(p0, p1);
            }
            public void DoorlockAnswer(string p0)