2020-12-16 1.主页和信息中心增加收到通知事件处理。2.主页时间格式显示优化处理
7个文件已修改
127 ■■■■ 已修改文件
.vs/HDL_APP_Project/xs/UserPrefs.xml 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Common/HDLCommon.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Common/Utlis.cs 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/HDL_ON.projitems 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/1-HomePage/HomePage.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/1-HomePage/MessageCenterPage.cs 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.vs/HDL_APP_Project/xs/UserPrefs.xml
@@ -1,8 +1,10 @@
<Properties StartupConfiguration="{D998E133-F0DD-4760-BE3C-461632F54DA4}|Default">
  <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.00008030-00014C392121802E" />
  <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/MainPage.cs">
  <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/1-HomePage/MessageCenterPage.cs">
    <Files>
      <File FileName="HDL_ON/UI/MainPage.cs" Line="57" Column="1" />
      <File FileName="HDL_ON/UI/UI2/1-HomePage/HomePage.cs" Line="1" Column="1" />
      <File FileName="HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs" Line="1" Column="1" />
      <File FileName="HDL_ON/UI/UI2/1-HomePage/MessageCenterPage.cs" Line="1" Column="1" />
    </Files>
    <Pads>
      <Pad Id="ProjectPad">
@@ -10,23 +12,20 @@
          <Node name="HDL_APP_Project" expanded="True">
            <Node name="HDL_ON" expanded="True">
              <Node name="Common" expanded="True" />
              <Node name="Entity" expanded="True" />
              <Node name="DAL" expanded="True">
                <Node name="Server" expanded="True" />
              </Node>
              <Node name="UI" expanded="True">
                <Node name="UI0-Public" expanded="True">
                  <Node name="Widget" expanded="True" />
                </Node>
                <Node name="UI1-Login" expanded="True" />
                <Node name="UI2" expanded="True">
                  <Node name="1-HomePage" expanded="True" />
                  <Node name="4-PersonalCenter" expanded="True">
                    <Node name="AboutOn" expanded="True" />
                  <Node name="1-HomePage" expanded="True">
                    <Node name="MessageCenterPage.cs" selected="True" />
                  </Node>
                </Node>
                <Node name="MainPage.cs" selected="True" />
              </Node>
            </Node>
            <Node name="HDL-ON_Android" expanded="True" />
            <Node name="HDL-ON_iOS" expanded="True" />
            <Node name="HDL-ON_iOS" expanded="True">
              <Node name="ViewController.cs" expanded="True" />
            </Node>
          </Node>
        </State>
      </Pad>
HDL_ON/Common/HDLCommon.cs
@@ -270,7 +270,7 @@
                    Shared.Application.RunOnMainThread(() =>
                    {
                        new Alert(jpushMessageInfo.Title, jpushMessageInfo.Content, Language.StringByID(StringId.Close)).Show();
                        //GetPushMessageAction?.Invoke();
                        GetPushMessageAction?.Invoke();
                    });
                    return;
                }
HDL_ON/Common/Utlis.cs
@@ -8,7 +8,7 @@
    /// <summary>
    /// 常用工具类
    /// </summary>
    public class Utlis
    public static class Utlis
    {
        /// <summary>
        /// 全局打印
@@ -328,7 +328,55 @@
            return Language.CurrentLanguage == "Chinese" ? LanguageTypeEnum.CHINESE.ToString() : LanguageTypeEnum.ENGLISH.ToString();
        }
        #region 时间格式转换
        private const int Second = 1;
        private const int Minute = 60 * Second;
        private const int Hour = 60 * Minute;
        private const int Day = 24 * Hour;
        private const int Month = 30 * Day;
        /// <summary>
        /// 时间转换
        /// 少于1天  显示 时分
        /// 少于一年 显示 月日
        /// 大于一年 显示 年
        /// </summary>
        /// <param name="dateTime"></param>
        /// <returns></returns>
        public static string ToFriendlyDisplay(this DateTime dateTime)
        {
            var ts = DateTime.Now - dateTime;
            var delta = ts.TotalSeconds;
            if (delta < 24 * Hour)
            {
                //显示 时:分
                return dateTime.ToString("HH:mm");
            }
            else if (delta < 12 * Month)
            {
                //显示 月:日
                return dateTime.ToString("MM/dd");
            }
            else
            {   //显示 年
                return dateTime.ToString("yyyy");
            }
        }
        /// <summary>
        /// 时间转换
        /// 少于1天  显示 时分
        /// 少于一年 显示 月日
        /// 大于一年 显示 年
        /// </summary>
        /// <param name="dateTime"></param>
        /// <returns></returns>
        public static string ToFriendlyDisplay(long unixTimeStamp)
        {
            return ToFriendlyDisplay(UnixToDateTimeMS(unixTimeStamp));
        }
        #endregion
    }
