Beispiel #1
0
        public LoginViewModel()
        {
            Profile = new FacebookProfile();

            OnLoginCommand     = new Command(async() => await LoginAsync());
            OnShareDataCommand = new Command(async() => await ShareDataAsync());
            OnLoadDataCommand  = new Command(async() => await LoadData());
            OnLogoutCommand    = new Command(() =>
            {
                if (CrossFacebookClient.Current.IsLoggedIn)
                {
                    CrossFacebookClient.Current.Logout();
                    IsLoggedIn = false;
                }
            });

            //OnFacebookLoginSuccessCmd = new Command<string>(
            //    (authToken) => DisplayAlert("Success", $"Authentication succeed: {authToken}"));
            OnFacebookLoginSuccessCmd = new Command <string>(
                (authToken) => {
                //DisplayAlert("Success", $"Authentication succeed: {authToken}");
                OnLoginSuccessful?.Invoke(this, new EventArgs());
            });

            OnFacebookLoginErrorCmd = new Command <string>(
                (err) => DisplayAlert("Error", $"Authentication failed: {err}"));

            OnFacebookLoginCancelCmd = new Command(
                () => DisplayAlert("Cancel", "Authentication cancelled by the user."));

            //Posts = new ObservableCollection<FacebookPost>();
            //LoadDataCommand.Execute(null);
        }
Beispiel #2
0
        public FacebookViewModel()
        {
            OnFacebookLoginSuccessCmd = new Command <string>(
                (authToken) => {
                //DisplayAlert("Success", $"Authentication succeed: {authToken}");
                OnLoginSuccessful?.Invoke(this, new EventArgs());
            });

            ScheduleVisibleDatesChanged = new Command <VisibleDatesChangedEventArgs>(VisibleDatesChanged);

            OnFacebookLoginErrorCmd = new Command <string>(
                (err) => DisplayAlert("Error", $"Authentication failed: {err}"));

            OnFacebookLoginCancelCmd = new Command(
                () => DisplayAlert("Cancel", "Authentication cancelled by the user."));
        }