Account image name example this example shows the user name obtained by different methods, currently logged on. It also demonstrates how to obtain and apply the image to the user's tile. Windows. system check. USERPROFILE is an information class and method applied to this sample.
Partial ClassMainpage: Page
{
# Region Properties
PrivateFrame _ scenariosframe;
PublicFrame scenariosframe
{
Get{Return_ Scenariosframe ;}
Set{_ Scenariosframe = value ;}
}
PrivateFrame _ inputframe;
PublicFrame inputframe
{
Get{Return_ Inputframe ;}
Set{_ Inputframe = value ;}
}
PrivateFrame _ outputframe;
PublicFrame outputframe
{
Get{Return_ Outputframe ;}
Set{_ Outputframe = value ;}
}
Private String_ Rootnamespace;
Public StringRootnamespace
{
Get{Return_ Rootnamespace ;}
Set{_ Rootnamespace = value ;}
}
# Endregion
# RegionEvents
Public EventSystem. eventhandler inputframeloaded;
Public EventSystem. eventhandler outputframeloaded;
# Endregion
PublicMainpage ()
{
Initializecomponent ();
_ Scenariosframe = scenariolist;
_ Inputframe = scenarioinput;
_ Outputframe = scenariooutput;
Setfeaturename (feature_name );
loaded + = New routedeventhandler (mainpage_loaded);
Windows. UI. viewmanagement. applicationview. getforcurrentview (). viewstatechanged + = New typedeventhandler (mainpage_viewstatechanged);
displayproperties. logicaldpichanged + = New displaypropertieseventhandler (displayproperties_logicaldpichanged);
Navigationcachemode = windows. UI. XAML. Navigation. navigationcachemode. required;
}
VoidMainpage_loaded (ObjectSender, routedeventargs E)
{
//Figure out what resolution and orientation we are in and respond appropriately
Checkresolutionandviewstate ();
//Load the scenariolist page into the proper frame
Scenariolist. navigate (type. GetType (_ rootnamespace +". Scenariolist"),This);
}
# RegionResolution and orientation code
VoidDisplayproperties_logicaldpichanged (ObjectSender)
{
Checkresolutionandviewstate ();
}
VoidCheckresolutionandviewstate ()
{
Visualstatemanager. gotostate (This, Applicationview. value. tostring () + displayproperties. resolutionscale. tostring (),False);
}
VoidMainpage_viewstatechanged (applicationview sender, applicationviewstatechangedeventargs ARGs)
{
Checkresolutionandviewstate ();
}
# Endregion
Private VoidSetfeaturename (StringStr)
{
Featurename. Text = STR;
}
AsyncVoidFooter_click (ObjectSender, routedeventargs E)
{
Await windows. system. launcher. launchiliasync (NewUri (hyperlinkbutton) sender). Tag. tostring ()));
}
Public Void Notifyuser ( String Strmessage, policytype type)
{
Switch (Type)
{
Case Yytype. statusmessage:
Statusblock. Style = resources [ " Statusstyle " ] As Style;
Break ;
Case Policytype. errormessage:
Statusblock. Style = resources [ " Errorstyle " ] As Style;
Break ;
}
Statusblock. Text = strmessage;
}
Public VoidDonavigation (type inpagetype, frame inframe, type outpagetype, frame outframe)
{
Inframe. navigate (inpagetype,This);
Outframe. navigate (outpagetype,This);
// Raise inputframeloaded so downstream pages know that the input frame content has been loaded.
If (Inputframeloaded! = Null )
{
Inputframeloaded ( This , New Eventargs ());
}
// Raise outputframeloaded so downstream pages know that the output frame content has been loaded.
If (Outputframeloaded! = Null )
{
Outputframeloaded ( This , New Eventargs ());
}
}
}
Public EnumPolicytype
{
Statusmessage,
Errormessage
};
Complete demo
/Files/risk/windows8/account image sample.rar