/// <summary> /// Select Project Command through command interface /// </summary> private void SelectProject(Object p) { ProjectModel selectedProject = GetProject((int)p); Globals.Project_ID = (int)p; Globals.ProjectSelected = true; ProjectSelected = true; Globals.ProjectName = selectedProject.ProjectName; Globals.ContractNo = selectedProject.ContractNo; selectedProject.LastOpened = DateTime.Now; // Store the current DateTime in the selected project record so it can be used to sort the project list EDBEntities eDB = new EDBEntities(); tblProject Rec = eDB.tblProjects.Where(o => o.ID == selectedProject.ID).FirstOrDefault(); Rec.LastOpened = selectedProject.LastOpened; Rec.LastOpenedBy = Environment.UserName; eDB.SaveChanges(); IsBackStageOpen = false; MainTitle = Globals.ContractNo + Globals.ProjectName; TypeViewModelLocator.GetTypeVM(); ObjectViewModelLocator.GetObjectVM(); TemplateViewModelLocator.GetTemplateVM(); PropertyViewModelLocator.GetPropertyVM(); AspectViewModelLocator.GetAspectVM(); AttributeViewModelLocator.GetAttributeVM(); ObjectAssociationViewModelLocator.GetObjectAssociationVM(); ObjectRequirementViewModelLocator.GetObjectRequirementVM(); TemplateAssociationViewModelLocator.GetTemplateAssociationVM(); TemplateRequirementViewModelLocator.GetTemplateRequirementVM(); }
public TemplateView() { InitializeComponent(); DataContext = TemplateViewModelLocator.GetTemplateVM(); PropertyTreeListView.DataContext = PropertyViewModelLocator.GetPropertyVM(); RequirementTreeListView.DataContext = RequirementViewModelLocator.GetRequirementVM(); TemplateAssociationTreeListView.DataContext = TemplateAssociationViewModelLocator.GetTemplateAssociationVM(); TemplateRequirementTreeListView.DataContext = TemplateRequirementViewModelLocator.GetTemplateRequirementVM(); }
//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; } } }