Browse Source

添加简易客户端调用示例

Zhangtaotao 6 years ago
parent
commit
a56f2c2dcc

+ 49 - 0
.gitignore

@@ -20,3 +20,52 @@ WeChatCore/obj/Debug/WeChatCore.csprojResolveAssemblyReference.cache
 WeChatCore/bin/Debug/Data/data.dat
 WeChatCore/obj/Debug/WeChatCore.csproj.CopyComplete
 WeChatCore/obj/Debug/WeChatCore.csproj.CoreCompileInputs.cache
+sample/EasyWeChatClient/.vs/EasyWeChatClient/v14/.suo
+sample/EasyWeChatClient/.vs/EasyWeChatClient/v15/.suo
+sample/EasyWeChatClient/.vs/EasyWeChatClient/v15/Server/sqlite3/db.lock
+sample/EasyWeChatClient/.vs/EasyWeChatClient/v15/Server/sqlite3/storage.ide
+sample/EasyWeChatClient/.vs/EasyWeChatClient/v15/Server/sqlite3/storage.ide-shm
+sample/EasyWeChatClient/.vs/EasyWeChatClient/v15/Server/sqlite3/storage.ide-wal
+sample/EasyWeChatClient/EasyWeChatClient/bin/Debug/Check.jpg
+sample/EasyWeChatClient/EasyWeChatClient/bin/Debug/CommonTools.dll
+sample/EasyWeChatClient/EasyWeChatClient/bin/Debug/CommonTools.pdb
+sample/EasyWeChatClient/EasyWeChatClient/bin/Debug/Data/data.dat
+sample/EasyWeChatClient/EasyWeChatClient/bin/Debug/EasyWeChatClient.exe
+sample/EasyWeChatClient/EasyWeChatClient/bin/Debug/EasyWeChatClient.exe.config
+sample/EasyWeChatClient/EasyWeChatClient/bin/Debug/EasyWeChatClient.pdb
+sample/EasyWeChatClient/EasyWeChatClient/bin/Debug/EasyWeChatClient.vshost.exe
+sample/EasyWeChatClient/EasyWeChatClient/bin/Debug/EasyWeChatClient.vshost.exe.config
+sample/EasyWeChatClient/EasyWeChatClient/bin/Debug/EasyWeChatClient.vshost.exe.manifest
+sample/EasyWeChatClient/EasyWeChatClient/bin/Debug/HttpHelper.dll
+sample/EasyWeChatClient/EasyWeChatClient/bin/Debug/HttpHelper.pdb
+sample/EasyWeChatClient/EasyWeChatClient/bin/Debug/ICSharpCode.SharpZipLib.dll
+sample/EasyWeChatClient/EasyWeChatClient/bin/Debug/Log/WeChat.log
+sample/EasyWeChatClient/EasyWeChatClient/bin/Debug/Newtonsoft.Json.dll
+sample/EasyWeChatClient/EasyWeChatClient/bin/Debug/Newtonsoft.Json.xml
+sample/EasyWeChatClient/EasyWeChatClient/bin/Debug/SyncKey.log
+sample/EasyWeChatClient/EasyWeChatClient/bin/Debug/User.jpg
+sample/EasyWeChatClient/EasyWeChatClient/bin/Debug/WeChatCore.dll
+sample/EasyWeChatClient/EasyWeChatClient/bin/Debug/WeChatCore.pdb
+sample/EasyWeChatClient/EasyWeChatClient/obj/Debug/App.g.cs
+sample/EasyWeChatClient/EasyWeChatClient/obj/Debug/App.g.i.cs
+sample/EasyWeChatClient/EasyWeChatClient/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
+sample/EasyWeChatClient/EasyWeChatClient/obj/Debug/EasyWeChatClient.csproj.CopyComplete
+sample/EasyWeChatClient/EasyWeChatClient/obj/Debug/EasyWeChatClient.csproj.CoreCompileInputs.cache
+sample/EasyWeChatClient/EasyWeChatClient/obj/Debug/EasyWeChatClient.csproj.FileListAbsolute.txt
+sample/EasyWeChatClient/EasyWeChatClient/obj/Debug/EasyWeChatClient.csproj.GenerateResource.Cache
+sample/EasyWeChatClient/EasyWeChatClient/obj/Debug/EasyWeChatClient.csprojResolveAssemblyReference.cache
+sample/EasyWeChatClient/EasyWeChatClient/obj/Debug/EasyWeChatClient.exe
+sample/EasyWeChatClient/EasyWeChatClient/obj/Debug/EasyWeChatClient.g.resources
+sample/EasyWeChatClient/EasyWeChatClient/obj/Debug/EasyWeChatClient.pdb
+sample/EasyWeChatClient/EasyWeChatClient/obj/Debug/EasyWeChatClient.Properties.Resources.resources
+sample/EasyWeChatClient/EasyWeChatClient/obj/Debug/EasyWeChatClient_MarkupCompile.cache
+sample/EasyWeChatClient/EasyWeChatClient/obj/Debug/EasyWeChatClient_MarkupCompile.i.cache
+sample/EasyWeChatClient/EasyWeChatClient/obj/Debug/EasyWeChatClient_MarkupCompile.i.lref
+sample/EasyWeChatClient/EasyWeChatClient/obj/Debug/EasyWeChatClient_MarkupCompile.lref
+sample/EasyWeChatClient/EasyWeChatClient/obj/Debug/MainWindow.baml
+sample/EasyWeChatClient/EasyWeChatClient/obj/Debug/MainWindow.g.cs
+sample/EasyWeChatClient/EasyWeChatClient/obj/Debug/MainWindow.g.i.cs
+sample/EasyWeChatClient/EasyWeChatClient/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
+sample/EasyWeChatClient/EasyWeChatClient/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
+sample/EasyWeChatClient/EasyWeChatClient/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
+sample/EasyWeChatClient/EasyWeChatClient/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll

