Windows 8 Store Apps Learning (58) Microsoft account

Source: Internet
Author: User
Tags expression xmlns

Introduced

Re-imagine the Windows 8 Store Apps Microsoft account

Get user-related information for Microsoft account

Get or set up pictures and videos of Microsoft account

Microsoft account verification, and the acquisition of relevant information

Example

1, to demonstrate how to obtain the Microsoft account user-related information

Account/accountinfo.xaml

<page
    x:class= "XamlDemo.Account.AccountInfo"
    xmlns= "http://schemas.microsoft.com/winfx/2006/xaml/ Presentation "
    xmlns:x=" Http://schemas.microsoft.com/winfx/2006/xaml "
    xmlns:local=" using: Xamldemo.account "
    xmlns:d=" http://schemas.microsoft.com/expression/blend/2008 "
    xmlns:mc=" http:// schemas.openxmlformats.org/markup-compatibility/2006 "
    mc:ignorable=" D ">
    
    <grid background=" Transparent ">
        <stackpanel margin=" 0 0 0 ">
    
            <textblock name=" lblmsg "fontsize=" 14.667 "/>
    
        </StackPanel>
    </Grid>
</Page>

Account/accountinfo.xaml.cs

* * Demo How to Obtain Microsoft account user-related information * * using System;
Using Windows.System.UserProfile;
Using Windows.UI.Xaml.Controls;
    
Using Windows.UI.Xaml.Navigation;
        Namespace Xamldemo.account {public sealed partial class Accountinfo:page {public AccountInfo () {this.
        InitializeComponent (); } protected async override void Onnavigatedto (NavigationEventArgs e) {if (userinformatio n.nameaccessallowed)//whether to allow access to user name {//Get the name used for display Lblmsg.text = "Display Name:
                "+ await Userinformation.getdisplaynameasync ();
    
                Lblmsg.text + = Environment.NewLine;
                Gets the name Lblmsg.text + = "Name:" + await userinformation.getfirstnameasync ();
    
                Lblmsg.text + = Environment.NewLine;
                Gets the last name lblmsg.text = "Last name:" + await userinformation.getlastnameasync (); LblmsG.text + = Environment.NewLine;
            ///If you need to obtain Getdomainnameasync (), Getprincipalnameasync (), Getsessioninitiationprotocoluriasync () and other information 
    You need to add the configuration <capability name= "Enterpriseauthentication"/&gt in the Package.appxmanifest, and you must use the company account to upload the app} }
}

2, demo how to get or set the Microsoft account picture and video

Account/accountpicture.xaml

<page x:class= "XamlDemo.Account.AccountPicture" xmlns= "Http://schemas.microsoft.com/winfx/2006/xaml/presentat Ion "xmlns:x=" Http://schemas.microsoft.com/winfx/2006/xaml "xmlns:local=" Using:XamlDemo.Account "xmlns:d=" http ://schemas.microsoft.com/expression/blend/2008 "xmlns:mc=" http://schemas.openxmlformats.org/ markup-compatibility/2006 "mc:ignorable=" D "> <grid background=" Transparent "> <stackpanel margin= "0 0 0" > <stackpanel orientation= "Horizontal" > <button x:name= "btn
    
            SetImage "content=" set the current Microsoft account of the picture (you can specify the small map, large image, video) "click=" Btnsetimage_click_1/> </StackPanel> <stackpanel orientation= "Horizontal" margin= "0 0 0" > <image x:name= "imgsmall" width= " "height=" horizontalalignment= "left"/> <image x:name= "Imglarge" width= "448" height= "448" Marg
    in= "0 0 0" horizontalalignment= "left"/>            <mediaelement x:name= "MediaElement" width= "height=" margin= "0 0 0" horizontalalignment= "left"/ > </StackPanel> </StackPanel> </Grid> </Page>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.