Thursday, February 09, 2012

Windows 7 Mango Training - 8-9 Feb

Silverlight, C# in windows 7 phone
Summary of lessons learnt:
  1. same as WPF technology. XAML for layout of UI with CS controlling interactivity and behaviour of app. similar to Flex with MXML and AS 
  2. no Console.Writeline(), have to use System.Diagnostics.Debug.WriteLine()
  3. Loading and Activating events has 10 sec limit. if exceeded OS will terminate app
  4. Loading and Activating event is mutually exclusive
  5. NavigationService.Navigate(Uri) to move from one XAML page to another. eg.: NavigationService.Navigate(new Uri("/IntroPage.xaml", UriKind.RelativeOrAbsolute));
  6. Dormant and Tombstone states
  7. recall x:Name attribute for XAML elements for C# code integration and reference
  8. use Blend to create animation (new StoryBoard, record mode. use timeline) and use Visual Studio to call the animation for interactivity. make sure that XAML file is saved before switching to and fro the 2 tools. file can be overwritten if not careful. 
  9. Easing in blend for a animation segment is set at the end keyframe. eg.: if bounce easing is to be applied between frame 1 and 2, then easing is to be set in frame 2, instead of 1. unlike Flash.
  10. PNG image for App Icon
  11. use System.Windows.Threading.DisptacherTimer to perform timer functions instead of Timer due to access restriction of UI across threads
  12. To change default XAML for a app, change the WMAppManifest.xml in the project to reflect the xaml page in the DefaultTask element.
  13. Touch.FrameReported event (eg.: Touch.FrameReported += new TouchFrameEventHandler(Touch_FrameReported); ) to capture multitouch events on screen. but be careful of the reference point when getting the TouchPoint. Example: TouchPoint pt = e.GetTouchPoints(ContentPanel)[0]; // gets 1st touch with respect to UI Element named "ContentPanel"
  14. for network security access issues when debugging app, may have to run Visual Studio as administrator. right click on "Visual Studio ..." > "Run as administrator"
  15. personal preference: show line numbers. Tool > Options > check "Show all options" > Text Editor > All languages > Display > check "Line numbers"
  16. use WebClient for network HTTP communication
  17. System.Net.Socket supported


No comments: