HDL Home App 第二版本 旧平台金堂用 正在使用
黄学彪
2019-12-30 3dcbd186c42c598c0c08d1cd37034cf2baa09e54
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/Base/CommonFormBase.cs
@@ -72,27 +72,51 @@
        #region ■ 关闭界面___________________________
        /// <summary>
        /// 画面关闭之前(底层变更,不能重载CloseForm方法了)
        /// </summary>
        public virtual void CloseFormBefore()
        {
        }
        /// <summary>
        /// 画面关闭之后(新增)
        /// </summary>
        public virtual void CloseFormAfter()
        {
        }
        /// <summary>
        /// 画面关闭
        /// </summary>
        public virtual void CloseForm()
        public void CloseForm()
        {
            //Log出力
            HdlLogLogic.Current.WriteLog(1, this.FormID + " 界面关闭");
            try
            {
                //关闭进度条
                this.CloseProgressBar();
            //移除接受在线状态推送
            this.RemoveGatewayOnlinePush();
            //移除设备属性变更推送
            this.RemoveDeviceAttributePush();
                //画面关闭之前
                this.CloseFormBefore();
            //关闭进度条
            this.CloseProgressBar();
                //调用的是Base的移除控件函数
                //而不是调用this的移除控件函
                base.RemoveFromParent();
            //调用的是Base的移除控件函数
            //而不是调用this的移除控件函
            base.RemoveFromParent();
                //从列表中移除(防止画面二重添加)
                UserCenterLogic.RemoveActionForm(this);
            //从列表中移除(防止画面二重添加)
            UserCenterLogic.RemoveActionForm(this);
                //画面关闭之后
                this.CloseFormAfter();
            }
            catch (Exception ex)
            {
                //出现未知错误
                this.ShowMassage(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uUnKnownError));
                //Log出力
                HdlLogLogic.Current.WriteLog(ex);
            }
        }
        /// <summary>
@@ -107,30 +131,6 @@
        #endregion
        #region ■ 网关在线状态推送___________________
        /// <summary>
        /// 设置网关接受在线状态推送
        /// </summary>
        public void AddGatewayOnlinePush()
        {
            for (int i = 0; i < UserCenterResourse.listGatewayOnlinePushForm.Count; i++)
            {
                if (this.FormID == UserCenterResourse.listGatewayOnlinePushForm[i].FormID)
                {
                    //已经存在,则不再添加
                    return;
                }
            }
            UserCenterResourse.listGatewayOnlinePushForm.Add(this);
        }
        /// <summary>
        /// 移除网关接受在线状态推送
        /// </summary>
        private void RemoveGatewayOnlinePush()
        {
            UserCenterResourse.listGatewayOnlinePushForm.RemoveAll((obj) => { return obj.FormID == this.FormID; });
        }
        /// <summary>
        /// 网关在线状态变更推送(只有在变更的时候才会推送)
@@ -141,42 +141,6 @@
        {
        }
        #endregion
        #region ■ 设备属性变更推送___________________
        /// <summary>
        /// 设置接受设备属性变更推送
        /// </summary>
        public void AddDeviceAttributePush()
        {
            for (int i = 0; i < UserCenterResourse.listDeviceAttributePushForm.Count; i++)
            {
                if (this.FormID == UserCenterResourse.listDeviceAttributePushForm[i].FormID)
                {
                    //已经存在,则不再添加
                    return;
                }
            }
            UserCenterResourse.listDeviceAttributePushForm.Add(this);
        }
        /// <summary>
        /// 移除设备属性变更推送
        /// </summary>
        private void RemoveDeviceAttributePush()
        {
            UserCenterResourse.listDeviceAttributePushForm.RemoveAll((obj) => { return obj.FormID == this.FormID; });
        }
        /// <summary>
        /// 设备属性变更推送(只有在变更的时候才会推送)
        /// </summary>
        /// <param name="device">设备对象</param>
        public virtual void DeviceAttributePush(ZigBee.Device.CommonDevice device)
        {
        }
        #endregion
        #region ■ 圆形进度条_________________________
@@ -368,7 +332,8 @@
                {
                    return null;
                }
                return form.GetType().InvokeMember(method, System.Reflection.BindingFlags.InvokeMethod, null, form, parameter);
                var myMethod = form.GetType().GetMethod(method);
                return myMethod.Invoke(form, parameter);
            }
            catch (Exception ex)
            {
@@ -395,5 +360,6 @@
        }
        #endregion
    }
}