Basic knowledge points:
1. Obtain the DeviceUniqueId of WP7:
public string GetDeviceUniqueId(){ string strUniqueId = null;
object uniqueId = DeviceExtendedProperties.GetValue("DeviceUniqueId"); if (uniqueId != null) { byte[] uniqueBytes = (byte[]) uniqueId; strUniqueId = Convert.ToBase64String(uniqueBytes); } return strUniqueId;}
2. Add a page switch animation (you need to use Microsoft. Phone. Controls. Toolkit ):
Modify the App. xaml. cs file:
private void InitializePhoneApplication()
{
if (phoneApplicationInitialized)
return;
// Create the frame but don't set it as RootVisual yet; this allows the splash
// screen to remain active until the application is ready to render.
// RootFrame = new PhoneApplicationFrame();
RootFrame = new TransitionFrame();
RootFrame.Navigated += CompleteInitializePhoneApplication;
// Handle navigation failures
RootFrame.NavigationFailed += RootFrame_NavigationFailed;
// Ensure we don't initialize again
phoneApplicationInitialized = true;
}
MainPage. xaml file:
<Phone: PhoneApplicationPage x: Class = "MyProject. mainPage "xmlns =" http://schemas.microsoft.com/winfx/2006/xaml/presentation "xmlns: x =" http://schemas.microsoft.com/winfx/2006/xaml "xmlns: phone =" clr-namespace: Microsoft. phone. controls; assembly = Microsoft. phone "xmlns: shell =" clr-namespace: Microsoft. phone. shell; assembly = Microsoft. phone "xmlns: d =" http://schemas.microsoft.com/expression/blend/2008 "xmlns: mc =" http://schemas.openxmlformats.org/markup-compatibility/2006 "xmlns: toolkit =" clr-namespace: Microsoft. phone. controls; assembly = Microsoft. phone. controls. toolkit "mc: Ignorable =" d "d: DesignWidth =" 480 "d: designHeight = "768" FontFamily = "{StaticResource quota}" FontSize = "{StaticResource quota}" Foreground = "{StaticResource quota}" SupportedOrientations = "Portrait" Orientation = "Portrait" shell: systemTray. isVisible = "True">
// Set the page switching animation <toolkit: TransitionService. navigationInTransition> <toolkit: NavigationInTransition. backward> <toolkit: TurnstileTransition Mode = "BackwardIn"/> </toolkit: NavigationInTransition. backward> <toolkit: NavigationInTransition. forward> <toolkit: TurnstileTransition Mode = "ForwardIn"/> </toolkit: NavigationInTransition. forward> </toolkit: NavigationInTransition> </tool Kit: TransitionService. navigationInTransition> <toolkit: TransitionService. navigationOutTransition> <toolkit: NavigationOutTransition. backward> <toolkit: TurnstileTransition Mode = "BackwardOut"/> </toolkit: NavigationOutTransition. backward> <toolkit: NavigationOutTransition. forward> <toolkit: TurnstileTransition Mode = "ForwardOut"/> </toolkit: NavigationOutTransition. forwar D> </toolkit: NavigationOutTransition> </toolkit: TransitionService. NavigationOutTransition> <! -- LayoutRoot is the root grid where all page content is placed --> <Grid x: Name = "LayoutRoot" Background = "Transparent"> </Grid> </phone: PhoneApplicationPage>
Problems encountered when individuals use the page to switch the animation:
1. Add A switching animation on page A, while page B does not add A switching animation. When A jumps to page B, click the "Back" key during the switching process, and the program will exit unexpectedly;
2. A switching animation is added for both page A and page B to jump from page A to page B. If you click "Back" before page B is loaded, page A and page B overlap.
Problems:
1. Draw a PolyLine in the Canvas. When the distance between the start point and the end point of the PolyLine is too large, the PolyLine cannot be displayed.
XAML file:
<Canvas>
<Polyline x:Name="MyPolyLine" Canvas.Left="0" Canvas.Top="400" Stroke="Blue" StrokeThickness="6"/></Canvas>
CS file:
Private void LoadLine (){
PointCollection pointCollection = new PointCollection ();
PointCollection. Add (new Point (0, 0 ));
PointCollection. Add (new Point (200, 0 ));
PointCollection. Add (new Point (1000, 0 ));
PointCollection. Add (new Point (10000, 0 ));
PointCollection. Add (new Point (20000, 0 ));
PointCollection. Add (new Point (30000, 0 ));
// If This vertex is added, the PolyLine is not displayed.
// PointCollection. Add (new Point (40000, 0 ));
This. MyPolyLine. Points = pointCollection ;}