private void SignInButtonSessionChanged(object sender, LiveConnectSessionChangedEventArgs e) { if (e.Session != null) { _session = e.Session; var client = new LiveConnectClient(_session); EventHandler<LiveOperationCompletedEventArgs> handler = null; handler = (s, even) => { client.GetCompleted -= handler; var resultDict = (Dictionary<string, object>)even.Result; var items = (List<object>)resultDict["data"]; // Перебираем все объекты в папке, отбиаем только тип folder foreach (var item in items.Cast<Dictionary<string, object>>().Where(item => item["type"].ToString() == "folder")) { _files.Add(new FileModel() { Name = item["name"].ToString() }); } lbFileList.ItemsSource = _files; }; client.GetCompleted += handler; //Путь к корню вашего skydrive client.GetAsync("me/skydrive/files"); } }
public async Task Authenticate(LiveConnectSessionChangedEventArgs e) { if (e.Status == LiveConnectSessionStatus.Connected) { CurrentLoginStatus = "Connected to Microsoft Services"; liveConnectClient = new LiveConnectClient(e.Session); microsoftAccountLoggedInUser = await liveConnectClient.GetAsync("me"); CurrentLoginStatus = "Getting Microsoft Account Details"; mobileServiceLoggedInUser = await App.MobileService.LoginWithMicrosoftAccountAsync(e.Session.AuthenticationToken); CurrentLoginStatus = string.Format("Welcome {0}!", microsoftAccountLoggedInUser.Result["name"]); userName = microsoftAccountLoggedInUser.Result["name"].ToString(); await Task.Delay(2000); // non-blocking Thread.Sleep for 2000ms (2 seconds) CurrentlyLoggedIn = true; CurrentLoginStatus = string.Empty; // this will then flip the bit that shows the different UI for logged in await UpdateUserOnRemoteService(); // and update on the remote service await UpdateLeaderBoard(); // do first pass on leaderboard update } else { CurrentLoginStatus = "Y U NO LOGIN?"; CurrentlyLoggedIn = false; } }
void btnSignin_SessionChanged(object sender, Microsoft.Live.Controls.LiveConnectSessionChangedEventArgs e) { if (e.Status == LiveConnectSessionStatus.Connected) { this.session = e.Session; //this.statusLabel.Text = AppResources.StatusSignedIn; this.gotoImportButton.IsEnabled = true; this.gotoBackupButton.IsEnabled = true; this.gotoRestoreButton.IsEnabled = true; } else { this.gotoImportButton.IsEnabled = false; this.gotoBackupButton.IsEnabled = false; this.gotoRestoreButton.IsEnabled = false; //this.statusLabel.Text = AppResources.StatusNotSignedIn; session = null; //if (e.Error != null) //{ // MessageBox.Show(String.Format(AppResources.SkyDriveError, e.Error.Message), AppResources.ErrorCaption, MessageBoxButton.OK); // //statusLabel.Text = e.Error.ToString(); //} } }
private async void btnSignin_SessionChanged_2(object sender, LiveConnectSessionChangedEventArgs e) { currentLoginType = "Microsoft"; if (TextValidation()) { lblMsg.Text = ""; App.liveAuthClient = new LiveAuthClient(redirectURL); LiveLoginResult liveLoginResult = await App.liveAuthClient.LoginAsync(new string[] { "wl.signin", "wl.basic" }); if (liveLoginResult.Session != null && liveLoginResult.Status == LiveConnectSessionStatus.Connected) { client = new LiveConnectClient(liveLoginResult.Session); LiveOperationResult operationResult = await client.GetAsync("me"); dynamic pic = await client.GetAsync("me/picture"); try { MobileServiceUser user = await App.MobileService.LoginAsync(client.Session.AuthenticationToken); if (!String.IsNullOrEmpty(user.UserId)) { dynamic meResult = operationResult.Result; if (meResult.first_name != null && meResult.last_name != null) //initiliazed user LiveUserInfo properties SetUserDetails(user.UserId, meResult.name, meResult.first_name, meResult.last_name, pic.Result.location); else infoTextBlock.Text = "Welcome, Guest!"; } } catch (LiveConnectException exception) { this.infoTextBlock.Text = "Error calling API: " + exception.Message; } } } }
private void RaiseSessionChangedEvent(LiveConnectSessionChangedEventArgs args) { var handler = this.SessionChanged; if (handler != null) { handler(this, args); } }
private void SignIn_SessionChanged (object sender, LiveConnectSessionChangedEventArgs e) { _progressIndicator.IsVisible = false; if (e.Status == LiveConnectSessionStatus.Connected) { Utilities.SkyDriveSession = e.Session; NavigationService.Navigate (new Uri ("/Upload.xaml", UriKind.RelativeOrAbsolute)); } }
private void signInButton_SessionChanged(object sender, LiveConnectSessionChangedEventArgs e) { if (e.Status == LiveConnectSessionStatus.Connected) { viewModel.Client = new LiveConnectClient(e.Session); } else { this.infoTextBlock.Text = "not signed in"; } }
private void signInButton_SessionChanged(object sender, LiveConnectSessionChangedEventArgs e) { if (e.Status == LiveConnectSessionStatus.Connected) { MainPage.session = e.Session; this.NavigationService.Navigate(new Uri("/Index.xaml", UriKind.Relative)); } else { MainPage.session = null; } }
public void LoginCompleted(object sender, LiveConnectSessionChangedEventArgs e) { if (e.Session != null && e.Status == LiveConnectSessionStatus.Connected) { App.Session = e.Session; if (dataFullName != null && dataPhoto != null) { GetProfileData(); } } else if (e.Error != null) { MessageBox.Show("Error logging in."); } }
private void SignInButton_SessionChanged(object sender, LiveConnectSessionChangedEventArgs e) { if (e.Session != null && e.Status == LiveConnectSessionStatus.Connected) { App.Session = e.Session; this.pivotControl.SelectedItem = this.albumPivot; if (!App.ViewModel.IsDataLoaded) { App.ViewModel.LoadData(); } } }
private void btnSignIn_OnSessionChanged(object sender, LiveConnectSessionChangedEventArgs e) { if (e.Status == LiveConnectSessionStatus.Connected) { btnSave.Visibility = App.ProfilesManager.Items.Count != 0 ? Visibility.Visible : Visibility.Collapsed; btnRestore.Visibility = Visibility.Visible; client = new LiveConnectClient(e.Session); client.UploadCompleted += client_UploadCompleted; client.GetCompleted += client_GetCompleted; client.DownloadCompleted += client_DownloadCompleted; } }
private void OnLogin(LiveLoginResult loginResult) { this.Session = loginResult.Session; var sessionChangedArgs = new LiveConnectSessionChangedEventArgs(loginResult.Status, loginResult.Session); this.RaiseSessionChangedEvent(sessionChangedArgs); if (loginResult.Status == LiveConnectSessionStatus.Connected) { this.SetButtonState(ButtonState.LogOut); } }
/// <summary> /// Event handler for SignInButton.SessionChanged event. /// </summary> private void btnLogin_SessionChanged(object sender, LiveConnectSessionChangedEventArgs e) { if (e.Status == LiveConnectSessionStatus.Connected) { this.liveClient = new LiveConnectClient(e.Session); this.GetMe(); } else { this.liveClient = null; this.tbResponse.Text = e.Error != null ? e.Error.ToString() : string.Empty; this.imgMe.Source = null; } }
private void OnSessionChanged(object sender, LiveConnectSessionChangedEventArgs e) { if (e.Error != null) { MessageBox.Show(e.Error.Message); return; } if (e.Status == LiveConnectSessionStatus.Connected) { ((App) App.Current).Session = e.Session; this.NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative)); } }
private async void btnSignin_SessionChanged_2(object sender, LiveConnectSessionChangedEventArgs e) { if (TextValidation()) { lblMsg.Text = ""; App.liveAuthClient = new LiveAuthClient(redirectURL); LiveLoginResult liveLoginResult = await App.liveAuthClient.LoginAsync(new string[] { "wl.signin", "wl.basic" }); if (liveLoginResult.Session != null && liveLoginResult.Status == LiveConnectSessionStatus.Connected) { client = new LiveConnectClient(liveLoginResult.Session); LiveOperationResult operationResult = await client.GetAsync("me"); dynamic pic = await client.GetAsync("me/picture"); try { MobileServiceUser user = await App.MobileService.LoginAsync(client.Session.AuthenticationToken); if (!String.IsNullOrEmpty(user.UserId)) { dynamic meResult = operationResult.Result; if (meResult.first_name != null && meResult.last_name != null) { infoTextBlock.Text = "Welcome, " + meResult.name; //initiliazed user LiveUserInfo properties LiveUserInfo.Id = user.UserId;//meResult.id; // user.UserId; //generated by Zumo LiveUserInfo.Name = meResult.name; LiveUserInfo.FirstName = meResult.first_name; LiveUserInfo.LastName = meResult.last_name; PushNotificationChannel channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync(); LiveUserInfo.channelUri = channel.Uri; LiveUserInfo.pic = pic.Result.location; this.Frame.Navigate(typeof(WhereTheFriend.Welcome)); } else { infoTextBlock.Text = "Welcome, Guest!"; } } } catch (LiveConnectException exception) { this.infoTextBlock.Text = "Error calling API: " + exception.Message; } } } }
public void OnSessionStateChanged(LiveConnectSessionChangedEventArgs evenementDeConnection) { if (evenementDeConnection.Status != LiveConnectSessionStatus.Connected) { IsActionPossible = false; } else { IsActionPossible = true; Session = evenementDeConnection.Session; } SauvegarderCommand.RaiseCanExecuteChanged(); RestaurerCommand.RaiseCanExecuteChanged(); }
private void OnSessionChanged(Object sender, LiveConnectSessionChangedEventArgs args) { if (args != null && args.Session != null && args.Status == LiveConnectSessionStatus.Connected) { this.client = new LiveConnectClient(args.Session); if (notes == null) { signedInUser(); } } else { signedOutUser(); } }
private void skydrive_SessionChanged(object sender, LiveConnectSessionChangedEventArgs e) { if (e != null && e.Status == LiveConnectSessionStatus.Connected) { App.client = new LiveConnectClient(e.Session); this.GetAccountInformations(); btnUpload.IsEnabled = true; } else { btnUpload.IsEnabled = false; App.client = null; if (rbtnSaveInCloud.IsChecked == true) InfoText.Text = e.Error != null ? e.Error.Message : string.Empty; } }
private void btnSignin_SessionChanged(object sender, LiveConnectSessionChangedEventArgs e) { if (e.Session != null && e.Session.Status == LiveConnectSessionStatus.Connected) { client = new LiveConnectClient(e.Session); infoTextBlock.Text = "Signed in."; client.GetCompleted += new EventHandler<LiveOperationCompletedEventArgs>(btnSignin_GetCompleted); client.GetAsync("me", null); } else { infoTextBlock.Text = "Not signed in."; client = null; } }
private async void SignInButton_OnSessionChanged(object sender, LiveConnectSessionChangedEventArgs e) { if (e.Error == null && e.Status == LiveConnectSessionStatus.Connected) { _client = new LiveConnectClient(e.Session); try { var meResult = await _client.GetAsync(LiveSdkConstants.MyDetails); var myDetails = JsonConvert.DeserializeObject<MeDetails>(meResult.RawResult); SignedInAs.Text = string.Format("Signed in as {0}", myDetails.Name); } catch { MessageBox.Show("Something went wrong"); } } }
private void btnSignin_SessionChanged(object sender, LiveConnectSessionChangedEventArgs e) { if (e.Status == LiveConnectSessionStatus.Connected) { client = new LiveConnectClient(e.Session); App.Current.LiveSession = e.Session; infoTextBlock.Text = "Authenticated. Looking for you.."; client.GetCompleted += new EventHandler<LiveOperationCompletedEventArgs>(OnGetCompleted); client.GetAsync("me", null); } else { // reset controls infoTextBlock.Text = "Sign in to allow SkyNote access to your files!"; this.btnViewContents.Visibility = System.Windows.Visibility.Collapsed; client = null; } }
/// <summary> /// btnSignin_SessionChanged tregar signin button clicked. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void btnSignin_SessionChanged(object sender, LiveConnectSessionChangedEventArgs e) { if (e.Session != null && e.Status == LiveConnectSessionStatus.Connected) { App.Session = e.Session; client = new LiveConnectClient(e.Session); LiveOperationResult result = await client.GetAsync("me"); OnGetCompleted(result); } else { // remove all live profile informaion. client = null; App.Session = null; gotoAlbum.Visibility = Visibility.Collapsed; ProfileName.Text = ""; ProfilePic.Source = null; } }
private async void SignInButton_SessionChanged(object sender, LiveConnectSessionChangedEventArgs e) { if (e.Status == LiveConnectSessionStatus.Connected) { busyProceedAction.IsRunning = true; liveClient = new LiveConnectClient(e.Session); lblLoginInfo.Visibility = Visibility.Collapsed; btnBackup.IsEnabled = true; await GetFolderId(); await CheckForBackup(); } else { lblLoginInfo.Visibility = Visibility.Visible; btnBackup.IsEnabled = false; btnRestore.IsEnabled = false; } busyProceedAction.IsRunning = false; }
private void signInBtn_SessionChanged(object sender, LiveConnectSessionChangedEventArgs e) { this.WorkDone(); if ((e.Status != LiveConnectSessionStatus.Connected) && (e.Error != null)) { if (!NetworkInterface.GetIsNetworkAvailable()) { this.Alert(AppResources.NoAvailableNetworkMessage, AppResources.LoginLiveIDMessage.ToUpperInvariant()); } else { this.Alert(AppResources.LiveConnectExceptionMessage, AppResources.LoginLiveIDMessage.ToUpperInvariant()); } } else if (e.Status == LiveConnectSessionStatus.Connected) { this.viewModel.InitializeLiveConnector(e.Session); this.viewModel.IsLogonToLiveId = e.Status == LiveConnectSessionStatus.Connected; } }
private void btnSignin_SessionChanged(object sender, LiveConnectSessionChangedEventArgs e) { if (e.Status == LiveConnectSessionStatus.Connected) { // client = new LiveConnectClient(e.Session); // App.Current.LiveSession = e.Session; this.txtLoginResult.Text = "Signed in."; this.txtWelcome.Visibility = System.Windows.Visibility.Visible; this.btnShowContent.Visibility = System.Windows.Visibility.Visible; this.btnAddFile.Visibility = System.Windows.Visibility.Visible; //client.GetCompleted += new EventHandler<LiveOperationCompletedEventArgs>(OnGetCompleted); // client.GetAsync("me", null); } else { this.txtLoginResult.Text = "Not signed in."; this.txtWelcome.Visibility = System.Windows.Visibility.Collapsed; // client = null; } }
void btnSignin_SessionChanged(object sender, Microsoft.Live.Controls.LiveConnectSessionChangedEventArgs e) { if (e.Status == LiveConnectSessionStatus.Connected) { PhoneApplicationService.Current.State["parameter"] = this.session = e.Session; this.NavigationService.Navigate(new Uri("/SkyDriveImportPage.xaml", UriKind.Relative)); //LiveConnectClient client = new LiveConnectClient(e.Session); //this.session = e.Session; //testLabel.Text = "Signed in."; //client.GetCompleted += client_GetCompleted; //client.GetAsync("me", null); } else { session = null; if (e.Error != null) { statusLabel.Text = "Error calling API: " + e.Error.ToString(); } } }
private void Signin_SessionChanged(object sender, LiveConnectSessionChangedEventArgs e) { if (e.Status == LiveConnectSessionStatus.Connected) { App.SkyDriveEnabled = true; this.autoUpload.IsEnabled = true; } }
private void SignInButton_OnSessionChanged(object sender, LiveConnectSessionChangedEventArgs e) { // As soon as user is logged in, passing her AuthenticationToken to the ViewModel to enable interaction with the service App.ViewModel.SetAuthenticationToken ( e.Status == LiveConnectSessionStatus.Connected ? e.Session.AuthenticationToken : string.Empty ); if (e.Error != null) { Dispatcher.BeginInvoke(() => MessageBox.Show(e.Error.Message)); } }
private void WLSignIn_OnSessionChanged(object sender, LiveConnectSessionChangedEventArgs e) { ((BackupRestoreViewModel)DataContext).SessionChangedCommand.Execute(e); }
private async void btnSignin_SessionChanged(object sender, LiveConnectSessionChangedEventArgs e) { await headsTailsUserDetails.Authenticate(e); }
private void OnSessionChanged(object sender, LiveConnectSessionChangedEventArgs e) { this.liveClient = (e.Status == LiveConnectSessionStatus.Connected) ? new LiveConnectClient(e.Session) : null; }
private void bLiveSignIn_SessionChanged(object sender, LiveConnectSessionChangedEventArgs e) { if (e.Status != LiveConnectSessionStatus.Connected) return; _client = new LiveConnectClient(e.Session); App.LiveSession = e.Session; GetMeAndFileListing(); }