摘要: 通过Window.DataContext实现窗口之间的传值,特别是跨窗口控件的联动,具有无可比拟的优势。实现方法如下: 1. MainWindow.xaml,在Window.DataContext中声明Binding,Binding的源是窗口的控件 MainWindow.xaml.cs 2. Win 阅读全文
posted @ 2017-01-30 17:05 protorock 阅读(4212) 评论(0) 推荐(0) 编辑
摘要: his can also be done via an elevated command prompt using thesccommand. The syntax is:sc config [service name] depend= Note: There is a spaceafterthe equals sign, and there isnotone before it. So if you want ServiceA to depend on both ServiceB and ServiceC--that is to say, ServiceA will not start un 阅读全文
posted @ 2013-09-15 11:46 protorock 阅读(335) 评论(0) 推荐(0) 编辑
摘要: 用C#实现一个类的IEnumerable接口时有两种方法:1)实现非泛型IEnumerable接口;2)实现泛型IEnumerable(T)接口。如果采用方法1,当集合元素T是值类型时,将涉及到巨多的boxing和unboxing操作。因此,理所当然地采用方法2;例如,以下代码采用方法2实现枚举从指定偏移开始所有整数using System.Collections.Generic;class Ints : IEnumerable { private readonly int offset; public Ints(int o) { offset = o; } public I... 阅读全文
posted @ 2013-07-25 17:08 protorock 阅读(1560) 评论(0) 推荐(0) 编辑
摘要: 部署或安装系统服务时需要指定服务运行的账户。一般地,可选择Local System、Local Service或Network Service账户。Local System/Local Service/Network Service账户的区别在于每个账户的权限(Rights)不同。在Windows 2003和Windows XP之前,Service几乎都是运行在Local System账户下;从Windows 2003和WindowsXP开始,系统增加了Local Service和 Network Service账户。为什么要增加这两个新的内置账户?如何为Service选择账户?在回答这两个问 阅读全文
posted @ 2013-07-14 15:48 protorock 阅读(2803) 评论(0) 推荐(0) 编辑
摘要: 1. 概述在Win7中运行的网络应用程序需要防火墙中增加许可规则。利用C#实现在防火墙自动添加入站端口许可规则。程序开发环境为vs2010旗舰版。using System;using System.Collections.Generic;using System.Linq;using System.Text;using Microsoft.TeamFoundation.Common;namespace FirewallAutomation{ class Program { static void Main(string[] args) { ... 阅读全文
posted @ 2013-01-29 14:35 protorock 阅读(879) 评论(0) 推荐(0) 编辑
摘要: 与xp、win2003相比,win7、win2008(包括win2008R2)系统中,存放用户数据(user data)和系统数据(system data)的默认文件夹位置发生变化。例如,在xp中存放用户数据的文件为%SystemDrive%\Documents and Settings;在win7中则为%SystemDriver%\User。这样的变化无疑对以前应用程序能否在win7下顺利带来兼容性问题。为了最大程度地保证对以前在xp运行程序的兼容性,在win7中采用了junction points(连接点)技术。通过这个技术,原来在xp下运行的程序对%SystemDrive%\Docume 阅读全文
posted @ 2012-12-21 00:46 protorock 阅读(1956) 评论(0) 推荐(0) 编辑
摘要: 一、原理二、延迟签名与签名操作假设正在开发一个类库 YourLibrary.dll1)生成公钥/私钥对 sn -k Your.snk2)提取出公钥并存放在public.snk中。public.snk的目的是为了便于分发;在Your.snk中的私钥是无法提取出来的 sn -p Your.snk public.snk3)对程序集进行延迟签名 csc /keyfile:public.snk /delaysign /t:library YourLibrary.cs4)让CLR信任程序集的内容,不执行签名验证 sn -Vr YourLibrary.dll这个命令会... 阅读全文
posted @ 2012-12-14 16:07 protorock 阅读(1860) 评论(2) 推荐(0) 编辑
摘要: 一、Visual Studio 2010 单元测试之一---普通单元测试http://blog.csdn.net/tjvictor/article/details/6175362二、Visual Studio 单元测试之二---顺序单元测试http://blog.csdn.net/tjvictor/article/details/6175472三、Visual Studio 单元测试之三---压力测试http://blog.csdn.net/tjvictor/article/details/6175477四、 Visual Studio 单元测试之四---Generic测试http://blo 阅读全文
posted @ 2012-11-26 21:23 protorock 阅读(723) 评论(0) 推荐(0) 编辑
摘要: 1. 在windows server 2008 r2 (sp1) 部署 Ext.net开发的webapp1.1 Ext.net的版本为 Ext.net.Community 2.0 RC2。下载源码1.2 用vs2010重新编译2. 开发webapp时,使用nuget,从官方向项目中加入ext.net2.1 从官方网站加入的ext.net有许可证限制2.2 利用上述1.2编译结果替换掉原有的ext.net.dll(为什么?你懂得!~~)3. 安装asp.net mvc33.1 下载 ASP.NET MVC 3 RTM3.2 安装AspNetMvc3Setup.exe, 然后运行语言包安装程序 A 阅读全文
posted @ 2012-10-31 20:04 protorock 阅读(329) 评论(0) 推荐(0) 编辑
摘要: 一、安装前的环境1. Windows7(SP1);2. 在安装IIS7.5之前,安装了Visual Studio 2010;二、安装IIS7.51. 打开 Windows功能:2. IIS7.5 安装完毕后,执行以下命令:3. 在IIS管理器中,双击“ISAPI 和 CGI 限制”4. 解除限制、5. 至此,IIS7.5 + .Net Framework v4.0.30319 配置完毕 阅读全文
posted @ 2012-10-30 00:37 protorock 阅读(2450) 评论(0) 推荐(0) 编辑