30
Software Development

Software Development. Chapter 3 – Your first Windows 8 app

Embed Size (px)

Citation preview

Software Development

Chapter 3 –Your first Windows 8 app

Contents ❷❸

• Getting ready• Visual Studio's first time setup• Acquiring a Windows 8 developer license• Your first program: Hello world!• Assignments• Questions and answers

Review: needed tool

• You will need at least the following tools to develop Windows 8 applications

1. Computer with a Windows 8 operating system– It is also recommened to have a touchscreen device, but

it is not required

2. Development tools– Development tools

3. Internet connection

Getting ready

• We will assume Windows 8 has already been installed on your work computer

• Before starting, you should ensure that:– You have functional internet connectoin,

downloading Visual Studio may take a long on a bad or slow connection

– Windows has been properly updated and security fixes are installed (use the Windows Update service)

Download Visual Studio 2013 Express• Visual Studio 2013 Express for Windows 8 is a free

product available at http://www.visualstudio.com/downloads/download-visual-studio-vs

• Download theexpress versiondesigned forWindows 8development

Installing Visual Studio

• Visual Studio 2013 Express installation file is titled winexpress_full.exe.

• Launch the installation file by double clicking on its icon.

• The installer's first screen will appear– Accept the license terms and click Install

Installer launch screen

Installation

• After clicking Install, you just need to wait for 10-20 minutes depending on your computer processing power

• You will be notified when the installation has finished successfully.

– A Launch button will appear on the bottom of the window.

Successfully installed

Visual Studio's first time setup

• When Visual Studio is launched for the first time, you will be asked to sign in.

• Signing in is required to develop Windows 8 applications

• The process is easy, just click on the Sign In button and follow instructions

– You may also sign in later

Signing in

Acquiring a developer license

• A developer license is required so that you will be able to install the programs you've developed

• A free developer license is valid for 30 days and a paid license for 90 days at a time

– After expiration the license can be automaticalle renewed through Visual Studio

Your first application

• The easiest way to learn Windows 8 programming is through trial and error

• Let's write a simple Hello World program– You can continue developing the application on

your own• You will need

– A computer with Windows 8.1 operating system– Visual Studio 2013 installed and registered

Starting a new project

• A Windows 8 application consists of a collection of different files called a project

• Launch Visual Studio, and choose File/New Project

• The New Project window will open

New Project window

Acquiring a developer license

• If you're starting a new project in Visual Studio without a developer license, the program will prompt you to get one

• Getting a temporarylicense is free

– This kind of license has noaccess to the WindowsStore

Hello World interface

• Visual Studio includes a code editor and a visual interface design view

• In Toolbox on the left side of the window you will find the component needed to build your interface.

• Drag'n'drop two components into the MainPage.xaml interface: TextBlock and Button

Interface

Writing code

• The Button will change the displayed text when the button is activated

• In Visual Studio code is written in the code editor

• You can open the code editor be double-clicking the Button component

• You may name the TextBlock component by using the Properties window

Code editor

Component and code• You can change a

component's name in the Properties window

• Once the TextBlock has been named, for example as ”textblock”, you can type the following code string into the Button component's event manager: textblock.Text =

”Hello, World!”;

Running your application

• You can launch your application through Visual Studio by clicking the Start button in the middle of the toolbar

Running your application

• Building and launching the application will take a few seconds

• The screen will turn black and your application interface will appear

• Touch the button, and the text should change

Application

Closing the application• As Windows 8 application run in fullscreen mode,

you must know how to return to Visual Studio• There are several ways

– Touchscreen: swipe down from the top of the screen to close the application

– Press Alt+F4 on your keyboard– Press Windows+D, to return to Visual Studio. Then click

the red Stop Debuggingbutton on the toolbar

Assignments• Find out the hardware requirements of Visual Studio Express

2013 for Windows. Will the studio run on older computers?• Explain why Windows 8 developers need a developer license.• Visual Studio is delivered with four program templates.

Describe the situations where you would use each template and give an example of an application suitable for each template.

• 4. Find out how you can easily open Blend directly from Visual Studio. Can Visual Studio be opened directly from Blend?

Questions and answers 1

Do I need a touch-screen computer, laptop, or tablet to be able to develop Windows 8 apps.

• Not necessarily, but having a touchscreen device has many advantages.

• Visual Studio comes equipped with a Windows 8 simulator, with which you can test on a mouse how your program would work on a touchscreen.

• The application will think that it is run with a touchscreen.

Questions and answers 2My computer has Windows 7 installed. How can I start

developing Windows 8 apps• You must upgrade your Windows to Windows 8 in order to

use and develop Windows 8 apps.• If your computer is at most a couple years old and runs well

on Windows 7, you will most likely be able to upgrade you operating system.

• If your computer is old and slow, it would be best to buy a new computer, for example a touchscreen laptop. These are available for under 400 euros.

Questions and answers 3I have created a Windows 8 app and want to copy it for my

friend/colleague. How can I copy my program to another computer? • If your friend or colleague has Windows 8 and Visual Studio, you can send

him your program's source code and ask to compile it on his computer.• If this is not possible or you want to keep the source code, you can create

an application package for distribution in Visual Studio, and then copy this package to another computer.

• The application package can be created by clicking on the Store menu and then clicking on Create App Packages. Your friend or colleague can then acquire the required developer license with the PowerShell command Get-WindowsDeveloperLicense.