HDL_ON/HDL_ON.projitems
@@ -291,5 +291,6 @@
    <Folder Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\RoomListManage\Transfer\" />
    <Folder Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\RoomListManage\AddRoom\" />
    <Folder Include="$(MSBuildThisFileDirectory)UI\BindingResidence\" />
    <Folder Include="$(MSBuildThisFileDirectory)Common\Utlis\" />
  </ItemGroup>
</Project>
HDL_ON/UI/UI2/1-HomePage/HomePage.cs
@@ -376,6 +376,7 @@
                // 查询未读消息并显示
                GetUnreadPushMessages();
                RegisterGetPushMessageAction();
            }
            catch (Exception ex)
            {
HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
@@ -404,7 +404,7 @@
        {
            try
            {
                return Utlis.UnixToDateTimeWithFormatMS(time, "HH:mm");
                return Utlis.ToFriendlyDisplay(time);
            }
            catch (Exception ex)
            {
@@ -417,13 +417,15 @@
        /// </summary>
        void RegisterGetPushMessageAction()
        {
            //HDLCommon.GetPushMessageAction = () => {
            //    if (bodyView != null)
            //    {
            //        Utlis.WriteLine("GetPushMessageAction H收到推送");
            //        GetUnreadPushMessages();
            //    }
            //};
            Action RegisterGetPushMessageAction = () => {
                if (bodyView != null)
                {
                    //Utlis.WriteLine("GetPushMessageAction H收到推送");
                    GetUnreadPushMessages();
                }
            };
            HDLCommon.GetPushMessageAction = RegisterGetPushMessageAction;
        }
        /// <summary>
@@ -431,7 +433,7 @@
        /// </summary>
        void UnregisterGetPushMessageAction()
        {
            //HDLCommon.GetPushMessageAction = null;
            HDLCommon.GetPushMessageAction = null;
        }
        #endregion
HDL_ON/UI/UI2/1-HomePage/MessageCenterPage.cs
@@ -44,11 +44,16 @@
        /// </summary>
        List<PushMessageInfo> PushMessageInfoList = new List<PushMessageInfo>();
        /// <summary>
        /// 页面关闭时间
        /// </summary>
        Action backAction;
        public override void RemoveFromParent()
        {
            UnregisterGetPushMessageAction();
            base.RemoveFromParent();
            backAction?.Invoke();
        }
        /// <summary>
@@ -66,7 +71,8 @@
        /// <param name="backAction"></param>
        public void LoadPage(Action backAction)
        {
            new TopViewDiv(bodyView, Language.StringByID(StringId.MessageCenter)).LoadTopView(backAction);
            this.backAction = backAction;
            new TopViewDiv(bodyView, Language.StringByID(StringId.MessageCenter)).LoadTopView();
            AddTopMenuView();
            AddMessageView();
@@ -631,14 +637,14 @@
        /// </summary>
        void RegisterGetPushMessageAction()
        {
            //HDLCommon.GetPushMessageAction = () =>
            //{
            //    if (bodyView != null)
            //    {
            //        Utlis.WriteLine("GetPushMessageAction M收到推送");
            //        GetPushMessageList(showMesType);
            //    }
            //};
            HDLCommon.GetPushMessageAction = () =>
            {
                if (bodyView != null)
                {
                    //Utlis.WriteLine("GetPushMessageAction M收到推送");
                    GetPushMessageList(showMesType);
                }
            };
        }
        /// <summary>
@@ -646,7 +652,7 @@
        /// </summary>
        void UnregisterGetPushMessageAction()
        {
            //HDLCommon.GetPushMessageAction = null;
            HDLCommon.GetPushMessageAction = null;
        }
#if DEBUG