上一页 1 ··· 3 4 5 6 7 8 下一页
摘要: 1.工厂方法(FactoryMethodPattern)模式起点:讲程序中创建对象的操作单独进行处理,大大提高了系统扩展的柔性,接口的抽象化处理给相互依赖的对象创建提供了最好的抽象模式。典型应用:工厂方法模式是最简单也是最容易理解的模式之一。其关注的核心是对于对象创建这件事儿的分离2.单例(singletonpattern)模式起点:一个类只有一个实例,而提供一个访问全局点的方式,更加灵活地保证了实例的创建和访问约束,而且唯一约束的实施由类本身实现。典型应用:一个类只有一个实例,经常被应用于Facade模式,称为单例外观。3.命令(comman pattern)模式起点:讲请求封装为对象,从而 阅读全文
posted @ 2013-05-22 23:50 法的空间 阅读(237) 评论(0) 推荐(0) 编辑
摘要: 单 例模式是广为流传的设计模式中的一种。本质上,单例模式是一个只允许创建一个实例,并提供对这个实例简单的访问途径的类。一般而言,单例模式在创建实例时 不允许传递任何参数-否则不同参数导致不同的实例创建,就会出现问题!(如果同一个实例可以被同参的不同请求所访问,那么工厂模式会更适合。)这篇文章只 针对无参创建的请求进行讨论。典型的,单例模式的应用往往是延后创建的(created lazily)---只有在第一次被用到的时候才会被创建。在C#中有实现单例模式有很多种方法。我将在这里一一展现给大家,从最常见的、线程不安全的到 延后创建的、线程安全的、再到简洁高效的版本。注意在下面的代码中,我忽略了所 阅读全文
posted @ 2013-05-22 22:14 法的空间 阅读(519) 评论(0) 推荐(0) 编辑
摘要: View Code <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:GEMS.Windows.Controls.CustomControls" xmlns:Themes="clr-namespace... 阅读全文
posted @ 2013-04-27 17:57 法的空间 阅读(200) 评论(0) 推荐(0) 编辑
摘要: View Code public class Indicator : UserControl { public Indicator() { this.InitializeComponent(); } private void InitializeComponent() { Grid g = new Grid(); this.Content = g; List<Path> pathlist = new List<Path>(); ... 阅读全文
posted @ 2013-04-21 00:36 法的空间 阅读(332) 评论(0) 推荐(0) 编辑
摘要: View Code <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:MyWPFCustomControls" xmlns:Microsoft_Windows_Themes="clr-namespac... 阅读全文
posted @ 2013-04-16 23:57 法的空间 阅读(395) 评论(0) 推荐(0) 编辑
摘要: View Code <Trigger Property="Validation.HasError" Value="True"> <Setter TargetName="Bd" Property="BorderBrush" Value="Red"/> </Trigger>View Code <Setter Property="Validation.ErrorTemplate"> <Setter.Value> <C 阅读全文
posted @ 2013-04-02 17:02 法的空间 阅读(252) 评论(0) 推荐(0) 编辑
摘要: 注意如果设置了系统dateformat格式。在变化系统culture的时候需要设置dateformat CultureInfo info = new CultureInfo(this.LanguageItems[value].Name); info.DateTimeFormat.ShortDatePattern= "dd/MM/yyyy"; info.DateTimeFormat.LongDatePattern = "dd/MM/yyyy"; Thread.CurrentThread.CurrentCulture = ... 阅读全文
posted @ 2013-03-20 23:13 法的空间 阅读(813) 评论(0) 推荐(0) 编辑
摘要: 样式:View Code <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:MCE.Gems.Common.Controls.CustomControls" xmlns:Themes="clr... 阅读全文
posted @ 2013-03-20 18:04 法的空间 阅读(358) 评论(0) 推荐(0) 编辑
摘要: View Code <RadioButton Margin="0,6,0,0" VerticalAlignment="Center" Grid.Row="0" Grid.Column="1" AutomationProperties.AutomationId="MaleRadioButton" Content="{DynamicResource ResourceKey=PM_Male}" IsChecked="{Binding Gender, ... 阅读全文
posted @ 2013-03-18 17:13 法的空间 阅读(548) 评论(0) 推荐(0) 编辑
摘要: View Code System.Timers.Timer t; DateTime lastInputTime = DateTime.MinValue; private void textBox1_PreviewKeyDown(object sender, KeyEventArgs e) { if (t!=null) { t.Stop(); } t = new System.Timers.Timer(); ... 阅读全文
posted @ 2013-03-12 00:40 法的空间 阅读(322) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 下一页