public MyDashboardPage() { InitializeComponent(); UserDataStore = DependencyService.Get <IDataStore <FirebaseUser> >() ?? new UserDataStore(); AdverismentDataStore = DependencyService.Get <IDataStore <Advertisement> >() ?? new AdvertismentDataStorage(); FirebaseUser = (FirebaseUser)JsonConvert.DeserializeObject(Preferences.Get("FirebaseUser", ""), typeof(FirebaseUser)); InitViewModel(); Device.BeginInvokeOnMainThread(async() => { var numberOfAds = await GetCurrentUserAdNumber(); FirebaseUserViewModel = new FirebaseUserViewModel { FirebaseUser = this.FirebaseUser, NumberOfUserAds = numberOfAds }; BindingContext = FirebaseUserViewModel; }); }
public MyDashboardPage(FirebaseUser user) { InitializeComponent(); FirebaseUser = user; AdverismentDataStore = DependencyService.Get <IDataStore <Advertisement> >() ?? new AdvertismentDataStorage(); UserDataStore = DependencyService.Get <IDataStore <FirebaseUser> >() ?? new UserDataStore(); InitViewModel(); Device.BeginInvokeOnMainThread(async() => { var numberOfAds = await GetCurrentUserAdNumber(); FirebaseUserViewModel = new FirebaseUserViewModel { FirebaseUser = this.FirebaseUser, NumberOfUserAds = numberOfAds }; BindingContext = FirebaseUserViewModel; FabButton.IsVisible = false; BottomButton.Text = "Pogledaj sve oglase"; BottomButton.Clicked -= Logout_Clicked; BottomButton.Clicked += ViewAds_Clicked; }); }