/// <summary>
        /// 画面遷移時の処理
        /// </summary>
        /// <param name="parameters">遷移中のパラメータ</param>
        public override async void OnNavigatingTo(INavigationParameters parameters)
        {
            base.OnNavigatingTo(parameters);

            //ローディングの表示
            LoadingMeetingData = true;

            var tokenCheckValidation = new TokenCheckValidation(_restService);

            TokenCheckParam = await tokenCheckValidation.Validate(_applicationProperties.GetFromProperties <TokenData>("token"));

            //token照合の際にエラーが発生した際の処理
            if (TokenCheckParam.HasError == true)
            {
                var p = new NavigationParameters
                {
                    { "ErrorPageType", ErrorPageType.ExpiredToken }
                };
                //終了している会議なのでエラー画面に飛ばす
                await _navigationService.NavigateAsync("/NavigationPage/ErrorTemplatePage", p);
            }

            //アプリ使用者のユーザーIDの取得
            MyUserId = _applicationProperties.GetFromProperties <string>("userId");

            //会議情報全件取得APIのコール
            GetMeetingsParam = await _restService.GetMeetingsDataAsync(MeetingConstants.OpenMeetingEndPoint, MyUserId);

            Meetings = GetMeetingsParam.Meetings;

            //ローディング非表示
            LoadingMeetingData = false;
        }
Beispiel #2
0
        public MeetingLabelItemDataCreatePageViewModel(INavigationService navigationService) : base(navigationService)
        {
            _restService     = new RestService();
            _operateDateTime = new OperateDateTime();

            _createMeetingLabelItemValidation = new CreateMeetingLabelItemValidation();
            _tokenCheckValidation             = new TokenCheckValidation(_restService);
            _applicationProperties            = new ApplicationProperties();
            _meetingLabelItemDatas            = new ObservableCollection <MeetingLabelItemData>();
            _createMeetingLabelItemParam      = new CreateMeetingLabelItemParam();

            _additionalMeetingLabelItemDatas = new List <MeetingLabelItemData>();

            //会議の各ラベルに項目(Item)を追加するコマンド
            CreateMeetingLabelItemCommand = new DelegateCommand(async() =>
            {
                //項目入力値のバリデーション
                CreateMeetingLabelItemParam = _createMeetingLabelItemValidation.InputValidate(InputLabelItemName);
                if (CreateMeetingLabelItemParam.HasError == true)
                {
                    return;
                }



                //uid取得の際のtoken情報照合
                TokenCheckParam = await _tokenCheckValidation.Validate(_applicationProperties.GetFromProperties <TokenData>("token"));

                var inputUid = 0;

                if (TokenCheckParam.HasError == true)
                {
                    return;
                }
                else
                {
                    //token情報照合に成功したらuid取得
                    GetUserParam = await _restService.GetUserDataAsync(UserConstants.OpenUserEndPoint, _applicationProperties.GetFromProperties <string>("userId"));

                    if (GetUserParam.HasError == true)
                    {
                        return;
                    }
                    else
                    {
                        //userDataの取得に成功したらuidを代入
                        var userData = GetUserParam.User;
                        inputUid     = userData.Id;
                    }
                }
                var meetingLabelItemData = new MeetingLabelItemData(TargetMeetingLabel.Id, inputUid, InputLabelItemName);
                MeetingLabelItemDatas.Add(meetingLabelItemData);
                AdditionalMeetingLabelItemDatas.Add(meetingLabelItemData);

                InputLabelItemName = "";
            });
        }
Beispiel #3
0
        public async Task TokenCheck_Validate_Success()
        {
            var testTokenText      = "test";
            var testTokenStartTime = DateTime.Now;
            var testTokenEndTime   = DateTime.Now.AddHours(1);
            var testToken          = new TokenData(testTokenText, testTokenStartTime, testTokenEndTime);

            var responseTokenCheckParam = new TokenCheckParam();

            responseTokenCheckParam.IsSuccessed = true;

            _mockRestService.Setup(r => r.CheckTokenDataAsync(It.IsAny <string>(), It.IsAny <TokenData>())).ReturnsAsync(responseTokenCheckParam);

            var actual = await _target.Validate(testToken);

            Assert.IsNotNull(actual);
            Assert.AreEqual(responseTokenCheckParam.IsSuccessed, actual.IsSuccessed);
            Assert.AreEqual(responseTokenCheckParam.HasError, actual.HasError);
            _mockRestService.VerifyAll();
        }