Win8 on Intel Programming Course Desktop : Sensors Cédric Andreolli Intel Software 2013-03-20.

Slides:



Advertisements
Similar presentations
ASP.NET Ajax Supplementary Tutorial. Why Use ASP.NET AJAX? - I ASP.NET AJAX enables you to build rich Web applications that have many advantages over.
Advertisements

Intel Do-It-Yourself Challenge Networking
Intel Do-It-Yourself Challenge Lab 5: Controlling Galileo from a webpage Nicolas Vailliet
Win8 on Intel Programming Course Win8 for developers, in detail Cédric Andreolli Intel.
Win8 on Intel Programming Course Desktop : Introduction Cédric Andreolli Intel Software.
Win8 on Intel Programming Course Desktop : WPF Cédric Andreolli Intel Software
10+10 Descending the Design Funnel Chapter 1.4 in Sketching User Experiences: The Workbook.
Intel Do-It-Yourself Challenge Arduino Motor Shield Nicolas Vailliet Intel Software.
Intel Do-It-Yourself Challenge node.js
The State Transition Diagram
Intel Do-It-Yourself Challenge Intel Galileo and Edison Paul Guermonprez Intel Software.
Internet of Things with Intel Edison Getting started with your board Pierre Collet Intel.
Internet of Things with Intel Edison Web controller
Internet of Things with Intel Edison GPIO on Edison
Win8 on Intel Programming Course Win8 and Intel Paul Guermonprez Intel Software
11 Getting Started with ASP.NET Beginning ASP.NET 4.0 in C# 2010 Chapters 5 and 6.
Why Should I Sketch? Chapter 1.2 in Sketching User Experiences: The Workbook.
Intel Do-It-Yourself Challenge Sensors Nicolas Vailliet Intel Software
Intel Do-It-Yourself Challenge : Let’s build an autonomous drone Paul Guermonprez Intel.
The Keyboard Study Lecture /slide deck produced by Saul Greenberg, University of Calgary, Canada Notice: some material in this deck is used from other.
Intel Do-It-Yourself Challenge Arduino sketches and full SD image Nicolas Vailliet Intel.
The Branching Storyboard Chapter 4.3 in Sketching the User Interface: The Workbook Image from:
Internet of Things with Intel Edison Presentation Paul Guermonprez Intel Software
Win8 on Intel Programming Course Desktop : Perceptual Computing Cédric Andreolli Intel.
Web Development in Microsoft Visual Studio Slide 2 Lecture Overview Introduce Visual Studio 2013 Create a first ASP.NET application.
ESE Einführung in Software Engineering N. XXX Prof. O. Nierstrasz Fall Semester 2009.
ESE Einführung in Software Engineering X. CHAPTER Prof. O. Nierstrasz Wintersemester 2005 / 2006.
Metamodeling Seminar X. CHAPTER Prof. O. Nierstrasz Spring Semester 2008.
ESE Einführung in Software Engineering X. CHAPTER Prof. O. Nierstrasz Wintersemester 2005 / 2006.
N. XXX Prof. O. Nierstrasz Thanks to Jens Palsberg and Tony Hosking for their kind permission to reuse and adapt the CS132 and CS502 lecture notes.
Internet of Things with Intel Edison Led sensor lab
CP — Concurrent Programming X. CHAPTER Prof. O. Nierstrasz Wintersemester 2005 / 2006.
12. eToys. © O. Nierstrasz PS — eToys 12.2 Denotational Semantics Overview:  … References:  …
Sequential Storyboards Chapter 4.1 in Sketching the User Interface: The Workbook Image from:
Intel Software Incubators Student project definition Paul Guermonprez Intel Software.
Intel Do-It-Yourself Challenge Hello World with the Arduino IDE Nicolas Vailliet Intel.
Intel Do-It-Yourself Challenge Lab 1: Intel Galileo’s Arduino side Nicolas Vailliet
CPSC 581 Human Computer Interaction II Interaction Design Lecture /slide deck produced by Saul Greenberg, University of Calgary, Canada Notice: some material.
Collecting Images & Clippings Chapter 2.3 in Sketching User Experiences: The Workbook.
Business Optix Library Service – Workflow
9.1 © 2004 Pearson Education, Inc. Exam Planning, Implementing, and Maintaining a Microsoft Windows Server 2003 Active Directory Infrastructure.
Graphical Screen Design Part 1: Contrast, Repetition, Alignment, Proximity Lecture /slide deck produced by Saul Greenberg, University of Calgary, Canada.
Win8 on Intel Programming Course Modern UI : Sensors Cédric Andreolli Intel Software.
Win8 on Intel Programming Course Modern UI : Features Cédric Andreolli Intel Software.
Intel Do-It-Yourself Challenge OpenCV
Win8 on Intel Programming Course The challenge Paul Guermonprez Intel Software
Virtual techdays INDIA │ Nov 2010 Developing Office Biz Application using WPF on Windows 7 Sarang Datye │ Sr. Consultant, Microsoft Sridhar Poduri.
Win8 on Intel Programming Course Modern UI HelloWorld in HTML5/JS Cédric Andreolli Intel.
What is a sketch? Chapter 1.2 addendum Sketching User Experiences: The Workbook.
Internet of Things with Intel Edison Compiling and running Pierre Collet Intel Software.
Tutorial 121 Creating a New Web Forms Page You will find that creating Web Forms is similar to creating traditional Windows applications in Visual Basic.
11 Web Services. 22 Objectives You will be able to Say what a web service is. Write and deploy a simple web service. Test a simple web service. Write.
Microsoft FrontPage 2003 Illustrated Complete Finalizing a Web Site.
The Animated Sequence Chapter 5.1 in Sketching User Experiences: The Workbook.
Intel Do-It-Yourself Challenge Wi-Fi Nicolas Vailliet Intel Software
Internet of Things with Intel Edison CylonJS Pierre Collet Intel Software
© Chinese University, CSE Dept. Distributed Systems / Simple Example Open Microsoft Visual Studio 2005:
Programming with Visual Studio.NET A short review of the process.
Sketching Vocabulary Chapter 3.4 in Sketching User Experiences: The Workbook Drawing objects, people, and their activities.
Win8 on Intel Programming Course Paul Guermonprez Intel Software
State of the Ward in 2007 Version 1.0 A Fifth Sunday Lesson Given in the Sterling Park Ward, Ashburn, VA Stake by D. Calvin Andrus, Bishop
Design of Everyday Things Part 2: Useful Designs? Lecture /slide deck produced by Saul Greenberg, University of Calgary, Canada Images from:
The Narrative Storyboard Chapter 4.4 in Sketching User Experiences: The Workbook.
UNDERSTANDING YOUR OPTIONS FOR CLIENT-SIDE DEVELOPMENT IN OFFICE 365 Mark Rackley
11 Getting Started with ASP.NET Beginning ASP.NET in C# and VB Chapters 1 and 2.
Images of pesticides By: Leslie London, University of Cape Town This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.5.
PHPBelgium – Belgian PHP community PHPBelgium event MVC = Make Venerated Code? Patrick Allaert.
Sketching Vocabulary Chapter 3.4 in Sketching User Experiences: The Workbook Drawing objects, people, and their activities.
Agenda Video pre-presentations Digital sketches & photo traces
Methodology Overview 2 basics in user studies Lecture /slide deck produced by Saul Greenberg, University of Calgary, Canada Notice: some material in this.
Presentation transcript:

