wxr
2023-01-10 f7063b6fb7b46e3612afb1c6bb426c94fb92593d
设备加载优化
8个文件已修改
411 ■■■■ 已修改文件
HDL-ON_Android/Properties/AndroidManifest.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_iOS/Info.plist 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Common/ApiUtlis.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Entity/DB_ResidenceData.cs 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Entity/FunctionList.cs 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI1-Login/LoginPage.cs 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/2-Classification/FunctionPage.cs 178 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs 176 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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.6.3" package="com.hdl.onpro" xmlns:tools="http://schemas.android.com/tools" android:versionCode="202301091">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.6.3" package="com.hdl.onpro" xmlns:tools="http://schemas.android.com/tools" android:versionCode="202301102">
    <uses-sdk android:minSdkVersion="26" android:targetSdkVersion="29" />
    <!--友盟-->
    <!--<uses-sdk android:minSdkVersion="8"></uses-sdk>-->
HDL-ON_iOS/Info.plist
@@ -100,9 +100,9 @@
    <key>UIStatusBarStyle</key>
    <string>UIStatusBarStyleLightContent</string>
    <key>CFBundleShortVersionString</key>
    <string>1.6.302301091</string>
    <string>1.6.302301102</string>
    <key>CFBundleVersion</key>
    <string>1.6.301091</string>
    <string>1.6.301102</string>
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>Use geographic location to provide services such as weather</string>
    <key>NSAppleMusicUsageDescription</key>
HDL_ON/Common/ApiUtlis.cs
@@ -229,7 +229,7 @@
                                {
                                    newFunction.AssembleStatus();
                                    newFunction.SaveFunctionFile();
                                    FunctionList.List.IniFunctionList(newFunction.savePath);
                                    FunctionList.List.IniFunctionList(newFunction.savePath,true);
                                    MainPage.Log($"============设备============{iiii++}");
                                }
HDL_ON/Entity/DB_ResidenceData.cs
@@ -298,16 +298,27 @@
            var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this));
            WirteResidenceInfo(ssd);
        }
        /// <summary>
        /// 当前选择的楼层
        /// </summary>
        public string CurFoor = Language.StringByID(StringId.All);
        SpatialInfo _CurFloor;
        /// <summary>
        /// 当前选择的楼层
        /// </summary>
        [Newtonsoft.Json.JsonIgnore]
        public SpatialInfo CurFloor = new SpatialInfo() { roomId = "", roomName = Language.StringByID(StringId.All)};
        public SpatialInfo CurFloor {
            get
            {
                if(_CurFloor == null || _CurFloor.roomName == "")
                {
                    _CurFloor = new SpatialInfo() { roomId = "", roomName = Language.StringByID(StringId.All) };
                }
                return _CurFloor;
            }
            set
            {
                _CurFloor = value;
            }
        }
        /// <summary>
        /// 分类界面显示的楼层
        /// </summary>
HDL_ON/Entity/FunctionList.cs
@@ -331,16 +331,24 @@
                    if (checkRepeat == true)
                    {
                        //检测重复
                        for (int i = 0; i < Functions.Count; i++)
                        var same = Functions.FindAll((obj) => obj.deviceId == tempFunction.deviceId);
                        if(same!= null)
                        {
                            if (Functions[i].deviceId == tempFunction.deviceId)
                            foreach(var sameTemp in same)
                            {
                                //先移除掉再加
                                Functions.RemoveAt(i);
                                Functions.Add(tempFunction);
                                return;
                                Functions.Remove(sameTemp);
                            }
                        }
                        //for (int i = 0; i < Functions.Count; i++)
                        //{
                        //    if (Functions[i].deviceId == tempFunction.deviceId)
                        //    {
                        //        //先移除掉再加
                        //        Functions.RemoveAt(i);
                        //        Functions.Add(tempFunction);
                        //        return;
                        //    }
                        //}
                    }
                    Functions.Add(tempFunction);
                }
