青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

An HP TouchSmart Application Development Guidelines Primer (Page 1 of 3)

LINK: http://www.touchsmartcommunity.com/article/95/An-HP-TouchSmart-Application-Development-Guidelines-Primer/

An introduction to building HP TouchSmart-hosted applications and a step-by-step tutorial for a “Hello World”

Building Your First TouchSmart Application
A developers guide to the TouchSmart Platform

Introduction

The Hewlett-Packard TouchSmart PC is an innovative new PC form-factor which affords users the unique ability to control interactions using only their hands. Through the use of a very stylish “10 foot” style user interface, the user can simply touch the integrated screen and perform most essential functions – viewing photos, listening to music, and surfing the web – all without using a keyboard or mouse.

The TouchSmart interface can be considered an entirely new user-interface platform – and now HP has opened up this platform to the entire developer community. With the release of the TouchSmart Application Developer Guidelines you can now build applications which run on this unique platform – and cater to its expanding user-base.

This article walks you through building your first TouchSmart application, with the goal of creating a basic application template which you can use for all your TouchSmart projects.

Getting Started

In order to follow the steps in this document, you will need to be familiar with Windows Presentation Foundation (WPF) and .NET development with C#. This article assumes a basic knowledge of these technologies. Please visit the Microsoft Developer Network (MSDN) at http://msdn.microsoft.com for more information.

