public ProjectWindowViewModel(ChildWindow aChildWindow, ProjectWindowType aProductWindowType, ProjectEntity aProjectEntity) { childWindow = aChildWindow; ProjectEntity = aProjectEntity; if (!String.IsNullOrWhiteSpace(ProjectEntity.ManufactureNumber)) { Title = "生产令号:" + ProjectEntity.ManufactureNumber; } else { Title = "添加"; } projectWindowType = aProductWindowType; if (projectWindowType == ProjectWindowType.Modify) { IsModify = true; IsAdd = false; } else if (projectWindowType == ProjectWindowType.ADD) { IsAdd = true; IsModify = true; } else if (projectWindowType == ProjectWindowType.View) { IsAdd = false; IsModify = false; } OnOK = new DelegateCommand(OnOKCommand); OnCancel = new DelegateCommand(OnCancelCommand); }
public ProjectWindow(ProjectWindowType aProductWindowType, ProjectEntity aProjectEntity) { InitializeComponent(); this.DataContext = new ProjectWindowViewModel(this, aProductWindowType, aProjectEntity); }