示例#1
0
        private async void AnswerThankMethod()
        {
            if (null == _answerService || Detail == null || Relationship == null)
            {
                return;
            }

            #region Checking Network

            if (false == Utility.Instance.IsNetworkAvailable)
            {
                ToasteIndicator.Instance.Show(String.Empty, "网络连接已中断", null, 3);

                return;
            }

            #endregion

            var answerId = Detail.Id;

            var result = Relationship.IsThanked == false
                ? await _answerService.ThankAsync(LoginUser.Current.Token, answerId)
                : await _answerService.CancelThankAsync(LoginUser.Current.Token, answerId, LoginUser.Current.Profile.Id);

            if (result == null)
            {
                return;
            }

            if (null != result.Error)
            {
                ToasteIndicator.Instance.Show(String.Empty, result.Error.Message, null, 3);

                Debug.WriteLine(Regex.Unescape(result.Error.Message));
                return;
            }

            Relationship.IsThanked = result.Result.IsThanked;
        }