随笔分类 - .NET
摘要:MVVM examplehttp://msdn.microsoft.com/en-us/magazine/dd419663.aspxDrag and DropGong solution to drop and drop for WPF compatible with MVVM architecturehttp://www.codeproject.com/Articles/43702/Drag-and-Drop-in-WPF-Part-IITreeView TopicsHow to get TreeViewItem from HierarchicalDataTemplate item?http:
阅读全文
摘要:C# reflection is supposed to fully or at least to a great extent cover all C# language constructs and features from an IL perspective. That's why I have been addicted to using it whenever possible or at least as a fall-back. However it does have some limitations and implications that we can neve
阅读全文
摘要:Various small points that it doesn't matter too much if you don't know or use them'@' symbolapart from being used in front of a string to change how compiler interpret the string (verbatim or not), it can be placed also in front of a variable which may otherwise conflict with observe
阅读全文
摘要:号称面试的题目总是非常有趣的,这里是又一个例子:【原题出处】http://topic.csdn.net/u/20110928/15/B00A34FE-8544-42E2-A771-3C4A888DB85A.html【问题梗概】求一个函数的一阶导数。【代码方案】 1 namespace Derivative 2 { 3 class Program 4 { 5 // 求一个节点表达的算式的导函数 6 static Expression GetDerivative(Expression node) 7 { 8 ...
阅读全文
摘要:A nicely done paint package called ZBrush which has some concepts and features like dialogs in menues and being able to be dragged out to the sides to dock ('Review of the UI' video)that I would like to see in some of the future GUI design projects I'm to be involved with. Robbie, I know
阅读全文
摘要:C# is pretty flexible in syntax which by means of working with delegate or lambda expressionallows one to define subroutine logic within the argument list of a method call where it is passed.It is really cool, though it's still not clear whether C# directly or indirectly supports (probably not)
阅读全文
摘要:1. 嵌套的泛型类型或方法的实例化:class GenericClass<T>
{ public class NestedGenericClass<T2> { ... } public void GenericMethod<T2>(T2 t) { ... }
}为了通过Reflection实例化以上的NestedGenericClass<>和GenericMethod<>,必须照顾到它们的包含类,即GenericClass<>。通常以为以下的过程会完成实例化到genNestedCls类型变量中:Type gcls ...
阅读全文
摘要:To continue the topic of why Java still there since the advent of .NET 2.0; Recently as required by the work, I had to have a look at the Hibernate technology. And as the projects we are on are either .NET or native Visual C++ based, if we need to do any data mapping, we have to find technologies th
阅读全文
摘要:WCF的配置 1. 客户端声明式配置端点定义在标签对内,也以ABC为要素,可含name用以命名。Contract根据指向导出的代理(接口)。 端点头信息 在中定义标签对,可含请求的优先级信息标签。 定义端点的元数据 metadata,含policyImporters和wsdlImporters。 端点属性设置 类似服务器侧,在endpoint标签中指定属性bindingConfiguration="配置式名称",在标签对中加入对应的具体的binding标签(如basicHttpBinding,wsHttpBinding等),在该标签中加入binding标签,其名称属性nam
阅读全文
摘要:WCF调试和内部机制 1. 客户端跟踪 了解.NET的Tracing机制可以知道,它主要由Source-Switch,Filter-Listener架构组成。跟踪也可在文件app.config中配置。 以一个典型客户端的配置文件格式为例: <configuration> <system.diagnostics> <sources> <source name="System.ServiceModel" ... propagateActivity ="true/false">...</source>
阅读全文
摘要:关于服务的部署和使用。1. 服务的部署控制台部署 配置简单。可配置一个基地址。 配置文件app.config用于配置服务端点等。 以下的IIS和WAS均支持消息首次启动;不需要设置基地址(基地址由网站的虚拟路径决定) IIS部署 .svc文件,必须位于App_Code子目录: C#代码文件也需要在App_Code中;而如选择使用编译后的文件,则将其放在bin子目录中。 配置文件web.config也位于App_Code中。 WAS部署 除了支持HTTP外,还支持其他协议如TCP,消息队列MSMQ,命名管道等。 使用方法接近IIS部署。 非HTTP支持(仅Windows Vista以上): 1.
阅读全文
摘要:服务侧的端点定义。1. 端点定义WCF端点(Endpoint)包含ABC三个方面,对应endpoint记号中的三个属性: 地址(属性address)遵照WS-Addressing标准,由方式(Scheme)、主机(Machine)、端口(Port)、路径(Path)四个部分组成,依照URI的形式。 在服务宿主(Service Host)工程中包含app.config,用以定义服务的端点等信息,通常结构包含服务定义(services),绑定定义(bindings)和行为定义(behaviors)三部分。 <system.serviceModel> <services> &
阅读全文
摘要:本章介绍WCF的基础概念。 WCF是.NET 3.0之后主推的程序间的业务导向(Service Oriented)的通信基础架构。 WCF相关的通信协议参考: SOAP 1.2 spec: http://www.w3.org/TR/soap/ WSDL 1.1 spec: http://www.w3.org/TR/wsdl XML Schema primer: http://www.w3.org/TR/xmlschema-0/ WCF业务主要由以下三部分组成: 服务(Service类) 描述和实现提供的服务,由服务约定(Contract,S/C两侧约定的接口)接口继承 主机(Host) 用于开
阅读全文
摘要:1. 本地化 文化标识 .NET使用Culture对象描述本地文化环境。文化标识是标准的,参照参考资料1。 中间(Neutral)、特定(Specific)和无关性(Invariant)文化 例如de-AT,de标志德语系中间文化,de-AT标识奥地利地区,则标志具体的特定文化。无关性文化表示软件资源中文化无关的内容。特定文化标识串如"de-AT"可代入CultureInfo构造函数创建一个该对象。 System.Threading.Thread.CurrentThread.CurrentCulture和CurrentUICulture标志当前线程采取的文化对象和界面文化对
阅读全文
摘要:Style和Animation简而言之就是简便(主要基于XAML而非代码)的方式定制变化的动态的界面;而Template则是以简便重用的方式扩展和丰富界面的静态表现。 1. 样式(Style)类 属性: Style BasedOn:样式继承 ResourceDictionary Resources:定义供样式使用的资源 SetterBaseCollection Setters:属性/事件设置器,包含一系列Setter或EventSetter Type TargetType:样式所作用的单元的类型 TriggerCollection Triggers:包含一系列Trigger对象,用来相应属性变
阅读全文
摘要:1. 数据绑定(Binding)一般配置 常用的绑定的目标(Dependency Object & associated Dependency Property,目标单元): 内容控件目标:object ContentControl.Content 集合控件目标:IEnumerable ItemsControl.ItemSource 绑定器: Binding ( : BindingBase : MarkupExtension ) Binding binding = new Binding(); binding.ElementName = "WPF控件名称"; / b
阅读全文
摘要:1. 资源和Pack URI体系 MSDN上比较完整的介绍: http://msdn.microsoft.com/en-us/library/aa970069.aspx 使用Pack URI的资源必须以Build Action为Resource(不是工程属性中资源列表里的Embedded Resource,其机制更复杂)加入WPF工程,嵌入程序二进制文件中的资源更新时要重新生成工程。 Pack URI基本格式:pack://<authority>/<path> 其中授权方<authority>对应一个包(package),路径<path>对应一个
阅读全文
摘要:1. 画刷 1.1 渐变画刷(Gradient Brushes) 主要包括线性渐变和辐射渐变,两者都作用在一个矩形填色区域上,用[0,1]×[0,1]覆盖。 线性渐变(LinearGradientBrush ):StartPoint和EndPoint用来指定渐变路径(直线),等色线与渐变路径垂直。用GradientStop单元定义渐变路径上的点,其Color属性为这个点上颜色,Offset属性为0到1,表示经过渐变路径的比例。第一个GradientStop之前和最后一个之后渐变路径上的点的颜色分别为这两个点的颜色。当沿渐变路径填色没有覆盖整个区域时,剩余区域的填色方法由LinearG
阅读全文
摘要:1. WPF控件概览控件类型关键基类实例类型说明孤立控件(Individual Control)ContentControlContent属性,对应一个object,如该元素不继承UIElement,则显示其ToString()字符串内容Label助记键(Mnemonic Keys):在字符前加_对应Alt+该字符,并用Target=”{Binding ElementName=???}”绑定聚焦对象Button快速访问(Access Keys):在字符前加_对应Alt+该字符 IsDefault="True"对应Enter键 IsCancel="True"
阅读全文
摘要:1. Journal 的使用Journal 用于在 XAML 浏览器应用程序(XBAP)中维护历史访问页。删除前一访问页只需调当前 NavigationService 对象的 RemoveBackEntry() 即可;而增加一个访问页则复杂得多:1) 实现一个 CustomContentState 的派生类,每个对象对应一个要保存的访问页,其中数据结构用于维护这个历史访问页的数据,在构造的时候通过适当的参数传入。它必须标上 Serializable() 属性。在这个类里要重载一个 Replay 方法和一个 JournalEntryName。Replay 一般通过向构造时传入的页面回调提供数据,
阅读全文

浙公网安备 33010602011771号