wxr
2022-07-29 da40946e8cf2ffb41157f5c388c525ccccaca692
备份
7个文件已添加
15个文件已修改
1139 ■■■■■ 已修改文件
HDL-ON_Android/Assets/Language.ini 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Phone/Public/Iot_agreement_icon.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Phone/Public/LinkIotIcon.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/HDL-ON_Android.csproj 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Properties/AndroidManifest.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_iOS/HDL-ON_iOS.csproj 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_iOS/Resources/Phone/Public/Iot_agreement_icon.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Common/ApiUtlis.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Common/R.cs 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/DriverLayer/Control.cs 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/Mqtt/MqttClient.cs 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/Server/HttpServerRequest.cs 73 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/Server/NewAPI.cs 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Entity/Integratedbrand/IntegratedBrand.cs 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/HDL_ON.projitems 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI0-Public/TopViewDiv.cs 65 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/BrandListPage.cs 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_AuthorizedPage.cs 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_BrandFunctionListPage.cs 250 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_BrandListPage.cs 251 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/iot_BindTipPage.cs 265 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Language.ini
@@ -544,6 +544,8 @@
556=Someone is running
557=Someone is standing
558=Someone is sitting
559=Bind a third-party account
560=Bound
@@ -1747,6 +1749,8 @@
556=有人在跑
557=有人站着
558=有人坐着
559=绑定第三方账号
560=已绑定
 
@@ -2929,6 +2933,8 @@
556=Someone is running
557=Someone is standing
558=Someone is sitting
559=Bind a third-party account
560=Bound
2532=Visitor Invitation Record
@@ -4122,6 +4128,9 @@
556=Someone is running
557=Someone is standing
558=Someone is sitting
559=Bind a third-party account
560=Bound
2532=Visitor Invitation Record
2533=Visitor management
HDL-ON_Android/Assets/Phone/Public/Iot_agreement_icon.png
HDL-ON_Android/Assets/Phone/Public/LinkIotIcon.png
HDL-ON_Android/HDL-ON_Android.csproj
@@ -258,6 +258,8 @@
    <AndroidAsset Include="Assets\Phone\FunctionIcon\ArmSensor\SomeoneStandBgIcon.png" />
    <AndroidAsset Include="Assets\Phone\Collection\FunctionArmOnbg.png" />
    <AndroidAsset Include="Assets\Phone\FunctionIcon\Icon\HomeIcon\sensormegahealth.png" />
    <AndroidAsset Include="Assets\Phone\Public\Iot_agreement_icon.png" />
    <AndroidAsset Include="Assets\Phone\Public\LinkIotIcon.png" />
  </ItemGroup>
  <ItemGroup>
    <AndroidResource Include="Resources\values\colors.xml" />
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:versionName="1.5.9" package="com.hdl.onpro" xmlns:tools="http://schemas.android.com/tools" android:versionCode="202207251">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.5.9" package="com.hdl.onpro" xmlns:tools="http://schemas.android.com/tools" android:versionCode="202207291">
    <uses-sdk android:minSdkVersion="26" android:targetSdkVersion="29" />
    <!--友盟-->
    <!--<uses-sdk android:minSdkVersion="8"></uses-sdk>-->
HDL-ON_iOS/HDL-ON_iOS.csproj
@@ -1418,8 +1418,7 @@
      <BundleResource Include="Resources\Phone\FunctionIcon\ArmSensor\SomeoneRunBgIcon.png" />
      <BundleResource Include="Resources\Phone\FunctionIcon\ArmSensor\SomeoneSitBgIcon.png" />
      <BundleResource Include="Resources\Phone\FunctionIcon\ArmSensor\SomeoneStandBgIcon.png" />
      <BundleResource Include="Resources\Phone\Collection\FunctionArmOnbg.png" />
      <BundleResource Include="Resources\Phone\FunctionIcon\Icon\HomeIcon\sensormegahealth.png" />
      <BundleResource Include="Resources\Phone\Public\Iot_agreement_icon.png" />
    </ItemGroup>
    <ItemGroup>
      <ITunesArtwork Include="iTunesArtwork" />
