internal void InitChangeEntry(EntityId changedEntityId, Dictionary<string, object> changedPropertyValues)
 {
     Action = HistoryAction.PropertiesChanged;
     ChangedEntityId = changedEntityId;
     ChangedPropertyValues = changedPropertyValues;
 }
 internal void SaveOldPropertyValues(EntityId entityId, Dictionary<string, object> propertyValues)
 {
     if (!_isClosed)
     {
         var newEntry = new HistoryEntry();
         newEntry.InitChangeEntry(entityId, propertyValues);
         Entries.Push(newEntry);
     }
 }
 private void SaveAsRecentProject(EntityId projectId)
 {
     var project = ViewModelService.Instance.QueryViewModel<RecentProjectViewModel>(projectId);
     project.ApplicationViewModel = this;
     Settings.AddRecentProject(project);
 }
        public void InitProject(EntityId projectId)
        {
            if (projectId == null)
                throw new ArgumentNullException("projectId", "projectId is null.");

            var newProject = ViewModelService.Instance.QueryViewModel<ProjectViewModel>(projectId);
            if (ProjectChanged != null)
                ProjectChanged(CurrentProject, newProject);

            CurrentProject = newProject;
            //Unload all views
            if (Settings.CloseStartPageAfterProjectLoad)
                DockManager.Views.ToList().ForEach(cur => cur.Close());
            else
                DockManager.GetViews(cur => !(cur.DataContext is StartViewModel)).ToList().ForEach(cur => cur.Close());

            SaveAsRecentProject(projectId);

            //Open next view
            if (Settings.ViewAfterProjectLoad == "Requirement Manager View")
            {
                string serviceId = "DTServices.CommonServices";
                string operationId = "GetRequirementManager";
                var viewModel = ViewModelService.Instance.ExecuteOperation<RequirementManagerViewModel>(serviceId, operationId, projectId);
                ViewService.Instance.ShowView(viewModel);
            }
            else if (Settings.ViewAfterProjectLoad == "Decision Table Manager View")
            {
                string serviceId = "DTServices.CommonServices";
                string operationId = "GetDecisionTableManager";
                var viewModel = ViewModelService.Instance.ExecuteOperation<DecisionTableManagerViewModel>(serviceId, operationId, projectId);
                ViewService.Instance.ShowView(viewModel);
            }

            //Init project explorer
            if (!ViewService.Instance.IsViewVisible<ProjectExplorerViewModel>(projectId))
            {
                var projectExplorerViewModel = ViewModelService.Instance.QueryViewModel<ProjectExplorerViewModel>(projectId);
                ViewService.Instance.ShowView(projectExplorerViewModel, activate: false, dockState: DockState.AutoHide);
            }

            //Init status view
            if (!ViewService.Instance.IsViewVisible<StatusViewModel>())
                ViewService.Instance.ShowView(Status, activate: false, dockState: DockState.AutoHide);
        }
        public void MyTestInitialize()
        {
            var projectDialog = new ProjectDialogModel
            {
                Name = "Test Project"
            };

            string serviceId = "DTServices.ProjectServices";
            string operationId = "CreateProject";
            ProjectId = ViewModelService.Instance.ExecuteOperation<EntityId>(serviceId, operationId, projectDialog);

            string serviceId2 = "DTServices.CommonServices";
            string operationId2 = "GetDecisionTableManager";
            var decisionTableManagerViewModel = ViewModelService.Instance.ExecuteOperation<DecisionTableManagerViewModel>(serviceId2, operationId2, ProjectId);
            var decisionTableDialog = new DecisionTableDialogModel
            {
                Name = "Test Table",
                DecisionTableManagerId = decisionTableManagerViewModel.EntityId
            };
            ViewModelService.Instance.InsertViewModel(decisionTableDialog, decisionTableManagerViewModel.EntityId, "DecisionTables");
            DecisionTable = ViewModelService.Instance.QueryViewModel<DecisionTableViewModel>(decisionTableManagerViewModel.DecisionTables[0].EntityId);
        }
        public void MyTestCleanup()
        {
            string serviceId = "DTServices.CommonServices";
            string operationId = "UnloadEntities";
            ViewModelService.Instance.ExecuteOperation(serviceId, operationId);

            ProjectId = null;
            DecisionTable = null;
        }