In addition, the following is required:

  • TouchSmart PC (model IQ504 or IQ506, current at the time of this writing)
  • Latest TouchSmart software (available from http://support.hp.com)
  • Microsoft Visual Studio 2008, Express (free) or Professional Edition
  • HP TouchSmart Application Development Guidelines (available from here).
  • .NET Framework 3.5 (although the same techniques can be used to build an application using Visual Studio 2005 and .NET 3.0)

It is recommended you install Visual Studio 2008 on the TouchSmart PC for ease of development, however it is not required. Since the TouchSmart application we are building is simply a Windows Presentation Foundation application it will run on any Vista or Windows XP PC with .NET 3.5.

Important Background Information

Before getting started you should know some important background information about a typical TouchSmart application:

  • To best integrate with the TouchSmart look-and-feel you should develop your application using the Windows Presentation Foundation (WPF)
  • The application runs as a separate process with a window that has the frame removed, it is not running within the TouchSmart shell process.
  • The TouchSmart shell is responsible for launching your application. Additionally, the TouchSmart shell will control the position and sizing of your window.
  • You must create three separate UI layouts for your application. This is not as difficult as it sounds; only one layout is interactive with controls – the other two layouts are for display only.
  • Design your application for a “10 foot” viewing experience. Plan to increase font and control sizes if you are converting an existing application.
  • Do not use pop-up windows in your application. This is perhaps the most unique requirement in building a TouchSmart application. The Windows “MessageBox” and other pop-up windows are not supported and should not be used. The best model to follow is to build your application like it was going to run in a web browser.
  • Your application must support 64-bit Vista, as this is the operating system used on the TouchSmart PC.

Building the HelloTouchSmart Application

The rest of this article describes how to build a basic TouchSmart enabled application. Over the next few sections, you will build a basic TouchSmart application which you can use as a template for all your TouchSmart projects.

Start by launching Visual Studio 2008 and create a new project. If you have User Account Control (UAC) enabled make sure to launch Visual Studio with Administrator privileges.

  • On the File menu, select New Project
  • Select WPF Application
  • Name your project “HelloTouchSmart” and click OK
  • For Visual Studio 2008 Professional Users, select the path to save your project. Choose “C:\TouchSmart”
  • For Visual Studio 2008 Express users, you will be prompted to save when you close your project. Choose “C:\TouchSmart” as the path to save your project to.

1. After the project is created, double-click the Window1.xaml file to open it. You are now going to make some important changes to this file which make it a TouchSmart application:

  • Edit the Window definition to match the XAML below. The most important aspect of this is making your application appear without a Window frame (using the combination of ShowInTaskbar, WindowStyle, and ResizeMode attributes). Additionally, it is important to position your window off screen (using the Top and Left attributes), since the TouchSmart shell will move it into the correct position as needed.

    <Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Name="HelloTouchSmart"
        Top="{Binding Source={x:Static SystemParameters.VirtualScreenHeight}}"
        Left="{Binding Source={x:Static SystemParameters.VirtualScreenWidth}}"
        Background="Black"
        ShowInTaskbar="False"
        WindowStyle="None"
        ResizeMode="NoResize">
        
  • Now add some basic text to the window by inserting the following between the elements in the XAML file. Keep in mind text on a TouchSmart UI should be large (at least 18 point), and match the font family used by the TouchSmart shell.

    <TextBlock Text="My first TouchSmart App!" Foreground="White" FontFamily="Segoe UI" FontSize="24"/>
        

2. Select Build, then Build Solution to create the HelloTouchSmart application.

  • Depending on the edition of Visual Studio you are using, the “HelloTouchSmart.exe” will be created in either the bin\Debug (Visual Studio Professional) or bin\Release (Visual Studio Express) folders
  • It is important to know where the output file is located since we will be registering the application with the TouchSmart shell in the next step.

3. Create a new XML file which contains information to register the application with the TouchSmart shell

  • Select Project then Add New Item
  • Select XML File
  • Create a file called Register.xml

4. The registration XML file needs specific attributes including the full-path to your application. Replace the contents of the file you created in the previous step with the contents below. If you have created your project in a different path make sure you correct the AppPath element below.

<AppManagementSetting>
<UserEditable>true</UserEditable>
<RunAtStartup>true</RunAtStartup>
<RemoveFromTaskbar>false</RemoveFromTaskbar>   <AppPath>C:\TouchSmart\HelloTouchSmart\HelloTouchSmart\bin\Release\HelloTouchSmart.exe
</AppPath>
<AppParameters>chromeless</AppParameters>
<AllowAttach>true</AllowAttach>
<Section>Top</Section>
<Type>InfoView</Type>
<DisplayName>HelloTouchSmart</DisplayName>
<IsVisible>true</IsVisible>
<UserDeleted>false</UserDeleted>
<InDefaultSet>false</InDefaultSet>
<IconName />
</AppManagementSetting>

 

5. Save the XML file. Now it will need to be registered with the TouchSmart shell for your application to start appear in the TouchSmart shell.

  • Make sure the TouchSmart shell is completely closed (click Close from the TouchSmart shell main screen)
  • Start a command window with Admin rights (if UAC is enabled)
  • Change the working directory to C:\Program Files(x86)\Hewlett-Packard\TouchSmart\SmartCenter 2.0
  • Type the following command line to register your application RegisterSmartCenterApp.exe updateconfig “C:\TouchSmart\HelloTouchSmart\HelloTouchSmart\Register.xml”
  • You should receive a successful message upon installation. Note you only need to register your application once.

6. After finishing these steps you should be greeted with your first TouchSmart application. Congratulations!

 

Enhancing the HelloTouchSmart Application

Now that you have a basic idea of how to build a TouchSmart application, the next step is to enhance it take advantage of the three layouts in the TouchSmart shell.

Each TouchSmart application needs to support three different UI views: small, medium, and large. If the user drags an application from the bottom area to the top area, it should switch from a small layout to a medium layout. If the user then clicks on the application in the medium layout it should switch to a large layout.

The small layout typically is an image that represents your application. The artwork should be a high-quality image that blends into the TouchSmart shell as best as possible.

The medium layout typically represents a non-interactive status view of your application. If your application is designed to display content from the web, for instance, this could be recent information your application has downloaded (e.g. most recent photos).

Finally, the large view represents your application. This is where you should expose all functions and features you intend to provide to the user. In the steps below we will enhance our sample to display an icon in the small layout and two different layouts for the medium and large views.

1. Start by closing the TouchSmart shell completely (clicking the Close button in the lower right-hand corner). Currently you will also need to manually “end task” the “HelloTouchSmart.exe” from the Windows task manager, as it doesn’t get closed by the TouchSmart shell when you close it. If you don’t close the application Visual Studio will be unable to build your project.

2. Open the HelloTouchSmart project

  • Double-click on the Window1.xaml file to open it. First we are going to define the 3 UI layouts.
  • We will also need an image in the project. Copy your favorite image (here we copied img35.jpg from the \Windows\Web\Wallpaper folder which is present on every installation of Windows Vista) into the project folder.
  • Add the image to your project by selecting Project->Add Existing Item. Change the file filter to “Image Files” then select the image file from your project folder.

3. You can define your layout using any of the WPF container elements; however for this example we are going to use the DockPanel.

  • Remove the TextBlock we defined in the section above.
  • Define three new sections between the as follows:

    <DockPanel Name="SmallUI" Background="Black">
        <Image Stretch="UniformToFill" Source="img35.jpg"/>
        </DockPanel>
        <DockPanel Name="MediumUI" Background="Black">
        <TextBlock Text="Medium UI" Foreground="White" FontFamily="Segoe UI"
        FontSize="24"/>
        </DockPanel>
        <DockPanel Name="LargeUI" Background="Black">
        <TextBlock Text="Large UI" Foreground="White" FontFamily="Segoe UI"
        FontSize="96"/>
        </DockPanel>
        

4. Compile the application then launch the TouchSmart shell.

  • There may be cases where the TouchSmart shell won’t re-launch your application properly.
  • If your application doesn’t appear for any reason (or appears without a UI), click Personalize, find the HelloTouchSmart tile, de-activate it and click OK.
  • Click Personalize again, find the HelloTouchSmart tile, activate it and click OK.
  • The TouchSmart shell should now launch your application.

5. As you can see our application appears but is only showing the large view. Close the TouchSmart shell and switch back to Visual Studio – we’ll fix this issue now.

  • Remember to “end task” HelloTouchSmart.exe from the Windows task manager

6. We are now going to add some code to Window1.xaml.cs to handle the resizing and show the appropriate controls.

  • Double-click on the Window1.xaml.cs file to open it. We will add code to show and hide our three DockPanels based on the size of the UI.
  • The size ratios below were derived from the HP TouchSmart Application Development Guidelines.

    public Window1()
        {
        InitializeComponent();
        SizeChanged += new SizeChangedEventHandler(Window1_SizeChanged);
        }
        void Window1_SizeChanged(object sender, SizeChangedEventArgs e)
        {
        double ratio = Math.Max(this.ActualWidth, this.ActualHeight) /
        Math.Max(SystemParameters.PrimaryScreenWidth,
        SystemParameters.PrimaryScreenHeight);
        if (ratio >= 0.68295) //Large
        {
        SmallUI.Visibility = Visibility.Collapsed;
        MediumUI.Visibility = Visibility.Collapsed;
        LargeUI.Visibility = Visibility.Visible;
        }
        else if (ratio <= 0.18) //Small
        {
        SmallUI.Visibility = Visibility.Visible;
        MediumUI.Visibility = Visibility.Collapsed;
        LargeUI.Visibility = Visibility.Collapsed;
        }
        else //Medium
        {
        SmallUI.Visibility = Visibility.Collapsed;
        MediumUI.Visibility = Visibility.Visible;
        LargeUI.Visibility = Visibility.Collapsed;
        }
        }
        
  • Seasoned WPF developers might see a better way to hide/show the panels but for the sake of being clear and concise we are keeping this code fairly simple. Feel free to create your own mechanism that suits your particular need.
  • Since the TouchSmart shell simply resizes and positions your window according to its needs you can use any WPF standard event handling and perform necessary adjustments to your user interface.

7. One final change is to prevent the application from being accidentally launched by a user. Since the application’s window appears initially off-screen it is important we only allow the application to be started by the TouchSmart shell.

  • Change the Window1 constructor to the following:

    public Window1()
        {
        bool okToRun = false;
        foreach (string str in Environment.GetCommandLineArgs())
        {
        if (str.CompareTo("chromeless") == 0)
        {
        okToRun = true;
        }
        }
        if (!okToRun)
        {
        Application.Current.Shutdown();
        }
        else
        {
        InitializeComponent();
        SizeChanged += new SizeChangedEventHandler(Window1_SizeChanged);
        }
        }
        
  • The parameter being checked (chromeless) was actually provided in the registration XML file created in the first part of this article. The TouchSmart shell will pass this parameter to your application on launch.

8. Compile and run your application as done in step four. You should now see your application display three distinct user interfaces depending on its placement in the TouchSmart shell.

You might have noticed the application at this point does not have an icon in the shell. To fix this issue create a compressed “Windows Vista style”256x256 PNG icon and embed it in the application executable by selecting Project->Properties and select your icon from the Application tab. There are several 3rd party tools for creating this specialized type of icon available since the standard version of Visual Studio does not support compressed PNG icons.

Tips for Debugging

If you would like to debug your application with the Visual Studio debugger we recommend you attach to the running process by selecting Debug->Attach to Process. This only works for the Professional Edition of Visual Studio.

To debug with the Express edition, you must change your window style to run as a normal Windows application and remove the check for “chromeless” above.

Summary

You should now be familiar with how a basic TouchSmart application is put together and have a good starting point for your future projects. Some other important items not covered (but are outlined in the HP TouchSmart Application Development Guidelines) include application skinning and UI notifications. These advanced topics will be covered in a follow-up article, however for now please refer to the HP developer document for more detailed information.

 

posted on 2009-05-25 15:26 zmj 閱讀(1116) 評論(0)  編輯 收藏 引用


只有注冊用戶登錄后才能發表評論。
網站導航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            亚洲一区二区成人在线观看| 在线日韩视频| 欧美三区美女| 99精品欧美一区二区三区综合在线 | 久久精品人人做人人综合| 国产精品毛片| 最新国产成人av网站网址麻豆| 亚洲欧美日本另类| 一区二区三区波多野结衣在线观看| 亚洲欧美激情一区二区| 国产一区二区成人久久免费影院| 久热精品视频在线观看一区| 欧美片第1页综合| 久久国产精品99久久久久久老狼 | 国产精品你懂的| 国产精品久久久久久模特| 亚洲视频专区在线| 亚洲高清视频中文字幕| 欧美激情视频在线免费观看 欧美视频免费一 | 午夜一区不卡| 欧美高清在线| 欧美国产一区在线| 亚洲黄色一区| 亚洲精品一级| 亚洲精品视频免费观看| 日韩一级二级三级| 久久不见久久见免费视频1| 亚洲日韩成人| 亚洲欧洲日产国码二区| 国产麻豆日韩欧美久久| 午夜国产不卡在线观看视频| 国产一区二区久久久| 亚洲国产成人一区| 黄色影院成人| 欧美午夜在线一二页| 亚洲欧美激情四射在线日 | 国产亚洲精品久久久| 亚洲国产精品va在看黑人| 亚洲深夜激情| 欧美激情五月| 午夜精品理论片| 欧美激情亚洲| 国产主播精品| 欧美久久久久久蜜桃| 国产一区清纯| 亚洲一区网站| 亚洲二区三区四区| 亚洲日本欧美| 亚洲欧美日韩一区二区三区在线观看 | 国产精品一区视频| avtt综合网| 亚洲精选久久| 欧美三级午夜理伦三级中视频| 国产日产欧美一区| 国产乱码精品一区二区三| 99在线|亚洲一区二区| 日韩小视频在线观看专区| 欧美精品一区在线播放| 一区二区不卡在线视频 午夜欧美不卡在| 久久久亚洲国产天美传媒修理工| 亚洲欧美三级在线| 国产一区在线播放| 美女在线一区二区| 欧美在线不卡| 日韩午夜一区| 国产日本欧美一区二区三区在线| 在线综合亚洲| 欧美护士18xxxxhd| 久久大逼视频| 国产亚洲精品7777| 亚洲电影自拍| 欧美黑人国产人伦爽爽爽| 亚洲精品在线看| 久久全球大尺度高清视频| 亚洲毛片在线观看.| 久久中文字幕一区| 亚洲精品一区二区三区福利| 亚洲欧美日韩成人高清在线一区| 亚洲精品一区二区三区福利| 欧美电影免费观看网站| 欧美色123| 亚洲精品中文字幕有码专区| 国产欧美va欧美va香蕉在| 亚洲激情偷拍| 亚洲国产精品成人| 新67194成人永久网站| 亚洲最新在线视频| 欧美伊人影院| 亚洲二区在线视频| 久久在线免费观看视频| 欧美日本一区| 久久免费精品视频| 性做久久久久久久免费看| 国产一区久久久| 亚洲一区二区欧美| 看欧美日韩国产| 国产欧美一区二区精品秋霞影院| 欧美 亚欧 日韩视频在线| 亚洲福利视频网站| 亚洲毛片视频| 欧美日韩国产综合在线| 亚洲第一区色| 亚洲欧美日韩国产一区二区| 国产精品丝袜91| 亚洲图片自拍偷拍| 噜噜噜噜噜久久久久久91| 亚洲欧洲精品一区二区三区 | 欧美大片第1页| 亚洲国产欧美日韩精品| 欧美乱人伦中文字幕在线| 在线综合亚洲| 免费国产一区二区| 亚洲欧美成人综合| 日韩午夜激情av| 亚洲一区中文| 日韩亚洲欧美成人| 久久婷婷蜜乳一本欲蜜臀| 裸体女人亚洲精品一区| 欧美在线视频一区二区| 亚洲综合精品自拍| 欧美成人一区二区三区| 亚洲系列中文字幕| 麻豆精品一区二区综合av| 欧美一级在线视频| 夜夜嗨av一区二区三区四季av | 亚洲大胆人体在线| 久久成人18免费网站| 久久免费视频这里只有精品| 久久最新视频| 国产精品乱码| 精品9999| 国产精品99久久不卡二区| 亚洲福利视频一区| 99视频国产精品免费观看| 亚洲欧洲日产国产网站| 欧美巨乳在线| 欧美va天堂在线| 欧美在线观看网站| 欧美成人精品激情在线观看| 亚洲三级影院| 欧美香蕉视频| 在线午夜精品| 久久精品1区| 久久久999精品免费| 亚洲精品在线免费观看视频| 亚洲一区二区三区视频播放| 欧美日韩在线第一页| 国产一区二区三区免费不卡 | 欧美国产日本| 亚洲最新视频在线| 欧美波霸影院| 国产亚洲欧美一区二区三区| 国产三级欧美三级| 国内精品久久久久久久果冻传媒| 欧美美女福利视频| 国产精品久久久久aaaa| 伊人春色精品| 韩曰欧美视频免费观看| 欧美一级在线播放| 亚洲深夜福利视频| 91久久精品日日躁夜夜躁欧美 | 欧美一区二区在线观看| 欧美精品乱码久久久久久按摩| 性8sex亚洲区入口| 亚洲美女毛片| 9色国产精品| 久久综合五月| 亚洲午夜羞羞片| 日韩亚洲成人av在线| 91久久黄色| 亚洲激情成人| 国产伦精品一区二区三区四区免费| 欧美在线资源| 欧美极品aⅴ影院| 久久久最新网址| 国产精品久久久久久久久借妻| 久久躁日日躁aaaaxxxx| 夜夜嗨av一区二区三区网站四季av| 久久一本综合频道| 激情欧美国产欧美| 亚洲欧美日韩国产精品| 一区二区久久| 欧美国产日韩精品| 亚洲愉拍自拍另类高清精品| 亚洲欧美日韩综合一区| 亚洲一区尤物| 欧美激情影音先锋| 蜜桃久久av一区| 亚洲一品av免费观看| 国产一区二区你懂的| 一本久久综合亚洲鲁鲁五月天| 国产精品99久久久久久久vr| 亚洲午夜一级| 亚洲精品久久7777| 欧美一区二区三区久久精品茉莉花| 欧美一级片久久久久久久| 国产精品久久久久久一区二区三区 | 欧美日韩国产成人在线| 久久成人在线| 宅男精品视频|