├── .gitattributes
├── .gitignore
├── AsyncTest
├── AsyncTest.sln
├── AsyncTest
│ ├── App.config
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── AsyncTest.csproj
│ ├── MainWindow.xaml
│ ├── MainWindow.xaml.cs
│ └── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
├── AwaitTest
│ ├── App.config
│ ├── AwaitTest.csproj
│ ├── Program.cs
│ └── Properties
│ │ └── AssemblyInfo.cs
└── ConcurrenceTest
│ ├── App.config
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── ConcurrenceTest.csproj
│ ├── MainWindow.xaml
│ ├── MainWindow.xaml.cs
│ └── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── BitStream
├── BitStream.sln
└── BitStream
│ ├── App.config
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── BitIO
│ ├── BitReader.cs
│ └── BitWriter.cs
│ ├── BitStream.csproj
│ ├── Codec
│ ├── Decoder6.cs
│ ├── Decoder7.cs
│ ├── Encoder6.cs
│ ├── Encoder7.cs
│ ├── IDecoder.cs
│ └── IEncoder.cs
│ ├── MainWindow.xaml
│ ├── MainWindow.xaml.cs
│ ├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
│ └── Resource
│ └── Dict.cs
├── ConfigFileTest
├── ConfigFileTest.sln
└── ConfigFileTest
│ ├── ConfigFile.cs
│ ├── ConfigFileTest.csproj
│ ├── Program.cs
│ ├── Properties
│ └── AssemblyInfo.cs
│ └── app.config
├── Document
├── C#并发性能测试.docx
├── CS异步操作总结.docx
└── readme.txt
├── FRPTest
├── FRPTest.sln
└── FRPTest
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── FRPTest.csproj
│ ├── MainWindow.xaml
│ ├── MainWindow.xaml.cs
│ ├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
│ ├── app.config
│ └── packages.config
├── MVVMTest
├── CommandTest
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── CommandTest.csproj
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── View
│ │ ├── MainWindow.xaml
│ │ └── MainWindow.xaml.cs
│ └── ViewModel
│ │ └── MainWindowViewModel.cs
├── DataBinding
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── DataBinding.csproj
│ ├── Model
│ │ └── TestData.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── View
│ │ ├── MainWindow.xaml
│ │ └── MainWindow.xaml.cs
│ └── ViewModel
│ │ └── MainWindowViewModel.cs
├── DataBindingTest
│ ├── Class1.cs
│ ├── DataBindingTest.csproj
│ └── Properties
│ │ └── AssemblyInfo.cs
├── EventBindingTest
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── EventBindingTest.csproj
│ ├── MainWindow.xaml
│ ├── MainWindow.xaml.cs
│ ├── MainWindowViewModel.cs
│ └── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
├── MVVMTest.sln
├── MVVMTest
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── MVVMTest.csproj
│ ├── Message
│ │ └── MainWindowMsg.cs
│ ├── Model
│ │ └── TestData.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── View
│ │ ├── MainWindow.xaml
│ │ └── MainWindow.xaml.cs
│ └── ViewModel
│ │ └── MainWindowViewModel.cs
├── MessageTest
│ ├── App.config
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── Message
│ │ ├── ComputeMsgArgs.cs
│ │ └── MainRegister.cs
│ ├── MessageTest.csproj
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── View
│ │ ├── ComputeWindow.xaml
│ │ ├── ComputeWindow.xaml.cs
│ │ ├── MainWindow.xaml
│ │ └── MainWindow.xaml.cs
│ └── ViewModel
│ │ ├── ComputeWindowViewModel.cs
│ │ └── MainWindowViewModel.cs
└── MyMVVM
│ ├── ConfirmMsgArgs.cs
│ ├── DialogMsgArgs.cs
│ ├── DispatcherHelper.cs
│ ├── IMessageManager.cs
│ ├── IMessageRegister.cs
│ ├── MessageManager.cs
│ ├── MessageRegister.cs
│ ├── MessageRegisterBase.cs
│ ├── ModelBase.cs
│ ├── MsgActionInfo.cs
│ ├── MsgActionInfoGeneric.cs
│ ├── MsgArgs.cs
│ ├── MyCommand.cs
│ ├── MyCommandGeneric.cs
│ ├── MyEventCommand.cs
│ ├── MyMVVM.csproj
│ ├── NotifyObject.cs
│ ├── Properties
│ └── AssemblyInfo.cs
│ ├── StringArgs.cs
│ ├── ViewModelBase.cs
│ ├── ViewModelInfo.cs
│ └── ViewModelManager.cs
├── README.md
├── UWPDDD
├── Dlls
│ └── AyxMVVM.dll
├── Domain
│ ├── Domain.csproj
│ ├── Domain.nuget.props
│ ├── Domain.nuget.targets
│ ├── Model
│ │ ├── ACategory.cs
│ │ └── ANote.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ └── Domain.rd.xml
│ ├── Repository
│ │ ├── Common
│ │ │ ├── IACategoryRepository.cs
│ │ │ ├── IANoteRepository.cs
│ │ │ └── IRepository.cs
│ │ ├── Database
│ │ │ ├── ACategoryDataRepo.cs
│ │ │ └── ANoteDataRepo.cs
│ │ ├── Mars
│ │ │ ├── ACategoryMarsRepo.cs
│ │ │ └── ANoteMarsRepo.cs
│ │ ├── Repositories.cs
│ │ └── WebService
│ │ │ ├── ACategoryWebRepo.cs
│ │ │ └── ANoteWebRepo.cs
│ └── project.json
├── Infrastructure
│ ├── Database
│ │ ├── ACategoryData.cs
│ │ ├── ANoteData.cs
│ │ └── DatabaseInfo.cs
│ ├── Infrastructure.csproj
│ ├── Infrastructure.nuget.props
│ ├── Infrastructure.nuget.targets
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ └── Infrastructure.rd.xml
│ └── project.json
├── UWPDDD.sln
├── UWPDDD
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── ApplicationInsights.config
│ ├── Assets
│ │ ├── LockScreenLogo.scale-200.png
│ │ ├── SplashScreen.scale-200.png
│ │ ├── Square150x150Logo.scale-200.png
│ │ ├── Square44x44Logo.scale-200.png
│ │ ├── Square44x44Logo.targetsize-24_altform-unplated.png
│ │ ├── StoreLogo.png
│ │ └── Wide310x150Logo.scale-200.png
│ ├── MainPage.xaml
│ ├── MainPage.xaml.cs
│ ├── Package.appxmanifest
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ └── Default.rd.xml
│ ├── View.csproj
│ ├── View.nuget.props
│ ├── View.nuget.targets
│ ├── View
│ │ ├── NoteInfoPage.xaml
│ │ └── NoteInfoPage.xaml.cs
│ └── project.json
└── ViewModel
│ ├── NoteInfoViewModel.cs
│ ├── NoteListViewModel.cs
│ ├── Properties
│ ├── AssemblyInfo.cs
│ └── ViewModel.rd.xml
│ ├── ViewModel.csproj
│ ├── ViewModel.nuget.props
│ ├── ViewModel.nuget.targets
│ ├── ViewModelLocator.cs
│ └── project.json
└── UWPTest
├── Dlls
└── AyxMVVM.dll
├── TitleBarTest
├── App.xaml
├── App.xaml.cs
├── Assets
│ ├── LockScreenLogo.scale-200.png
│ ├── SplashScreen.scale-200.png
│ ├── Square150x150Logo.scale-200.png
│ ├── Square44x44Logo.scale-200.png
│ ├── Square44x44Logo.targetsize-24_altform-unplated.png
│ ├── StoreLogo.png
│ └── Wide310x150Logo.scale-200.png
├── MainPage.xaml
├── MainPage.xaml.cs
├── Package.appxmanifest
├── Properties
│ ├── AssemblyInfo.cs
│ └── Default.rd.xml
├── TitleBarTest.csproj
└── project.json
├── UWPTest.sln
└── xBindTest
├── App.xaml
├── App.xaml.cs
├── Assets
├── LockScreenLogo.scale-200.png
├── SplashScreen.scale-200.png
├── Square150x150Logo.scale-200.png
├── Square44x44Logo.scale-200.png
├── Square44x44Logo.targetsize-24_altform-unplated.png
├── StoreLogo.png
└── Wide310x150Logo.scale-200.png
├── MainPage.xaml
├── MainPage.xaml.cs
├── MainPageViewModel.cs
├── Package.appxmanifest
├── Properties
├── AssemblyInfo.cs
└── Default.rd.xml
├── project.json
└── xBindTest.csproj
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/AsyncTest/AsyncTest.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.23107.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AsyncTest", "AsyncTest\AsyncTest.csproj", "{44449FEC-DFDB-41FA-86C0-FF1EA02A89DD}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConcurrenceTest", "ConcurrenceTest\ConcurrenceTest.csproj", "{4CC3BAC6-8886-4386-B5DA-DB503171D351}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AwaitTest", "AwaitTest\AwaitTest.csproj", "{6192351F-AE96-46C7-B8F1-28DA355CCC2A}"
11 | EndProject
12 | Global
13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
14 | Debug|Any CPU = Debug|Any CPU
15 | Release|Any CPU = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
18 | {44449FEC-DFDB-41FA-86C0-FF1EA02A89DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19 | {44449FEC-DFDB-41FA-86C0-FF1EA02A89DD}.Debug|Any CPU.Build.0 = Debug|Any CPU
20 | {44449FEC-DFDB-41FA-86C0-FF1EA02A89DD}.Release|Any CPU.ActiveCfg = Release|Any CPU
21 | {44449FEC-DFDB-41FA-86C0-FF1EA02A89DD}.Release|Any CPU.Build.0 = Release|Any CPU
22 | {4CC3BAC6-8886-4386-B5DA-DB503171D351}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23 | {4CC3BAC6-8886-4386-B5DA-DB503171D351}.Debug|Any CPU.Build.0 = Debug|Any CPU
24 | {4CC3BAC6-8886-4386-B5DA-DB503171D351}.Release|Any CPU.ActiveCfg = Release|Any CPU
25 | {4CC3BAC6-8886-4386-B5DA-DB503171D351}.Release|Any CPU.Build.0 = Release|Any CPU
26 | {6192351F-AE96-46C7-B8F1-28DA355CCC2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27 | {6192351F-AE96-46C7-B8F1-28DA355CCC2A}.Debug|Any CPU.Build.0 = Debug|Any CPU
28 | {6192351F-AE96-46C7-B8F1-28DA355CCC2A}.Release|Any CPU.ActiveCfg = Release|Any CPU
29 | {6192351F-AE96-46C7-B8F1-28DA355CCC2A}.Release|Any CPU.Build.0 = Release|Any CPU
30 | EndGlobalSection
31 | GlobalSection(SolutionProperties) = preSolution
32 | HideSolutionNode = FALSE
33 | EndGlobalSection
34 | EndGlobal
35 |
--------------------------------------------------------------------------------
/AsyncTest/AsyncTest/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/AsyncTest/AsyncTest/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/AsyncTest/AsyncTest/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace AsyncTest
10 | {
11 | ///
12 | /// App.xaml 的交互逻辑
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/AsyncTest/AsyncTest/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/AsyncTest/AsyncTest/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // 有关程序集的一般信息由以下
8 | // 控制。更改这些特性值可修改
9 | // 与程序集关联的信息。
10 | [assembly: AssemblyTitle("AsyncTest")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("AsyncTest")]
15 | [assembly: AssemblyCopyright("Copyright © 2015")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | //将 ComVisible 设置为 false 将使此程序集中的类型
20 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
21 | //请将此类型的 ComVisible 特性设置为 true。
22 | [assembly: ComVisible(false)]
23 |
24 | //若要开始生成可本地化的应用程序,请
25 | // 中的 .csproj 文件中
26 | //例如,如果您在源文件中使用的是美国英语,
27 | //使用的是美国英语,请将 设置为 en-US。 然后取消
28 | //对以下 NeutralResourceLanguage 特性的注释。 更新
29 | //以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //主题特定资源词典所处位置
36 | //(当资源未在页面
37 | //或应用程序资源字典中找到时使用)
38 | ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
39 | //(当资源未在页面
40 | //、应用程序或任何主题专用资源字典中找到时使用)
41 | )]
42 |
43 |
44 | // 程序集的版本信息由下列四个值组成:
45 | //
46 | // 主版本
47 | // 次版本
48 | // 生成号
49 | // 修订号
50 | //
51 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
52 | // 方法是按如下所示使用“*”: :
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/AsyncTest/AsyncTest/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.42000
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace AsyncTest.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// 一个强类型的资源类,用于查找本地化的字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 VS 项目。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// 返回此类使用的缓存的 ResourceManager 实例。
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AsyncTest.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// 使用此强类型资源类,为所有资源查找
51 | /// 重写当前线程的 CurrentUICulture 属性。
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/AsyncTest/AsyncTest/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.42000
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace AsyncTest.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/AsyncTest/AsyncTest/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/AsyncTest/AwaitTest/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/AsyncTest/AwaitTest/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading;
6 | using System.Threading.Tasks;
7 |
8 | namespace AwaitTest
9 | {
10 | class Program
11 | {
12 | static void Main(string[] args)
13 | {
14 | Console.WriteLine("主线程测试开始..");
15 | AsyncMethod();
16 | Thread.Sleep(1000);
17 | Console.WriteLine("主线程测试结束..");
18 | Console.ReadLine();
19 | }
20 |
21 | static void AsyncMethod()
22 | {
23 | Console.WriteLine("开始异步代码");
24 | MyMethod();
25 | Console.WriteLine("异步代码执行完毕");
26 | }
27 |
28 | static async void MyMethod()
29 | {
30 | for (int i = 0; i < 5; i++)
31 | {
32 | await Task.Delay(1000); //模拟耗时操作
33 | Console.WriteLine("异步执行完毕" + i.ToString() + "..");
34 | }
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/AsyncTest/AwaitTest/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("AwaitTest")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("AwaitTest")]
13 | [assembly: AssemblyCopyright("Copyright © 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | //将 ComVisible 设置为 false 将使此程序集中的类型
18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("6192351f-ae96-46c7-b8f1-28da355ccc2a")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”: :
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/AsyncTest/ConcurrenceTest/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/AsyncTest/ConcurrenceTest/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/AsyncTest/ConcurrenceTest/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace ConcurrenceTest
10 | {
11 | ///
12 | /// App.xaml 的交互逻辑
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/AsyncTest/ConcurrenceTest/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/AsyncTest/ConcurrenceTest/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // 有关程序集的一般信息由以下
8 | // 控制。更改这些特性值可修改
9 | // 与程序集关联的信息。
10 | [assembly: AssemblyTitle("ConcurrenceTest")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("ConcurrenceTest")]
15 | [assembly: AssemblyCopyright("Copyright © 2015")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | //将 ComVisible 设置为 false 将使此程序集中的类型
20 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
21 | //请将此类型的 ComVisible 特性设置为 true。
22 | [assembly: ComVisible(false)]
23 |
24 | //若要开始生成可本地化的应用程序,请
25 | // 中的 .csproj 文件中
26 | //例如,如果您在源文件中使用的是美国英语,
27 | //使用的是美国英语,请将 设置为 en-US。 然后取消
28 | //对以下 NeutralResourceLanguage 特性的注释。 更新
29 | //以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //主题特定资源词典所处位置
36 | //(当资源未在页面
37 | //或应用程序资源字典中找到时使用)
38 | ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
39 | //(当资源未在页面
40 | //、应用程序或任何主题专用资源字典中找到时使用)
41 | )]
42 |
43 |
44 | // 程序集的版本信息由下列四个值组成:
45 | //
46 | // 主版本
47 | // 次版本
48 | // 生成号
49 | // 修订号
50 | //
51 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
52 | // 方法是按如下所示使用“*”: :
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/AsyncTest/ConcurrenceTest/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.42000
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace ConcurrenceTest.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// 一个强类型的资源类,用于查找本地化的字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 VS 项目。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// 返回此类使用的缓存的 ResourceManager 实例。
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ConcurrenceTest.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// 使用此强类型资源类,为所有资源查找
51 | /// 重写当前线程的 CurrentUICulture 属性。
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/AsyncTest/ConcurrenceTest/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.42000
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace ConcurrenceTest.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/AsyncTest/ConcurrenceTest/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/BitStream/BitStream.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BitStream", "BitStream\BitStream.csproj", "{0F0EFD4C-2A85-47E6-8604-672E757D8A6E}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {0F0EFD4C-2A85-47E6-8604-672E757D8A6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {0F0EFD4C-2A85-47E6-8604-672E757D8A6E}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {0F0EFD4C-2A85-47E6-8604-672E757D8A6E}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {0F0EFD4C-2A85-47E6-8604-672E757D8A6E}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/BitStream/BitStream/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/BitStream/BitStream/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/BitStream/BitStream/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace BitStream
10 | {
11 | ///
12 | /// App.xaml 的交互逻辑
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/BitStream/BitStream/BitIO/BitWriter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace BitStream.BitIO
8 | {
9 | public class BitWriter
10 | {
11 | public readonly StringBuilder BinString;
12 |
13 | public BitWriter()
14 | {
15 | BinString = new StringBuilder();
16 | }
17 |
18 | public BitWriter(int bitLength)
19 | {
20 | var add = 8 - bitLength % 8;
21 | BinString = new StringBuilder(bitLength + add);
22 | }
23 |
24 | public void WriteByte(byte b, int bitLength=8)
25 | {
26 | var bin = Convert.ToString(b, 2);
27 | AppendBinString(bin, bitLength);
28 | }
29 |
30 | public void WriteInt(int i, int bitLength)
31 | {
32 | var bin = Convert.ToString(i, 2);
33 | AppendBinString(bin, bitLength);
34 | }
35 |
36 | public void WriteChar7(char c)
37 | {
38 | var b = Convert.ToByte(c);
39 | var bin = Convert.ToString(b, 2);
40 | AppendBinString(bin, 7);
41 | }
42 |
43 | public byte[] GetBytes()
44 | {
45 | Check8();
46 | var len = BinString.Length / 8;
47 | var result = new byte[len];
48 |
49 | for (int i = 0; i < len; i++)
50 | {
51 | var bits = BinString.ToString(i * 8, 8);
52 | result[i] = Convert.ToByte(bits, 2);
53 | }
54 |
55 | return result;
56 | }
57 |
58 | public string GetBinString()
59 | {
60 | Check8();
61 | return BinString.ToString();
62 | }
63 |
64 |
65 | private void AppendBinString(string bin, int bitLength)
66 | {
67 | if (bin.Length > bitLength)
68 | throw new Exception("len is too short");
69 | var add = bitLength - bin.Length;
70 | for (int i = 0; i < add; i++)
71 | {
72 | BinString.Append('0');
73 | }
74 | BinString.Append(bin);
75 | }
76 |
77 | private void Check8()
78 | {
79 | var add = 8 - BinString.Length % 8;
80 | for (int i = 0; i < add; i++)
81 | {
82 | BinString.Append("0");
83 | }
84 | }
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/BitStream/BitStream/Codec/Decoder6.cs:
--------------------------------------------------------------------------------
1 | using BitStream.BitIO;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace BitStream.Codec
9 | {
10 | public class Decoder6:IDecoder
11 | {
12 | private static Decoder6 _default;
13 | public static Decoder6 Default
14 | {
15 | get
16 | {
17 | if (_default == null)
18 | _default = new Decoder6();
19 | return _default;
20 | }
21 | }
22 |
23 | public string Decode(byte[] data)
24 | {
25 | var reader = new BitReader(data);
26 | while(reader.Remain > 8)
27 | {
28 | var start = reader.ReadByte();
29 | if (start == 2)
30 | break;
31 | }
32 | var len = reader.ReadInt(16);
33 | var result = new StringBuilder(len);
34 | for (int i = 0; i < len; i++)
35 | {
36 | var index = reader.ReadInt(6);
37 | var ch = Dict.Custom[index];
38 | result.Append(ch);
39 | }
40 |
41 | return result.ToString();
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/BitStream/BitStream/Codec/Decoder7.cs:
--------------------------------------------------------------------------------
1 | using BitStream.BitIO;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace BitStream.Codec
9 | {
10 | public class Decoder7 : IDecoder
11 | {
12 | private static Decoder7 _default;
13 | public static Decoder7 Default
14 | {
15 | get
16 | {
17 | if (_default == null)
18 | _default = new Decoder7();
19 | return _default;
20 | }
21 | }
22 | public string Decode(byte[] data)
23 | {
24 | var reader = new BitReader(data);
25 | while (reader.Remain > 8)
26 | {
27 | var start = reader.ReadByte();
28 | if (start == 2)
29 | break;
30 | }
31 | var len = reader.ReadInt(16);
32 | var result = new StringBuilder(len);
33 | for (int i = 0; i < len; i++)
34 | {
35 | var b = reader.ReadInt(7);
36 | var ch = Convert.ToChar(b);
37 | result.Append(ch);
38 | }
39 |
40 | return result.ToString();
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/BitStream/BitStream/Codec/Encoder6.cs:
--------------------------------------------------------------------------------
1 | using BitStream.BitIO;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace BitStream.Codec
9 | {
10 | public class Encoder6:IEncoder
11 | {
12 | private static Encoder6 _default;
13 | public static Encoder6 Default
14 | {
15 | get
16 | {
17 | if (_default == null)
18 | _default = new Encoder6();
19 | return _default;
20 | }
21 | }
22 |
23 | public byte[] Encode(string text)
24 | {
25 | text = text.ToUpper();
26 | var len = text.Length * 6 + 24;
27 |
28 | var writer = new BitWriter(len);
29 | writer.WriteByte(2);
30 | writer.WriteInt(text.Length, 16);
31 |
32 | for (int i = 0; i < text.Length; i++)
33 | {
34 | var index = GetChar6Index(text[i]);
35 | writer.WriteInt(index, 6);
36 | }
37 |
38 | return writer.GetBytes();
39 |
40 | }
41 |
42 | private int GetChar6Index(char c)
43 | {
44 | for (int i = 0; i < 64; i++)
45 | {
46 | if (Dict.Custom[i] == c)
47 | return i;
48 | }
49 | return 10; //return *
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/BitStream/BitStream/Codec/Encoder7.cs:
--------------------------------------------------------------------------------
1 | using BitStream.BitIO;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace BitStream.Codec
9 | {
10 | public class Encoder7 : IEncoder
11 | {
12 | private static Encoder7 _default;
13 | public static Encoder7 Default
14 | {
15 | get
16 | {
17 | if (_default == null)
18 | _default = new Encoder7();
19 | return _default;
20 | }
21 | }
22 |
23 | public byte[] Encode(string text)
24 | {
25 | var len = text.Length * 7 + 24;
26 |
27 | var writer = new BitWriter(len);
28 | writer.WriteByte(2);
29 | writer.WriteInt(text.Length, 16);
30 |
31 | for (int i = 0; i < text.Length; i++)
32 | {
33 | var b = Convert.ToByte(text[i]);
34 | writer.WriteByte(b, 7);
35 | }
36 |
37 | return writer.GetBytes();
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/BitStream/BitStream/Codec/IDecoder.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace BitStream.Codec
8 | {
9 | public interface IDecoder
10 | {
11 | string Decode(byte[] data);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/BitStream/BitStream/Codec/IEncoder.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace BitStream.Codec
8 | {
9 | public interface IEncoder
10 | {
11 | byte[] Encode(string text);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/BitStream/BitStream/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/BitStream/BitStream/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // 有关程序集的一般信息由以下
8 | // 控制。更改这些特性值可修改
9 | // 与程序集关联的信息。
10 | [assembly: AssemblyTitle("BitStream")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("BitStream")]
15 | [assembly: AssemblyCopyright("Copyright © 2016")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | //将 ComVisible 设置为 false 将使此程序集中的类型
20 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
21 | //请将此类型的 ComVisible 特性设置为 true。
22 | [assembly: ComVisible(false)]
23 |
24 | //若要开始生成可本地化的应用程序,请
25 | // 中的 .csproj 文件中
26 | //例如,如果您在源文件中使用的是美国英语,
27 | //使用的是美国英语,请将 设置为 en-US。 然后取消
28 | //对以下 NeutralResourceLanguage 特性的注释。 更新
29 | //以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //主题特定资源词典所处位置
36 | //(当资源未在页面
37 | //或应用程序资源字典中找到时使用)
38 | ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
39 | //(当资源未在页面
40 | //、应用程序或任何主题专用资源字典中找到时使用)
41 | )]
42 |
43 |
44 | // 程序集的版本信息由下列四个值组成:
45 | //
46 | // 主版本
47 | // 次版本
48 | // 生成号
49 | // 修订号
50 | //
51 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
52 | // 方法是按如下所示使用“*”: :
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/BitStream/BitStream/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本: 4.0.30319.42000
5 | //
6 | // 对此文件的更改可能导致不正确的行为,如果
7 | // 重新生成代码,则所做更改将丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace BitStream.Properties
12 | {
13 |
14 |
15 | ///
16 | /// 强类型资源类,用于查找本地化字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 VS 项目。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// 返回此类使用的缓存 ResourceManager 实例。
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BitStream.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// 覆盖当前线程的 CurrentUICulture 属性
56 | /// 使用此强类型的资源类的资源查找。
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/BitStream/BitStream/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace BitStream.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/BitStream/BitStream/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/BitStream/BitStream/Resource/Dict.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace BitStream
8 | {
9 | public static class Dict
10 | {
11 | public static char[] Custom = new char[]
12 | {
13 | 'K', //0
14 | '.', //1
15 | '0', //2
16 | '-', //3
17 | '=', //4
18 | '@', //5
19 | '#', //6
20 | '9', //7
21 | '!', //8
22 | 'L', //9
23 | '*', //10
24 | '1', //11
25 | ',', //12
26 | '\'', //13
27 | 'A', //14
28 | 'Q', //15
29 | '?', //16
30 | 'E', //17
31 | ';', //18
32 | 'Y', //19
33 | '5', //20
34 | '/', //21
35 | 'J', //22
36 | 'N', //23
37 | '<', //24
38 | '2', //25
39 | ']', //26
40 | 'P', //27
41 | '[', //28
42 | '6', //29
43 | 'M', //30
44 | 'R', //31
45 | 'D', //32
46 | 'Z', //33
47 | 'S', //34
48 | '>', //35
49 | '3', //36
50 | 'X', //37
51 | '?', //38
52 | 'C', //39
53 | '$', //40
54 | 'I', //41
55 | 'W', //42
56 | 'O', //43
57 | '4', //44
58 | '%', //45
59 | 'B', //46
60 | 'H', //47
61 | '&', //48
62 | 'V', //49
63 | '8', //50
64 | ')', //51
65 | 'T', //52
66 | '~', //53
67 | 'G', //54
68 | '(', //55
69 | ' ', //56
70 | '7', //57
71 | '+', //58
72 | '_', //59
73 | 'F', //60
74 | ':', //61
75 | '"', //62
76 | 'U', //63
77 | };
78 | }
79 | }
--------------------------------------------------------------------------------
/ConfigFileTest/ConfigFileTest.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.23107.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConfigFileTest", "ConfigFileTest\ConfigFileTest.csproj", "{1419ADFE-FC98-461E-B7C3-1FA12B13622E}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {1419ADFE-FC98-461E-B7C3-1FA12B13622E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {1419ADFE-FC98-461E-B7C3-1FA12B13622E}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {1419ADFE-FC98-461E-B7C3-1FA12B13622E}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {1419ADFE-FC98-461E-B7C3-1FA12B13622E}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/ConfigFileTest/ConfigFileTest/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace ConfigFileTest
7 | {
8 | class Program
9 | {
10 | static void Main(string[] args)
11 | {
12 | //创建或载入配置文件
13 | var config = ConfigFile.LoadOrCreateFile("config.test");
14 |
15 | //使用带参数的属性快速保存配置信息
16 | config["string"] = "这是一条文本记录";
17 | //使用带参数的属性快速保存非字符串
18 | config["intX"] = 45.ToString();
19 | config["Date"] = DateTime.Now.ToString();
20 | //保存配置信息的一般方式
21 | config.AddOrSetConfigValue("intY", 88);
22 | config.AddOrSetConfigValue("bool", true);
23 |
24 | //读取特定类型的数据
25 | var x = config.GetConfigValueInt("intX");
26 | //使用TryParse类方法读取特定类型的数据
27 | int y;
28 | config.TryParseConfigValue("intY", out y);
29 | DateTime dt;
30 | config.TryParseConfigValue("Date", out dt);
31 | //使用GetConfigValueXXX方法读取特定类型的数据
32 | bool b = config.GetConfigValueBool("bool");
33 | var c = x + y;
34 |
35 | //字符串类型数据直接读取
36 | Console.WriteLine(config["string"]);
37 | Console.WriteLine(c);
38 | Console.WriteLine(b);
39 | Console.WriteLine(dt);
40 |
41 | Console.ReadKey();
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/ConfigFileTest/ConfigFileTest/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("ConfigFileTest")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("ConfigFileTest")]
13 | [assembly: AssemblyCopyright("Copyright © 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | //将 ComVisible 设置为 false 将使此程序集中的类型
18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
19 | //请将此类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("1419adfe-fc98-461e-b7c3-1fa12b13622e")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 生成号
30 | // 修订号
31 | //
32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”: :
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/ConfigFileTest/ConfigFileTest/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Document/C#并发性能测试.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/durow/TestArea/cb90880b59e57fca03569ca2e13a9cc10eb732b2/Document/C#并发性能测试.docx
--------------------------------------------------------------------------------
/Document/CS异步操作总结.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/durow/TestArea/cb90880b59e57fca03569ca2e13a9cc10eb732b2/Document/CS异步操作总结.docx
--------------------------------------------------------------------------------
/Document/readme.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/durow/TestArea/cb90880b59e57fca03569ca2e13a9cc10eb732b2/Document/readme.txt
--------------------------------------------------------------------------------
/FRPTest/FRPTest.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.23107.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FRPTest", "FRPTest\FRPTest.csproj", "{499A66C5-80DB-4F3A-93AA-1E78243F010E}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {499A66C5-80DB-4F3A-93AA-1E78243F010E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {499A66C5-80DB-4F3A-93AA-1E78243F010E}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {499A66C5-80DB-4F3A-93AA-1E78243F010E}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {499A66C5-80DB-4F3A-93AA-1E78243F010E}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/FRPTest/FRPTest/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/FRPTest/FRPTest/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Windows;
7 |
8 | namespace FRPTest
9 | {
10 | ///
11 | /// App.xaml 的交互逻辑
12 | ///
13 | public partial class App : Application
14 | {
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/FRPTest/FRPTest/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/FRPTest/FRPTest/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Navigation;
13 | using System.Windows.Shapes;
14 |
15 | namespace FRPTest
16 | {
17 | ///
18 | /// MainWindow.xaml 的交互逻辑
19 | ///
20 | public partial class MainWindow : Window
21 | {
22 | public MainWindow()
23 | {
24 | InitializeComponent();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/FRPTest/FRPTest/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // 有关程序集的一般信息由以下
8 | // 控制。更改这些特性值可修改
9 | // 与程序集关联的信息。
10 | [assembly: AssemblyTitle("FRPTest")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("FRPTest")]
15 | [assembly: AssemblyCopyright("Copyright © 2015")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | //将 ComVisible 设置为 false 将使此程序集中的类型
20 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
21 | //请将此类型的 ComVisible 特性设置为 true。
22 | [assembly: ComVisible(false)]
23 |
24 | //若要开始生成可本地化的应用程序,请
25 | // 中的 .csproj 文件中
26 | //例如,如果您在源文件中使用的是美国英语,
27 | //使用的是美国英语,请将 设置为 en-US。 然后取消
28 | //对以下 NeutralResourceLanguage 特性的注释。 更新
29 | //以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //主题特定资源词典所处位置
36 | //(当资源未在页面
37 | //或应用程序资源字典中找到时使用)
38 | ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
39 | //(当资源未在页面
40 | //、应用程序或任何主题专用资源字典中找到时使用)
41 | )]
42 |
43 |
44 | // 程序集的版本信息由下列四个值组成:
45 | //
46 | // 主版本
47 | // 次版本
48 | // 生成号
49 | // 修订号
50 | //
51 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
52 | // 方法是按如下所示使用“*”: :
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/FRPTest/FRPTest/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.42000
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace FRPTest.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// 一个强类型的资源类,用于查找本地化的字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 VS 项目。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// 返回此类使用的缓存的 ResourceManager 实例。
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("FRPTest.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// 使用此强类型资源类,为所有资源查找
51 | /// 重写当前线程的 CurrentUICulture 属性。
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/FRPTest/FRPTest/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.42000
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace FRPTest.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/FRPTest/FRPTest/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/FRPTest/FRPTest/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/FRPTest/FRPTest/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/MVVMTest/CommandTest/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/MVVMTest/CommandTest/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Windows;
7 |
8 | namespace CommandTest
9 | {
10 | ///
11 | /// App.xaml 的交互逻辑
12 | ///
13 | public partial class App : Application
14 | {
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/MVVMTest/CommandTest/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // 有关程序集的一般信息由以下
8 | // 控制。更改这些特性值可修改
9 | // 与程序集关联的信息。
10 | [assembly: AssemblyTitle("CommandTest")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("CommandTest")]
15 | [assembly: AssemblyCopyright("Copyright © 2015")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | //将 ComVisible 设置为 false 将使此程序集中的类型
20 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
21 | //请将此类型的 ComVisible 特性设置为 true。
22 | [assembly: ComVisible(false)]
23 |
24 | //若要开始生成可本地化的应用程序,请
25 | // 中的 .csproj 文件中
26 | //例如,如果您在源文件中使用的是美国英语,
27 | //使用的是美国英语,请将 设置为 en-US。 然后取消
28 | //对以下 NeutralResourceLanguage 特性的注释。 更新
29 | //以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //主题特定资源词典所处位置
36 | //(当资源未在页面
37 | //或应用程序资源字典中找到时使用)
38 | ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
39 | //(当资源未在页面
40 | //、应用程序或任何主题专用资源字典中找到时使用)
41 | )]
42 |
43 |
44 | // 程序集的版本信息由下列四个值组成:
45 | //
46 | // 主版本
47 | // 次版本
48 | // 生成号
49 | // 修订号
50 | //
51 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
52 | // 方法是按如下所示使用“*”: :
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/MVVMTest/CommandTest/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本: 4.0.30319.42000
5 | //
6 | // 对此文件的更改可能导致不正确的行为,如果
7 | // 重新生成代码,则所做更改将丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace CommandTest.Properties
12 | {
13 |
14 |
15 | ///
16 | /// 强类型资源类,用于查找本地化字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 VS 项目。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// 返回此类使用的缓存 ResourceManager 实例。
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CommandTest.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// 覆盖当前线程的 CurrentUICulture 属性
56 | /// 使用此强类型的资源类的资源查找。
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/MVVMTest/CommandTest/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace CommandTest.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/MVVMTest/CommandTest/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/MVVMTest/CommandTest/View/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
11 |
12 |
14 |
15 |
16 |
17 |
18 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/MVVMTest/CommandTest/View/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using CommandTest.ViewModel;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace CommandTest
17 | {
18 | ///
19 | /// MainWindow.xaml 的交互逻辑
20 | ///
21 | public partial class MainWindow : Window
22 | {
23 | public MainWindow()
24 | {
25 | InitializeComponent();
26 | DataContext = new MainWindowViewModel();
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/MVVMTest/CommandTest/ViewModel/MainWindowViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows;
3 | using MyMVVM;
4 |
5 | namespace CommandTest.ViewModel
6 | {
7 | class MainWindowViewModel : NotifyObject
8 | {
9 |
10 | private bool _canExecute;
11 | public bool CanExecute
12 | {
13 | get { return _canExecute; }
14 | set
15 | {
16 | _canExecute = value;
17 | RaisePropertyChanged("CanExecute");
18 | }
19 | }
20 |
21 |
22 | private MyCommand _normalCommand;
23 | public MyCommand NormalCommand
24 | {
25 | get
26 | {
27 | if(_normalCommand == null)
28 | _normalCommand = new MyCommand(
29 | new Action