Esempio n. 1
0
 private void PostToSocial(string message)
 {
     if (SettingsManager.FacebookActive)
     {
         var fb = new FacebookManager(SettingsManager.FacebookToken);
         fb.OnComplete = (args =>
         {
             if (args.Error == null)
             {
                 Dispatcher.BeginInvoke(() => MessageBox.Show("Ya esta en tu muro!"));
             }
             else
             {
                 Dispatcher.BeginInvoke(() => MessageBox.Show(args.Error.Message));
                 SettingsManager.FacebookActive = false;
             }
         });
         fb.Share(_movie, message);
     }
 }
Esempio n. 2
0
        private void LoadState()
        {
            try
            {
                AppState.Current = PersistableFile<AppState>.Load(Constants.AppStateFileName).Data;
                if (AppState.Current.Date < DateTime.Today)
                {
                    AppState.Current = null;
                    SettingsManager.CurrentDate = DateTime.Today;
                }

                var fb = new FacebookManager(SettingsManager.FacebookToken);
                var wb = new WebBrowser();
                FacebookOAuthResult result = null;
                wb.Navigated += (sender, e) =>
                {
                    result = FacebookManager.GetToken(e.Uri);
                    if (result == null)
                        SettingsManager.FacebookToken = null;
                    else
                        SettingsManager.FacebookToken = result.AccessToken;
                };
                wb.Navigate(FacebookManager.GetFacebookLoginUrl());
            }
            catch (Exception)
            {
                AppState.Current = null;
            }
        }