Ejemplo n.º 1
0
        protected async Task <bool> UserLogOut()
        {
            ILoginService _ILoginService = new LoginService();

            if (AppUtils.IsNetwork())
            {
                _objProgress = new CustomProgress(Activity);
                var Authkey = StorageUtils <String> .GetPreferencesValue(DroidConstant.CurrentUser);

                var response = await _ILoginService.LogoutUser(ServiceType.UserService, Authkey);

                _objProgress.DismissDialog();
                if (response != null)
                {
                    if (response.IsSuccess)
                    {
                        StorageUtils <String> .SavePreferences(DroidConstant.CurrentUser, "");

                        LoginManager.Instance.LogOut();
                        new GoogleApiClient.Builder(Activity)
                        .AddApi(PlusClass.API)
                        .AddScope(new Scope(Scopes.Profile))
                        .Build().Disconnect();
                        Activity.StartActivity(typeof(LoginActivity));
                        Activity.Finish();

                        return(true);
                    }
                    else
                    {
                        AppUtils.ShowToast(Activity, response.Message);

                        return(true);
                    }
                }
                else
                {
                    AppUtils.ShowToast(Activity, response.Message);
                    return(true);
                }
            }
            else
            {
                AppUtils.ShowToast(Activity, Resources.GetString(Resource.String.network_error));
                _objProgress.DismissDialog();
                return(true);
            }
        }
/// <summary>
/// Fetch Event
/// </summary>
/// <returns>List</returns>
        async Task <List <EventList> > GetEventList()
        {
            if (AppUtils.IsNetwork())
            {
                var request = new EventRequest
                {
                    PageNo = 1
                };
                _objProgress = new CustomProgress(Activity);
                var Authkey = StorageUtils <String> .GetPreferencesValue(DroidConstant.CurrentUser);

                var response = await _IEventListService.GetEnrolledEventsList(request, ServiceType.EventService, Authkey);

                _objProgress.DismissDialog();
                if (response != null)
                {
                    if (response.IsSuccess && response.Result != null)
                    {
                        result = response.Result;
                        if (result.Count == 0 && request.PageNo == 1)
                        {
                            //AppUtils.ShowToast(Activity, response.Message);
                        }
                        else
                        {
                            eventAdapter.UpdateList(result);
                        }
                    }
                    else
                    {
                        //AppUtils.ShowToast(Activity, response.Message);
                    }
                }
                else
                {
                    //AppUtils.ShowToast(Activity, Resources.GetString(Resource.String.network_error));
                }
            }
            else
            {
                AppUtils.ShowToast(Activity, Resources.GetString(Resource.String.network_error));
                _objProgress.DismissDialog();
            }
            return(result);
        }