Exemple #1
0
        private ApiResult <string> GetGuestTokenApi(Context context, AppPreferences app_cache)
        {
            var _result = (ApiResult <string>)null;

            try
            {
                var api  = new ApiAsnycTask(context, context.GetString(Resource.String.api_url) + "user/getguesttoken");
                var json = api.Execute().Get().ToString();

                _result = JsonConvert.DeserializeObject <ApiResult <string> >(json);
                if (_result.success == true)
                {
                    app_cache.GuestTokenKey = _result.result;
                }
                else
                {
                    AppDialog.SNG.Alert(context, _result.message);
                }
            }
            catch (Java.Lang.Exception ex)
            {
                Log.Error(this.GetType().Name, ex.Message);
            }

            return(_result);
        }
Exemple #2
0
        public string GetGuestToken(Context context)
        {
            var _app_cache = new AppPreferences(context);

            var _result = _app_cache.GuestTokenKey;

            if (this.CheckExpired(context, _result) == true)
            {
                var _new_token = this.GetGuestTokenApi(context, _app_cache);
                if (_new_token != null)
                {
                    _result = _new_token.result;
                }
            }

            return(_result);
        }