wxr
2021-12-21 cb9567eab8f5b417dfa13e904798eef5095e5248
安卓协议界面,插座电量功能
9个文件已添加
24个文件已修改
11202 ■■■■■ 已修改文件
HDL-ON_Android/AgreementActivity.cs 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Application.cs 497 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Language.ini 12 ●●●●● 补丁 | 查看 | 原始文档 | 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 9128 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Resources/drawable/btn_agree.xml 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Resources/drawable/btn_disagree.xml 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Resources/drawable/dialog_background2.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Resources/layout/activity_splash.xml 93 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Resources/layout/activity_webview.xml 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Resources/values/strings.xml 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/SplashActivity.cs 302 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/WebviewActivity.cs 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_iOS/Info.plist 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_iOS/Resources/Language.ini 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Common/OnAppConfig.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Common/R.cs 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/DriverLayer/Control.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/Mqtt/MqttClient.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/Server/HttpUtil.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/HDL_ON.projitems 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/MainPage.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/1-HomePage/HomePage.cs 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPage.cs 176 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPageBLL.cs 85 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPage_CumulativePowerConsumption.cs 374 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPage_InstantaneousValue.cs 196 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EchartsOption_BrokenLine.cs 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/AgreementActivity.cs
New file
@@ -0,0 +1,76 @@
using System;
using Android.App;
using Android.Content;
using Android.Net;
using Android.OS;
using CN.Jpush.Android.Api;
//using Android.Widget;
using Com.Hdl.ON.Jpush.Androidjpush;
using HDL_ON;
using Java.Util;
using Microsoft.AppCenter;
using Microsoft.AppCenter.Analytics;
using Microsoft.AppCenter.Crashes;
using Shared;
namespace HDL_ON_Android
{
    [Activity(Label = "AgreementActivity", Theme = "@style/MyTheme1")]
    public class AgreementActivity : Activity
    {
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // Create your application here
            SetContentView(Resource.Layout.activity_splash);
            Android.Widget.TextView tvPrivacyPolicy = FindViewById<Android.Widget.TextView>(Resource.Id.privacy_policy_btn);
            Android.Widget.TextView tvServiceAgreement = FindViewById<Android.Widget.TextView>(Resource.Id.service_agreement_btn);
            Android.Widget.Button btnDisagree = FindViewById<Android.Widget.Button>(Resource.Id.disagree_btn);
            Android.Widget.Button btnAgree = FindViewById<Android.Widget.Button>(Resource.Id.agree_btn);
            tvPrivacyPolicy.Click += (sender, e) =>
            {
                Intent i = new Intent(this, typeof(WebviewActivity));
                i.PutExtra("url", "https://developer.hdlcontrol.com/HDLOnPlusPrivacyPolicy.html");
                StartActivity(i);
                Intent data = new Intent();
                data.PutExtra("data", "disagree");
                SetResult(Result.Canceled, Intent);
            };
            tvServiceAgreement.Click += (sender, e) =>
            {
                Intent i = new Intent(this, typeof(WebviewActivity));
                i.PutExtra("url", "https://developer.hdlcontrol.com/HDLOnPlusUserAgreement.html");
                StartActivity(i);
                Intent data = new Intent();
                data.PutExtra("data", "disagree");
                SetResult(Result.Canceled, Intent);
            };
            btnDisagree.Click += (sender, e) =>
            {
                //Java.Lang.JavaSystem.Exit(0);
                FinishAffinity();
            };
            btnAgree.Click += (sender, e) =>
            {
                OnAppConfig.Instance.isAgreePrivacyPolicy = true;
                OnAppConfig.Instance.FirstRunApp = false;
                OnAppConfig.Instance.SaveConfig();
                Intent data = new Intent();
                data.PutExtra("data", "agree");
                SetResult(Result.Ok, Intent);
                Finish();
            };
        }
    }
}
HDL-ON_Android/Application.cs
@@ -18,400 +18,159 @@
namespace HDL_ON_Android
{
  /// <summary>
  /// 设定为默认启动的Application
  /// </summary>
  [Android.App.Application]
  public class Application : Android.App.Application, Android.App.Application.IActivityLifecycleCallbacks
  {
    static void reStartApp(Android.App.Application application)
    {
      var intent = new Intent(application, typeof(BaseActivity));
      intent.AddFlags(ActivityFlags.NewTask);
      application.StartActivity(intent);
      Android.OS.Process.KillProcess(Android.OS.Process.MyPid());
    }
    public Application(IntPtr handle, Android.Runtime.JniHandleOwnership ownerShip) : base(handle, ownerShip) { }
    public override void OnCreate()
    {
      //注册未处理异常事件
      AppCenter.Start("64ac5859-2cd7-4ef8-a5da-5455e29679ec", typeof(Analytics), typeof(Crashes));
      if (Shared.Application.Activity != null)
      {
        reStartApp(this);
        return;
      }
      base.OnCreate();
      RegisterActivityLifecycleCallbacks(this);
      initAll();
    }
    /// <summary>
    /// 所有初始化全部在这个方法实现
    /// 设定为默认启动的Application
    /// </summary>
    void initAll()
    [Android.App.Application]
    public class Application : Android.App.Application, Android.App.Application.IActivityLifecycleCallbacks
    {
      string[] permissions = new string[] { Manifest.Permission.WriteExternalStorage, Manifest.Permission.RecordAudio,
            Manifest.Permission.Camera, Manifest.Permission.ProcessOutgoingCalls, Manifest.Permission.GetAccounts};
      //禁止屏幕长亮
      BaseActivity.KeepScreenON = false;
      //隐藏虚拟按键
      BaseActivity.IsHideVirualButtons = true;
      //实现安卓返回按键
      BaseActivity.BackKeyAction = () =>
      {
        try
        static void reStartApp(Android.App.Application application)
        {
          var result = MainPage.LoadEvent_BackAction();
          switch (result)
          {
            case 0:
              break;
            case 1:
            case 2:
              BaseActivity.VerifyDateTime = DateTime.MaxValue;
              break;
            default:
              BaseActivity.VerifyDateTime = DateTime.MaxValue;
              break;
          }
            var intent = new Intent(application, typeof(BaseActivity));
            intent.AddFlags(ActivityFlags.NewTask);
            application.StartActivity(intent);
            Android.OS.Process.KillProcess(Android.OS.Process.MyPid());
        }
        catch (Exception ex)
        public Application(IntPtr handle, Android.Runtime.JniHandleOwnership ownerShip) : base(handle, ownerShip) { }
        public override void OnCreate()
        {
          MainPage.Log(ex.Message);
          BaseActivity.VerifyDateTime = DateTime.MaxValue;
        }
      };
      init();
      BaseActivity.OnCreateActoin += (activity, application) =>
      {
        Language.CurrentLanguage = "Chinese";
        Locale locale1 = Locale.Default;
        var localeList = Resources.Configuration.Locale;
        if (localeList.Language == "zh")
        {
          Language.CurrentLanguage = "Chinese";
        }
        else
        {
          Language.CurrentLanguage = "English";
        }
        //获取极光推送ID
        GetJPushRegistrationID(activity);
        BaseActivity.NetworkStateChanged += (int internetStatus) =>
              {
                //if (!IsEnterBackground)
                //{
                //    ////BusSocket.Stop();
                //    //new System.Threading.Thread(() =>
                //    //{
                //    //    System.Threading.Thread.Sleep(1000);
                //    //    //BusSocket.Start();
                //    //})
                //    //{ IsBackground = true }.Start();
                //}
                //else
                //{
                //    Console.WriteLine("HHH 网络变化但处于后台");
                //}
                //网络变化处理
                HDLCommon.Current.UpdateInternetStatus((int)internetStatus, MainPage.IsEnterBackground);
              };
      };
      BaseActivity.RefreshUIAction += (activity) =>
      {
        MainPage.Show();
        checkSomeInfo();
      };
      BaseActivity.OnResumeAction += (activity) =>
      {
        checkSomeInfo();
      };
      BaseActivity.OnDestroyAction += (activity) =>
      {
        Console.WriteLine("OnDestroyAction");
        //BusSocket.Stop();
        //UserInfo.Current.unlockTime = DateTime.Now;
      };
      HDLUtils.SetAuthoritiesName("com.hdl.onpro.fileProvider");
      //Shared.Application.IsGpsEnable = true;
      bool isfirst = true;
      //获取经纬度
      Shared.Application.LocationAction = (lon, lat) =>
      {
        try
        {
          if (isfirst)
          {
            //只触发一次
            //Shared.Application.LocationAction = null;
            new HDL_ON.DAL.Server.HttpServerRequest().GetCityWeatherInfo(lon.ToString(), lat.ToString());
          }
          isfirst = false;
          ///监听经纬度
          HDL_ON.UI.UI2.Intelligence.Automation.LogicMethod.CurrLogicMethod.AppLatAndLonEvent(lon, lat);
          //关闭定位服务
          //Shared.Application.StopGPSLocationService();
        }
        catch (Exception ex)
        {
          Utlis.WriteLine("GetCityInfo catch" + ex.Message);
        }
        MainPage.Log($"经纬度:::{lon}:{lat}");
      };
    }
    /// <summary>
    ///
    /// </summary>
    /// <param name="activity"></param>
    void GetJPushRegistrationID(BaseActivity activity)
    {
      try
      {
        //保存获取的极光服务器上的注册ID到本地文件
        var tokenID = JPushInterface.GetRegistrationID(activity);
        Console.WriteLine("RegistrationID:  " + tokenID);
        if (!string.IsNullOrEmpty(tokenID) && OnAppConfig.Instance.PushDeviceToken != tokenID)
        {
          OnAppConfig.Instance.PushDeviceToken = tokenID;
          OnAppConfig.Instance.PhoneName = Android.OS.Build.Manufacturer;
          OnAppConfig.Instance.SaveConfig();
        }
        int loadTokenCount = 0;
        System.Threading.Tasks.Task.Run(() =>
        {
          while (string.IsNullOrEmpty(tokenID))
          {
            System.Threading.Thread.Sleep(1000);
            tokenID = JPushInterface.GetRegistrationID(activity);
            Console.WriteLine("Sleep.tokenID + " + JPushInterface.GetRegistrationID(activity));
            loadTokenCount++;
            if (loadTokenCount > 30)
            if (Shared.Application.Activity != null)
            {
              break;
                //reStartApp(this);
                return;
            }
          }
          Console.WriteLine("RegistrationID:  " + tokenID);
          if (!string.IsNullOrEmpty(tokenID) && OnAppConfig.Instance.PushDeviceToken != tokenID)
          {
            OnAppConfig.Instance.PushDeviceToken = tokenID;
            OnAppConfig.Instance.PhoneName = Android.OS.Build.Manufacturer;
            OnAppConfig.Instance.SaveConfig();
          }
        });
      }
      catch
      {
      }
    }
    public static bool IsShowTip = true;
    void init()
    {
      //手机名称 Android.OS.Build.Manufacturer;
      //OnAppConfig.Instance.PhoneName = Android.OS.Build.Manufacturer;
      //#if DEBUG
      //CN.Jpush.Android.Api.JPushInterface.SetDebugMode(true);
      //#endif
      CN.Jpush.Android.Api.JPushInterface.Init(this);
    }
    void checkSomeInfo()
    {
      try
      {
        IsShowTip = true;
        var status = isNetworkAvailable(this);
        int internetStatus = 0;
        if (!status)
        {
          internetStatus = 0;
            base.OnCreate();
            RegisterActivityLifecycleCallbacks(this);
        }
        var isWifi = isWifiConnected(this);
        if (isWifi)
        public void OnActivityCreated(Activity activity, Bundle savedInstanceState)
        {
          internetStatus = 2;
        }
        else
        public void OnActivityDestroyed(Activity activity)
        {
          internetStatus = 1;
            //throw new NotImplementedException ();
        }
      }
      catch (Exception ex)
      {
        Console.WriteLine($"android check some info erorr : {ex.Message}");
      }
    }
    bool isNetworkAvailable(Context context)
    {
      var cm = (ConnectivityManager)context.GetSystemService(ConnectivityService);
      if (cm == null || cm.ActiveNetworkInfo == null)
      {
        return false;
      }
      else
      {
        return cm.ActiveNetworkInfo.IsAvailable;
      }
    }
    bool isWifiConnected(Context context)
    {
      if (context != null)
      {
        var mConnectivityManager = (ConnectivityManager)context.GetSystemService
        (ConnectivityService);
        var mWiFiNetworkInfo = mConnectivityManager.GetNetworkInfo(ConnectivityType.Wifi);
        if (mWiFiNetworkInfo != null)
        public void OnActivityPaused(Activity activity)
        {
          return mWiFiNetworkInfo.IsAvailable;
            //throw new NotImplementedException ();
        }
      }
      return false;
    }
    public void OnActivityCreated(Activity activity, Bundle savedInstanceState)
    {
    }
    public void OnActivityDestroyed(Activity activity)
    {
      //throw new NotImplementedException ();
    }
    public void OnActivityPaused(Activity activity)
    {
      //throw new NotImplementedException ();
    }
    public void OnActivityResumed(Activity activity)
    {
      //throw new NotImplementedException ();
    }
    public void OnActivitySaveInstanceState(Activity activity, Bundle outState)
    {
      //throw new NotImplementedException ();
    }
    public void OnActivityStarted(Activity activity)
    {
      //throw new NotImplementedException ();
      mCount++;
      if (mCount == 1)
      {
        Console.WriteLine("HHH OnActivityStarted:foreground");
        BusSocketStart();
        //后台回到前台
        new HDL_ON.UI.AppUnlockPage().LoadPage();
      }
    }
    public void OnActivityStopped(Activity activity)
    {
      mCount--;
      if (mCount == 0)
      {
        Console.WriteLine("HHH OnActivityStopped: background");
        BusSocketStop();
        //进入后台
        UserInfo.Current.unlockTime = DateTime.Now;
      }
    }
    public override void OnTerminate()
    {
      base.OnTerminate();
      UnregisterActivityLifecycleCallbacks(this);
    }
    int mCount;
    ///// <summary>
    ///// 是否进入后台
    ///// </summary>
    //public bool IsEnterBackground = false;
    /// <summary>
    /// 进入后台的时间
    /// </summary>
    DateTime CloseTime = DateTime.Now;
    /// <summary>
    /// BusSocketStop
    /// </summary>
    void BusSocketStop()
    {
      //IsEnterBackground = true;
      CloseTime = DateTime.Now;
      MainPage.IsEnterBackground = true;
      //进入后台mqtt正在连接重置状态
      HDL_ON.DAL.Mqtt.MqttClient.RemoteMqttIsConnecting = false;
      HDL_ON.DriverLayer.UdpSocket._BusSocket.Stop();
    }
    /// <summary>
    /// BusSocketStart
    /// </summary>
    void BusSocketStart()
    {
      //IsEnterBackground = false;
      if (CloseTime.AddSeconds(10) < DateTime.Now)
      {
        //后台超过10s就断开MQTT重连
        //if (HDL_ON.DriverLayer.Control.Ins.IsRemote)
        public void OnActivityResumed(Activity activity)
        {
          HDL_ON.DAL.Mqtt.MqttClient.DisConnectRemote("closeTime", false);
            //throw new NotImplementedException ();
        }
      }
      MainPage.IsEnterBackground = false;
      HDL_ON.DriverLayer.UdpSocket._BusSocket.Start();
      HDL_ON.DriverLayer.Control.Ins.SearchLoaclGateway();
    }
        public void OnActivitySaveInstanceState(Activity activity, Bundle outState)
        {
            //throw new NotImplementedException ();
        }
    protected override void Dispose(bool disposing)
    {
      base.Dispose(disposing);
    }
        public void OnActivityStarted(Activity activity)
        {
            //throw new NotImplementedException ();
            if (HDL_ON.OnAppConfig.Instance.FirstRunApp)
            {
                return;
            }
            mCount++;
            if (mCount == 1)
            {
                Console.WriteLine("HHH OnActivityStarted:foreground");
                BusSocketStart();
                //后台回到前台
                new HDL_ON.UI.AppUnlockPage().LoadPage();
            }
        }
    /// <summary>
    /// 查询通知权限,并提示
    /// </summary>
    public void QueryNotificationPermission()
    {
        public void OnActivityStopped(Activity activity)
        {
            mCount--;
            if (mCount == 0)
            {
                Console.WriteLine("HHH OnActivityStopped: background");
                BusSocketStop();
                //进入后台
                UserInfo.Current.unlockTime = DateTime.Now;
            }
        }
        public override void OnTerminate()
        {
            base.OnTerminate();
            UnregisterActivityLifecycleCallbacks(this);
        }
        public int mCount;
        ///// <summary>
        ///// 是否进入后台
        ///// </summary>
        //public bool IsEnterBackground = false;
        /// <summary>
        /// 进入后台的时间
        /// </summary>
        DateTime CloseTime = DateTime.Now;
        /// <summary>
        /// BusSocketStop
        /// </summary>
        void BusSocketStop()
        {
            //IsEnterBackground = true;
            CloseTime = DateTime.Now;
            MainPage.IsEnterBackground = true;
            //进入后台mqtt正在连接重置状态
            HDL_ON.DAL.Mqtt.MqttClient.RemoteMqttIsConnecting = false;
            HDL_ON.DriverLayer.UdpSocket._BusSocket.Stop();
        }
        /// <summary>
        /// BusSocketStart
        /// </summary>
        void BusSocketStart()
        {
            //IsEnterBackground = false;
            if (CloseTime.AddSeconds(10) < DateTime.Now)
            {
                //后台超过10s就断开MQTT重连
                //if (HDL_ON.DriverLayer.Control.Ins.IsRemote)
                {
                    HDL_ON.DAL.Mqtt.MqttClient.DisConnectRemote("closeTime", false);
                }
            }
            MainPage.IsEnterBackground = false;
            HDL_ON.DriverLayer.UdpSocket._BusSocket.Start();
            HDL_ON.DriverLayer.Control.Ins.SearchLoaclGateway();
        }
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);
        }
        /// <summary>
        /// 查询通知权限,并提示
        /// </summary>
        public void QueryNotificationPermission()
        {
        }
    }
  }
}
}
HDL-ON_Android/Assets/Language.ini
@@ -502,6 +502,12 @@
514=Gateway location information is not configured
515=Add Security
516=Withdrawal
517=Instantaneous value
518=Cumulative power consumption
519=Voltage (V)
520=Electric Current (A)
521=Power (W)
522=Refresh
 
