wei
2020-12-18 d53f7315de145266e6465d9f95d11d1712b9a91b
HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
old mode 100644 new mode 100755
@@ -67,7 +67,7 @@
                }
                string msg = function.name + Language.StringByID(StringId.CollectionCancelled);
                LoadDeviceFunctionControlZone();
                function.SaveFunctionData();
                function.SaveFunctionData(true);
                new PublicAssmebly().TipMsgAutoClose(msg, true);
            };
        }
@@ -81,7 +81,7 @@
                scene.collect = false;
                string msg = scene.name + Language.StringByID(StringId.CollectionCancelled);
                LoadSceneFunctionControlZone();
                scene.SaveSceneData();
                scene.CollectScene();
                new PublicAssmebly().TipMsgAutoClose(msg, true);
            };
        }
@@ -217,9 +217,26 @@
                new System.Threading.Thread(() =>
                {
                    function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
                    System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
                    d.Add("on_off", function.trait_on_off.curValue.ToString());
                    Control.Ins.SendWriteCommand(function, d);
                    Dictionary<string, string> d = new Dictionary<string, string>();
                    if (function.spk == SPK.LightDimming || function.spk == SPK.LightRGB)
                    {
                        var light = function as Light;
                        d.Add(FunctionAttributeKey.OnOff, light.trait_on_off.curValue.ToString());
                        if (btnSwitch.IsSelected)
                        {
                            d.Add(FunctionAttributeKey.Brightness, light.lastBrightness.ToString());
                        }
                        else
                        {
                            light.lastBrightness = light.brightness;
                        }
                        Control.Ins.SendWriteCommand(light, d);
                    }
                    else
                    {
                        d.Add("on_off", function.trait_on_off.curValue.ToString());
                        Control.Ins.SendWriteCommand(function, d);
                    }
                })
                { IsBackground = true }.Start();
            };
@@ -282,6 +299,7 @@
                //房间删除事件
                Action backAction = () => {
                    RegisterGetPushMessageAction();
                    GetUnreadPushMessages();
                };
@@ -347,11 +365,8 @@
                                {
                                    ShowMesBtnState(pushMessageInfoList[0], true);
                                });
                            }
                        }
                    }
                    else
                    {
@@ -365,9 +380,7 @@
                {
                    isGetting = false;
                }
            });
        }
        /// <summary>
@@ -403,7 +416,7 @@
        {
            try
            {
                return Utlis.UnixToDateTimeWithFormatMS(time, "HH:mm");
                return Utlis.ToFriendlyDisplay(time);
            }
            catch (Exception ex)
            {
@@ -411,6 +424,29 @@
            }
        }
        /// <summary>
        /// 注册收到推送监听
        /// </summary>
        void RegisterGetPushMessageAction()
        {
            Action RegisterGetPushMessageAction = () => {
                if (bodyView != null)
                {
                    //Utlis.WriteLine("GetPushMessageAction H收到推送");
                    GetUnreadPushMessages();
                }
            };
            HDLCommon.GetPushMessageAction = RegisterGetPushMessageAction;
        }
        /// <summary>
        /// 取消收到推送监听
        /// </summary>
        void UnregisterGetPushMessageAction()
        {
            HDLCommon.GetPushMessageAction = null;
        }
        #endregion
    }