HDL-ON_iOS/Resources/Phone/Public/Iot_agreement_icon.png
HDL_ON/Common/ApiUtlis.cs
@@ -480,6 +480,7 @@
                            FileUtlis.Files.DeleteFile(file);
                        }
                    }
                    FunctionList.List.securities.Clear();
                    foreach (var function in infoList)
                    {
                        function.SaveFile();
HDL_ON/Common/R.cs
@@ -5,6 +5,14 @@
    public static class StringId
    {
        /// <summary>
        /// 已绑定
        /// </summary>
        public const int Bound = 560;
        /// <summary>
        /// 绑定第三方账号
        /// </summary>
        public const int Bind3thIotAccount = 559;
        /// <summary>
        /// 有人坐着
        /// </summary>
        public const int SomeoneSitting = 558;
HDL_ON/DAL/DriverLayer/Control.cs
@@ -1044,11 +1044,15 @@
                        if (Ins.GatewayOnline_Local && isCloudData)//本地链接,除了涂鸦设备数据之外的云端数据不处理
                        {
                            if (FunctionList.List.OtherBrandFunction.Count != 0)
                            if (FunctionList.List.OtherBrandFunction.Count == 0)
                            {
                                MainPage.Log($"A协议更新状态:本地链接,除了涂鸦设备数据之外的云端数据不处理...");
                                return;
                            }
                            else
                            {
                                if (FunctionList.List.OtherBrandFunction.Find((obj) => obj.sid == updateTemp.sid) == null)
                                {
                                    //MainPage.Log($"A协议更新状态:本地链接,除了涂鸦设备数据之外的云端数据不处理...");
                                    return;
                                }
                            }
HDL_ON/DAL/Mqtt/MqttClient.cs
@@ -515,12 +515,30 @@
                                //Tag 网络状态解析
                                else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/thing/property/send")
                                {
                                    var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey);
                                    var revString = Encoding.UTF8.GetString(bytes);
                                    MainPage.Log($"mqtt 状态更新:{revString}");
                                    Control.Ins.UpdataFunctionStatus(revString, null, true);
                                    //Control.Ins.MsgInfoList.Add($"mqtt 状态更新:{revString}");
                                    //Control.Ins.MsgInfoList.Add(revString + "\r\n");
                                    if (Control.Ins.GatewayOnline_Local)//本地链接,除了涂鸦设备数据之外的云端数据不处理
                                    {
                                        if (FunctionList.List.OtherBrandFunction.Count == 0)
                                        {
                                            MainPage.Log($"A协议更新状态:本地链接,除了涂鸦设备数据之外的云端数据不处理...");
                                            return;
                                        }
                                        else
                                        {
                                            var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey);
                                            var revString = Encoding.UTF8.GetString(bytes);
                                            MainPage.Log($"mqtt 状态更新:{revString}");
                                            Control.Ins.UpdataFunctionStatus(revString, null, true);
                                            //Control.Ins.MsgInfoList.Add($"mqtt 状态更新:{revString}");
                                            //Control.Ins.MsgInfoList.Add(revString + "\r\n");
                                            //if (FunctionList.List.OtherBrandFunction.Find((obj) => obj.sid == updateTemp.sid) == null)
                                            //{
                                            //    return;
                                            //}
                                        }
                                    }
                                }
                                //一端口数据解析
                                else
HDL_ON/DAL/Server/HttpServerRequest.cs
@@ -2623,6 +2623,79 @@
            return pack;
        }
        /// <summary>
        /// 获取第三方品牌列表_Iot
        /// </summary>
        public ResponsePackNew Get3tyIotBrandList()
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            var requestJson = HttpUtil.GetSignRequestJson(d);
            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetBrandList_Iot, requestJson);
            return pack;
        }
        /// <summary>
        /// 搜索第三方设备_iot
        /// </summary>
        /// <returns></returns>
        public ResponsePackNew Search3tyIotDevice(string companyId)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("companyId", companyId);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Search3tyIotDevice, requestJson);
            return pack;
        }
        /// <summary>
        /// 搜索第三方设备功能列表_iot
        /// </summary>
        /// <returns></returns>
        public ResponsePackNew Get3tyIotDeviceFunctionList(string companyId)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("companyId", companyId);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Get3tyIotFunction, requestJson);
            return pack;
        }
        /// <summary>
        /// 设置第三方设备绑定的住宅
        /// </summary>
        /// <returns></returns>
        public ResponsePackNew Set3tyIotFunctionToHouse(string deviceId,string homeId)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("deviceId", deviceId);
            d.Add("homeId", homeId);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Setting3tyIotFunctionToHouse, requestJson);
            return pack;
        }
        /// <summary>
        /// 解绑第三方平台账号
        /// </summary>
        /// <returns></returns>
        public ResponsePackNew Unbound3tyIotAccount(string companyId)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("companyId", companyId);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Unbound3tyIotAccount, requestJson);
            return pack;
        }
        /// <summary>
        /// 获取绑定的第三方品牌列表
        /// </summary>
HDL_ON/DAL/Server/NewAPI.cs
@@ -609,6 +609,26 @@
        /// 获取品牌列表
        /// </summary>
        public const string Api_Post_GetBrandList = "/home-wisdom/app/product/brand/list";
        /// <summary>
        /// 获取品牌列表_iot 平台
        /// </summary>
        public const string Api_Post_GetBrandList_Iot = "/smart-open/platform/auth/brand/list";
        /// <summary>
        /// 发现第三方iot平台设备
        /// </summary>
        public const string Api_Post_Search3tyIotDevice = "/home-wisdom/app/open/discoveryDevice";
        /// <summary>
        /// 获取第三方iot平台设备功能列表
        /// </summary>
        public const string Api_Post_Get3tyIotFunction = "/home-wisdom/app/open/discoveryDevice";
        /// <summary>
        /// 配置第三方iot平台设备功能到住宅
        /// </summary>
        public const string Api_Post_Setting3tyIotFunctionToHouse = "/home-wisdom/app/open/assignDeviceToHouse";
        /// <summary>
        /// 解绑第三方iot平台账号
        /// </summary>
        public const string Api_Post_Unbound3tyIotAccount = "/open-platform/tripartite/userUnbind";
        #region ■  -- 红外宝接口___________________________
        /// <summary>
