public async Task <UserInfo> VerifySavedCredentialsAsync() { // Attempt to sign in using credentials stored locally // If succeeds, ask for a new active session var savedCredentials = _credentialStore.GetSavedCredentials(PasswordVaultResourceName); if (savedCredentials != null) { savedCredentials.RetrievePassword(); var result = await SignInUserAsync(savedCredentials.UserName, savedCredentials.Password, false); if (result.SignedIn) { return(SignedInUser); } } return(null); }
public Tuple <string, string> VerifyUserCredentialsAsync() { var cred = _credentialStore.GetSavedCredentials(PasswordVaultResourceName); if (cred != null) { cred.RetrievePassword(); //var result = await SignInAsync(cred.UserName, cred.Password, false); //if (result.Item1 != null) //{ // return result.Item1; //} return(new Tuple <string, string>(cred.UserName, cred.Password)); } return(null); }
async private System.Threading.Tasks.Task GetTasksforLiveTile() { try { var updaterWide = TileUpdateManager.CreateTileUpdaterForApplication(); var updaterSqure = TileUpdateManager.CreateTileUpdaterForApplication(); var updaterBadge = BadgeUpdateManager.CreateBadgeUpdaterForApplication(); updaterWide.EnableNotificationQueue(true); updaterSqure.EnableNotificationQueue(true); updaterWide.Clear(); updaterSqure.Clear(); updaterBadge.Clear(); int counter = 0; var crd = _credentialStore.GetSavedCredentials(PasswordVaultResourceName); VIServiceHelper.Instance.ConnectAsync(crd.UserName, crd.Password, new EventAggregator()); var allTasks = await VIServiceHelper.Instance.SyncTasksFromSvcAsync(); if (allTasks != null) { foreach (var collection in allTasks.InSetsOf(3)) { int index = 0; XmlDocument tileXmlSquare = TileUpdateManager.GetTemplateContent(TileTemplateType.TileSquare310x310TextList01); var bindingElementSquare = (XmlElement)tileXmlSquare.GetElementsByTagName("binding").Item(0); bindingElementSquare.SetAttribute("branding", "name"); XmlNodeList tileTextAttributes = tileXmlSquare.GetElementsByTagName("text"); foreach (var item in collection) { XmlDocument tileXmlWide = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWideBlockAndText02); var bindingElemWide = (XmlElement)tileXmlWide.GetElementsByTagName("binding").Item(0); bindingElemWide.SetAttribute("branding", "name"); tileTextAttributes[index].InnerText = item.CustomerName.ToString(); tileTextAttributes[++index].InnerText = item.ContactName.ToString(); tileTextAttributes[++index].InnerText = item.StatusDueDate.Day.ToString() + " " + item.StatusDueDate.ToString("MMMM"); tileXmlWide.GetElementsByTagName(textElementName)[0].InnerText = item.CustomerName; tileXmlWide.GetElementsByTagName(textElementName)[1].InnerText = item.StatusDueDate.Day.ToString(); tileXmlWide.GetElementsByTagName(textElementName)[2].InnerText = item.StatusDueDate.ToString("MMMM"); updaterWide.Update(new TileNotification(tileXmlWide)); ++index; } if (counter++ > 6) { break; } updaterSqure.Update(new TileNotification(tileXmlSquare)); } XmlDocument BadgeXml = BadgeUpdateManager.GetTemplateContent(BadgeTemplateType.BadgeNumber); var badgeAttributes = BadgeXml.GetElementsByTagName("badge"); ((XmlElement)badgeAttributes[0]).SetAttribute("value", allTasks.Count.ToString()); updaterBadge.Update(new BadgeNotification(BadgeXml)); } } catch (Exception) { } }