摘要: 1.在web.config文件中有如下配置 1 <configuration> 2 3 <!--数据库链接配置--> 4 <connectionStrings> 5 <add name="ConnectionString" connectionString="Data Source=.;Initial Catalog=QualityCourses;Persist Security Info=True;User ID=sa;Password=sa" 6 providerName="System.Data.阅读全文
posted @ 2012-05-24 16:36 January 阅读(2) 评论(0) 编辑
摘要: 说明:该案例与前一个案例的来源一样,同样讲述的是MVVM,算是MVVM的进阶吧。在该案例中,涉及到数据访问,Prism等更为复杂的问题。首先来看界面设计,我在作者的基础上稍微做了改动,大致如下:1.首先还是来一个解决方案的截图:2.实现步骤2.1)从OO的角度来说,首先是完成基类的书写,该案例主要有两个对象,是Dish类(菜品类)和Restaurant(餐馆类),实现起来都较为简单,具体如下:Restaurant Class 1 public class Restaurant 2 { 3 /// <summary> 4 /// 餐馆名称 5 ...阅读全文
posted @ 2012-04-10 11:32 January 阅读(202) 评论(1) 编辑
摘要: 说明:关于什么是MVVM,园子中已经有很多文章做过介绍,自己对MVVM也有了初步的认识,算是一知半解吧。概念看起来总是有那么点抽象,简单的办法就是通过动手实践来进一步理解。从网上弄了几个案例,相信有人看过,在此只为了自己加深对MVVM的认识。1.目录结构,MVVM的目录结构大致如下:2.类图及实现过程简单的实现过程大致如下,首先就是手动实现两个接口:INotifyPropertyChanged,ICommand.2.1 INotifyPropertyChanged 接口的实现 1 //1.继承INotifyPropertyChanged,要引用该命名空间 2 using System.Comp阅读全文
posted @ 2012-04-09 17:23 January 阅读(179) 评论(0) 编辑
摘要: 说明:通过本例对BackgroundWorker的WorkerReportsProgress,WorkerSupportsCancdllation属性及Dowork,ProessChanged,RunWorkerCompleted事件做进一步的了解。 1 public partial class Form1 : Form 2 { 3 public Form1() 4 { 5 InitializeComponent(); 6 7 //获取或设置一个值,该值指示BW报告能否报告进度更新 8 ...阅读全文
posted @ 2012-04-09 11:58 January 阅读(162) 评论(0) 编辑
摘要: 1 //错误的处理 2 private void cmdBreakRules_Click(object sender, RoutedEventArgs e) 3 { 4 Thread thread = new Thread(UpdateTextWrong); 5 thread.Start(); 6 } 7 8 private void UpdateTextWrong() 9 {10 txt.Text = "Here is some ...阅读全文
posted @ 2012-04-09 11:35 January 阅读(118) 评论(0) 编辑
摘要: 说明:希望通过揣摩这些案例,能进一步了解进程的工作原理。1.方法一描述的是在同一窗口中,在计算素数的同时而不影响Canvas的工作。方法1 1 #region Long-Running Calculation in UI Thread 2 3 public delegate void NextPrimeDelegate(); 4 private long num = 3; 5 private bool continueCalculating = false; 6 private bool fNotAPrime =...阅读全文
posted @ 2012-04-09 10:33 January 阅读(41) 评论(0) 编辑
摘要: 说明:在数据绑定时,如果有些字段为空值,那么在数据绑定时可以用默认值来显示为空的字段。 1 <Grid> 2 <ListBox x:Name="lstPeople" Width="400"> 3 <ListBox.ItemTemplate> 4 <DataTemplate> 5 <StackPanel Orientation="Horizontal"> 6 <TextBlock Text="{Binding Path=FirstNam...阅读全文
posted @ 2012-04-06 17:22 January 阅读(80) 评论(1) 编辑
摘要: 1 2 <Window x:Class="MainWindow" 3 Loaded="Window_Loaded"> 4 5 <ListBox x:Name="lstPeople" Width="200"> 6 <ListBox.ItemTemplate> 7 <DataTemplate> 8 <StackPanel> 9 <StackPanel Orientation="Horizontal">10 ...阅读全文
posted @ 2012-04-06 17:09 January 阅读(33) 评论(0) 编辑
摘要: <Window.Resources> <DrawingImage x:Key="OverlayImageVector"> <DrawingImage.Drawing> <GeometryDrawing Brush="Red"> <GeometryDrawing.Geometry> <RectangleGeometry Rect="0 0 16 16" RadiusX="3" RadiusY="3" /> ...阅读全文
posted @ 2012-04-06 16:56 January 阅读(98) 评论(0) 编辑
摘要: 1 <Window.TaskbarItemInfo> 2 <TaskbarItemInfo /> 3 </Window.TaskbarItemInfo> 4 5 <Grid> 6 <ProgressBar x:Name="ProgressBar" Margin="10" 7 HorizontalAlignment="Stretch" 8 VerticalAlignment="Center" 9 Height...阅读全文
posted @ 2012-04-06 16:32 January 阅读(136) 评论(0) 编辑