HDL_ON/Entity/Integratedbrand/IntegratedBrand.cs
@@ -28,6 +28,66 @@
        /// </summary>
        public string productPlatform;
    }
    /// <summary>
    /// 第三方集成品牌对象类
    /// </summary>
    public class IntegratedBrand_Iot
    {
        public IntegratedBrand_Iot()
        {
        }
        /// <summary>
        /// id
        /// </summary>
        public string authBrandId;
        public string brandName
        {
            get
            {
                if(Language.CurrentLanguage == "Chinese")
                {
                    return authBrandNameCn;
                }
                else
                {
                    return authBrandNameEn;
                }
            }
        }
        /// <summary>
        /// 品牌名称中文
        /// </summary>
        public string authBrandNameCn;
        /// <summary>
        /// 品牌名称英文
        /// </summary>
        public string authBrandNameEn;
        /// <summary>
        /// 品牌副标题(中文)
        /// </summary>
        public string authBrandSubheadCn;
        /// <summary>
        /// 品牌副标题(英文)
        /// </summary>
        public string authBrandSubheadEn;
        /// <summary>
        /// 图片url
        /// </summary>
        public string authrBandIconUrl;
        /// <summary>
        /// 认证授权地址
        /// </summary>
        public string authorizationUrl;
        /// <summary>
        /// 是否已经授权
        /// </summary>
        public bool hasAuthorization;
        /// <summary>
        /// 公司id
        /// </summary>
        public string companyId;
    }
    /// <summary>
    /// 第三方设备信息
HDL_ON/HDL_ON.projitems
@@ -507,6 +507,10 @@
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\Visitor\LpTimeDialogCallBak.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\Visitor\LpTipDialogCallBack.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\ArmSensor\SensorMegahealth_AlarmDataStatisticsPage.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\AddFunction\Iot_BrandListPage.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\AddFunction\iot_BindTipPage.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\AddFunction\Iot_BrandFunctionListPage.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\AddFunction\Iot_AuthorizedPage.cs" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="$(MSBuildThisFileDirectory)Entity\Device\" />
HDL_ON/UI/UI0-Public/TopViewDiv.cs
@@ -79,12 +79,12 @@
        /// </summary>
        /// <param name="frame"></param>
        /// <param name="tilte"></param>
        public void LoadTopView()
        public void LoadTopView(uint color = CSS_Color.TopViewColor)
        {
            contentView = new FrameLayout()
            {
                Height = Application.GetRealHeight(64),
                BackgroundColor = CSS_Color.TopViewColor,
                BackgroundColor = color,
            };
            baseView.AddChidren(contentView);
@@ -334,9 +334,9 @@
        /// </summary>
        /// <param name="frame"></param>
        /// <param name="tilte"></param>
        public void LoadTopView_Add3tyIot(string type, Action<string, string> callBack)
        public void LoadTopView_Add3tyIot( Action<string, string> callBack)
        {
            LoadTopView();
            LoadTopView(CSS_Color.MainBackgroundColor);
            var btnAddIcon = new Button()
            {
@@ -344,39 +344,40 @@
                Y = Application.GetRealHeight(29),
                Width = Application.GetMinRealAverage(28),
                Height = Application.GetMinRealAverage(28),
                UnSelectedImagePath = "Public/AddIcon.png",
                UnSelectedImagePath = "Public/LinkIotIcon.png",
            };
            contentView.AddChidren(btnAddIcon);
            btnAddIcon.MouseUpEventHandler += (sender, e) =>
            {
                if (type == "floors")
                {
                    Action<string> callBackAction = (floorName) =>
                    {
                        callBack("add", floorName);
                    };
                    string newFloorName = "1F";
                    for (int i = 0; i < SpatialInfo.CurrentSpatial.FloorList.Count + 1;)
                    {
                        newFloorName = ++i + "F";
                        if (null == SpatialInfo.CurrentSpatial.FloorList.Find((obj) => obj.roomName == newFloorName))
                        {
                            break;
                        }
                    }
                    var fs = new List<string>();
                    foreach (var f in SpatialInfo.CurrentSpatial.FloorList)
                    {
                        fs.Add(f.roomName);
                    }
                    new PublicAssmebly().LoadDialog_EditParater(StringId.AddFloors, newFloorName, callBackAction, StringId.FloorNameCannotBeEmpty,
                        StringId.AddFloorFailed_FloorAlreadyExist, fs);
                }
                else
                {
                    callBack("", "");
                }
                var page = new Iot_BrandListPage();
                MainPage.BasePageView.AddChidren(page);
                page.LoadPage();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            };
        }
        /// <summary>
        /// 向framelayout添加顶部区域,第三方平台
        /// </summary>
        public void LoadTopView_3tyIot(Action action)
        {
            LoadTopView(CSS_Color.MainBackgroundColor);
            var btnAddIcon = new Button()
            {
                X = Application.GetRealWidth(337),
                Y = Application.GetRealHeight(29),
                Width = Application.GetMinRealAverage(28),
                Height = Application.GetMinRealAverage(28),
                UnSelectedImagePath = "Public/Iot_agreement_icon.png",
            };
            contentView.AddChidren(btnAddIcon);
            btnAddIcon.MouseUpEventHandler += (sender, e) =>
            {
                action();
            };
        }
HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/BrandListPage.cs
@@ -26,13 +26,20 @@
            };
            new TopViewDiv(bodyView, Language.StringByID(StringId.FunctionBrand)).LoadTopView();//.LoadTopView_AddIcon("3ty",action);//.LoadTopView();//
            new TopViewDiv(bodyView, Language.StringByID(StringId.FunctionBrand)).LoadTopView_Add3tyIot(action);
            bodyView.BackgroundColor = CSS_Color.BackgroundColor;
            bodyView.BackgroundColor = CSS_Color.MainBackgroundColor;
            bodyView.AddChidren(new Button
            {
                Y = Application.GetRealHeight(64),
                Height = Application.GetRealHeight(1),
                BackgroundColor = CSS_Color.DividingLineColor,
            });
            contentView = new VerticalRefreshLayout()
            {
                Y = Application.GetRealHeight(64),
                Y = Application.GetRealHeight(65),
                Height = Application.GetRealHeight(603),
            };
            bodyView.AddChidren(contentView);
