public static TemplateAssociationViewModel GetTemplateAssociationVM() { if (templateAssociationVM == null) { templateAssociationVM = new TemplateAssociationViewModel(); } return(templateAssociationVM); }
//TODO: fix hard code private void OnDrop(object sender, Telerik.Windows.DragDrop.DragEventArgs e) { if (e.Data != null && e.AllowedEffects != DragDropEffects.None) { var treeListViewName = (sender as RadTreeListView).Name; TreeListViewRow destination = e.OriginalSource as TreeListViewRow ?? (e.OriginalSource as FrameworkElement).ParentOfType <TreeListViewRow>(); switch (treeListViewName) { case "ObjectTreeListView": ObjectViewModelLocator.GetObjectVM().MoveSelection(destination); break; case "TemplateTreeListView": TemplateViewModelLocator.GetTemplateVM().MoveSelection(destination); break; case "PropertyTreeListView": PropertyViewModelLocator.GetPropertyVM().MoveSelection(destination); break; case "ObjectAssociationTreeListView": ObjectAssociationViewModel objectAssociationViewModel = ObjectAssociationViewModelLocator.GetObjectAssociationVM(); objectAssociationViewModel.AssociateWithObject(destination); objectAssociationViewModel.FilteredObjectAssociations.View.Refresh(); break; case "ObjectRequirementTreeListView": ObjectRequirementViewModel objectRequirementViewModel = ObjectRequirementViewModelLocator.GetObjectRequirementVM(); objectRequirementViewModel.AssociateWithObject(destination); objectRequirementViewModel.FilteredObjectRequirements.View.Refresh(); break; case "TemplateAssociationTreeListView": TemplateAssociationViewModel templateAssociationViewModel = TemplateAssociationViewModelLocator.GetTemplateAssociationVM(); templateAssociationViewModel.AssociateWithTemplate(destination); templateAssociationViewModel.FilteredTemplateAssociations.View.Refresh(); break; case "TemplateRequirementTreeListView": TemplateRequirementViewModel templateRequirementViewModel = TemplateRequirementViewModelLocator.GetTemplateRequirementVM(); templateRequirementViewModel.AssociateWithTemplate(destination); templateRequirementViewModel.FilteredTemplateRequirements.View.Refresh(); break; case "RequirementTreeListView": RequirementViewModelLocator.GetRequirementVM().MoveSelection(destination); break; } } }