wxr
2020-09-11 9b5399d3dd4299563821af0a7131f9a52402feea
20209112

1.修正窗帘界面标题名称显示
2.修复重启软件无法加载功能列表的问题
3.增加调光渐变时间
10个文件已修改
233 ■■■■■ 已修改文件
.vs/HDL_APP_Project/xs/UserPrefs.xml 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DriverLayer/CommonPage.cs 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DriverLayer/Control.cs 64 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Entity/Function/Light.cs 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Entity/FunctionList.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePage.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPage.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPage.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPage.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.vs/HDL_APP_Project/xs/UserPrefs.xml
@@ -1,26 +1,45 @@
<Properties StartupConfiguration="{09712674-2A38-407B-B1E2-560B2C352F9A}|Default">
  <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS automaticSigning="False" PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneSimulatorTarget.61286FD1-B849-4457-AA51-F3CD79A395F6" />
  <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/Entity/FunctionList.cs">
<Properties StartupConfiguration="{D998E133-F0DD-4760-BE3C-461632F54DA4}|Default">
  <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS automaticSigning="False" PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.6242be7109c740c6cb8999a8904b6e0ea8d45192" />
  <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/Entity/Function/Light.cs">
    <Files>
      <File FileName="HDL_ON/DriverLayer/CommonPage.cs" Line="169" Column="67" />
      <File FileName="HDL_ON/Entity/Function/Light.cs" Line="91" Column="14" />
      <File FileName="HDL_ON/Entity/Function/AC.cs" Line="303" Column="17" />
      <File FileName="HDL_ON/Entity/Function/Curtain.cs" Line="26" Column="27" />
      <File FileName="HDL_ON/DAL/Net/TcpListener.cs" Line="215" Column="53" />
      <File FileName="HDL_ON/UI/UI0-Public/UpdataTcpResidenceDataDialog.cs" Line="47" Column="64" />
      <File FileName="HDL_ON/Entity/FunctionList.cs" Line="172" Column="44" />
      <File FileName="HDL_ON/DriverLayer/Control_Bus.cs" Line="1" Column="1" />
      <File FileName="HDL_ON/DriverLayer/CommonPage.cs" />
      <File FileName="HDL_ON/DriverLayer/Control.cs" Line="267" Column="56" />
      <File FileName="HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs" />
      <File FileName="HDL_ON/UI/UI2/2-Classification/FunctionPage.cs" />
      <File FileName="HDL_ON/Entity/DB_ResidenceData.cs" />
      <File FileName="HDL_ON/Entity/FunctionList.cs" />
      <File FileName="HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPage.cs" Line="41" Column="9" />
      <File FileName="HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs" Line="64" Column="32" />
      <File FileName="HDL_ON/Entity/Function/Light.cs" Line="79" Column="10" />
    </Files>
    <Pads>
      <Pad Id="ProjectPad">
        <State name="__root__">
          <Node name="HDL_APP_Project" expanded="True">
            <Node name="HDL-ON_Android" selected="True" />
            <Node name="HDL_ON" expanded="True">
              <Node name="DAL" expanded="True">
                <Node name="Net" expanded="True" />
              </Node>
              <Node name="DriverLayer" expanded="True" />
              <Node name="Entity" expanded="True">
                <Node name="Function" expanded="True">
                  <Node name="Light.cs" selected="True" />
                </Node>
              </Node>
              <Node name="UI" expanded="True">
                <Node name="UI0-Public" expanded="True" />
                <Node name="UI2" expanded="True">
                  <Node name="2-Classification" expanded="True" />
                  <Node name="3-Intelligence" expanded="True" />
                  <Node name="FuntionControlView" expanded="True">
                    <Node name="Curtain" expanded="True" />
                    <Node name="Light" expanded="True" />
                  </Node>
                </Node>
              </Node>
            </Node>
          </Node>
        </State>
      </Pad>
      <Pad Id="MonoDevelop.Debugger.WatchPad">
        <State>
          <Value>function.function</Value>
        </State>
      </Pad>
    </Pads>
