Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Building Windows 8.1 & Windows Phone Applications.

Similar presentations


Presentation on theme: "Introduction to Building Windows 8.1 & Windows Phone Applications."— Presentation transcript:

1 Introduction to Building Windows 8.1 & Windows Phone Applications

2 Hi. I’m Waseem Hassan Windows 8.1 Developer Windows Phone Developer Microsoft Azure Developer waseemhassan.net waseemhassan@outlook.com

3 How Windows and Windows Phone Applications are developed?

4 C# XAML Front- End Back-End

5 Tools Needed

6 Where to start?

7 C# Start building universal applications XAML

8 Microsoft Virtual Academy

9 Join the MVA Community! Microsoft Virtual Academy ‑ Free online learning tailored for IT Pros and Developers ‑ Over 2M registered users ‑ Up-to-date, relevant training on variety of Microsoft products Recommended Course Flow ‑ Programming in C# JumpStart ‑ Essentials of Developing / Building Windows Store Apps with C# / XAML ‑ Advanced Windows Store Apps with C# / XAML ‑ Designing your XAML UI with Blend

10 Introduction to C#

11 The Basics of C# Lots of similarities with C++ Object-Oriented Classes, structs, enums Familiar basic types: int, double, bool, … Familiar keywords: for, while, if, else, … Similar syntax: curly braces { }, dot notation, … Exceptions: try and catch

12 The Basics of C# Everything lives in a class/struct (no globals) No pointers! (so no ->, * or & notation) Garbage collection: no delete! No header files Interfaces Static members accessed with. (not ::) In a nutshell: much easier than C++

13 C# Features Properties Interfaces The foreach keyword The readonly keyword Parameter modifiers: ref and out Delegates and events Generics (Instead of Templates)

14 Properties Class members, alongside methods and fields “field” is what C# calls a member variable Properties “look like fields, behave like methods” By convention, names are in UpperCamelCase

15 Properties class Person { // Private field (the "backing field") private String name; // Public property public String Name { get { return name; } set { // "value" is an automatic // variable inside the setter name = value; } class Program { static void Main( string[] args ) { Person p = new Person(); // Use the setter p.Name = "Waseem"; // Use the getter Console.WriteLine( p.Name ); }

16 Properties Demo

17 Properties A really core feature of C# You’ll see them everywhere DateTime.Now String.Length Etc. Get into the habit of using a property whenever you need a getter and/or setter Preferred to using GetValue(), SetValue() methods Never use public fields!

18 Interfaces Like a class, but all its members are implicitly abstract i.e., it does not provide any method implementations, only method signatures A class can only inherit from a single base class, but may implement multiple interfaces interface ILog { void Log( string text ); }

19 Interfaces Demo

20 Delegates Delegates are how C# defines a dynamic interface between two methods Same goal as function pointers in C Delegates are type-safe Consists of 2 parts: a delegate type and a delegate instance

21 Delegates A delegate type looks like an (abstract) method declaration, preceded with the delegate keyword A delegate instance creates an instance of this type, supplying it with the name of the real method to attach to Example on next slide

22 Delegates // Delegate type (looks like an abstract method) delegate int Transform( int number ); // The real method we're going to attach to the delegate static int DoubleIt( int number ) { return number * 2; } static void Main( string[] args ) { // Create a delegate instance Transform transform; // Attach it to a real method transform = DoubleIt; // And now call it (via the delegate) int result = transform( 5 ); Console.WriteLine( result ); } I can never remember the syntax for either! Keep a handy reference book…

23 Multicast Delegates A delegate instance can have more than one function attached to it Now when we call transform(), all methods are called In the order in which they were added Transform transform = DoubleIt; transform += HalveIt; transform += TripleIt; // etc.

24 Delegates Demo

25 Events Events are really just special instances of delegates By convention they have a specific declaration for the delegate: We declare an event like this We use an event just like a delegate except that only the += and -= can be used by classes delegate void GuestHandler( String name ); event GuestHandler EnterEvent;

26 Events Demo

27 Introduction to XAML

28 XAML Extensible Application Markup Language ‑ Used for designing the interface Much more easier and powerful than XML (Android) and Objective-C (iOS)

29 Demo

30 Layouts

31 XAML Layouts StackPanel Grid Canvas

32 02 Layouts Demo

33 Controls

34 XAML Controls TextBox TextBlock Slider ProgressBar ProgressRing Button CheckBox RadioButton HyperlinkButto n ToggleSwitch PasswordBox RichEditBox ComboBox Image ToolTip Popup

35 03 Controls Demo

36 Questions?

37 References Microsoft Virtual Academy

38 Thank You


Download ppt "Introduction to Building Windows 8.1 & Windows Phone Applications."

Similar presentations


Ads by Google