Skip to content

Commit

Permalink
添加客户端代码
Browse files Browse the repository at this point in the history
  • Loading branch information
nl8590687 committed Jul 24, 2018
1 parent 6f0a6c4 commit 8e079bb
Show file tree
Hide file tree
Showing 17 changed files with 979 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
# ASRT_SpeechClient_UWP
An UWP client software for ASRT speech recognition system. 一个可用于ASRT语音识别系统的UWP客户端软件

本软件是用来配套ASRT语音识别系统演示用的客户端,不过也可以基于此进一步开发相关应用软件

[查看ASRT语音识别系统](https://github.com/nl8590687/ASRT_SpeechRecognition)

43 changes: 43 additions & 0 deletions SpeechClient_UWP/SpeechClient_UWP.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27703.2042
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpeechClient_UWP", "SpeechClient_UWP\SpeechClient_UWP.csproj", "{2E08D93C-BE50-485C-B24C-2CF22DBD5873}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM = Debug|ARM
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|ARM = Release|ARM
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2E08D93C-BE50-485C-B24C-2CF22DBD5873}.Debug|ARM.ActiveCfg = Debug|ARM
{2E08D93C-BE50-485C-B24C-2CF22DBD5873}.Debug|ARM.Build.0 = Debug|ARM
{2E08D93C-BE50-485C-B24C-2CF22DBD5873}.Debug|ARM.Deploy.0 = Debug|ARM
{2E08D93C-BE50-485C-B24C-2CF22DBD5873}.Debug|x64.ActiveCfg = Debug|x64
{2E08D93C-BE50-485C-B24C-2CF22DBD5873}.Debug|x64.Build.0 = Debug|x64
{2E08D93C-BE50-485C-B24C-2CF22DBD5873}.Debug|x64.Deploy.0 = Debug|x64
{2E08D93C-BE50-485C-B24C-2CF22DBD5873}.Debug|x86.ActiveCfg = Debug|x86
{2E08D93C-BE50-485C-B24C-2CF22DBD5873}.Debug|x86.Build.0 = Debug|x86
{2E08D93C-BE50-485C-B24C-2CF22DBD5873}.Debug|x86.Deploy.0 = Debug|x86
{2E08D93C-BE50-485C-B24C-2CF22DBD5873}.Release|ARM.ActiveCfg = Release|ARM
{2E08D93C-BE50-485C-B24C-2CF22DBD5873}.Release|ARM.Build.0 = Release|ARM
{2E08D93C-BE50-485C-B24C-2CF22DBD5873}.Release|ARM.Deploy.0 = Release|ARM
{2E08D93C-BE50-485C-B24C-2CF22DBD5873}.Release|x64.ActiveCfg = Release|x64
{2E08D93C-BE50-485C-B24C-2CF22DBD5873}.Release|x64.Build.0 = Release|x64
{2E08D93C-BE50-485C-B24C-2CF22DBD5873}.Release|x64.Deploy.0 = Release|x64
{2E08D93C-BE50-485C-B24C-2CF22DBD5873}.Release|x86.ActiveCfg = Release|x86
{2E08D93C-BE50-485C-B24C-2CF22DBD5873}.Release|x86.Build.0 = Release|x86
{2E08D93C-BE50-485C-B24C-2CF22DBD5873}.Release|x86.Deploy.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8B5B3468-5D8A-490F-A8BF-E87DA1BCA19C}
EndGlobalSection
EndGlobal
7 changes: 7 additions & 0 deletions SpeechClient_UWP/SpeechClient_UWP/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Application
x:Class="SpeechClient_UWP.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:SpeechClient_UWP">

</Application>
100 changes: 100 additions & 0 deletions SpeechClient_UWP/SpeechClient_UWP/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

namespace SpeechClient_UWP
{
/// <summary>
/// 提供特定于应用程序的行为,以补充默认的应用程序类。
/// </summary>
sealed partial class App : Application
{
/// <summary>
/// 初始化单一实例应用程序对象。这是执行的创作代码的第一行,
/// 已执行,逻辑上等同于 main() 或 WinMain()。
/// </summary>
public App()
{
this.InitializeComponent();
this.Suspending += OnSuspending;
}

/// <summary>
/// 在应用程序由最终用户正常启动时进行调用。
/// 将在启动应用程序以打开特定文件等情况下使用。
/// </summary>
/// <param name="e">有关启动请求和过程的详细信息。</param>
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
Frame rootFrame = Window.Current.Content as Frame;

// 不要在窗口已包含内容时重复应用程序初始化,
// 只需确保窗口处于活动状态
if (rootFrame == null)
{
// 创建要充当导航上下文的框架,并导航到第一页
rootFrame = new Frame();

rootFrame.NavigationFailed += OnNavigationFailed;

if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: 从之前挂起的应用程序加载状态
}

// 将框架放在当前窗口中
Window.Current.Content = rootFrame;
}

if (e.PrelaunchActivated == false)
{
if (rootFrame.Content == null)
{
// 当导航堆栈尚未还原时,导航到第一页,
// 并通过将所需信息作为导航参数传入来配置
// 参数
rootFrame.Navigate(typeof(MainPage), e.Arguments);
}
// 确保当前窗口处于活动状态
Window.Current.Activate();
}
}

/// <summary>
/// 导航到特定页失败时调用
/// </summary>
///<param name="sender">导航失败的框架</param>
///<param name="e">有关导航失败的详细信息</param>
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
{
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
}

/// <summary>
/// 在将要挂起应用程序执行时调用。 在不知道应用程序
/// 无需知道应用程序会被终止还是会恢复,
/// 并让内存内容保持不变。
/// </summary>
/// <param name="sender">挂起的请求的源。</param>
/// <param name="e">有关挂起请求的详细信息。</param>
private void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
//TODO: 保存应用程序状态并停止任何后台活动
deferral.Complete();
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions SpeechClient_UWP/SpeechClient_UWP/MainPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<Page
x:Class="SpeechClient_UWP.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:SpeechClient_UWP"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

<Grid Background="#FF043CF7">
<ScrollViewer Name="ScrollViewer" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" RenderTransformOrigin="1.774,9.9" Margin="0,0,0,200">
<TextBox x:Name="text_note" HorizontalAlignment="Stretch" Margin="0,0,0,0" Text="" TextWrapping="Wrap" AcceptsReturn="True" VerticalAlignment="Stretch" BorderThickness="0,0,0,2" RequestedTheme="Default" ScrollViewer.VerticalScrollBarVisibility="Auto" FontFamily="Microsoft YaHei" FontSize="108" Foreground="White" Background="#66FFFFFF" FontWeight="Bold"/>
</ScrollViewer>

<Button x:Name="btn_start_speech_input" Content="开始语音输入" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="100,500,0,50" Width="300" Height="120" Foreground="White" FontSize="36" Click="btn_start_speech_input_Click"/>
<Button x:Name="btn_end_speech_input" Content="停止语音输入" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="450,0,0,50" Width="300" Height="120" Foreground="White" FontSize="36" Click="btn_end_speech_input_Click"/>
<Button x:Name="btn_save_file" Content="保存文件" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="100,500,100,50" Width="300" Height="120" Foreground="White" FontSize="36" Click="btn_save_file_Click"/>
<TextBox x:Name="MessageBox" HorizontalAlignment="Center" Height="100" Text=" 正在识别... " VerticalAlignment="Bottom" Width="400" Background="#66FFFFFF" FontSize="70" Foreground="White" FontFamily="Microsoft YaHei" IsReadOnly="True" Margin="0,0,0,180"/>

</Grid>
</Page>
Loading

0 comments on commit 8e079bb

Please sign in to comment.