protected override async void OnAppearing()
        {
            if (_applicationManager == null)
            {
                _applicationManager = new ApplicationManager(
                    DependencyService.Get<ITransportResource>(),
                    DependencyService.Get<IDtoSerializer>(),
                    DependencyService.Get<IStorage>(),
                    DependencyService.Get<IDeviceInfo>());
                _applicationManager.ConnectionManager.ConnectionDropped += () => Navigation.PushAsync(new SplashscreenPage());
            }

            AuthenticationResponseType result;
            try
            {
                result = await _applicationManager.AccountManager.ValidateAccount();
            }
            catch (System.Exception)
            {
                DisplayAlert(";(", "Server is not available", "Ok", null);
                return;
            }
            if (result == AuthenticationResponseType.Success)
            {
                await Navigation.PushAsync(new HomePage(new HomeViewModel(_applicationManager)));
            }
            else
            {
                await Navigation.PushAsync(new RegistrationPage(new RegistrationViewModel(_applicationManager)));
            }

            base.OnAppearing();
        }
 public HomeViewModel(ApplicationManager appManager)
 {
     _appManager = appManager;
     Users = new ObservableCollection<UserViewModel>();
     Events = new ObservableCollection<EventViewModel>();
     _eventViewModelFactory = new EventViewModelFactory();
     _photoPicker = DependencyService.Get<IPhotoPicker>();
     LoadData();
 }
        public RegistrationViewModel(ApplicationManager appManager)
        {
            _appManager = appManager;
            _countriesRepository = new CountriesRepository();

            SelectedCountry = Countries.First();
            SelectedSex = Sexes.First();
            SelectedAge = Ages.First();
        }