Ejemplo n.º 1
0
        public MDPageViewModel(INavigationService navigationService,
                               IPageDialogService dialogService)
        {
            _navigationService = navigationService;
            _dialogService     = dialogService;

            MenuCommand = new DelegateCommand <string>(async(x) =>
            {
                switch (x)
                {
                    #region 工作日誌
                case "工作日誌":
                    await _navigationService.NavigateAsync("xf:///MDPage/NaviPage/WorkingLogPage");
                    break;
                    #endregion

                    #region 請假單
                case "請假單":
                    await _navigationService.NavigateAsync("xf:///MDPage/NaviPage/LeaveAppFormPage");
                    break;
                    #endregion

                    #region 請假單審核
                case "請假單審核":
                    await _navigationService.NavigateAsync("xf:///MDPage/NaviPage/LeaveAppFormManagerPage");
                    break;
                    #endregion

                    #region 緊急電話清單
                case "緊急電話清單":
                    await _navigationService.NavigateAsync("xf:///MDPage/NaviPage/OnCallPage");
                    break;
                    #endregion

                    #region 關  於
                case "關  於":
                    await _navigationService.NavigateAsync("xf:///MDPage/NaviPage/AboutPage");
                    break;
                    #endregion

                    #region 登  出
                case "登  出":
                    var fooResult = await _dialogService.DisplayAlertAsync("提醒",
                                                                           "您確定要進行登出作業嗎?", "是", "取消");
                    if (fooResult == true)
                    {
                        #region 要進行登出,所以,清空本機快取資料
                        var fooProgressDialogConfig = new ProgressDialogConfig()
                        {
                            MaskType = MaskType.Black,
                            Title    = "請稍後,正在進行登出中..."
                        };
                        using (Acr.UserDialogs.UserDialogs.Instance.Progress(fooProgressDialogConfig))
                        {
                            await MainHelper.CleanRepositories();
                        }
                        await _navigationService.NavigateAsync("xf:///LoginPage");
                        #endregion
                    }
                    break;

                    #endregion
                default:
                    break;
                }
            });
        }