@@ -31,7 +50,7 @@
    <String>Shared.Droid.TouchID/Shared.Droid.TouchID.csproj</String>
    <String>Shared.IOS/Shared.IOS.csproj</String>
  </DisabledProjects>
  <MonoDevelop.Ide.Workspace ActiveConfiguration="Release|iPhone" />
  <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|iPhone" />
  <MonoDevelop.Ide.ItemProperties.HDL-ON__Android AndroidDesignerPreferredTheme="AppTheme" AndroidDesignerPreferredDevice="Nexus 4" PreferredExecutionTarget="Android.SelectDevice" />
  <MonoDevelop.Ide.DebuggingService.Breakpoints>
    <BreakpointStore>
HDL_ON/DriverLayer/CommonPage.cs
@@ -65,15 +65,10 @@
            return BitConverter.ToSingle(byteTemp, 0);
        }
        static void Packet_ReceiveEvent(byte subnetID, byte deviceID, Command command, byte[] receiveBytes, string revGatewayIP)
        {
            try
            {
                if(revGatewayIP == "172.16.2.237")
                {
                }
                Control.controlLostCount = 0;
                switch (command)
@@ -88,12 +83,6 @@
                            {
                                if (updataObj.functionType != FunctionType.RGB)
                                {
                                    var newState = receiveBytes[2] == 0 ? "off" : "on";
                                    if (updataObj.trait_on_off.value.ToString() == newState)
                                    {
                                        //状态一样,不用再刷新页面
                                        break;
                                    }
                                    if (updataObj.trait_on_off.value.ToString() == "on")
                                    {
                                        if (updataObj.functionType == FunctionType.Fan)
@@ -255,12 +244,17 @@
                                FunctionPage.UpdataStates(curtain);
                                HomePage.UpdataFunctionStates(curtain);
                                ClassificationPage.UpdataInfo(curtain);
                                RollingShutterPage.UpdataState(curtain);
                                switch (curtain.functionType)
                                {
                                    case FunctionType.Curtain:
                                        CurtainModulePage.UpdataState(curtain);
                                        break;
                                    case FunctionType.MotorCurtain:
                                        MotorCurtainPage.UpdataState(curtain);
                                        break;
                                    case FunctionType.RollingShutter:
                                        RollingShutterPage.UpdataState(curtain);
                                        break;
                                }
                            }
                        }
HDL_ON/DriverLayer/Control.cs
@@ -3,6 +3,7 @@
using HDL_ON.DAL;
using HDL_ON.DAL.Net;
using HDL_ON.Entity;
using HDL_ON.UI;
namespace HDL_ON
{
@@ -13,7 +14,7 @@
        /// </summary>
        public static void Send(Function function)
        {
            switch(function.functionCategory)
            switch (function.functionCategory)
            {
                case FunctionCategory.Scene:
                    ControlScene(function as Scene);
@@ -114,7 +115,7 @@
                        {
                            curtainState = 1;
                        }
                        else if (function.trait_on_off.value.ToString() =="off")
                        else if (function.trait_on_off.value.ToString() == "off")
                        {
                            curtainState = 2;
                        }
@@ -154,7 +155,7 @@
                    case FunctionType.Relay:
                    case FunctionType.Dimmer:
                        byte brightness = 0;
                        if(function.trait_on_off.value.ToString() == "on")
                        if (function.trait_on_off.value.ToString() == "on")
                        {
                            var brightnessTrait = function.function.Find((obj) => obj.name == "brightness");
                            if (brightnessTrait != null)
@@ -257,7 +258,7 @@
                                ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] {
                                            function.bus_Data.LoopID,
                                            b1,
                                            0, 0 });
                                            0, Convert.ToByte(light.fadeTime) });
                                break;
                            case FunctionType.Relay:
                                ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { function.bus_Data.LoopID, light.trait_on_off.value.ToString() == "on" ? (byte)100 : (byte)0, 0, 0 });
@@ -393,55 +394,12 @@
                        }
                        break;
                }
                foreach (var dic in commandDictionary)
                {
                    switch (dic.Key)
                    {
                        case "on_off":
                            break;
                        case "brightness":
                            break;
                        case "color":
                            break;
                        default:
                            MainPage.Log($"功能未支持 : {dic.Key}");
                            break;
                            //case "cct":
                            //case "delay":
                            //case "fade_time":
                            //case "open_level":
                            //case "lock":
                            //case "ico":
                            //case "mode":
                            //case "fan":
                            //case "temp":
                            //case "swing":
                            //case "set_ point":
                            //case "pm25":
                            //case "volume":
                            //case "vol_step":
                            //case "source":
                            //case "treble":
                            //case "bass":
                            //case "playlist":
                            //case "song_name":
                            //case "current_status":
                            //case "enable":
                            //case "lux":
                            //case "adjust_value":
                            //case "range":
                            //case "humidity":
                            //case "type":
                            //case "state":
                            //case "sensitivity":
                            //case "pm25value":
                    }
                }
                #region 发送命令立即更新UI
                HomePage.UpdataFunctionStates(function);
                RoomPage.UpdataStates(function);
                FunctionPage.UpdataStates(function);
                ClassificationPage.UpdataInfo(function);
                #endregion
            }
            catch (Exception ex)
            {
HDL_ON/Entity/Function/Light.cs
@@ -79,6 +79,64 @@
        }
        [Newtonsoft.Json.JsonIgnore]
        Trait trait_fadeTime;
        /// <summary>
        /// 亮度值
        /// </summary>
        [Newtonsoft.Json.JsonIgnore]
        public int fadeTime
        {
            get
            {
                if (trait_fadeTime == null)
                {
                    trait_fadeTime = function.Find((obj) => obj.name == "fade_time");
                    //找不到属性需要声明一个,防止报错闪退
                    if (trait_fadeTime == null)
                    {
                        trait_fadeTime = new Trait()
                        {
                            name = "fade_time",
                            value_key = new List<string> { "up", "down" },
                            max = 10,
                            min = 0,
                        };
                        trait_fadeTime.value = 0;
                        function.Add(trait_fadeTime);
                    }
                }
                return Convert.ToInt32(trait_fadeTime.value);
            }
            set
            {
                try
                {
                    if (trait_fadeTime == null)
                    {
                        trait_fadeTime = function.Find((obj) => obj.name == "fade_time");
                        //找不到属性需要声明一个,防止报错闪退
                        if (trait_fadeTime == null)
                        {
                            trait_fadeTime = new Trait()
                            {
                                name = "fade_time",
                                value_key = new List<string> { "up", "down" },
                                max = 100,
                                min = 0,
                            };
                            trait_fadeTime.value = 0;
                            function.Add(trait_fadeTime);
                        }
                    }
                    trait_fadeTime.value = value;
                }
                catch
                {
                }
            }
        }
        [Newtonsoft.Json.JsonIgnore]
        public Trait trait_color;
        /// <summary>
        /// RGB颜色
