现在的位置: 首页 > 综合 > 正文

自学Windows Phone 7随笔

2012年11月18日 ⁄ 综合 ⁄ 共 2172字 ⁄ 字号 评论关闭

      移动开发是趋势,作为程序员应该不断学习,我现在开始自学Windows Phone 7移动开发。其他的不多说了直接开始:

  1、我的开发环境:(http://msdn.microsoft.com/zh-cn/library/ff402535%28v=vs.92%29.aspx)

    *Windows 7 Vdisual Studio 2010 Express for Windows Phone 

           *安装Windows Phone SDK (工具)

           *Windows Phone Emulator (模拟器)也可以使用Windows Phone系统的真机

           *Expression Bleed 、SilverLight、XNA

     2、基本概念:

          *Metro、Zure、XNA、XMAl

     3、创建第一个Windows Phone 应用程序

         先看看模拟器:

         * vs 2010中创建项目

           打开:MainPage.xaml 

            <!--TitlePanel 包含应用程序的名称和页标题-->
        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
            <TextBlock x:Name="ApplicationTitle" Text="我的应用程序" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock x:Name="PageTitle" Text="  Hello World" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>

        <!--ContentPanel - 在此处放置其他内容-->
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
            <Button Content="Say Hi" Height="72" HorizontalAlignment="Left" Margin="37,49,0,0" Name="button1" VerticalAlignment="Top" Width="160" Click="button1_Click" />
        </Grid>

         MainPage.xaml .cs

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            PageTitle.Text = "Good morning!";  //标题
            MessageBox.Show("Welcome to Windows Phone 7 application","Message",MessageBoxButton.OK); //信息框
            this.NavigationService.Navigate(new Uri("/Second.xaml", UriKind.Relative));  //页面跳转
        }

        启动调试看效果:

  

    WMAppManifest.xml  中的修改

    1.设置默认启动页面

        <Tasks>
           <DefaultTask  Name ="_default" NavigationPage="MainPage.xaml"/>
        </Tasks>

       2.设置My First PhoneApp的图标 上图红框处

       <IconPath IsRelative="true" IsResource="false">myico.gif</IconPath>

      3.鼠标在My First PhoneApp上点击不放可以设置到Start中显示,BackgroundImageURI 可以设置该程序在Start中显示的图标

       <Tokens>
      <PrimaryToken TokenID="PhoneApp1Token" TaskName="_default">
        <TemplateType5>
          <BackgroundImageURI IsRelative="true" IsResource="false">myBackgroudimg.gif</BackgroundImageURI>
          <Count>0</Count>
          <Title>Welcome</Title>
        </TemplateType5>
      </PrimaryToken>
    </Tokens>

 

      好,第一个Windows Phone应用程序就基本完成了。第一次写博客,文笔和页面布局都不理想,请大家多多原谅,指正。希望跟喜欢Windows Phone的高手们多多交流。 续。。。

 

       

抱歉!评论已关闭.