+ 31 - 0
sample/EasyWeChatClient/EasyWeChatClient.sln

@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+VisualStudioVersion = 14.0.25420.1
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyWeChatClient", "EasyWeChatClient\EasyWeChatClient.csproj", "{FE7197A0-84EC-4024-B34D-9F84DD0B3749}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WeChatCore", "..\..\WeChatCore\WeChatCore.csproj", "{588E8149-F7FC-4304-87E1-43426D41AAC4}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{FE7197A0-84EC-4024-B34D-9F84DD0B3749}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{FE7197A0-84EC-4024-B34D-9F84DD0B3749}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{FE7197A0-84EC-4024-B34D-9F84DD0B3749}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{FE7197A0-84EC-4024-B34D-9F84DD0B3749}.Release|Any CPU.Build.0 = Release|Any CPU
+		{588E8149-F7FC-4304-87E1-43426D41AAC4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{588E8149-F7FC-4304-87E1-43426D41AAC4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{588E8149-F7FC-4304-87E1-43426D41AAC4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{588E8149-F7FC-4304-87E1-43426D41AAC4}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {7CFD712E-948D-4304-A885-0EA7C5FA7EF5}
+	EndGlobalSection
+EndGlobal

+ 6 - 0
sample/EasyWeChatClient/EasyWeChatClient/App.config

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+    <startup> 
+        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
+    </startup>
+</configuration>

+ 9 - 0
sample/EasyWeChatClient/EasyWeChatClient/App.xaml

@@ -0,0 +1,9 @@
+<Application x:Class="EasyWeChatClient.App"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:local="clr-namespace:EasyWeChatClient"
+             StartupUri="MainWindow.xaml">
+    <Application.Resources>
+         
+    </Application.Resources>
+</Application>

+ 17 - 0
sample/EasyWeChatClient/EasyWeChatClient/App.xaml.cs

@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace EasyWeChatClient
+{
+    /// <summary>
+    /// App.xaml 的交互逻辑
+    /// </summary>
+    public partial class App : Application
+    {
+    }
+}

+ 54 - 0
sample/EasyWeChatClient/EasyWeChatClient/Common/TextBoxWriter.cs

@@ -0,0 +1,54 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace EasyWeChatClient.Common
+{
+    public class TextBoxWriter : TextWriter
+    {
+        TextBox textBox;
+        delegate void WriteFunc(string value);
+        WriteFunc write;
+        WriteFunc writeLine;
+
+        public TextBoxWriter(TextBox textBox)
+        {
+            this.textBox = textBox;
+            write = Write;
+            writeLine = WriteLine;
+        }
+
+
+        // 使用UTF-16避免不必要的编码转换
+        public override Encoding Encoding
+        {
+            get { return Encoding.Unicode; }
+        }
+
+
+        // 最低限度需要重写的方法
+        public override void Write(string value)
+        {
+            Application.Current.Dispatcher.Invoke(new Action(() =>
+            {
+                textBox.AppendText(value);
+            }));
+        }
+
+
+        // 为提高效率直接处理一行的输出
+        public override void WriteLine(string value)
+        {
+            Application.Current.Dispatcher.Invoke(new Action(() =>
+            {
+                textBox.AppendText(value);
+                textBox.AppendText(this.NewLine);
+            }));
+        }
+    }
+}

+ 108 - 0
sample/EasyWeChatClient/EasyWeChatClient/EasyWeChatClient.csproj

@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{FE7197A0-84EC-4024-B34D-9F84DD0B3749}</ProjectGuid>
+    <OutputType>WinExe</OutputType>
+    <RootNamespace>EasyWeChatClient</RootNamespace>
+    <AssemblyName>EasyWeChatClient</AssemblyName>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <WarningLevel>4</WarningLevel>
+    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+    <TargetFrameworkProfile />
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup>
+    <StartupObject />
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xaml">
+      <RequiredTargetFramework>4.0</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="WindowsBase" />
+    <Reference Include="PresentationCore" />
+    <Reference Include="PresentationFramework" />
+  </ItemGroup>
+  <ItemGroup>
+    <ApplicationDefinition Include="App.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </ApplicationDefinition>
+    <Page Include="MainWindow.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
+    <Compile Include="App.xaml.cs">
+      <DependentUpon>App.xaml</DependentUpon>
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Common\TextBoxWriter.cs" />
+    <Compile Include="MainWindow.xaml.cs">
+      <DependentUpon>MainWindow.xaml</DependentUpon>
+      <SubType>Code</SubType>
+    </Compile>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Properties\AssemblyInfo.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Properties\Resources.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+      <DependentUpon>Resources.resx</DependentUpon>
+    </Compile>
+    <Compile Include="Properties\Settings.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DependentUpon>Settings.settings</DependentUpon>
+      <DesignTimeSharedInput>True</DesignTimeSharedInput>
+    </Compile>
+    <EmbeddedResource Include="Properties\Resources.resx">
+      <Generator>ResXFileCodeGenerator</Generator>
+      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+    </EmbeddedResource>
+    <None Include="Properties\Settings.settings">
+      <Generator>SettingsSingleFileGenerator</Generator>
+      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="App.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\..\WeChatCore\WeChatCore.csproj">
+      <Project>{588e8149-f7fc-4304-87e1-43426d41aac4}</Project>
+      <Name>WeChatCore</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project>

+ 13 - 0
sample/EasyWeChatClient/EasyWeChatClient/MainWindow.xaml

@@ -0,0 +1,13 @@
+<Window x:Class="EasyWeChatClient.MainWindow"
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+        xmlns:local="clr-namespace:EasyWeChatClient"
+        mc:Ignorable="d"
+        Title="MainWindow" Height="350" Width="600">
+    <Grid>
+        <Image x:Name="Image1"></Image>
+        <TextBox x:Name="a1" Visibility="Collapsed" TextWrapping="WrapWithOverflow" IsReadOnly="True" Background="Black" Foreground="White" FontSize="14" TextChanged="a1_TextChanged" VerticalScrollBarVisibility="Auto"></TextBox>
+    </Grid>
+</Window>

+ 86 - 0
sample/EasyWeChatClient/EasyWeChatClient/MainWindow.xaml.cs

@@ -0,0 +1,86 @@
+using EasyWeChatClient.Common;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using WeChatCore;
+using WeChatCore.Common;
+
+namespace EasyWeChatClient
+{
+    /// <summary>
+    /// MainWindow.xaml 的交互逻辑
+    /// </summary>
+    public partial class MainWindow : Window
+    {
+        public MainWindow()
+        {
+            InitializeComponent();
+            Console.SetOut(new TextBoxWriter(a1));
+            CommonMethodCallBackHandlers.DownLoadQRCodeCompleted += CommonMethodCallBackHandlers_DownLoadQRCodeCompleted;
+            CommonMethodCallBackHandlers.LoginScranQRCodeCompleted += CommonMethodCallBackHandlers_LoginScranQRCodeCompleted;
+            CommonMethodCallBackHandlers.LoginCompleted += CommonMethodCallBackHandlers_LoginCompleted;
+            CommonMethodCallBackHandlers.ReceivedMsgAnalyseMsgCompleted += CommonMethodCallBackHandlers_ReceivedMsgAnalyseMsgCompleted;
+            CommonMethodCallBackHandlers.SendMsgCompleted += CommonMethodCallBackHandlers_SendMsgCompleted;
+            new Task(() =>
+            {
+                WeiChat.InitWeiChatRobot();
+            }).Start();
+        }
+
+        void CommonMethodCallBackHandlers_SendMsgCompleted(bool obj)
+        {
+            
+        }
+
+        void CommonMethodCallBackHandlers_ReceivedMsgAnalyseMsgCompleted(WeChatCore.Entity.MsgEntity obj)
+        {
+            
+        }
+
+        private void CommonMethodCallBackHandlers_LoginCompleted(bool obj)
+        {
+            if (obj)
+            {
+                this.Dispatcher.Invoke(new Action(() =>
+                {
+                    Image1.Visibility = Visibility.Collapsed;
+                    a1.Visibility = Visibility.Visible;
+                }));
+            }
+        }
+
+        private void CommonMethodCallBackHandlers_LoginScranQRCodeCompleted(string obj)
+        {
+            this.Dispatcher.Invoke(new Action(() =>
+            {
+                Image1.Source = new BitmapImage(new Uri(obj));
+            }
+            ));
+        }
+
+        private void CommonMethodCallBackHandlers_DownLoadQRCodeCompleted()
+        {
+            this.Dispatcher.Invoke(new Action(() =>
+            {
+                Image1.Source = new BitmapImage(new Uri(Environment.CurrentDirectory + "\\Check.jpg"));
+            }));
+        }
+
+        private void a1_TextChanged(object sender, TextChangedEventArgs e)
+        {
+            a1.ScrollToEnd();
+        }
+    }
+}

+ 55 - 0
sample/EasyWeChatClient/EasyWeChatClient/Properties/AssemblyInfo.cs

@@ -0,0 +1,55 @@
+using System.Reflection;
+using System.Resources;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("EasyWeChatClient")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("EasyWeChatClient")]
+[assembly: AssemblyCopyright("Copyright ©  2018")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 将 ComVisible 设置为 false 会使此程序集中的类型
+//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
+//请将此类型的 ComVisible 特性设置为 true。
+[assembly: ComVisible(false)]
+
+//若要开始生成可本地化的应用程序,请设置
+//.csproj 文件中的 <UICulture>CultureYouAreCodingWith</UICulture>
+//例如,如果您在源文件中使用的是美国英语,
+//使用的是美国英语,请将 <UICulture> 设置为 en-US。  然后取消
+//对以下 NeutralResourceLanguage 特性的注释。  更新
+//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
+
+//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
+
+
+[assembly: ThemeInfo(
+    ResourceDictionaryLocation.None, //主题特定资源词典所处位置
+                                     //(未在页面中找到资源时使用,
+                                     //或应用程序资源字典中找到时使用)
+    ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
+                                              //(未在页面中找到资源时使用,
+                                              //、应用程序或任何主题专用资源字典中找到时使用)
+)]
+
+
+// 程序集的版本信息由下列四个值组成: 
+//
+//      主版本
+//      次版本
+//      生成号
+//      修订号
+//
+// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
+// 方法是按如下所示使用“*”: :
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 63 - 0
sample/EasyWeChatClient/EasyWeChatClient/Properties/Resources.Designer.cs

@@ -0,0 +1,63 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     此代码由工具生成。
+//     运行时版本:4.0.30319.42000
+//
+//     对此文件的更改可能会导致不正确的行为,并且如果
+//     重新生成代码,这些更改将会丢失。
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace EasyWeChatClient.Properties {
+    using System;
+    
+    
+    /// <summary>
+    ///   一个强类型的资源类,用于查找本地化的字符串等。
+    /// </summary>
+    // 此类是由 StronglyTypedResourceBuilder
+    // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
+    // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
+    // (以 /str 作为命令选项),或重新生成 VS 项目。
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    internal class Resources {
+        
+        private static global::System.Resources.ResourceManager resourceMan;
+        
+        private static global::System.Globalization.CultureInfo resourceCulture;
+        
+        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+        internal Resources() {
+        }
+        
+        /// <summary>
+        ///   返回此类使用的缓存的 ResourceManager 实例。
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Resources.ResourceManager ResourceManager {
+            get {
+                if (object.ReferenceEquals(resourceMan, null)) {
+                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("EasyWeChatClient.Properties.Resources", typeof(Resources).Assembly);
+                    resourceMan = temp;
+                }
+                return resourceMan;
+            }
+        }
+        
+        /// <summary>
+        ///   使用此强类型资源类,为所有资源查找
+        ///   重写当前线程的 CurrentUICulture 属性。
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Globalization.CultureInfo Culture {
+            get {
+                return resourceCulture;
+            }
+            set {
+                resourceCulture = value;
+            }
+        }
+    }
+}

+ 117 - 0
sample/EasyWeChatClient/EasyWeChatClient/Properties/Resources.resx

@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 26 - 0
sample/EasyWeChatClient/EasyWeChatClient/Properties/Settings.Designer.cs

@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     此代码由工具生成。
+//     运行时版本:4.0.30319.42000
+//
+//     对此文件的更改可能会导致不正确的行为,并且如果
+//     重新生成代码,这些更改将会丢失。
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace EasyWeChatClient.Properties {
+    
+    
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
+    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+        
+        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+        
+        public static Settings Default {
+            get {
+                return defaultInstance;
+            }
+        }
+    }
+}

+ 7 - 0
sample/EasyWeChatClient/EasyWeChatClient/Properties/Settings.settings

@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
+  <Profiles>
+    <Profile Name="(Default)" />
+  </Profiles>
+  <Settings />
+</SettingsFile>