Win8 on Intel Programming Course Desktop : Sensors Cédric Andreolli Intel Software

Agenda

Sensors in desktop applications This part will introduce the sensors in desktop applications Enabling WinRT in WPF applications A quick “how to” that shows the steps needed to enable WinRT API in WPF applications Programming the Sensors An example that will show how to use the sensors in your desktop applications

Sensors in Desktop applications

Sensors in desktop applications Why do we need the sensors? Desktop applications represent the biggest part of todays applications A lot of applications can’t run in Modern UI because of native libraries dependencies How to access the sensors in desktop applications ? Sensors can be programmed with the win32 API but… It is complicated…

Sensors in desktop applications And what about the WinRT API? WinRT is way simpler than win32… And WinRT can be enabled in C# but we must change some configuration files to access it! Desktop Applications can use the sensors through WinRT but Visual Studio need some configuration

Enabling WinRT in WPF applications

Enabling WinRT in WPF apps Create a new WPF project Create also a new solution and name your project “HelloWorld”

Enabling WinRT in WPF apps Set up the environment Right now, WinRT is not available, you can’t add the reference to WinRT (You can look for it in References -> Add but you won’t find it)

Enabling WinRT in WPF apps How can we reference it? By default, WinRT is available for applications that target Windows 8 Store. This information can be added in the.csproj file Open the file HelloWorld.csproj This file is in your Visual Studio project directory (Documents\Visual Studio 2012\Projects\WPF\HelloWorld)