1000=Room Humidity
1001=V-chip
@@ -1627,6 +1633,12 @@
514=未配置网关位置信息
515=添加安防
516=撤销同意
517=瞬时值
518=累计用电
519=电压(V)
520=电流(A)
521=功率(W)
522=刷新
 
1000=室内湿度
1001=童锁
HDL-ON_Android/HDL-ON_Android.csproj
@@ -200,6 +200,8 @@
    <Compile Include="LeChengVideo\Form\ReverseCallFragment.cs" />
    <Compile Include="LeChengVideoActivity.cs" />
    <Compile Include="Other\HDLONUtils.cs" />
    <Compile Include="WebviewActivity.cs" />
    <Compile Include="AgreementActivity.cs" />
  </ItemGroup>
  <ItemGroup>
    <AndroidAsset Include="Assets\agconnect-services.json" />
@@ -442,6 +444,29 @@
      <Generator>
      </Generator>
    </AndroidResource>
    <AndroidResource Include="Resources\layout\activity_splash.xml">
      <SubType></SubType>
      <Generator></Generator>
    </AndroidResource>
    <AndroidResource Include="Resources\drawable\dialog_background2.xml">
      <SubType></SubType>
      <Generator></Generator>
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </AndroidResource>
    <AndroidResource Include="Resources\drawable\btn_agree.xml">
      <SubType></SubType>
      <Generator></Generator>
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </AndroidResource>
    <AndroidResource Include="Resources\drawable\btn_disagree.xml">
      <SubType></SubType>
      <Generator></Generator>
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </AndroidResource>
    <AndroidResource Include="Resources\layout\activity_webview.xml">
      <SubType></SubType>
      <Generator></Generator>
    </AndroidResource>
  </ItemGroup>
  <ItemGroup>
    <AndroidAsset Include="Assets\Phone\Public\MsgIcon\TipSuccessIcon.png" />
HDL-ON_Android/Properties/AndroidManifest.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="202112131" android:versionName="1.4.3" package="com.hdl.onpro">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="202112203" android:versionName="1.4.4" package="com.hdl.onpro">
    <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="28" />
    <!-- 乐橙可视对讲需要的权限 -->
    <!--<uses-permission android:name="android.permission.INTERNET" />-->
HDL-ON_Android/Resources/Resource.designer.cs
Diff too large
HDL-ON_Android/Resources/drawable/btn_agree.xml
New file
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<shape
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <!-- 圆角的半径 -->
    <corners android:radius="4dp"/>
    <!-- 填充颜色 -->
    <solid
        android:color="#245ec3"        />
    <!--    边框颜色-->
    <stroke
        android:width="0.01dp"
        android:color="#245ec3"/>
</shape>
HDL-ON_Android/Resources/drawable/btn_disagree.xml
New file
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<shape
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <!-- 圆角的半径 -->
    <corners android:radius="4dp"/>
    <!-- 填充颜色 -->
    <solid
        android:color="@color/white"        />
    <!--    边框颜色-->
    <stroke
        android:width="0.01dp"
        android:color="#245ec3"/>
<!--        <corners-->
<!--            android:topLeftRadius="4dp"-->
<!--            android:topRightRadius="4dp"-->
<!--            android:bottomLeftRadius="4dp"-->
<!--            android:bottomRightRadius="114dp" />-->
</shape>
HDL-ON_Android/Resources/drawable/dialog_background2.xml
New file
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<shape
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <!-- 圆角的半径 -->
    <corners android:radius="4dp"/>
    <!-- 填充颜色 -->
    <solid
        android:color="@color/white"        />
</shape>
HDL-ON_Android/Resources/layout/activity_splash.xml
New file
@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8" ?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/loading"
    android:orientation="vertical">
    <FrameLayout
        android:id="@+id/live_window"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:background="#55000000">
        <RelativeLayout
            android:layout_width="280dp"
            android:layout_height="417dp"
            android:layout_gravity="center"
            android:background="@drawable/dialog_background2">
            <TextView
                android:layout_width="match_parent"
                android:layout_height="25dp"
                android:id="@+id/title_tv"
                android:text="@string/privacy_policy_and_service_agreement"
                android:textColor="#bb000000"
                android:layout_marginTop="15dp"
                android:layout_marginLeft="0dp"
                android:layout_marginRight="0dp"
                android:textSize="18sp"
                android:gravity="center"/>
            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/msg_content_tv"
                android:layout_marginTop="49dp"
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp"
                android:text="@string/read_privacy_policy_and_service_agreement_tip"
                android:textColor="#66000000"
                />
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="30dp"
                android:id="@+id/privacy_policy_btn"
                android:gravity="center"
                android:text="@string/login_privacy_policy"
                android:textColor="#E6000000"
                android:layout_marginTop="105dp"
                android:layout_marginLeft="16dp"/>
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="30dp"
                android:text="@string/login_user_service_agreement"
                android:textColor="#E6000000"
                android:id="@+id/service_agreement_btn"
                android:layout_marginTop="140dp"
                android:layout_marginLeft="16dp"
                android:gravity="center"/>
            <Button
                android:layout_width="120dp"
                android:layout_height="52dp"
                android:id="@+id/disagree_btn"
                android:text="@string/disagree"
                android:textColor="#245ec3"
                android:layout_marginLeft="16dp"
                android:layout_marginBottom="20dp"
                android:layout_alignParentBottom="true"
                android:background="@drawable/btn_disagree"/>
            <Button
                android:layout_width="120dp"
                android:layout_height="52dp"
                android:id="@+id/agree_btn"
                android:text="@string/agree"
                android:textColor="@color/color_white"
                android:layout_alignParentRight="true"
                android:layout_alignParentBottom="true"
                android:layout_marginRight="16dp"
                android:layout_marginBottom="20dp"
                android:background="@drawable/btn_agree"/>
        </RelativeLayout>
    </FrameLayout>
</LinearLayout>
HDL-ON_Android/Resources/layout/activity_webview.xml
New file
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8" ?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#FFFFFF"
    android:orientation="vertical">
    <LinearLayout
        android:layout_width="80dp"
        android:id="@+id/webview_back_ll"
        android:background="#FFFFFF"
        android:orientation="vertical"
        android:layout_height="44dp">
        <ImageView
            android:layout_width="12dp"
            android:layout_height="20dp"
            android:layout_marginLeft="20dp"
            android:layout_marginTop="11dp"
            android:id="@+id/webview_back_img"
            android:background="@drawable/back_icon"/>
    </LinearLayout>
    <android.webkit.WebView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/webView1"
        android:background="#ffffff"/>
</LinearLayout>
HDL-ON_Android/Resources/values/strings.xml
@@ -21,4 +21,12 @@
        <string name="talk_open_failed">Intercom failed to open</string>
        <string name="unlock_fail">Fail to unlock</string>
        <string name="screenshot_fail">Fail to screenshot</string>
        <string name="login_user_service_agreement">《用户服务协议》</string>
        <string name="login_privacy_policy">《隐私权政策》</string>
        <string name="privacy_policy_and_service_agreement">隐私权政策及服务条款</string>
        <string name="read_privacy_policy_and_service_agreement_tip">为了更好的保障您的合法权益,请您阅读并同意以下协议</string>
        <string name="disagree">不同意</string>
        <string name="agree">同意</string>
