예제 #1
0
        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;
            });
        }
예제 #2
0
        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;
            });
        }