HDL_ON/UI/UI1-Login/LoginPage.cs
@@ -221,13 +221,13 @@
                    //etAccount.Text = "support7@hdlautomation.com";
                    //etAccount.Text = "18570064522";
                    //etAccount.Text = "18718417827";
                    etAccount.Text = "ablis-nn@yandex.ru";
                    etAccount.Text = "18188019284";
                    //etAccount.Text = "13143792049";
                    //etAccount.Text = "13288623489";//罗晓东
                    //etAccount.Text = "18244942707";
                    //etAccount.Text = "13143792049";
                    //etAccount.Text = "18688414428";
                    etAccount.Text = "18244942707";
                    //etAccount.Text = "18244942707";
                }
                else
                {
@@ -261,9 +261,9 @@
                }
                b = !b;
                etPassword.Text = "123456";
                if(etAccount.Text == "ablis-nn@yandex.ru")
                if(etAccount.Text == "18188019284")
                {
                    etPassword.Text = "07112001Ulyna";
                    etPassword.Text = "CEZUJHSZ";
                }
                else if(etAccount.Text == "13143792049")
                {
HDL_ON/UI/UI2/2-Classification/FunctionPage.cs
@@ -215,70 +215,136 @@
            #endregion
        }
        /// <summary>
        /// 显示的设备的总数
        /// </summary>
        int showCount = 0;
        /// <summary>
        /// 加载功能row
        /// </summary>
        void ShowFunctionRow(List<Function> showList)
        void ShowFunctionRow(List<Function> showList, bool isAppend = false)
        {
            functionListView.RemoveAll();
            foreach (var function in showList)
            {
                if(function.spk == SPK.SensorDryContact|| function.spk == SPK.SensorDryContact2)
                {
                    continue;
                }
                if (function.spk == SPK.LightRGBW || function.spk == SPK.LightRGB || function.spk == SPK.LightDimming)
                {
                    var functionDiv = new FunctionControlZone(function)
                    {
                        Gravity = Gravity.CenterHorizontal,
                        Width = Application.GetRealWidth(343),
                        Height = Application.GetRealHeight(116),
                        Radius = (uint)Application.GetMinRealAverage(12),
                        BorderColor = 0x00FFFFFF,
                        BorderWidth = 1,
                        BackgroundColor = CSS_Color.MainBackgroundColor,
                        Tag = function.spk + function.sid
                    };
                    functionDiv.LoadFunctionDiv();
                    functionListView.AddChidren(functionDiv);
                }
                else if(function.spk == SPK.IpCam_Imou)
                {
                    var functionDiv = new FunctionControlZone(function)
                    {
                        Gravity = Gravity.CenterHorizontal,
                        Width = Application.GetRealWidth(343),
                        Height = Application.GetRealHeight(96),
                        Radius = (uint)Application.GetMinRealAverage(12),
                        BorderColor = 0x00FFFFFF,
                        BorderWidth = 1,
                        BackgroundColor = CSS_Color.MainBackgroundColor,
                        Tag = function.spk + function.sid
                    };
                    functionDiv.LoadFunctionDiv();
                    functionListView.AddChidren(functionDiv);
            var waitPage = new Loading();
            bodyView.AddChidren(waitPage);
            waitPage.Start("");
                }
                else
            new System.Threading.Thread(() =>
            {
                try
                {
                    var functionDiv = new FunctionControlZone(function)
                    Application.RunOnMainThread(() =>
                    {
                        Gravity = Gravity.CenterHorizontal,
                        Width = Application.GetRealWidth(343),
                        Height = Application.GetRealHeight(96),
                        Radius = (uint)Application.GetMinRealAverage(12),
                        BorderColor = 0x00FFFFFF,
                        BorderWidth = 1,
                        BackgroundColor = CSS_Color.MainBackgroundColor,
                        Tag = function.spk + function.sid
                    };
                    functionDiv.LoadFunctionDiv();
                    functionListView.AddChidren(functionDiv);
                        if (!isAppend)
                        {
                            showCount = 0;
                            functionListView.RemoveAll();
                        }
                        int i = 0;
                        foreach (var function in showList)
                        {
                            i++;
                            if (i > 50)
                            {
                                break;
                            }
                            showCount++;
                            if (function.spk == SPK.SensorDryContact || function.spk == SPK.SensorDryContact2)
                            {
                                continue;
                            }
                            if (function.spk == SPK.LightRGBW || function.spk == SPK.LightRGB || function.spk == SPK.LightDimming)
                            {
                                var functionDiv = new FunctionControlZone(function)
                                {
                                    Gravity = Gravity.CenterHorizontal,
                                    Width = Application.GetRealWidth(343),
                                    Height = Application.GetRealHeight(116),
                                    Radius = (uint)Application.GetMinRealAverage(12),
                                    BorderColor = 0x00FFFFFF,
                                    BorderWidth = 1,
                                    BackgroundColor = CSS_Color.MainBackgroundColor,
                                    Tag = function.spk + function.sid
                                };
                                functionDiv.LoadFunctionDiv();
                                functionListView.AddChidren(functionDiv);
                            }
                            else if (function.spk == SPK.IpCam_Imou)
                            {
                                var functionDiv = new FunctionControlZone(function)
                                {
                                    Gravity = Gravity.CenterHorizontal,
                                    Width = Application.GetRealWidth(343),
                                    Height = Application.GetRealHeight(96),
                                    Radius = (uint)Application.GetMinRealAverage(12),
                                    BorderColor = 0x00FFFFFF,
                                    BorderWidth = 1,
                                    BackgroundColor = CSS_Color.MainBackgroundColor,
                                    Tag = function.spk + function.sid
                                };
                                functionDiv.LoadFunctionDiv();
                                functionListView.AddChidren(functionDiv);
                            }
                            else
                            {
                                var functionDiv = new FunctionControlZone(function)
                                {
                                    Gravity = Gravity.CenterHorizontal,
                                    Width = Application.GetRealWidth(343),
                                    Height = Application.GetRealHeight(96),
                                    Radius = (uint)Application.GetMinRealAverage(12),
                                    BorderColor = 0x00FFFFFF,
                                    BorderWidth = 1,
                                    BackgroundColor = CSS_Color.MainBackgroundColor,
                                    Tag = function.spk + function.sid
                                };
                                functionDiv.LoadFunctionDiv();
                                functionListView.AddChidren(functionDiv);
                            }
                            functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(10) });
                        }
                        if (showList.Count > showCount)
                        {
                            var btnAppend = new Button()
                            {
                                Height = Application.GetRealHeight(60),
                                TextAlignment = TextAlignment.Center,
                                TextSize = CSS_FontSize.SubheadingFontSize,
                                TextColor = CSS_Color.FirstLevelTitleColor,
                                Text = "加载更多",
                            };
                            if (Language.CurrentLanguage != "Chinese")
                            {
                                btnAppend.Text = "Load more";
                            }
                            functionListView.AddChidren(btnAppend);
                            btnAppend.MouseUpEventHandler = (sender, e) =>
                            {
                                btnAppend.RemoveFromParent();
                                ShowFunctionRow(showList, true);
                            };
                        }
                    });
                }
                functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(10) });
            }
                catch (Exception ex)
                {
                    MainPage.Log("ShowFunctionRowError : " + ex.Message);
                }
                finally
                {
                    Application.RunOnMainThread(() =>
                    {
                        if (waitPage != null)
                        {
                            waitPage.RemoveFromParent();
                            waitPage = null;
                        }
                    });
                }
            })
            { IsBackground = true }.Start();
        }
HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs
@@ -25,6 +25,10 @@
        /// </summary>
        Button btnFloor;
        /// <summary>
        /// 全选按钮
        /// </summary>
        Button btnChooseAll;
        /// <summary>
        /// 功能列表集合显示区域
        /// </summary>
        static VerticalScrolViewLayout functionListView;
@@ -89,15 +93,46 @@
            btnFloor = new Button()
            {
                X = btnFloorDownIcon.Right,
                Y = Application.GetRealHeight(18),
                //Y = Application.GetRealHeight(18),
                Width = Application.GetRealWidth(200),
                Height = Application.GetMinRealAverage(16),
                //Height = Application.GetMinRealAverage(16+18*2),
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                TextAlignment = TextAlignment.CenterLeft,
                Text = DB_ResidenceData.Instance.CurFloor.roomName,
            };
            roomFloorChangeView.AddChidren(btnFloor);
            btnChooseAll = new Button()
            {
                X = Application.GetRealWidth(245),
                Width = Application.GetRealWidth(109),
                TextAlignment = TextAlignment.CenterRight,
                TextSize = CSS_FontSize.TextFontSize,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextID = StringId.SelectedAll,
            };
            if(sceneLishtList.Count>0)
            {
                btnChooseAll.TextID = StringId.Cancel;
            }
            roomFloorChangeView.AddChidren(btnChooseAll);
            btnChooseAll.MouseUpEventHandler = (sender, e) => {
                if (sceneLishtList.Count > 0)
                {
                    sceneLishtList.Clear();
                    btnChooseAll.TextID = StringId.SelectAll;
                    btnConfrim.IsSelected = false;
                }
                else
                {
                    sceneLishtList.AddRange(lightList);
                    btnChooseAll.TextID = StringId.Cancel;
                    btnConfrim.IsSelected = true;
                }
                LoadLightRow(lightList);
            };
            #endregion
            functionListView = new VerticalScrolViewLayout()
