private void Create() { TableMakerProductType proT = new TableMakerProductType(); //实例化一个新的model TableMakerProductTypeEditViewModel proTevm = new TableMakerProductTypeEditViewModel(proT); //实例化一个新的view model proTevm.DisplayName = "Table Maker Product Type-Create"; var TableMakerProductTypeEditViewInstance = new TableMakerProductTypeView(); //实例化一个新的view TableMakerProductTypeEditViewInstance.DataContext = proTevm; TableMakerProductTypeEditViewInstance.ShowDialog(); //设置viewmodel属性 if (proTevm.IsOK == true) { _programTypeService.SuperAdd(proT); } }
private void SaveAs() { TableMakerProductType proT = new TableMakerProductType(); //实例化一个新的model TableMakerProductTypeEditViewModel proTevm = new TableMakerProductTypeEditViewModel(proT); //实例化一个新的view model proTevm.DisplayName = "Table Maker Product Type-Save As"; proTevm.Description = _selectedItem.Description; var TableMakerProductTypeEditViewInstance = new TableMakerProductTypeView(); //实例化一个新的view TableMakerProductTypeEditViewInstance.DataContext = proTevm; TableMakerProductTypeEditViewInstance.ShowDialog(); if (proTevm.IsOK == true) { _programTypeService.SuperAdd(proT); } }