Enabling WinRT in WPF apps Add the target (Version 1) You can add the TargetPlatformVersion in an existing PropertyGroup

Enabling WinRT in WPF apps Add the target (Version 2) You can create a PropertyGroup This is the best solution because all your project can access this property

Enabling WinRT in WPF apps Reload the project Go back in Visual Studio, you should see: Click on Reload All

Enabling WinRT in WPF apps Add the reference In the Solution Explorer, right click on References -> Add References… On the left, select Windows -> Core and check Windows

Enabling WinRT in WPF apps Add the reference Click on OK Congratulations, WinRT is Linked! WinRT can be linked by specifying Windows 8 as target for our application

Enabling WinRT in WPF apps …but we are not done The devices are available right now but the devices event handlers can’t be used If you try to use it:

Enabling WinRT in WPF apps Add the Runtime DLL Some runtime DLL are missing You can find those DLL in C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5 The files are: System.Runtime.dll System.Runtime.InteropServices.WindowsRuntime.dll Right click on your project’s name and select Add References…

Enabling WinRT in WPF apps Add the Runtime DLL To access WinRT you must also link 2 DLLs (Runtime and InteropServices)

Programming the sensors

Project settings A part of sensor programming for desktop is similar to sensor programming for Windows Store applications Create a WPF window as follow

Programming the sensors Project settings Add name properties for each of your Textbox In the next slides, the Textboxes will be called accX, accY and accZ Create an accelerometer Open the C# file and add

Programming the sensors Solve missing references The class Accelerometer is unkown, in the C# editor, right click on it, select Resolve and click on the first option

Programming the sensors Retrieve a valid accelerometer As in Windows Store Applications, use the Windows.Devices.Sensors.Accelerometer.GetDefault() method to retrieve a valid accelerometer

Programming the sensors Add a handler Visual Studio can help you generating your handler Display auto-completion by pressing Ctrl+Tab Let Visual Studio add the handler by pressing Tab when the tooltip appear

Programming the sensors Add a handler Pressing Tab a second time will create the following function

Programming the sensors Sensors handlers If you try to access the UI elements in the handler, you will get troubles

Programming the sensors Sensors handlers The handler is launched by the sensor manager which doesn’t run on the UI thread This thread is not allowed to access UI elements How to solve this problem? WPF provides dispatchers that can send a job to the thread of a specific element Each UI control has a Dispatcher attribute

Programming the sensors Using a Dispatcher (version 1) A dispatcher can invoke a delegate

Programming the sensors Using a Dispatcher (version 2) Same code without the Action

Programming the sensors Run the program You should see the content of the Textbox change if your computer has an accelerometer Except for the thread managment, using the sensors in desktop applications is almost similar to Windows Store application

Conclusion

WinRT is available in desktop applications Using WinRT offers an easy way to access interesting features in Windows desktop application You just need to specify the target and to reference 2 DLLs Sensors programming Programming the sensors is not difficult in desktop applications You just need to resolve the thread troubles

License Creative Commons – By 3.0 You are free: to Share — to copy, distribute and transmit the work to Remix — to adapt the work to make commercial use of the work Under the following conditions: Attribution — You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). With the understanding that: Waiver — Any of the above conditions can be waived if you get permission from the copyright holder. Public Domain — Where the work or any of its elements is in the public domain under applicable law, that status is in no way affected by the license. Other Rights — In no way are any of the following rights affected by the license: – Your fair dealing or fair use rights, or other applicable copyright exceptions and limitations; – The author's moral rights; – Rights other persons may have either in the work itself or in how the work is used, such as publicity or privacy rights. Notice — For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to this web page.