private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            IContainerProvider   myContainer          = (App.Current as PrismApplication).Container;
            AppExceptionsService appExceptionsService = myContainer
                                                        .Resolve <AppExceptionsService>();
            AppStatus appStatus = myContainer
                                  .Resolve <AppStatus>();

            Task.Run(async() =>
            {
                await appExceptionsService.ReadFromFileAsync();
                ExceptionRecordDto fooObject = new ExceptionRecordDto()
                {
                    CallStack     = (e.ExceptionObject as Exception).StackTrace,
                    ExceptionTime = DateTime.Now,
                    Message       = (e.ExceptionObject as Exception).Message,
                    DeviceModel   = DeviceInfo.Model,
                    DeviceName    = DeviceInfo.Name,
                    OSType        = DeviceInfo.Platform.ToString(),
                    OSVersion     = DeviceInfo.Version.ToString(),
                };
                if (appStatus.SystemStatus.UserID <= 0)
                {
                    fooObject.MyUserId = null;
                }
                else
                {
                    fooObject.MyUserId = appStatus.SystemStatus.UserID;
                }
                appExceptionsService.Items.Add(fooObject);
                await appExceptionsService.WriteToFileAsync();
            }).Wait();
        }
        public async void OnNavigatedTo(INavigationParameters parameters)
        {
            #region 確認網路已經連線
            //if (await UtilityHelper.CanConnectRemoteHostService() == false)
            //{
            //    await dialogService.DisplayAlertAsync("警告", "無網路連線可用 或者 無法連線到遠端主機,請檢查網路狀態與主機服務是否可以使用", "確定");
            //    return;
            //}
            #endregion

            #region 讀取相關定義資料
            using (IProgressDialog fooIProgressDialog =
                       UserDialogs.Instance.Loading($"請稍後,更新資料中...",
                                                    null, null, true, MaskType.Clear))
            {
                await AppStatusHelper.ReadAndUpdateAppStatus(systemStatusService, appStatus);

                #region 取得 連絡電話本
                fooIProgressDialog.Title = "請稍後,取得 連絡電話本";
                await onCallPhoneService.ReadFromFileAsync();

                var fooResult = await onCallPhoneService.GetAsync();

                if (fooResult.Status == true)
                {
                    await onCallPhoneService.WriteToFileAsync();
                }
                #endregion

                #region 取得 請假假別
                fooIProgressDialog.Title = "請稍後,取得 請假假別";
                await leaveCategoryService.ReadFromFileAsync();

                fooResult = await leaveCategoryService.GetAsync();

                if (fooResult.Status == true)
                {
                    await leaveCategoryService.WriteToFileAsync();
                }
                #endregion

                #region 取得 專案清單
                fooIProgressDialog.Title = "請稍後,取得 專案清單";
                await projectService.ReadFromFileAsync();

                fooResult = await projectService.GetAsync();

                if (fooResult.Status == true)
                {
                    await projectService.WriteToFileAsync();
                }
                #endregion

                #region  傳例外異常
                fooIProgressDialog.Title = "請稍後,上傳例外異常";
                await appExceptionsService.ReadFromFileAsync();

                if (appExceptionsService.Items.Count > 0)
                {
                    await appExceptionsService.ReadFromFileAsync();

                    fooResult = await exceptionRecordsService.PostAsync(appExceptionsService.Items);

                    if (fooResult.Status == true)
                    {
                        appExceptionsService.Items.Clear();
                        await appExceptionsService.WriteToFileAsync();
                    }
                }
                #endregion
            }
            #endregion

            if (appStatus.SystemStatus.IsLogin == false)
            {
                // 使用者尚未成功登入,切換到登入頁面
                await navigationService.NavigateAsync("/LoginPage");

                return;
            }

            #region 使用者已經成功登入了,接下來要更新相關資料
            using (IProgressDialog fooIProgressDialog =
                       UserDialogs.Instance.Loading($"請稍後,更新資料中...",
                                                    null, null, true, MaskType.Clear))
            {
                #region 取得 使用者清單
                fooIProgressDialog.Title = "請稍後,取得 使用者清單";
                await myUserService.ReadFromFileAsync();

                var fooResult = await myUserService.GetAsync();

                if (fooResult.Status == true)
                {
                    await myUserService.WriteToFileAsync();
                }
                #endregion
            }

            // 使用者尚已經功登入,切換到首頁頁面
            await navigationService.NavigateAsync("/MDPage/NaviPage/HomePage");

            #endregion
        }