Windows Phone 7中英文互翻译源码下载

移动开发
本文为大家提供了Windows Phone 7中英文互翻译的源码下载,希望对正在学习或者刚刚接触Windows Phone开发的网友们有所启发和帮助。

15115614_H7rb.jpg

15115614_vKVA.jpg

XAML:

  1. <phone:PhoneApplicationPage 
  2.     x:Class="WebCPServic.MainPage" 
  3.     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  4.     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
  5.     xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" 
  6.     xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" 
  7.     xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
  8.     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
  9.     mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768" 
  10.     FontFamily="{StaticResource PhoneFontFamilyNormal}" 
  11.     FontSize="{StaticResource PhoneFontSizeNormal}" 
  12.     Foreground="{StaticResource PhoneForegroundBrush}" 
  13.     SupportedOrientations="Portrait" Orientation="Portrait" 
  14.     shell:SystemTray.IsVisible="True"> 
  15.  
  16.     <!--LayoutRoot 是包含所有页面内容的根网格--> 
  17.     <Grid x:Name="LayoutRoot" Background="Transparent"> 
  18.         <Grid.RowDefinitions> 
  19.             <RowDefinition Height="Auto"/> 
  20.             <RowDefinition Height="*"/> 
  21.         </Grid.RowDefinitions> 
  22.  
  23.         <!--TitlePanel 包含应用程序的名称和页标题--> 
  24.         <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28"> 
  25.             <TextBlock x:Name="ApplicationTitle" Text="WP7开发者:dev.ruanman.net" Style="{StaticResource PhoneTextNormalStyle}"/> 
  26.             <TextBlock x:Name="PageTitle" Text="中英文翻译" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/> 
  27.         </StackPanel> 
  28.  
  29.         <!--ContentPanel - 在此处放置其他内容--> 
  30.         <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> 
  31.             <TextBlock Height="49" HorizontalAlignment="Left" Margin="12,66,0,0" Name="des" Text="请输入你需要查询的英文或中文" VerticalAlignment="Top" Width="284" /> 
  32.             <TextBox Height="72" HorizontalAlignment="Left" Margin="6,106,0,0" Name="No" Text="dev.ruanman.net" VerticalAlignment="Top" Width="415" /> 
  33.             <Button Content="查询" Height="72" HorizontalAlignment="Left" Margin="12,184,0,0" Name="search" VerticalAlignment="Top" Width="247" Click="search_Click" /> 
  34.             <TextBlock Height="auto"  TextAlignment="Center" HorizontalAlignment="Center" Margin="6,510,0,0" Name="hugwp" Text="www.ruanman.net" VerticalAlignment="Top" Width="444" /> 
  35.             <ListBox Height="242" HorizontalAlignment="Left" Margin="9,262,0,0" Name="listBox1" VerticalAlignment="Top" Width="441" /> 
  36.         </Grid> 
  37.     </Grid> 
  38.  
  39.     <!--演示 ApplicationBar 用法的示例代码--> 
  40.     <!--<phone:PhoneApplicationPage.ApplicationBar> 
  41.         <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True"> 
  42.             <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="按钮 1"/> 
  43.             <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="按钮 2"/> 
  44.             <shell:ApplicationBar.MenuItems> 
  45.                 <shell:ApplicationBarMenuItem Text="菜单项 1"/> 
  46.                 <shell:ApplicationBarMenuItem Text="菜单项 2"/> 
  47.             </shell:ApplicationBar.MenuItems> 
  48.         </shell:ApplicationBar> 
  49.     </phone:PhoneApplicationPage.ApplicationBar>--> 
  50.  
  51. </phone:PhoneApplicationPage>  

C#:

  1. private void search_Click(object sender, RoutedEventArgs e) 
  2.        { 
  3.  
  4.            //实例化一个web service代理的对象 
  5.  
  6.            EnglishChineseReference.EnglishChineseSoapClient proxy = new EnglishChineseReference.EnglishChineseSoapClient(); 
  7.  
  8.            //getMobileCodeInfo方法调用结束之后 触发的事件 
  9.  
  10.            proxy.TranslatorStringCompleted += new EventHandler<EnglishChineseReference.TranslatorStringCompletedEventArgs>(proxy_GetIcpInfoByDomainCompleted); 
  11.            //将调用信息包括方法名和参数加入到soap消息中通过http传送给web service服务端    
  12.  
  13.            //这里对应的是调用了web service的getMobileCodeInfo方法 
  14.  
  15.            proxy.TranslatorStringAsync(No.Text, ""); 
  16.  
  17.        } 
  18.  
  19.        void proxy_GetIcpInfoByDomainCompleted(object sender, EnglishChineseReference.TranslatorStringCompletedEventArgs e) 
  20.        { 
  21.  
  22.            if (e.Error == null
  23.            { 
  24.                try 
  25.                { 
  26.                    this.listBox1.ItemsSource = e.Result; 
  27.  
  28.                } 
  29.                catch (Exception) 
  30.                { 
  31.  
  32.                    MessageBox.Show("网络出现问题,或者是手机号码错误"); 
  33.                } 
  34.            } 
  35.            else 
  36.            { 
  37.                MessageBox.Show("网络出现问题,或者是手机号码错误"); 
  38.            } 
  39.        }  

源码下载:

http://down.51cto.com/data/840237

责任编辑:闫佳明 来源: wpcome
相关推荐

2015-12-01 11:17:41

Windows 10Version 151镜像

2009-02-18 22:06:38

Windows 7中英文2in1安装盘

2010-04-08 09:33:05

微软Bing必应

2015-08-18 15:19:51

2009-03-17 09:52:22

Unicode中英文Python

2013-05-31 00:35:05

2010-04-06 09:33:37

CentOS系统

2009-10-20 14:07:00

CCIE必读书籍

2009-08-13 09:26:14

.NET正则表达式

2010-04-08 17:40:23

Windows Pho

2010-08-02 14:47:51

Windows PhoWindows PhoWindows Pho

2011-08-12 10:10:17

2013-07-30 11:18:37

Windows PhoWindows Pho

2010-02-05 09:57:25

C++中英文字符串

2010-11-26 16:00:08

Windows Pho

2010-05-05 13:16:02

Windows PhoWindows CE

2011-06-17 14:16:21

ListBoxWindows Pho

2012-05-15 10:05:56

WP7 下载进度

2011-04-01 13:20:40

Windows Pho应用程序

2010-12-21 10:02:48

SilverlightWindows Pho
点赞
收藏

51CTO技术栈公众号