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

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) 評(píng)論(0)  編輯 收藏 引用


只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
網(wǎng)站導(dǎo)航: 博客園   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>
            亚洲午夜久久久久久尤物| 麻豆freexxxx性91精品| 在线精品视频免费观看 | 欧美日本精品| 性色av一区二区怡红| 亚洲三级色网| 牛人盗摄一区二区三区视频| 亚洲夜间福利| 中日韩美女免费视频网址在线观看 | 免费看的黄色欧美网站| 午夜精品久久久久久久久久久久 | 亚洲精品久久久久中文字幕欢迎你| 欧美伊人久久久久久午夜久久久久| 一本一本a久久| 一本色道久久综合亚洲91| 日韩一级黄色片| 亚洲一区精品电影| 午夜精品久久久久久久| 香蕉久久夜色精品| 久久久久高清| 亚洲高清中文字幕| 一区二区三区你懂的| 亚洲欧美日韩在线一区| 久久久国产一区二区| 美女精品在线| 欧美视频一区| 国模一区二区三区| 最新高清无码专区| 99爱精品视频| 久久这里有精品视频| 国产亚洲精品福利| 久久人人97超碰国产公开结果| 久久久久免费观看| 欧美日韩亚洲一区| 国产主播精品| 中文日韩在线| 亚洲第一久久影院| 欧美一区二区三区免费观看视频| 男男成人高潮片免费网站| 欧美丝袜第一区| 日韩一级欧洲| 亚洲日本欧美天堂| 久久在线免费| 在线不卡免费欧美| 久久九九热免费视频| 99riav国产精品| 欧美精品久久久久久久久老牛影院 | 激情一区二区| 久久久国产精品一区二区三区| 一本色道久久综合亚洲精品小说| 欧美大色视频| 99精品国产在热久久婷婷| 亚洲国产精品女人久久久| 久久久久一区二区| 欧美亚日韩国产aⅴ精品中极品| 亚洲最快最全在线视频| 亚洲经典一区| 蜜臀va亚洲va欧美va天堂| 午夜精品一区二区三区四区| 国产亚洲精品成人av久久ww| 欧美在线精品一区| 久久久亚洲欧洲日产国码αv| 亚洲国产欧美在线人成| 亚洲国产精品va在线观看黑人| 免费美女久久99| 欧美资源在线| 欧美日韩另类字幕中文| 久久精品亚洲精品国产欧美kt∨| 久久久www免费人成黑人精品 | 国产日韩免费| 女人色偷偷aa久久天堂| 国产精品久久久久久久久借妻| 久久av红桃一区二区小说| 久久综合给合久久狠狠狠97色69| 日韩亚洲欧美中文三级| 久久国产精品网站| 亚洲视频碰碰| 欧美激情精品久久久久久黑人| 欧美诱惑福利视频| 欧美日韩免费高清| 亚洲国产精品成人va在线观看| 国产精品久久久久秋霞鲁丝| 亚洲欧洲一区二区在线播放| 亚洲电影在线看| 亚洲成人中文| 在线欧美不卡| 欧美大片专区| 国产婷婷色一区二区三区在线| 亚洲一级黄色av| 日韩视频不卡| 国产精品草莓在线免费观看| 亚洲国产欧美久久| 夜夜夜久久久| 国产精品素人视频| 久久九九精品| 亚洲精品久久久久中文字幕欢迎你| 亚洲国产一区二区在线| 欧美成人国产| 午夜精品理论片| 亚洲国产精品传媒在线观看 | 亚洲自啪免费| 欧美在线视频免费观看| 国产精品一区二区你懂的| 老司机成人在线视频| 美女精品在线| 一区二区免费看| 欧美日韩国产va另类| 亚洲欧美成人精品| 激情偷拍久久| 欧美成人自拍| 中文久久精品| 久久国产精品99国产| 在线观看视频一区二区| 欧美日韩国产色视频| 亚洲日韩视频| 久久国产直播| 亚洲精品乱码久久久久久蜜桃麻豆 | 久久久免费精品| 欧美波霸影院| 午夜久久久久| 最新日韩av| 黄色精品一二区| 欧美精品www在线观看| 翔田千里一区二区| 亚洲黄色在线| 美日韩精品免费| 毛片精品免费在线观看| 在线视频欧美日韩| 亚洲天堂偷拍| 最新亚洲一区| 在线观看亚洲精品视频| 国产午夜精品全部视频在线播放| 欧美精品啪啪| 噜噜爱69成人精品| 欧美理论在线播放| 免费欧美网站| 久久影视精品| 欧美成人午夜剧场免费观看| 欧美一区二区在线观看| 亚洲福利在线观看| 夜夜嗨av一区二区三区中文字幕 | 国产一区二区三区高清在线观看| 免费成人网www| 免费看黄裸体一级大秀欧美| 女人色偷偷aa久久天堂| 久久综合色88| 国产精品黄视频| 日韩午夜在线观看视频| 亚洲视频久久| 六十路精品视频| 一区二区三区四区五区在线| 黑人巨大精品欧美一区二区小视频| 在线观看日韩一区| 这里只有精品在线播放| 欧美在线视频免费播放| 免费黄网站欧美| 亚洲欧洲在线一区| 欧美在线免费播放| 国产精品婷婷| 亚洲美女视频在线观看| 欧美诱惑福利视频| 一区二区三区**美女毛片| 久久亚洲视频| 国产精品无码专区在线观看| 亚洲欧洲在线免费| 久久综合久久美利坚合众国| 一区二区国产在线观看| 欧美日韩免费一区二区三区| 亚洲网站在线播放| 国产精品美女999| 中国女人久久久| 亚洲国产片色| 欧美黄色一区二区| 亚洲国产日韩在线| 99ri日韩精品视频| 欧美日韩另类视频| 亚洲娇小video精品| 久久免费99精品久久久久久| 亚洲欧美自拍偷拍| 亚洲欧洲一区二区天堂久久| 亚洲欧洲精品一区二区| 欧美金8天国| 中文欧美字幕免费| 亚洲国产另类 国产精品国产免费| 欧美色视频日本高清在线观看| 亚洲一区二区三区免费观看| 亚洲欧美国产精品va在线观看| 国产最新精品精品你懂的| 欧美1区2区视频| 国产一区二区三区在线观看免费视频| 欧美一区二区大片| 免费日韩成人| 久久精品官网| 欧美三级不卡| 日韩一区二区电影网| 亚洲九九精品| 国产午夜精品福利| 欧美1级日本1级| 国产视频一区二区三区在线观看| 欧美激情无毛|