</resources>
HDL-ON_Android/SplashActivity.cs
@@ -1,7 +1,16 @@
using Android.App;
using System;
using Android.App;
using Android.Content;
using Android.Net;
using Android.OS;
using CN.Jpush.Android.Api;
//using Android.Widget;
using Com.Hdl.ON.Jpush.Androidjpush;
using HDL_ON;
using Java.Util;
using Microsoft.AppCenter;
using Microsoft.AppCenter.Analytics;
using Microsoft.AppCenter.Crashes;
using Shared;
namespace HDL_ON_Android
@@ -10,18 +19,299 @@
    [IntentFilter(new string[] { "com.hdl.onpro.SplashActivity", Intent.ActionView })]
    public class SplashActivity : Activity
    {
        protected override void OnActivityResult(int requestCode, Result resultVal, Intent data)
        {
            if (requestCode == 99)
            {
                if (resultVal == Result.Ok)
                {
                    if (!OnAppConfig.Instance.FirstRunApp)
                    {
                        ////打开baseActivity
                        Intent i = new Intent(this, typeof(BaseActivity));//Intent intent=new Intent( 起始组件对象 , 目标 Service.class);
                        StartActivityForResult(i, 1);
                        OverridePendingTransition(0, 0);
                        initAll();
                        initOhterSdk();
                        Finish();//关闭自己
                    }
                }
            }
            base.OnActivityResult(requestCode, resultVal, data);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            //Intent i = new Intent(this, typeof(BaseActivity));//Intent intent=new Intent( 起始组件对象 , 目标 Service.class);
            //StartActivityForResult(i, 1);
            //OverridePendingTransition(0, 0);
            //initAll();
            //打开baseActivity
            Intent i = new Intent(this, typeof(BaseActivity));//Intent intent=new Intent( 起始组件对象 , 目标 Service.class);
            StartActivity(i);
            if (HDL_ON.OnAppConfig.Instance.FirstRunApp)
            {
                Intent intent = new Intent(this, typeof(AgreementActivity));
                StartActivityForResult(intent,99);
            }
            else
            {
                ////打开baseActivity
                Intent i = new Intent(this, typeof(BaseActivity));//Intent intent=new Intent( 起始组件对象 , 目标 Service.class);
                StartActivityForResult(i, 1);
                OverridePendingTransition(0, 0);
                initAll();
                initOhterSdk();
                Finish();//关闭自己
            }
            OverridePendingTransition(0, 0);
            Finish();
        }
        void initOhterSdk()
        {
            //注册未处理异常事件
            AppCenter.Start("64ac5859-2cd7-4ef8-a5da-5455e29679ec", typeof(Analytics), typeof(Crashes));
            //手机名称 Android.OS.Build.Manufacturer;
            //OnAppConfig.Instance.PhoneName = Android.OS.Build.Manufacturer;
            //#if DEBUG
            //CN.Jpush.Android.Api.JPushInterface.SetDebugMode(true);
            //#endif
            JPushInterface.Init(this);
            BaseActivity.OnCreateActoin += (activity, application) =>
            {
                //获取极光推送ID
                GetJPushRegistrationID(activity);
            };
        }
        /// <summary>
        /// 所有初始化全部在这个方法实现
        /// </summary>
        void initAll()
        {
            //禁止屏幕长亮
            BaseActivity.KeepScreenON = false;
            //隐藏虚拟按键
            BaseActivity.IsHideVirualButtons = true;
            //实现安卓返回按键
            BaseActivity.BackKeyAction = () =>
            {
                try
                {
                    var result = MainPage.LoadEvent_BackAction();
                    switch (result)
                    {
                        case 0:
                            break;
                        case 1:
                        case 2:
                            BaseActivity.VerifyDateTime = DateTime.MaxValue;
                            break;
                        default:
                            BaseActivity.VerifyDateTime = DateTime.MaxValue;
                            break;
                    }
                }
                catch (Exception ex)
                {
                    MainPage.Log(ex.Message);
                    BaseActivity.VerifyDateTime = DateTime.MaxValue;
                }
            };
            BaseActivity.OnCreateActoin += (activity, application) =>
            {
                Language.CurrentLanguage = "Chinese";
                Locale locale1 = Locale.Default;
                var localeList = Resources.Configuration.Locale;
                if (localeList.Language == "zh")
                {
                    Language.CurrentLanguage = "Chinese";
                }
                else
                {
                    Language.CurrentLanguage = "English";
                }
                BaseActivity.NetworkStateChanged += (int internetStatus) =>
                {
                    //if (!IsEnterBackground)
                    //{
                    //    ////BusSocket.Stop();
                    //    //new System.Threading.Thread(() =>
                    //    //{
                    //    //    System.Threading.Thread.Sleep(1000);
                    //    //    //BusSocket.Start();
                    //    //})
                    //    //{ IsBackground = true }.Start();
                    //}
                    //else
                    //{
                    //    Console.WriteLine("HHH 网络变化但处于后台");
                    //}
                    //网络变化处理
                    HDLCommon.Current.UpdateInternetStatus((int)internetStatus, MainPage.IsEnterBackground);
                };
            };
            BaseActivity.RefreshUIAction += (activity) =>
            {
                MainPage.Show();
                checkSomeInfo();
            };
            BaseActivity.OnResumeAction += (activity) =>
            {
                checkSomeInfo();
            };
            BaseActivity.OnDestroyAction += (activity) =>
            {
                Console.WriteLine("OnDestroyAction");
                //BusSocket.Stop();
                //UserInfo.Current.unlockTime = DateTime.Now;
            };
            HDLUtils.SetAuthoritiesName("com.hdl.onpro.fileProvider");
            //Shared.Application.IsGpsEnable = true;
            bool isfirst = true;
            //获取经纬度
            Shared.Application.LocationAction = (lon, lat) =>
            {
                try
                {
                    if (isfirst)
                    {
                        //只触发一次
                        //Shared.Application.LocationAction = null;
                        new HDL_ON.DAL.Server.HttpServerRequest().GetCityWeatherInfo(lon.ToString(), lat.ToString());
                    }
                    isfirst = false;
                    ///监听经纬度
                    HDL_ON.UI.UI2.Intelligence.Automation.LogicMethod.CurrLogicMethod.AppLatAndLonEvent(lon, lat);
                    //关闭定位服务
                    //Shared.Application.StopGPSLocationService();
                }
                catch (Exception ex)
                {
                    Utlis.WriteLine("GetCityInfo catch" + ex.Message);
                }
                MainPage.Log($"经纬度:::{lon}:{lat}");
            };
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="activity"></param>
        void GetJPushRegistrationID(BaseActivity activity)
        {
            try
            {
                //保存获取的极光服务器上的注册ID到本地文件
                var tokenID = JPushInterface.GetRegistrationID(activity);
                Console.WriteLine("RegistrationID:  " + tokenID);
                if (!string.IsNullOrEmpty(tokenID) && OnAppConfig.Instance.PushDeviceToken != tokenID)
                {
                    OnAppConfig.Instance.PushDeviceToken = tokenID;
                    OnAppConfig.Instance.PhoneName = Android.OS.Build.Manufacturer;
                    OnAppConfig.Instance.SaveConfig();
                }
                int loadTokenCount = 0;
                System.Threading.Tasks.Task.Run(() =>
                {
                    while (string.IsNullOrEmpty(tokenID))
                    {
                        System.Threading.Thread.Sleep(1000);
                        tokenID = JPushInterface.GetRegistrationID(activity);
                        Console.WriteLine("Sleep.tokenID + " + JPushInterface.GetRegistrationID(activity));
                        loadTokenCount++;
                        if (loadTokenCount > 30)
                        {
                            break;
                        }
                    }
                    Console.WriteLine("RegistrationID:  " + tokenID);
                    if (!string.IsNullOrEmpty(tokenID) && OnAppConfig.Instance.PushDeviceToken != tokenID)
                    {
                        OnAppConfig.Instance.PushDeviceToken = tokenID;
                        OnAppConfig.Instance.PhoneName = Android.OS.Build.Manufacturer;
                        OnAppConfig.Instance.SaveConfig();
                    }
                });
            }
            catch
            {
            }
        }
        public static bool IsShowTip = true;
        void checkSomeInfo()
        {
            try
            {
                IsShowTip = true;
                var status = isNetworkAvailable(this);
                int internetStatus = 0;
                if (!status)
                {
                    internetStatus = 0;
                }
                var isWifi = isWifiConnected(this);
                if (isWifi)
                {
                    internetStatus = 2;
                }
                else
                {
                    internetStatus = 1;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine($"android check some info erorr : {ex.Message}");
            }
        }
        bool isNetworkAvailable(Context context)
        {
            var cm = (ConnectivityManager)context.GetSystemService(ConnectivityService);
            if (cm == null || cm.ActiveNetworkInfo == null)
            {
                return false;
            }
            else
            {
                return cm.ActiveNetworkInfo.IsAvailable;
            }
        }
        bool isWifiConnected(Context context)
        {
            if (context != null)
            {
                var mConnectivityManager = (ConnectivityManager)context.GetSystemService
                (ConnectivityService);
                var mWiFiNetworkInfo = mConnectivityManager.GetNetworkInfo(ConnectivityType.Wifi);
                if (mWiFiNetworkInfo != null)
                {
                    return mWiFiNetworkInfo.IsAvailable;
                }
            }
            return false;
        }
    }
HDL-ON_Android/WebviewActivity.cs
New file
@@ -0,0 +1,40 @@

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Webkit;
using Android.Widget;
namespace HDL_ON_Android
{
    [Activity(Label = "WebviewActivity",Theme = "@style/MyTheme1")]
    public class WebviewActivity : Activity
    {
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // Create your application here
            SetContentView(Resource.Layout.activity_webview);
            string url = Intent.GetStringExtra("url");
            WebView view = FindViewById<WebView>(Resource.Id.webView1);
            view.LoadUrl(url);
            LinearLayout btnBack = FindViewById<LinearLayout>(Resource.Id.webview_back_ll);
            btnBack.Click += (sender, e) => {
                Finish();
            };
        }
    }
}
HDL-ON_iOS/Info.plist
@@ -100,9 +100,9 @@
    <key>UIStatusBarStyle</key>
    <string>UIStatusBarStyleLightContent</string>
    <key>CFBundleShortVersionString</key>
    <string>1.4.302112152</string>
    <string>1.4.302112201</string>
    <key>CFBundleVersion</key>
    <string>1.4.12151</string>
    <string>1.4.12201</string>
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>Use geographic location to provide services such as weather</string>
    <key>NSAppleMusicUsageDescription</key>
HDL-ON_iOS/Resources/Language.ini
@@ -502,6 +502,12 @@
514=Gateway location information is not configured
515=Add Security
516=Withdrawal
517=Instantaneous value
518=Cumulative power consumption
519=Voltage (V)
520=Electric Current (A)
521=Power (W)
522=Refresh
 
1000=Room Humidity
1001=V-chip
@@ -1627,6 +1633,12 @@
514=未配置网关位置信息
515=添加安防
516=撤销同意
517=瞬时值
518=累计用电
519=电压(V)
520=电流(A)
521=功率(W)
522=刷新
 
1000=室内湿度
1001=童锁
HDL_ON/Common/OnAppConfig.cs
@@ -90,6 +90,10 @@
        /// 是否同意协议
        /// </summary>
        public bool isAgreePrivacyPolicy;
        /// <summary>
        /// 第一次启动app
        /// </summary>
        public bool FirstRunApp = true;
        /// <summary>
        /// 忽略更新的版本号
HDL_ON/Common/R.cs
@@ -4,6 +4,31 @@
{
    public static class StringId
    {
        /// <summary>
        /// 刷新
        /// </summary>
        public const int Refresh = 522;
        /// <summary>
        /// 功率(W)
        /// </summary>
        public const int ActivePowerAndUnit = 521;
        /// <summary>
        /// 电流(A)
        /// </summary>
        public const int CurrentAndUnit = 520;
        /// <summary>
        /// 电压(V)
        /// </summary>
        public const int VoltageAndUnit = 519;
        /// <summary>
        /// 累计用电
        /// </summary>
        public const int CumulativePowerConsumption = 518;
        /// <summary>
        /// 瞬时值
        /// </summary>
        public const int InstantaneousValue = 517;
        /// <summary>
        /// 撤销同意
        /// </summary>
HDL_ON/DAL/DriverLayer/Control.cs
@@ -835,7 +835,7 @@
                            var revString = Encoding.UTF8.GetString(receiveBytes);
                            receiveObj.BodyDataString = revString;
                            MainPage.Log($"局域网信息: 解密后:" + receiveObj.BodyDataString);
                            //if(receiveObj.Topic.EndsWith("/thing/property/up"))
                            //if (receiveObj.Topic.EndsWith("/thing/property/up"))
                            //{
                            //    MsgInfoList.Add(revString + "\r\n");
                            //}
@@ -1142,6 +1142,7 @@
                            case SPK.ElectricSocket:
                            case SPK.PanelSocket:
                                SocketPage.UpdataState(localFunction);
                                SocketPage_InstantaneousValue.UpdataView(localFunction);
                                break;
                            case SPK.ElectricTV:
                                break;
HDL_ON/DAL/Mqtt/MqttClient.cs
@@ -454,6 +454,7 @@
                                            var securityString = Encoding.UTF8.GetString(securityBytes);
                                            var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<SecurityStatusObj>(securityString);
                                            MainPage.Log($"安防状态变化:{securityString}");
                                            //Control.Ins.MsgInfoList.Add($"远程安防状态变化:{securityString}" + "\r\n");
                                            if (temp != null)
                                            {
@@ -484,6 +485,7 @@
                                    var revString = Encoding.UTF8.GetString(bytes);
                                    MainPage.Log($"mqtt 状态更新:{revString}");
                                    Control.Ins.UpdataFunctionStatus(revString, null, true);
                                    //Control.Ins.MsgInfoList.Add(revString + "\r\n");
                                }
                                //一端口数据解析
                                else
HDL_ON/DAL/Server/HttpUtil.cs
@@ -17,8 +17,8 @@
        /// 固定域名,正式环境
        /// 公共域名就近解析
        /// </summary>
        public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
        //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm
        //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
        public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm
        /// <summary>
        /// RegionMark
        /// </summary>
HDL_ON/HDL_ON.projitems
@@ -488,6 +488,8 @@
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\2-Classification\SceneControlZone.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\CalculatedDistance.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\ArmCenter\PushConfigPage.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Electrical\SocketPage_InstantaneousValue.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Electrical\SocketPage_CumulativePowerConsumption.cs" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="$(MSBuildThisFileDirectory)Entity\Device\" />
HDL_ON/UI/MainPage.cs
@@ -26,7 +26,7 @@
    /// <summary>
    /// 版本号
    /// </summary>
    public static string VersionString = "1.4.3";
    public static string VersionString = "1.4.4";
    ///// <summary>
    ///// 客户端类型
    ///// </summary>
@@ -146,6 +146,7 @@
        BaseView = Application.MainPage;
        Application.MainPage.BackgroundColor = CSS_Color.MainBackgroundColor;
        Language.UpdateLanguage();
        //#region 测试
        //var ddd = new UI.test.TestDialog();
        //ddd.InitView();
HDL_ON/UI/UI2/1-HomePage/HomePage.cs
@@ -390,7 +390,7 @@
                    SelectedImagePath = "Collection/DefenseStatusIcon.png",
                    UnSelectedImagePath = "Collection/DisarmStatusIcon.png"
                };
                if (false && DB_ResidenceData.Instance.GatewayType == 1)
                if (DB_ResidenceData.Instance.GatewayType == 1)
                {
                        
                    topView.AddChidren(btnSecurityStatus);
@@ -553,6 +553,20 @@
#if DEBUG
            FunctionList.List.Functions.Add(new Function()
            {
                spk = SPK.PanelSocket,
                name = "面板插座",
                attributes = new List<FunctionAttributes>
                {
                    new FunctionAttributes(){ key = "on_off",curValue= "on",state = "on" },
                    new FunctionAttributes(){ key = "on_off_usb",curValue= "on",state = "on" },
                    new FunctionAttributes(){ key = "active_power",curValue= "220",state = "220" },
                    new FunctionAttributes(){ key = "voltage",curValue= "5",state = "5" },
                    new FunctionAttributes(){ key = "current",curValue= "110",state = "110" },
                    new FunctionAttributes(){ key = "total_electricity",curValue= "123.33",state = "123.33" },
                }
            });
            //FunctionList.List.Functions.Add(new Function()
            //{
HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs
@@ -86,7 +86,7 @@
            //判断是否需要隐藏自动化
            if (HideAutoPage)
            {
                if (false && DB_ResidenceData.Instance.GatewayType == 1)//网关需要加载安防--2021-11-28 19:56:53  刘晓辉将安防放入改界面
                if (DB_ResidenceData.Instance.GatewayType == 1)//网关需要加载安防--2021-11-28 19:56:53  刘晓辉将安防放入该界面
                {
                    btnSceneTilte  = new Button()
                    {
@@ -139,7 +139,7 @@
            }
            else
            {
                if (false && DB_ResidenceData.Instance.GatewayType == 1)//网关需要加载安防--2021-11-28 19:56:53  刘晓辉将安防放入改界面
                if (DB_ResidenceData.Instance.GatewayType == 1)
                {
                    btnAutomationTitle = new Button()
                    {
HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs
@@ -142,7 +142,7 @@
        ///// <summary>
        ///// 获取支持文本
        ///// </summary>
        //Button btnSupportText;
        Button btnSupportText;
        /// <summary>
        /// 关于On文本
@@ -935,7 +935,8 @@
            //    BackgroundColor = 0xFFFF0000,
            //};
            //supportView.AddChidren(supView);
            //supView.MouseUpEventHandler = (sender, e) => {
            //supView.MouseUpEventHandler = (sender, e) =>
            //{
            //    Dialog dialog = new Dialog();
            //    var bodyView = new FrameLayout();
@@ -957,7 +958,8 @@
            //        TextAlignment = TextAlignment.CenterLeft,
            //        TextSize = CSS_FontSize.SubheadingFontSize,
            //    };
            //    btnClose.MouseUpEventHandler = (sender, e) => {
            //    btnClose.MouseUpEventHandler = (sender9, e0) =>
            //    {
            //        dialog.Close();
            //    };
            //    bodyView.AddChidren(btnClose);
HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs
@@ -198,7 +198,6 @@
            #region 固定布防区域
            /*
            var fixedDeploymentView = new FrameLayout()
            {
                Height = Application.GetRealHeight(133),
@@ -288,7 +287,6 @@
            };
            disasterAlarmView.SetClick(disasterAlarmViewClick);
            fixedDeploymentTypeView.AddChidren(burglarAlarmView);
            */
            #endregion
HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPage.cs
@@ -2,6 +2,7 @@
using Shared;
using HDL_ON.UI.CSS;
using HDL_ON.Entity;
using HDL_ON.DriverLayer;
namespace HDL_ON.UI
{
@@ -132,6 +133,92 @@
            };
            controlView.AddChidren(btnSwitch);
            if (function.attributes.Find((obj) => obj.key == "active_power" || obj.key == "voltage" || obj.key == "current") != null)
            {
                //加载瞬时值
                var btnInstantaneousValue = new Button()
                {
                    X = Application.GetRealWidth(67),
                    Y = Application.GetRealHeight(377),
                    Width = Application.GetMinRealAverage(32),
                    Height = Application.GetMinRealAverage(32),
                    UnSelectedImagePath = "FunctionIcon/EnvironmentalScience/DiagramIconOn.png",
                };
                controlView.AddChidren(btnInstantaneousValue);
                var btnInstantaneousValueText = new Button()
                {
                    X = Application.GetRealWidth(35),
                    Y = btnInstantaneousValue.Bottom,
                    Width = Application.GetRealWidth(96),
                    Height = Application.GetRealHeight(29),
                    TextAlignment = TextAlignment.Center,
                    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                    TextColor = CSS_Color.TextualColor,
                    TextID = StringId.InstantaneousValue
                };
                controlView.AddChidren(btnInstantaneousValueText);
                EventHandler<MouseEventArgs> eventHandler = (sender, e) => {
                    var page = new SocketPage_InstantaneousValue(function);
                    MainPage.BasePageView.AddChidren(page);
                    page.LoadPage();
                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                };
                btnInstantaneousValue.MouseUpEventHandler = eventHandler;
                btnInstantaneousValueText.MouseUpEventHandler = eventHandler;
            }
            if(function.attributes.Find((obj)=>obj.key == "total_electricity") != null)
            {
                //加载累计用电
                var btnTotalElectricity = new Button()
                {
                    X = Application.GetRealWidth(200),
                    Y = Application.GetRealHeight(377),
                    Height = Application.GetMinRealAverage(32),
                    TextColor = CSS_Color.MainColor,
                    TextSize = CSS_FontSize.EmphasisFontSize_Secondary,
                    Text = function.GetAttrState("total_electricity"),
                    TextAlignment = TextAlignment.BottomLeft,
                };
                btnTotalElectricity.Width = btnTotalElectricity.GetTextWidth();
                controlView.AddChidren(btnTotalElectricity);
                var btnTotalElectricityUnit = new Button()
                {
                    X = btnTotalElectricity.Right,
                    Y = Application.GetRealHeight(377),
                    Width = Application.GetRealWidth(100),
                    Height = Application.GetMinRealAverage(32),
                    TextColor = CSS_Color.TextualColor,
                    TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel,
                    Text = "kW·h",
                    TextAlignment = TextAlignment.BottomLeft,
                };
                controlView.AddChidren(btnTotalElectricityUnit);
                var btnTotalElectricityText = new Button()
                {
                    X = Application.GetRealWidth(200),
                    Y = btnTotalElectricity.Bottom,
                    Width = Application.GetRealWidth(235),
                    Height = Application.GetRealHeight(29),
                    TextAlignment = TextAlignment.CenterLeft,
                    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                    TextColor = CSS_Color.TextualColor,
                    TextID = StringId.CumulativePowerConsumption
                };
                controlView.AddChidren(btnTotalElectricityText);
                EventHandler<MouseEventArgs> eventHandler = (sender, e) => {
                    var page = new SocketPage_CumulativePowerConsumption(function);
                    MainPage.BasePageView.AddChidren(page);
                    page.LoadPage();
                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                };
                btnTotalElectricity.MouseUpEventHandler = eventHandler;
                btnTotalElectricityUnit.MouseUpEventHandler = eventHandler;
                btnTotalElectricityText.MouseUpEventHandler = eventHandler;
            }
            LoadEventList();
            new TopViewDiv(bodyView, Language.StringByID(StringId.Socket)).LoadTopView_FunctionTop(function, actionRefresh);
@@ -143,4 +230,93 @@
        }
    }
    public partial class SocketPage
    {
        /// <summary>
        /// 更新灯光状态
        /// </summary>
        public static void UpdataState(Function uFan)
        {
            Application.RunOnMainThread(() =>
            {
                try
                {
                    if (bodyView == null)
                        return;
                    bodyView.btnSwitch.IsSelected = bodyView.btnSwitchIcon.IsSelected = uFan.trait_on_off.curValue.ToString() == "on";
                }
                catch (Exception ex)
                {
                    MainPage.Log($"RelayPage error {ex.Message}");
                }
            });
        }
        /// <summary>
        /// 加载事件列表
        /// </summary>
        void LoadEventList()
        {
            LoadSwitchEvent();
            LoadCollectionEvent();
            //回退刷新信息事件
            actionRefresh = () => {
                btnFunctionName.Text = btnFunctionName_Out.Text = function.name;
                btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName();
                function.UpdataFuncitonInfo();
            };
        }
        /// <summary>
        /// 收藏功能按钮事件
        /// </summary>
        void LoadCollectionEvent()
        {
            btnCollection.MouseUpEventHandler += (sender, e) => {
                btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
                function.CollectFunction();
            };
        }
        /// <summary>
        /// 加载开关事件
        /// </summary>
        void LoadSwitchEvent()
        {
            btnSwitchIcon.MouseUpEventHandler += (sender, e) =>
            {
                btnSwitchIcon.IsSelected = btnSwitch.IsSelected = !btnSwitchIcon.IsSelected;
                new System.Threading.Thread(() =>
                {
                    function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
                    //Control.Send(CommandType_A.write, this.function);
                    System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
                    d.Add("on_off", function.trait_on_off.curValue.ToString());
                    Control.Ins.SendWriteCommand(function, d);
                })
                { IsBackground = true }.Start();
            };
            btnSwitch.MouseUpEventHandler += (sender, e) =>
            {
                btnSwitch.IsSelected = btnSwitchIcon.IsSelected = !btnSwitch.IsSelected;
                new System.Threading.Thread(() =>
                {
                    function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
                    //Control.Send(CommandType_A.write, this.function);
                    System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
                    d.Add("on_off", function.trait_on_off.curValue.ToString());
                    Control.Ins.SendWriteCommand(function, d);
                })
                { IsBackground = true }.Start();
            };
        }
    }
}
HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPageBLL.cs
@@ -5,89 +5,4 @@
namespace HDL_ON.UI
{
    public partial class SocketPage
    {
        /// <summary>
        /// 更新灯光状态
        /// </summary>
        public static void UpdataState(Function uFan)
        {
            Application.RunOnMainThread(() =>
            {
                try
                {
                    if (bodyView == null)
                        return;
                    bodyView.btnSwitch.IsSelected = bodyView.btnSwitchIcon.IsSelected = uFan.trait_on_off.curValue.ToString() == "on";
                }
                catch (Exception ex)
                {
                    MainPage.Log($"RelayPage error {ex.Message}");
                }
            });
        }
        /// <summary>
        /// 加载事件列表
        /// </summary>
        void LoadEventList()
        {
            LoadSwitchEvent();
            LoadCollectionEvent();
            //回退刷新信息事件
            actionRefresh = () => {
                btnFunctionName.Text = btnFunctionName_Out.Text = function.name;
                btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName();
                function.UpdataFuncitonInfo();
            };
        }
        /// <summary>
        /// 收藏功能按钮事件
        /// </summary>
        void LoadCollectionEvent()
        {
            btnCollection.MouseUpEventHandler += (sender, e) => {
                btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
                function.CollectFunction();
            };
        }
        /// <summary>
        /// 加载开关事件
        /// </summary>
        void LoadSwitchEvent()
        {
            btnSwitchIcon.MouseUpEventHandler += (sender, e) =>
            {
                btnSwitchIcon.IsSelected = btnSwitch.IsSelected = !btnSwitchIcon.IsSelected;
                new System.Threading.Thread(() =>
                {
                    function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
                    //Control.Send(CommandType_A.write, this.function);
                    System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
                    d.Add("on_off", function.trait_on_off.curValue.ToString());
                    Control.Ins.SendWriteCommand(function, d);
                })
                { IsBackground = true }.Start();
            };
            btnSwitch.MouseUpEventHandler += (sender, e) =>
            {
                btnSwitch.IsSelected = btnSwitchIcon.IsSelected = !btnSwitch.IsSelected;
                new System.Threading.Thread(() =>
                {
                    function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
                    //Control.Send(CommandType_A.write, this.function);
                    System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
                    d.Add("on_off", function.trait_on_off.curValue.ToString());
                    Control.Ins.SendWriteCommand(function, d);
                })
                { IsBackground = true }.Start();
            };
        }
    }
}
HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPage_CumulativePowerConsumption.cs
New file
@@ -0,0 +1,374 @@
using System;
using System.Collections.Generic;
using HDL_ON.DAL.Server;
using HDL_ON.DriverLayer;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
using Shared;
namespace HDL_ON.UI
{
    public class SocketPage_CumulativePowerConsumption : FrameLayout
    {
        static SocketPage_CumulativePowerConsumption bodyView;
        /// <summary>
        /// 顶部区域
        /// </summary>
        FrameLayout generalTableView;
        /// <summary>
        /// 实时功耗
        /// </summary>
        Button btnRealTimeData;
        /// <summary>
        /// 实时功耗单位
        /// </summary>
        Button btnTotalValueUint;
        /// <summary>
        /// 总功耗
        /// </summary>
        TextButton btnTotalValue;
        /// <summary>
        /// 历史数据区域
        /// </summary>
        FrameLayout diagramView;
        /// <summary>
        /// 曲线图数据string
        /// </summary>
        EchartsOption_BrokenLine brokenLine;
        /// <summary>
        /// 插查询的能源列表
        /// </summary>
        List<Function> queryList = new List<Function>();
        /// <summary>
        /// 查询条件
        /// hour、week、month
        /// </summary>
        string curQueryType = "hour";
        /// <summary>
        /// 能源列表区域
        /// </summary>
        FrameLayout energyListView;
        /// <summary>
        /// 历史数据图表
        /// </summary>
        MyEchartsViewOn myEchartsView_Line;
        Function function;
        /// <summary>
        /// 主页
        /// </summary>
        public SocketPage_CumulativePowerConsumption(Function function)
        {
            this.function = function;
            bodyView = this;
        }
        /// <summary>
        ///
        /// </summary>
        public void LoadPage()
        {
            new TopViewDiv(bodyView, Language.StringByID(StringId.CumulativePowerConsumption)).LoadTopView();
            bodyView.BackgroundColor = CSS_Color.BackgroundColor;
            var contentView = new FrameLayout()
            {
                Y = Application.GetRealHeight(64),
                Height = Application.GetRealHeight(603),
            };
            bodyView.AddChidren(contentView);
            #region 顶部view
            generalTableView = new FrameLayout()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealWidth(16),
                Width = Application.GetRealWidth(343),
                Height = Application.GetRealWidth(148),//419//148
                Radius = (uint)Application.GetRealWidth(5),
                BackgroundColor = CSS_Color.MainBackgroundColor,
            };
            contentView.AddChidren(generalTableView);
            btnTotalValue = new TextButton()
            {
                X = Application.GetRealWidth(18),
                Y = Application.GetRealWidth(24),
                Width = Application.GetRealWidth(18),
                Height = Application.GetRealWidth(52),
                TextColor = CSS_Color.FirstLevelTitleColor,
                IsBold = true,
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = 40,
                Text = function.GetAttrState("total_electricity")
            };
            btnTotalValue.Width = btnTotalValue.GetTextWidth();
            generalTableView.AddChidren(btnTotalValue);
            btnTotalValueUint = new Button()
            {
                X = btnTotalValue.Right,
                Y = Application.GetRealWidth(24),
                Width = Application.GetRealWidth(60),
                Height = Application.GetRealWidth(28),
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.SubheadingFontSize,
                IsBold = true,
                Text = "kW‧h",
                TextAlignment = TextAlignment.CenterLeft,
            };
            generalTableView.AddChidren(btnTotalValueUint);
            btnRealTimeData = new Button()
            {
                X = Application.GetRealWidth(18),
                Y = btnTotalValue.Bottom,
                Width = Application.GetRealWidth(209),
                Height = Application.GetRealWidth(28),
                TextColor = CSS_Color.TextualColor,
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextAlignment = TextAlignment.CenterLeft,
                TextID = StringId.RealTimePowerConsumption,
            };
            btnRealTimeData.Text = Language.StringByID(StringId.RealTimePowerConsumption).Replace("{0}", function.GetAttrState("active_power"));
            generalTableView.AddChidren(btnRealTimeData);
            generalTableView.Height = Application.GetRealWidth(459);
            #endregion
            initDiagramView();
        }
        /// <summary>
        /// 加载曲线图
        /// </summary>
        /// <param name="contentView"></param>
        void initDiagramView()
        {
            brokenLine = new EchartsOption_BrokenLine();
            diagramView = new FrameLayout()
            {
                Y = Application.GetRealWidth(136),
                Gravity = Gravity.CenterHorizontal,
                Width = Application.GetRealWidth(343),
                Height = Application.GetRealWidth(281),
                BackgroundColor = CSS_Color.MainBackgroundColor,
                Radius = (uint)Application.GetRealWidth(12),
                BorderColor = 0x00000000,
                BorderWidth = 0,
            };
            generalTableView.AddChidren(diagramView);
            #region 选择数据日期范围
            var showDataTypeView = new FrameLayout()
            {
                X = Application.GetRealWidth(183),
                Y = Application.GetRealHeight(12),
                Width = Application.GetRealWidth(144),
                Height = Application.GetRealHeight(24),
                BackgroundImagePath = "FunctionIcon/EnvironmentalScience/SensorHistoryBg1.png",
            };
            diagramView.AddChidren(showDataTypeView);
            var btnShowHistroyData_Day = new Button()
            {
                Width = Application.GetRealWidth(48),
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.PromptingColor2,
                SelectedTextColor = CSS_Color.MainColor,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                IsSelected = true,
                TextID = StringId.day,
            };
            showDataTypeView.AddChidren(btnShowHistroyData_Day);
            var btnShowHistroyData_Week = new Button()
            {
                X = Application.GetRealWidth(48),
                Width = Application.GetRealWidth(48),
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.PromptingColor2,
                SelectedTextColor = CSS_Color.MainColor,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                TextID = StringId.week,
            };
            showDataTypeView.AddChidren(btnShowHistroyData_Week);
            var btnShowHistroyData_Month = new Button()
            {
                X = Application.GetRealWidth(48 * 2),
                Width = Application.GetRealWidth(48),
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.PromptingColor2,
                SelectedTextColor = CSS_Color.MainColor,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                Text = Language.StringByID(StringId.month),//DateTime.Now.Month.ToString() +
            };
            showDataTypeView.AddChidren(btnShowHistroyData_Month);
            btnShowHistroyData_Day.MouseUpEventHandler = (sender, e) =>
            {
                showDataTypeView.BackgroundImagePath = "FunctionIcon/EnvironmentalScience/SensorHistoryBg1.png";
                btnShowHistroyData_Day.IsSelected = true;
                btnShowHistroyData_Month.IsSelected = false;
                btnShowHistroyData_Week.IsSelected = false;
                curQueryType = "hour";
                brokenLine.YvalueText = "";
                    LoadMothed_GetHistoryData();
            };
            btnShowHistroyData_Week.MouseUpEventHandler = (sender, e) =>
            {
                showDataTypeView.BackgroundImagePath = "FunctionIcon/EnvironmentalScience/SensorHistoryBg2.png";
                btnShowHistroyData_Day.IsSelected = false;
                btnShowHistroyData_Month.IsSelected = false;
                btnShowHistroyData_Week.IsSelected = true;
                curQueryType = "week";
                brokenLine.YvalueText = "";
                    LoadMothed_GetHistoryData();
            };
            btnShowHistroyData_Month.MouseUpEventHandler = (sender, e) =>
            {
                showDataTypeView.BackgroundImagePath = "FunctionIcon/EnvironmentalScience/SensorHistoryBg3.png";
                btnShowHistroyData_Day.IsSelected = false;
                btnShowHistroyData_Month.IsSelected = true;
                btnShowHistroyData_Week.IsSelected = false;
                curQueryType = "month";
                brokenLine.YvalueText = "";
                    LoadMothed_GetHistoryData();
            };
            #endregion
            var historyDataView = new FrameLayout()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealWidth(52),
                Height = Application.GetRealWidth(240),
            };
            diagramView.AddChidren(historyDataView);
            myEchartsView_Line = new MyEchartsViewOn()
            {
                Y = Application.GetRealWidth(10),
                Height = Application.GetRealWidth(220),
            };
            historyDataView.AddChidren(myEchartsView_Line);
            LoadMothed_GetHistoryData();
        }
        /// <summary>
        /// 读取历史数据
        /// </summary>
        void LoadMothed_GetHistoryData()
        {
            var loadPage = new Loading()
            {
                LodingBackgroundColor = 0x88888888,
            };
            diagramView.AddChidren(loadPage);
            //var d = new List<string> ();
            //var dd = new List<EnvironmentalSensorHistor>();
            //Random random = new Random() ;
            //for (int ii = 0; ii < 13; ii++)
            //{
            //    var i = random.Next(10000);
            //    d.Add(i.ToString());
            //    dd.Add(new EnvironmentalSensorHistor
            //    {
            //        fieldName = i.ToString(),
            //        fieldValue = i.ToString()
            //    });
            //}
            //brokenLine.InitXdataText(d);
            //brokenLine.InitYdataText(function.name, dd, "#80AEFF");
            //brokenLine.yTitle = "能耗(kW)";
            //brokenLine.xTitle = "小时";
            //var opString = brokenLine.InitOption();
            //myEchartsView_Line.ShowWithOption(opString);
            //return;
            new System.Threading.Thread(() =>
            {
                try
                {
                    Application.RunOnMainThread(() =>
                    {
                        loadPage.Start(Language.StringByID(StringId.PleaseWait));
                    });
                    var sensorType = function.spk.Split(".")[1];
                    var revertObj = new HttpServerRequest().GetSensorHistory(curQueryType, function.deviceId, "total_electricity");
                    if (revertObj != null)
                    {
                        if (revertObj.Code == StateCode.SUCCESS)
                        {
                            var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject<List<EnvironmentalSensorHistor>>(revertObj.Data.ToString());
                            List<string> vs = new List<string>();
                            if (brokenLine.YvalueText == "")
                            {
                                foreach (var data in revertData)
                                {
                                    vs.Add(data.fieldName);
                                }
                                brokenLine.InitXdataText(vs);
                            }
                            if (function.GetAttribute("ydata") == null)
                            {
                                function.attributes.Add(new FunctionAttributes() { key = "ydata" });
                            }
                            function.SetAttrState("ydata", brokenLine.InitYdataText(function.name, revertData, "#80AEFF") + ",");
                        }
                    }
                    brokenLine.yTitle = Language.StringByID(StringId.EnergyConsumption) + "(kW)";
                    brokenLine.xTitle = Language.StringByID(StringId.timeMode);
                    if (curQueryType != "hour")
                    {
                        brokenLine.xTitle = Language.StringByID(StringId.Date);
                    }
                    var opString = brokenLine.InitOption();
                    Application.RunOnMainThread(() =>
                    {
                        myEchartsView_Line.ShowWithOption(opString);
                    });
                }
                catch (Exception ex)
                {
                    MainPage.Log($"sensor history error : {ex.Message}");
                }
                finally
                {
                    Application.RunOnMainThread(() =>
                    {
                        loadPage.Hide();
                    });
                }
            })
            { IsBackground = true }.Start();
        }
    }
}
HDL_ON/UI/UI2/FuntionControlView/Electrical/SocketPage_InstantaneousValue.cs
New file
@@ -0,0 +1,196 @@
using System;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
using Shared;
namespace HDL_ON.UI
{
    public class SocketPage_InstantaneousValue : FrameLayout
    {
        static SocketPage_InstantaneousValue bodyView;
        HorizontalScrolViewLayout instantaneousValueView;
        Function function;
        public SocketPage_InstantaneousValue(Function function)
        {
            this.function = function;
            bodyView = this;
        }
        public void LoadPage()
        {
            bodyView.BackgroundColor = CSS.CSS_Color.BackgroundColor;
            FrameLayout contentView = new FrameLayout()
            {
                Y= Application .GetRealHeight(64),
                Height = Application.GetRealHeight(603),
            };
            bodyView.AddChidren(contentView);
            instantaneousValueView = new HorizontalScrolViewLayout()
            {
                Y = Application.GetRealHeight(16),
                Width = Application.GetRealWidth(343),
                Height = Application.GetRealHeight(110),
                Gravity = Gravity.CenterHorizontal,
                Radius = (uint)Application.GetRealWidth(12),
                BackgroundColor = CSS.CSS_Color.MainBackgroundColor,
                ScrollEnabled = false,
            };
            contentView.AddChidren(instantaneousValueView);
            var voltageAttr = function.GetAttribute("voltage");//电压
            if (voltageAttr != null)
            {
                var view = new InstantaneousValueView();
                view.Init(voltageAttr.curValue.ToString(), Language.StringByID(StringId.VoltageAndUnit));
                view.Tag = "voltage";
                instantaneousValueView.AddChidren(view);
            }
            var currentAttr = function.GetAttribute("current");//电流
            if (currentAttr != null)
            {
                var view = new InstantaneousValueView();
                view.Init(currentAttr.curValue.ToString(), Language.StringByID(StringId.CurrentAndUnit));
                view.Tag = "current";
                instantaneousValueView.AddChidren(view);
            }
            var active_powerAttr = function.GetAttribute("active_power");//有功功率
            if (active_powerAttr != null)
            {
                var view = new InstantaneousValueView();
                view.Init(active_powerAttr.curValue.ToString(), Language.StringByID(StringId.ActivePowerAndUnit));
                view.Tag = "active_power";
                instantaneousValueView.AddChidren(view);
            }
            var btnRefresh = new Button()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealHeight(539),
                Width = Application.GetRealWidth(220),
                Height = Application.GetRealWidth(44),
                Radius = (uint)Application.GetRealWidth(22),
                BackgroundColor = CSS_Color.MainColor,
                TextColor = CSS_Color.MainBackgroundColor,
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextAlignment = TextAlignment.Center,
                IsBold = true,
                TextID = StringId.Refresh,
            };
            contentView.AddChidren(btnRefresh);
            btnRefresh.MouseUpEventHandler = (sender, e) => {
                new System.Threading.Thread(() =>
                {
                    DriverLayer.Control.Ins.SendReadCommand(function);
                })
                { IsBackground = true }.Start();
            };
            new TopViewDiv(bodyView, Language.StringByID(StringId.InstantaneousValue)).LoadTopView();
            new System.Threading.Thread(() =>
            {
                DriverLayer.Control.Ins.SendReadCommand(function);
            })
            { IsBackground = true }.Start();
        }
        public static void UpdataView(Function updata)
        {
            if(bodyView!=null)
            {
                for (int i = 0; i < bodyView.instantaneousValueView.ChildrenCount; i++)
                {
                    var view = bodyView.instantaneousValueView.GetChildren(i);
                    if(null != view.Tag )
                    {
                        if (view.GetType() == typeof(InstantaneousValueView))
                        {
                           var view2 = view as InstantaneousValueView;
                            switch (view.Tag.ToString())
                            {
                                case "active_power":
                                    var attr = updata.GetAttribute("active_power");
                                    if (attr != null)
                                    {
                                        view2.btnValue.Text = attr.curValue.ToString();
                                    }
                                    break;
                                case "voltage":
                                    var attr1 = updata.GetAttribute("voltage");
                                    if (attr1 != null)
                                    {
                                        view2.btnValue.Text = attr1.curValue.ToString();
                                    }
                                    break;
                                case "current":
                                    var attr2 = updata.GetAttribute("current");
                                    if (attr2 != null)
                                    {
                                        view2.btnValue.Text = attr2.curValue.ToString();
                                    }
                                    break;
                            }
                        }
                    }
                }
            }
        }
    }
    public class InstantaneousValueView :FrameLayout
    {
        public FrameLayout View;
        public Button btnValue;
        public Button btnLine;
        public Button btnUnit;
        public InstantaneousValueView()
        {
            View = this;
            View.Width = Application.GetRealWidth(115);
            View.Height = Application.GetRealHeight(110);
        }
        public void Init(string value, string unit)
        {
            btnValue = new Button()
            {
                Height = Application.GetRealHeight(59),
                Y = Application.GetRealWidth(12),
                TextAlignment = TextAlignment.Center,
                TextColor = CSS.CSS_Color.FirstLevelTitleColor,
                TextSize = CSS.CSS_FontSize.EmphasisFontSize_FirstLevel,
                Text = value,
            };
            View.AddChidren(btnValue);
            btnLine = new Button()
            {
                Height = Application.GetRealHeight(2),
                Width = Application.GetRealWidth(60),
                Gravity = Gravity.CenterHorizontal,
                BackgroundColor = CSS.CSS_Color.MainColor,
                Y = Application.GetRealHeight(59),
            };
            View.AddChidren(btnLine);
            btnUnit = new Button()
            {
                Y = Application.GetRealHeight(59),
                Height = Application.GetRealHeight(33),
                TextAlignment = TextAlignment.Center,
                TextColor = CSS.CSS_Color.PromptingColor1,
                TextSize = CSS.CSS_FontSize.PromptFontSize_FirstLevel,
                Text = unit
            };
            View.AddChidren(btnUnit);
        }
    }
}
HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EchartsOption_BrokenLine.cs
@@ -124,23 +124,25 @@
                    ]
            }";
#else
 public string optionString = @"{
        public string optionString = @"{
                 tooltip: {
                    trigger: 'axis'
                    },
                    grid: {
                         top: '10%',
                         top: '15%',
                        left: '13%',
                        right: '10%',
                        bottom: '15%',
                        right: '12%',
                        bottom: '10%',
                    },
                    xAxis: {
                        type: 'category',
                        boundaryGap: false,
                        data: [{0}],
                        name: '{10}'
                    },
                    yAxis: {
                        type: 'value',
                        name: '{20}'
                    },
                    series: [  
                        {1}
HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs
@@ -73,7 +73,7 @@
            };
            bodyView.AddChidren(contentView);
            contentView.AddChidren(new Button() { Height = Application.GetRealHeight(12) });
            contentView.AddChidren(new Button() { Height = Application.GetRealHeight(16) });
            FrameLayout diagramView = new FrameLayout()
            {