@@ -157,44 +192,110 @@
        }
        /// <summary>
        /// 显示的设备的总数
        /// </summary>
        int showCount = 0;
        /// <summary>
        /// 加载功能row
        /// </summary>
        /// <param name="lightList"></param>
        void LoadLightRow(List<Function> functions)
        void LoadLightRow(List<Function> functions, bool isAppend = false)
        {
            functionListView.RemoveAll();
            var waitPage = new Loading();
            bodyView.AddChidren(waitPage);
            waitPage.Start("");
            foreach (var function in functions)
            new System.Threading.Thread(() =>
            {
                var functionDiv = new LightRow(function)
                try
                {
                    Gravity = Gravity.CenterHorizontal,
                    Width = Application.GetRealWidth(343),
                    Height = Application.GetRealHeight(62),
                    Radius = (uint)Application.GetMinRealAverage(12),
                    BorderColor = 0x00FFFFFF,
                    BorderWidth = 1,
                    BackgroundColor = CSS_Color.MainBackgroundColor,
                    Tag = function.spk + function.sid
                };
                    Application.RunOnMainThread(() =>
                    {
                        if (!isAppend)
                        {
                            showCount = 0;
                            functionListView.RemoveAll();
                        }
                        int i = 0;
                        foreach (var function in functions)
                        {
                            i++;
                            if (i > 100)
                            {
                                break;
                            }
                            showCount++;
                            var functionDiv = new LightRow(function)
                            {
                                Gravity = Gravity.CenterHorizontal,
                                Width = Application.GetRealWidth(343),
                                Height = Application.GetRealHeight(62),
                                Radius = (uint)Application.GetMinRealAverage(12),
                                BorderColor = 0x00FFFFFF,
                                BorderWidth = 1,
                                BackgroundColor = CSS_Color.MainBackgroundColor,
                                Tag = function.spk + function.sid
                            };
                Action setAction = () =>
                            Action setAction = () =>
                            {
                                if (sceneLishtList.Count > 0)
                                {
                                    btnConfrim.IsSelected = true;
                                }
                                else
                                {
                                    btnConfrim.IsSelected = false;
                                }
                            };
                            functionDiv.LoadDiv(sceneLishtList, setAction);
                            functionListView.AddChidren(functionDiv);
                            functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(12) });
                        }
                        if (functions.Count > showCount)
                        {
                            var btnAppend = new Button()
                            {
                                Height = Application.GetRealHeight(60),
                                TextAlignment = TextAlignment.Center,
                                TextSize = CSS_FontSize.SubheadingFontSize,
                                TextColor = CSS_Color.FirstLevelTitleColor,
                                Text = "加载更多",
                            };
                            if (Language.CurrentLanguage != "Chinese")
                            {
                                btnAppend.Text = "Load more";
                            }
                            functionListView.AddChidren(btnAppend);
                            btnAppend.MouseUpEventHandler = (sender, e) =>
                            {
                                btnAppend.RemoveFromParent();
                                LoadLightRow(functions, true);
                            };
                        }
                    });
                }
                catch (Exception ex)
                {
                    if (sceneLishtList.Count > 0)
                    MainPage.Log("ShowFunctionRowError : " + ex.Message);
                }
                finally
                {
                    Application.RunOnMainThread(() =>
                    {
                        btnConfrim.IsSelected = true;
                    }
                    else
                    {
                        btnConfrim.IsSelected = false;
                    }
                };
                functionDiv.LoadDiv(sceneLishtList,setAction);
                functionListView.AddChidren(functionDiv);
                functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(12) });
            }
                        if (waitPage != null)
                        {
                            waitPage.RemoveFromParent();
                            waitPage = null;
                        }
                    });
                }
            })
            { IsBackground = true }.Start();
        }
@@ -211,6 +312,21 @@
                var form = new FloorRoomSelectPopupView();
                form.ShowDeviceFunctionView(btnFloor, this.lightList, (selectId, listFunc) =>
                {
                    btnChooseAll.MouseUpEventHandler = (sender2, e2) => {
                        if (sceneLishtList.Count > 0)
                        {
                            sceneLishtList.Clear();
                            btnChooseAll.TextID = StringId.SelectAll;
                            btnConfrim.IsSelected = false;
                        }
                        else
                        {
                            sceneLishtList.AddRange(listFunc);
                            btnChooseAll.TextID = StringId.Cancel;
                            btnConfrim.IsSelected = true;
                        }
                        LoadLightRow(listFunc);
                    };
                    nowSelectId = selectId;
                    //重新加载界面
                    LoadLightRow(listFunc);