HDL_ON/Entity/FunctionList.cs
@@ -102,7 +102,7 @@
        /// </summary>
        public List<Function> GetAllDeviceFunctionList()
        {
            if (deviceFunctionList == null)
            if (deviceFunctionList == null|| deviceFunctionList.Count == 0)
            {
                deviceFunctionList = new List<Function>();
                deviceFunctionList.AddRange(aCs);
HDL_ON/UI/UI2/FuntionControlView/Curtain/CurtainModulePage.cs
@@ -155,7 +155,7 @@
            controlView.AddChidren(btnCurtainOpen);
            LoadEventList();
            new TopViewDiv(bodyView, Language.StringByID(StringId.LocationManagement)).LoadTopView(curtain, actionRefresh);
            new TopViewDiv(bodyView,curtain.name).LoadTopView(curtain, actionRefresh);
        }
    }
HDL_ON/UI/UI2/FuntionControlView/Curtain/MotorCurtainPage.cs
@@ -206,7 +206,7 @@
            controlView.AddChidren(btnCurtainOpen);
            LoadEventList();
            new TopViewDiv(bodyView, Language.StringByID(StringId.LocationManagement)).LoadTopView(curtain,actionRefresh);
            new TopViewDiv(bodyView, curtain.name).LoadTopView(curtain,actionRefresh);
        }
    }
HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPage.cs
@@ -206,7 +206,7 @@
            controlView.AddChidren(btnCurtainOpen);
            LoadEventList();
            new TopViewDiv(bodyView, Language.StringByID(StringId.LocationManagement)).LoadTopView(curtain, actionRefresh);
            new TopViewDiv(bodyView, curtain.name).LoadTopView(curtain, actionRefresh);
        }
    }
HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPage.cs
@@ -35,6 +35,10 @@
        /// </summary>
        Button btnBrightnessText;
        /// <summary>
        /// 渐变时间修改
        /// </summary>
        DiyImageSeekBar barFadeTime;
        /// <summary>
        /// 开关按钮
        /// </summary>
        Button btnSwitch;
@@ -189,7 +193,7 @@
            };
            controlView.AddChidren(btnGradualChangeMinValuesText);
            var barGradualChange = new DiyImageSeekBar()
            barFadeTime = new DiyImageSeekBar()
            {
                X = btnGradualChangeMinValuesText.Right,
                Y = Application.GetRealHeight(412 - 21) + Application.GetRealHeight(8),
@@ -203,14 +207,14 @@
                ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                ProgressBarUnitSring = "s",
                MaxValue = 10,
                Progress = 0,
                Progress = light.fadeTime,
                SeekBarPadding = Application.GetRealWidth(20),
            };
            controlView.AddChidren(barGradualChange);
            controlView.AddChidren(barFadeTime);
            var btnGradualChangeMaxValuesText = new Button()
            {
                X = barGradualChange.Right,
                X = barFadeTime.Right,
                Y = btnGradualChangeText.Bottom + Application.GetRealHeight(8),
                Width = Application.GetRealWidth(35),
                Height = Application.GetRealHeight(21),
HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs
@@ -32,8 +32,10 @@
                        {
                            bodyView.dimmerBar.SetProgressBarColors(CSS_Color.DividingLineColor, CSS_Color.DividingLineColor);
                        }
                        //bodyView.dimmerBar.WaveColor = uFunction.on_off == "on" ? CSS.CSS_Color.AuxiliaryColor1 : CSS.CSS_Color.PromptingColor2;
                        bodyView.btnSwitch.IsSelected = uFunction.trait_on_off.value.ToString() == "on";
                        bodyView.btnBrightnessText.Y = ((100 - uFunction.brightness) * Application.GetRealHeight(288 - 16 - 16) / 100) + Application.GetRealWidth(40);
                        bodyView.btnBrightnessText.Text = uFunction.brightness + "%";
                    }
                }
                catch (Exception ex)
@@ -48,10 +50,22 @@
            LoadSwitchEvent();
            LoadCollectionEvent();
            LoadEvent_DimmerBar();
            LoadEvet_ChangeFadeTime();
            //回退刷新信息事件
            actionRefresh = () => {
                btnFunctionName.Text = btnFunctionName_Out.Text = light.name;
                btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = light.GetRoomListName();
            };
        }
        /// <summary>
        /// 修改灯光渐变时间
        /// </summary>
        void LoadEvet_ChangeFadeTime()
        {
            barFadeTime.OnProgressChangedEvent = (sender, e) =>
            {
                light.fadeTime = e;
                light.SaveFunctionData();
            };
        }
@@ -83,6 +97,7 @@
                Control.SendWriteCommand(light, d);
            };
            dimmerBar.OnProgressChangedEvent = (sender, e) => {
                light.fadeTime = 0;
                if (!btnSwitch.IsSelected)
                {
                    dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1);
@@ -113,8 +128,6 @@
                    }
                }
                MainPage.Log( dimmerBar.NowProgressY.ToString());
                //btnBrightnessText.Y = dimmerBar.NowProgressY + Application.GetRealWidth(40);
                btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(288 - 16 - 16) / 100) + Application.GetRealWidth(40);
                btnBrightnessText.Text = light.brightness + "%";
            };
@@ -127,6 +140,7 @@
        {
            btnSwitch.MouseUpEventHandler += (sender, e) =>
            {
                light.fadeTime = barFadeTime.Progress;
                btnSwitch.IsSelected = !btnSwitch.IsSelected;
                if (btnSwitch.IsSelected)
                {