@@ -102,22 +109,23 @@
            {
                var row = new RowLayout()
                {
                    Height = Application.GetRealHeight(50),
                    Height = Application.GetRealHeight(87),
                    BackgroundColor = CSS_Color.MainBackgroundColor,
                    LineColor = 0x00000000,
                };
                contentView.AddChidren(row);
                if (isFrist)
                {
                    isFrist = false;
                }
                else
                //if (isFrist)
                //{
                //    isFrist = false;
                //}
                //else
                {
                    Button btnLine = new Button()
                    {
                        X = Application.GetRealWidth(56),
                        Width = Application.GetRealWidth(303),
                        Y = Application.GetRealHeight(86),
                        Gravity = Gravity.CenterHorizontal,
                        Width = Application.GetRealWidth(343),
                        Height = 1,
                        BackgroundColor = CSS_Color.DividingLineColor,
                    };
@@ -128,9 +136,9 @@
                {
                    X = Application.GetRealWidth(12),
                    Gravity = Gravity.CenterVertical,
                    Width = Application.GetRealWidth(32),
                    Height = Application.GetRealWidth(32),
                    Radius = (uint)Application.GetRealWidth(4),
                    Width = Application.GetRealWidth(47),
                    Height = Application.GetRealWidth(47),
                    Radius = (uint)Application.GetRealWidth(9),
                    BackgroundColor = CSS_Color.PromptingColor1
                };
                row.AddChidren(btnIcon);
@@ -146,11 +154,11 @@
                Button btnName = new Button()
                {
                    X = Application.GetRealWidth(56),
                    Width = Application.GetRealWidth(303),
                    X = Application.GetRealWidth(83),
                    Width = Application.GetRealWidth(210),
                    TextAlignment = TextAlignment.CenterLeft,
                    TextColor = CSS_Color.FirstLevelTitleColor,
                    TextSize = CSS_FontSize.TextFontSize,
                    TextSize = CSS_FontSize.SubheadingFontSize,
                    Text = brand.brandName,
                };
                row.AddChidren(btnName);
@@ -158,6 +166,7 @@
                ImageUtlis.Current.Load3tyBrandIconImages(brand.brandName, brand.brandIcon, btnIcon);
                btnName.MouseUpEventHandler = (sender, e) => {
                    var page = new DeviceListPage(brand);
                    MainPage.BasePageView.AddChidren(page);
                    page.LoadPage();
HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_AuthorizedPage.cs
New file
@@ -0,0 +1,44 @@
using System;
using Shared;
using HDL_ON.Entity;
using HDL_ON.DAL.Server;
namespace HDL_ON.UI
{
    public class Iot_AuthorizedPage
    {
        HttpServerRequest http = new HttpServerRequest();
        IntegratedBrand_Iot brand_Iot;
        public Iot_AuthorizedPage(IntegratedBrand_Iot brand)
        {
            brand_Iot = brand;
        }
        /// <summary>
        /// 搜索第三方设备
        /// </summary>
        private void SearchDevice()
        {
            var pack = http.Search3tyIotDevice(brand_Iot.companyId);
            if(pack!= null)
            {
            }
        }
        /// <summary>
        /// 获取第三方功能列表
        /// </summary>
        private void GetFunction()
        {
            var pack = http.Get3tyIotDeviceFunctionList(brand_Iot.companyId);
            if(pack != null)
            {
            }
        }
    }
}
HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_BrandFunctionListPage.cs
New file
@@ -0,0 +1,250 @@
using System;
using System.Collections.Generic;
using HDL_ON.DAL.Server;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
using Shared;
namespace HDL_ON.UI
{
    public class Iot_BrandFunctionListPage :FrameLayout
    {
        FrameLayout bodyView;
        IntegratedBrand_Iot brand_Iot;
        /// <summary>
        /// 解绑回调
        /// </summary>
        public Action unboundAction;
        public Iot_BrandFunctionListPage(IntegratedBrand_Iot brand_Iot)
        {
            bodyView = this;
            this.brand_Iot = brand_Iot;
        }
        public void LoadPage()
        {
            Action action = () => {
                var page = new iot_BindTipPage();
                MainPage.BasePageView.AddChidren(page);
                page.unboundAction = () => {
                    this.RemoveFromParent();
                    unboundAction?.Invoke();
                };
                page.LoadPage(brand_Iot);
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            };
            new TopViewDiv(bodyView, "品牌名称").LoadTopView_3tyIot(action);
            bodyView.BackgroundColor = CSS_Color.MainBackgroundColor;
            bodyView.AddChidren(new Button
            {
                Y = Application.GetRealHeight(64),
                Height = Application.GetRealHeight(1),
                BackgroundColor = CSS_Color.DividingLineColor,
            });
            Button btnTipText = new Button()
            {
                Y = Application.GetRealHeight(80),
                Width = Application.GetRealWidth(347),
                Height = Application.GetRealHeight(65),
                Gravity = Gravity.CenterHorizontal,
                Radius = (uint)Application.GetRealWidth(5),
                BackgroundColor = 0x194484F4,
                TextColor = CSS_Color.FirstLevelTitleColor,
                Padding = new Padding(12,  Application.GetRealWidth(16), 12, Application.GetRealWidth(16)),
                TextSize = CSS_FontSize.TextFontSize,
                Text = "默认将第三方品牌的设备全部关联到On Pro上,您也可以通过下方的开关按键,进行选择性关联。",
                IsMoreLines = true,
                TextAlignment = TextAlignment.CenterLeft,
            };
            bodyView.AddChidren(btnTipText);
            var contentView = new VerticalRefreshLayout()
            {
                Y = Application.GetRealHeight(150),
                Height = Application.GetRealHeight(573),
            };
            bodyView.AddChidren(contentView);
            LoadDeviceFunctionControlZone(contentView);
        }
        /// <summary>
        /// 加载设备功能显示区域
        /// </summary>
        void LoadDeviceFunctionControlZone(VerticalRefreshLayout deviceFunctionView)
        {
            #region ContextView
            var rowView = new FrameLayout();
            try
            {
                int index = 0;
                var list = new List<Function>();
                list.Add(new Function
                {
                    spk = SPK.AcStandard,
                    name = "空调"
                });
                list.Add(new Function
                {
                    spk = SPK.LightDimming,
                    name = "灯光"
                });
                foreach (var function in list)
                {
                    if (index % 2 == 0)
                    {
                        rowView = new FrameLayout()
                        {
                            Height = Application.GetRealWidth(140),
                        };
                        deviceFunctionView.AddChidren(rowView);
                    }
                    var functionView_X = Application.GetRealWidth((182 + 7) * (index % 2));
                    if (index % 2 == 0)
                    {
                        functionView_X += Application.GetRealWidth(7);
                    }
                    var functionView = new FrameLayout()
                    {
                        X = functionView_X,
                        Width = Application.GetRealWidth(182),
                        Height = Application.GetRealWidth(140),
                        Radius = (uint)Application.GetRealWidth(12),
                        Tag = function.sid
                    };
                    rowView.AddChidren(functionView);
                    var btnbg = new Button()
                    {
                        UnSelectedImagePath = "Collection/Functionbg.png",
                        SelectedImagePath = "Collection/FunctionOnbg.png",
                        Tag = function.sid
                    };
                    functionView.AddChidren(btnbg);
                    LoadDeviceFunctionDiv(functionView, function,btnbg);
                    index++;
                }
                if (index == 0)
                {
                    var view = new FrameLayout();
                    deviceFunctionView.AddChidren(view);
                    var btnNoCollectionBg = new Button()
                    {
                        Y = Application.GetRealHeight(20),
                        Gravity = Gravity.CenterHorizontal,
                        Width = Application.GetRealWidth(180),
                        Height = Application.GetRealWidth(180),
                        Text = "没有任何设备"
                    };
                    view.AddChidren(btnNoCollectionBg);
                    var btnNoCollectionTip = new Button()
                    {
                        Height = Application.GetRealHeight(42),
                        Y = btnNoCollectionBg.Bottom,
                        TextAlignment = TextAlignment.Center,
                        TextColor = CSS_Color.PromptingColor1,
                        TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                        TextID = StringId.TipNoFunctionCollcetion,
                    };
                    view.AddChidren(btnNoCollectionTip);
                }
            }
            catch (Exception ex)
            {
            }
            deviceFunctionView.AddChidren(new Button { Height = Application.GetRealHeight(30) });
            #endregion
        }
        /// <summary>
        /// 加载功能控制卡片
        /// </summary>
        void LoadDeviceFunctionDiv(FrameLayout view, Function function,Button btnBg)
        {
            try
            {
                Button btnIcon;
                btnIcon = new Button()
                {
                    Gravity = Gravity.CenterHorizontal,
                    Y = Application.GetRealHeight(24),
                    Width = Application.GetMinRealAverage(54),
                    Height = Application.GetMinRealAverage(54),
                };
                view.AddChidren(btnIcon);
                btnIcon.UnSelectedImagePath = $"FunctionIcon/Icon/HomeIcon/{function.IconName}_blue.png";
                btnIcon.SelectedImagePath = $"FunctionIcon/Icon/HomeIcon/{function.IconName}_white.png";
                Button btnName;
                btnName = new Button()
                {
                    Y = btnIcon.Bottom,
                    Text = function.name,
                    IsBold = true,
                    TextColor = CSS_Color.FirstLevelTitleColor,
                    SelectedTextColor = CSS_Color.MainBackgroundColor,
                    TextSize = CSS_FontSize.TextFontSize,
                    Height = Application.GetRealWidth(24),
                    TextAlignment = TextAlignment.Center,
                };
                view.AddChidren(btnName);
                Button btnClick = new Button();
                view.AddChidren(btnClick);
                btnClick.MouseUpEventHandler = (sender, e) => {
                    function.collect = !function.collect;
                    if (function.collect)
                    {
                        btnName.IsSelected = btnIcon.IsSelected = btnBg.IsSelected = true;
                        var pack = http.Set3tyIotFunctionToHouse(function.deviceId, DB_ResidenceData.Instance.CurrentRegion.id);
                        if (pack != null)
                        {
                        }
                    }
                    else
                    {
                        btnName.IsSelected = btnIcon.IsSelected = btnBg.IsSelected = false;
                        var pack = http.Set3tyIotFunctionToHouse(function.deviceId, "0");
                        if (pack != null)
                        {
                        }
                    }
                };
            }
            catch (Exception ex)
            {
                MainPage.Log("homepage LoadControlView error : " + ex.Message);
            }
        }
        HttpServerRequest http = new HttpServerRequest();
    }
}
HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_BrandListPage.cs
New file
@@ -0,0 +1,251 @@
using System;
using System.Collections.Generic;
using HDL_ON.DAL.Server;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
using Shared;
namespace HDL_ON.UI
{
    /// <summary>
    /// 第三方品牌列表界面
    /// </summary>
    public class Iot_BrandListPage : FrameLayout
    {
        FrameLayout bodyView;
        VerticalRefreshLayout contentView;
        List<IntegratedBrand_Iot> brandList;
        public Iot_BrandListPage()
        {
            bodyView = this;
            brandList = new List<IntegratedBrand_Iot>();
        }
        public void LoadPage()
        {
            new TopViewDiv(bodyView, Language.StringByID(StringId.Bind3thIotAccount)).LoadTopView(CSS_Color.MainBackgroundColor);
            bodyView.BackgroundColor = CSS_Color.MainBackgroundColor;
            bodyView.AddChidren(new Button
            {
                Y = Application.GetRealHeight(64),
                Height = Application.GetRealHeight(1),
                BackgroundColor = CSS_Color.DividingLineColor,
            });
            Button btnTipText = new Button()
            {
                Y = Application.GetRealHeight(80),
                Width = Application.GetRealWidth(347),
                Height = Application.GetRealHeight(65),
                Gravity = Gravity.CenterHorizontal,
                Radius = (uint)Application.GetRealWidth(5),
                BackgroundColor = 0x194484F4,
                TextColor = CSS_Color.FirstLevelTitleColor,
                Padding = new Padding(12, Application.GetRealWidth(16), 12, Application.GetRealWidth(16)),
                TextSize = CSS_FontSize.TextFontSize,
                Text = "通过绑定第三方平台账号寄哪里云端连接,将您在三方平台的设备同步到On Pro进行控制",
                IsMoreLines = true,
                TextAlignment = TextAlignment.CenterLeft,
            };
            bodyView.AddChidren(btnTipText);
            contentView = new VerticalRefreshLayout()
            {
                Y = Application.GetRealHeight(150),
                Height = Application.GetRealHeight(573),
            };
            bodyView.AddChidren(contentView);
            GetBindList();
            contentView.BeginHeaderRefreshingAction = () =>
            {
                contentView.EndHeaderRefreshing();
                GetBindList();
            };
            LoadRow();
        }
        /// <summary>
        /// 获取绑定列表
        /// </summary>
        void GetBindList()
        {
            var waitPage = new Loading();
            waitPage.Start();
            new System.Threading.Thread(() => {
                try
                {
                    var pm = new DAL.Server.HttpServerRequest();
                    var pack = pm.Get3tyIotBrandList();
                    if (pack.Code == DAL.Server.StateCode.SUCCESS)
                    {
                        brandList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<IntegratedBrand_Iot>>(pack.Data.ToString());
                        if (brandList.Count > 0)
                        {
                            Application.RunOnMainThread(() =>
                            {
                                LoadRow();
                            });
                        }
                        else
                        {
                            Application.RunOnMainThread(() =>
                            {
                                //NotListTipView();
                                LoadRow();
                            });
                        }
                    }
                    else
                    {
                        IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
                    }
                }
                catch (Exception ex)
                {
                    MainPage.Log("2--::" + ex.Message);
                }
                finally
                {
                    Application.RunOnMainThread(() => { waitPage.Hide(); });
                }
            })
            { IsBackground = true }.Start();
        }
        void LoadRow()
        {
            contentView.RemoveAll();
            bool isFrist = true;
            brandList.Add(new IntegratedBrand_Iot
            {
                authBrandNameCn = "Test Hdl",
                authBrandNameEn = "Test Hdl",
                hasAuthorization = false
            });
            foreach (var brand in brandList)
            {
                var row = new RowLayout()
                {
                    Height = Application.GetRealHeight(87),
                    BackgroundColor = CSS_Color.MainBackgroundColor,
                    LineColor = 0x00000000,
                };
                contentView.AddChidren(row);
                //if (isFrist)
                //{
                //    isFrist = false;
                //}
                //else
                {
                    Button btnLine = new Button()
                    {
                        Y = Application.GetRealWidth(86),
                        Gravity = Gravity.CenterHorizontal,
                        Width = Application.GetRealWidth(343),
                        Height = 1,
                        BackgroundColor = CSS_Color.DividingLineColor,
                    };
                    row.AddChidren(btnLine);
                }
                ImageView btnIcon = new ImageView()
                {
                    X = Application.GetRealWidth(12),
                    Gravity = Gravity.CenterVertical,
                    Width = Application.GetRealWidth(47),
                    Height = Application.GetRealWidth(47),
                    Radius = (uint)Application.GetRealWidth(9),
                    BackgroundColor = CSS_Color.PromptingColor1
                };
                row.AddChidren(btnIcon);
                Button btnBindTip = new Button()
                {
                    Width = Application.GetRealWidth(326),
                    TextAlignment = TextAlignment.CenterRight,
                    TextColor = CSS_Color.PromptingColor1,
                    TextSize = CSS_FontSize.SubheadingFontSize,
                    TextID = brand.hasAuthorization ? StringId.Bound : StringId.Unbound,
                };
                row.AddChidren(btnBindTip);
                Button btnRight = new Button()
                {
                    X = Application.GetRealWidth(339),
                    Gravity = Gravity.CenterVertical,
                    Width = Application.GetMinRealAverage(16),
                    Height = Application.GetMinRealAverage(16),
                    UnSelectedImagePath = "Public/Right.png",
                };
                row.AddChidren(btnRight);
                Button btnName = new Button()
                {
                    X = Application.GetRealWidth(83),
                    Width = Application.GetRealWidth(310),
                    TextAlignment = TextAlignment.CenterLeft,
                    TextColor = CSS_Color.FirstLevelTitleColor,
                    TextSize = CSS_FontSize.TextFontSize,
                    Text = brand.authBrandNameCn,
                };
                row.AddChidren(btnName);
                //下载第三方品牌icon
                //ImageUtlis.Current.Load3tyBrandIconImages(brand.brandName, brand.authrBandIconUrl, btnIcon);
                btnName.MouseUpEventHandler = (sender, e) => {
                    if (brand.hasAuthorization)
                    {
                        Action unboundAction = () =>
                        {
                            brand.hasAuthorization = false;
                            btnBindTip.TextID = StringId.Unbound;
                        };
                        var page = new Iot_BrandFunctionListPage(brand);
                        MainPage.BasePageView.AddChidren(page);
                        page.unboundAction = unboundAction;
                        page.LoadPage();
                        MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                    }
                    else
                    {
                        Action action = () => {
                            brand.hasAuthorization = true;
                            btnBindTip.TextID = StringId.Bound;
                        };
                        Action action2 = () => {
                            brand.hasAuthorization = false;
                            btnBindTip.TextID = StringId.Unbound;
                        };
                        var page = new iot_BindTipPage();
                        MainPage.BasePageView.AddChidren(page);
                        page.boundAction = action;
                        page.unboundAction = action2;
                        page.LoadPage(brand);
                        MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                    }
                };
            }
        }
    }
}
HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/iot_BindTipPage.cs
New file
@@ -0,0 +1,265 @@
using System;
using HDL_ON.DAL.Server;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
using Shared;
namespace HDL_ON.UI
{
    public class iot_BindTipPage : FrameLayout
    {
        FrameLayout bodyView;
        /// <summary>
        /// 解绑回调
        /// </summary>
        public Action unboundAction;
        /// <summary>
        /// 绑定回调
        /// </summary>
        public Action boundAction;
        public iot_BindTipPage()
        {
            bodyView = this;
        }
        public void LoadPage(IntegratedBrand_Iot brand_Iot)
        {
            new TopViewDiv(bodyView, Language.StringByID(StringId.Bind3thIotAccount)).LoadTopView(CSS_Color.MainBackgroundColor);
            bodyView.BackgroundColor = CSS_Color.MainBackgroundColor;
            var contentView = new VerticalScrolViewLayout()
            {
                Y = Application.GetRealHeight(64),
                BackgroundColor = CSS_Color.BackgroundColor,
                Height = Application.GetRealHeight(667 - 124)
            };
            bodyView.AddChidren(contentView);
            var btnIcon = new Button()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealHeight(25),
                Width = Application.GetRealWidth(106),
                Height = Application.GetRealWidth(106),
                UnSelectedImagePath = "Public/Logo.png",
            };
            contentView.AddChidren(btnIcon);
            var btnTipTitle = new Button()
            {
                X = Application.GetRealWidth(16),
                Y = Application.GetRealHeight(140),
                Width = Application.GetRealWidth(300),
                Height = Application.GetRealHeight(60),
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = 21,
                TextAlignment = TextAlignment.CenterLeft,
                IsBold = true,
                Text = "关于账号绑定的声明"
            };
            contentView.AddChidren(btnTipTitle);
            var btnTipText = new Button()
            {
                Padding =new Padding(0, Application.GetRealWidth(16), 0, Application.GetRealWidth(16)),
                Y = Application.GetRealHeight(140),
                Height = Application.GetRealHeight(340),
                IsMoreLines = true,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = 14,
                TextAlignment = TextAlignment.CenterLeft,
                Text = $"账户绑定品牌:{brand_Iot.brandName} (以下简称第三方品牌)" + "\r\n" + "\r\n" +
"您绑定第三方品牌的账号后,将授权“On Pro”使用您在第三方账号,协同管理设备,On Pro也将自动同步您在第三方品牌中添加的设备。" + "\r\n" + "\r\n" +
"为实现设备控制功能,本应用将从第三方中获取以下数据:" + "\r\n" + "\r\n" +
"1.第三方品牌上添加的部分设备列表,用于在On Pro中进行智能化控制;" + "\r\n" + "\r\n" +
"2.设备及网络信息,包括设备标志符、MAC地址、设备序列号,用于识别当前工作的设备以及进行设备控制功能。" + "\r\n" + "\r\n" +
"如果您不同意我们收集以上信息,将无法管理第三方品牌的设备。" + "\r\n" + "\r\n" +
"如需终止以上信息的收集与处理,您可以在“我的”> “绑定第三方账户”>“解除”"
            };
            contentView.AddChidren(btnTipText);
            var optionView = new FrameLayout()
            {
                Y = Application.GetRealHeight(667 - 80),
                Height = Application.GetRealHeight(90),
                Radius = (uint)Application.GetRealWidth(22),
                BackgroundColor = CSS_Color.MainBackgroundColor,
            };
            bodyView.AddChidren(optionView);
            var btnCannel = new Button()
            {
                X = Application.GetRealWidth(17),
                Y = Application.GetRealHeight(14),
                Width = Application.GetRealWidth(164),
                Height = Application.GetRealHeight(44),
                BorderColor = CSS_Color.MainColor,
                BackgroundColor = CSS_Color.MainBackgroundColor,
                BorderWidth = (uint)Application.GetRealWidth(1),
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.MainColor,
                TextSize = CSS_FontSize.SubheadingFontSize,
                Text = "返回",
                Radius = (uint)Application.GetRealHeight(22)
            };
            optionView.AddChidren(btnCannel);
            btnCannel.MouseUpEventHandler = (sender, e) => {
                this.RemoveFromParent();
            };
            var btnComfirm = new Button()
            {
                X = Application.GetRealWidth(196),
                Y = Application.GetRealHeight(14),
                Width = Application.GetRealWidth(164),
                Height = Application.GetRealHeight(44),
                TextAlignment = TextAlignment.Center,
                BackgroundColor= CSS_Color.MainColor,
                TextColor = CSS_Color.MainBackgroundColor,
                TextSize = CSS_FontSize.SubheadingFontSize,
                Text = "同意授权",
                Radius = (uint)Application.GetRealHeight(22)
            };
            optionView.AddChidren(btnComfirm);
            if (!brand_Iot.hasAuthorization)
            {
                btnComfirm.MouseUpEventHandler = (sender, e) =>
                {
                    brand_Iot.hasAuthorization = true;
                    boundAction?.Invoke();
                    this.RemoveFromParent();
                    var page = new Iot_BrandFunctionListPage(brand_Iot);
                    page.unboundAction = unboundAction;
                    MainPage.BasePageView.AddChidren(page);
                    page.LoadPage();
                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                };
            }
            else
            {
                btnComfirm.Text = "解除授权";
                btnComfirm.MouseUpEventHandler = (sender, e) =>
                {
                    Dialog dialog = new Dialog()
                    {
                        BackgroundColor = CSS_Color.DialogTransparentColor1,
                    };
                    FrameLayout contentView = new FrameLayout()
                    {
                        Gravity = Gravity.Center,
                        Width = Application.GetRealWidth(305),
                        Height = Application.GetRealHeight(180),
                        BackgroundColor = CSS.CSS_Color.MainBackgroundColor,
                        BorderColor = 0x00000000,
                        BorderWidth = 0,
                        Radius = (uint)Application.GetMinRealAverage(10),
                    };
                    dialog.AddChidren(contentView);
                    Button btnMsg = new Button()
                    {
                        Gravity = Gravity.CenterHorizontal,
                        Height = Application.GetRealHeight(70),
                        Y = Application.GetRealHeight(30),
                        TextAlignment = TextAlignment.Center,
                        TextColor = CSS_Color.FirstLevelTitleColor,
                        TextSize = CSS_FontSize.SubheadingFontSize,
                        Padding = new Padding(0,Application.GetRealWidth(16),0,Application.GetRealWidth(16)),
                        Text = "撤销授权后,该品牌关联在On Pro中的设备将全部被解绑,相关使用信息合设备值也将失效",
                        IsMoreLines = true,
                    };
                    contentView.AddChidren(btnMsg);
                    Button btnLine = new Button()
                    {
                        Y = Application.GetRealHeight(125),
                        Height = Application.GetRealHeight(1),
                        BackgroundColor = CSS.CSS_Color.DividingLineColor,
                    };
                    contentView.AddChidren(btnLine);
                    Button btnConfirm = new Button()
                    {
                        Y = btnLine.Bottom,
                        Height = Application.GetRealHeight(55),
                        TextAlignment = TextAlignment.Center,
                        TextColor = CSS_Color.MainColor,
                        TextSize = CSS_FontSize.SubheadingFontSize,
                        SelectedTextColor = CSS_Color.MainBackgroundColor,
                        SelectedBackgroundColor = CSS_Color.MainColor,
                        Text = "确定撤回授权",
                    };
                    btnConfirm.SetCornerWithSameRadius(Application.GetMinRealAverage(10), HDLUtils.RectCornerBottomLeft);
                    btnConfirm.SetCornerWithSameRadius(Application.GetMinRealAverage(10), HDLUtils.RectCornerBottomRight);
                    contentView.AddChidren(btnConfirm);
                    dialog.Show();
                    btnConfirm.MouseDownEventHandler += (sender, e) =>
                    {
                        btnConfirm.IsSelected = true;
                    };
                    btnConfirm.MouseUpEventHandler += (sender, e) =>
                    {
                        var http = new HttpServerRequest();
                        var waitPage = new Loading();
                        this.AddChidren(waitPage);
                        waitPage.Start("");
                        new System.Threading.Thread(() =>
                        {
                            try
                            {
                                var pack = http.Unbound3tyIotAccount(brand_Iot.companyId);
                                if (pack != null)
                                {
                                    if (pack.Code == StateCode.SUCCESS)
                                    {
                                        Application.RunOnMainThread(() =>
                                        {
                                            btnConfirm.IsSelected = false;
                                            dialog.Close();
                                            this.RemoveFromParent();
                                            brand_Iot.hasAuthorization = false;
                                            unboundAction?.Invoke();
                                        });
                                    }
                                }
                            }
                            catch { }
                            finally
                            {
                                Application.RunOnMainThread(() => {
                                    waitPage.Hide();
                                    waitPage.RemoveFromParent();
                                });
                            }
                        })
                        { IsBackground = true }.Start();
                    };
                };
            }
        }
    }
}
HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs
@@ -161,6 +161,7 @@
            colorPicker = new ColorPicker()
            {
                Gravity = Gravity.Center,
                ColorImagePath = "FunctionIcon/Light/ColorWheel.png",
            };
            framePickerBack.AddChidren(colorPicker);