private void ConfigureTemplate(object obj) { if (SelectedTemplate != null) { IWindowService templateBuilderView = _windowFactory.GetWindowService(WindowType.TemplateAssemblyView); TemplateBuilderViewModel templateBuilderViewModel = new TemplateBuilderViewModel(templateBuilderView.Close, _windowFactory, _allItemViewModels, SelectedTemplate, _unitOfWork); templateBuilderView.OpenAsDialog(templateBuilderViewModel); } }
private void CreateNewTemplate(object obj) { TemplateViewModel template = new TemplateViewModel(new Template()); _unitOfWork.TemplateRepository.Add(template.TemplateModel); _unitOfWork.Save(); Templates.Add(template); IWindowService templateBuilderView = _windowFactory.GetWindowService(WindowType.TemplateAssemblyView); TemplateBuilderViewModel templateBuilderViewModel = new TemplateBuilderViewModel(templateBuilderView.Close, _windowFactory, _allItemViewModels, template, _unitOfWork); templateBuilderView.OpenAsDialog(templateBuilderViewModel); if (template.ItemViewModels.Count == 0) { Templates.Remove(template); _unitOfWork.TemplateRepository.Delete(template.TemplateModel); } }