private async Task ProfileSelected(Profile p)
        {
            ProfilesViewModel profilesViewModel = this;

            if (profilesViewModel._settings.RefreshProfileInProgress)
            {
                return;
            }
            await Task.Run((Action)(() =>
            {
                try
                {
                    this.IsLoading = this._settings.RefreshProfileInProgress = true;
                    this._messenger.Publish <ProfileSyncMessage>((M0) new ProfileSyncMessage((object)this, this.IsLoading));
                    this._profileDataService.SetActiveProfile(p);
                    this._messenger.Publish <ActiveProfileChangedMessage>((M0) new ActiveProfileChangedMessage((object)this, p));
                    this.GetProfiles();
                    this.RefreshProfile(p);
                }
                catch (Exception ex)
                {
                    ErrorHandler.Current.HandleError(ex);
                }
                finally
                {
                    this.IsLoading = this._settings.RefreshProfileInProgress = false;
                    this._messenger.Publish <ProfileSyncMessage>((M0) new ProfileSyncMessage((object)this, this.IsLoading));
                }
            }));

            profilesViewModel.ShouldPopViewModel = true;
        }
        private async Task ExecuteNewProfileCommand()
        {
            ProfilesViewModel profilesViewModel = this;

            if (profilesViewModel._settings.RefreshProfileInProgress)
            {
                return;
            }
            int num = await profilesViewModel._navigationService.Navigate <NewProfileViewModel>((IMvxBundle)null, new CancellationToken()) ? 1 : 0;
        }
        private async void GetProfiles()
        {
            ProfilesViewModel profilesViewModel = this;

            try
            {
                profilesViewModel.Busy();
                List <Profile> profiles = (List <Profile>)null;
                TaskAwaiter    awaiter  = Task.Run((Action)(() =>
                {
                    profiles = this._profileDataService.GetProfiles().ToList <Profile>();
                    List <Student> list = this._studentDataService.GetStudents().ToList <Student>();
                    foreach (Profile profile1 in profiles)
                    {
                        Profile profile = profile1;
                        profile.Student = list.FirstOrDefault <Student>((Func <Student, bool>)(x => x.ProfileId == profile.RolelessId)) ?? new Student();
                        profile.NewItemsCount = this._refreshDataService.GetProfileNewsItemCount(profile);
                    }
                })).GetAwaiter();
                if (!awaiter.IsCompleted)
                {
                    int num;
                    // ISSUE: explicit reference operation
                    // ISSUE: reference to a compiler-generated field
                    (^ this).\u003C\u003E1__state = num = 0;
                    TaskAwaiter taskAwaiter = awaiter;
                    // ISSUE: explicit reference operation
                    // ISSUE: reference to a compiler-generated field
                    (^ this).\u003C\u003Et__builder.AwaitUnsafeOnCompleted <TaskAwaiter, ProfilesViewModel.\u003CGetProfiles\u003Ed__36>(ref awaiter, this);
                    return;
                }
                awaiter.GetResult();
                profilesViewModel.Profiles = new ObservableCollection <Profile>((IEnumerable <Profile>)profiles.OrderBy <Profile, string>((Func <Profile, string>)(x => x.Student?.Name)));
                profilesViewModel.NotBusy();
            }
            catch (Exception ex)
            {
                // ISSUE: explicit reference operation
                // ISSUE: reference to a compiler-generated field
                (^ this).\u003C\u003E1__state = -2;
                // ISSUE: explicit reference operation
                // ISSUE: reference to a compiler-generated field
                (^ this).\u003C\u003Et__builder.SetException(ex);
                return;
            }
            // ISSUE: explicit reference operation
            // ISSUE: reference to a compiler-generated field
            (^ this).\u003C\u003E1__state = -2;
            // ISSUE: explicit reference operation
            // ISSUE: reference to a compiler-generated field
            (^ this).\u003C\u003Et__builder.SetResult();
        }
        private async Task DeleteProfile(Profile profile)
        {
            ProfilesViewModel profilesViewModel = this;

            if (profile == null)
            {
                return;
            }
            string        text1          = profilesViewModel._textProvider.GetText((string)null, (string)null, "Common_Delete_Profile_Message");
            string        str            = profilesViewModel._textProvider.GetText((string)null, (string)null, "Common_Delete_Profile_Title") + " - " + profile.Student?.Name;
            string        text2          = profilesViewModel._textProvider.GetText((string)null, (string)null, "Common_Delete_Confirm");
            string        text3          = profilesViewModel._textProvider.GetText((string)null, (string)null, "Common_Delete_Cancel");
            ConfirmConfig confirmConfig1 = new ConfirmConfig();

            confirmConfig1.set_Message(text1);
            confirmConfig1.set_Title(str);
            confirmConfig1.set_OkText(text2);
            confirmConfig1.set_CancelText(text3);
            ConfirmConfig confirmConfig2 = confirmConfig1;

            if (profilesViewModel._platformStyleProvider.DeleteConfirmationStyle != -1)
            {
                confirmConfig2.set_AndroidStyleId(new int?(profilesViewModel._platformStyleProvider.DeleteConfirmationStyle));
            }
            if (!await profilesViewModel._userDialogs.ConfirmAsync(confirmConfig2, new CancellationToken?()))
            {
                return;
            }
            try
            {
                profilesViewModel.IsLoading = profilesViewModel._settings.RefreshProfileInProgress = true;
                profilesViewModel._messenger.Publish <ProfileSyncMessage>((M0) new ProfileSyncMessage((object)profilesViewModel, profilesViewModel.IsLoading));
                try
                {
                    if (profile.PushSettings.IsPushActive)
                    {
                        int num = await profilesViewModel._profileDataService.NotificationDeleteAsync(profile, false).ConfigureAwait(false) ? 1 : 0;
                    }
                }
                catch (Exception ex)
                {
                    CrossMobileAnalytics.Current.TrackException(ex, (IDictionary <string, string>)null, "ProfileDeleteCommand || NotificationDeleteAsync", "/Users/admin/myagent/macMiniBlack3/_work/2/s/eKreta.Mobile/eKreta.Mobile.Core.Standard/ViewModels/ProfilesViewModel.cs", 149);
                }
                profilesViewModel._authDataService.DeleteProfile(profile);
                if (!profilesViewModel.SetFirstProfileActive())
                {
                    int num1 = await profilesViewModel._navigationService.Navigate <LoginViewModel>((IMvxBundle)null, new CancellationToken()) ? 1 : 0;
                }
                profilesViewModel._messenger.Publish <ActiveProfileChangedMessage>((M0) new ActiveProfileChangedMessage((object)profilesViewModel, profile));
                profilesViewModel.SelectedItem = (Profile)null;
            }
            catch (Exception ex)
            {
                CrossMobileAnalytics.Current.TrackException(ex, (IDictionary <string, string>)null, "ProfileDeleteCommand || " + ex.Source, "/Users/admin/myagent/macMiniBlack3/_work/2/s/eKreta.Mobile/eKreta.Mobile.Core.Standard/ViewModels/ProfilesViewModel.cs", 163);
                ErrorHandler.Current.HandleError(ex);
            }
            finally
            {
                profilesViewModel.IsLoading = profilesViewModel._settings.RefreshProfileInProgress = false;
                profilesViewModel._messenger.Publish <ProfileSyncMessage>((M0) new ProfileSyncMessage((object)profilesViewModel, profilesViewModel.IsLoading));
            }
            profilesViewModel.GetProfiles();
        }