Beispiel #1
0
        private void SubscribeRunningTaskToEvents(TaskInstanceConfigurationViewModel taskInstanceViewModel)
        {
            taskInstanceViewModel.PropertyChanged += TaskConfigNameHasChanged;

            if (taskInstanceViewModel.ConfigurationEntries != null)
            {
                foreach (var configEntries in taskInstanceViewModel.ConfigurationEntries)
                {
                        configEntries.ConfigChanged += SetHasChanges;
                }
            }
        }
Beispiel #2
0
 private void CreateViewModelTaskInstances(IEnumerable<TaskConfiguration> activeTasksFromDb)
 {
     foreach (var taskConfiguration in activeTasksFromDb)
     {
         var taskInstanceViewModel = new TaskInstanceConfigurationViewModel
                                         {
                                             ConfigurationEntries =
                                                 new ObservableCollection<ConfigurationEntryViewModel>
                                                 (
                                                     (from entry in taskConfiguration.Entries
                                                      select new ConfigurationEntryViewModel
                                                                 {  
                                                                     Name = entry.Name,
                                                                     Type = entry.Type,
                                                                     Value = entry.Value,
                                                                     HelpText = entry.HelpText
                                                                 }).ToArray()
                                                 ),
                                             DispatchInterval = taskConfiguration.DispatchInterval,
                                             RunningTaskName = taskConfiguration.Name,
                                             AvailableTaskName = taskConfiguration.TaskName
                                         };
         _viewModel.AddTaskInstance(taskInstanceViewModel);
     }
 }
Beispiel #3
0
		partial void OnSetSelectedRunningTask(ref TaskInstanceConfigurationViewModel value);
Beispiel #4
0
 public void AddTaskInstance(TaskInstanceConfigurationViewModel taskInstanceViewModel)
 {
     if (!TaskInstanceNameAlreadyExists(taskInstanceViewModel.RunningTaskName))
         SubscribeRunningTaskToEvents(taskInstanceViewModel);
         RunningTasks.Add(taskInstanceViewModel);
 }
Beispiel #5
0
        private void UnsubscribeRemovedTaskInstanceFromEvents(TaskInstanceConfigurationViewModel taskInstanceViewModel)
        {
            taskInstanceViewModel.PropertyChanged -= TaskConfigNameHasChanged;

            if (taskInstanceViewModel.ConfigurationEntries != null)
            {
                foreach (var configEntries in taskInstanceViewModel.ConfigurationEntries)
                {
                    configEntries.ConfigChanged -= SetHasChanges;
                }
            }
        }
Beispiel #6
0
        public void OnActivateSelectedTask()
        {
            var newTaskInstance = new TaskInstanceConfigurationViewModel
            {
                RunningTaskName = "New " + SelectedAvailableTask.Name,
                AvailableTaskName = SelectedAvailableTask.Name,
                ConfigurationEntries = SelectedAvailableTask.ConfigurationEntries
            };

            if (TaskInstanceNameAlreadyExists(newTaskInstance.RunningTaskName))
                newTaskInstance.RunningTaskName = GetNameWithPostfix(newTaskInstance.RunningTaskName);

            AddTaskInstance(newTaskInstance);
            SelectedAvailableTask = null;
            SelectedRunningTask = newTaskInstance;

        }
 protected void CreateTaskInstance(ObservableCollection<ConfigurationEntryViewModel> configurationEntryViewModels)
 {
     taskInstance = new TaskInstanceConfigurationViewModel
     {
         AvailableTaskName = "Test task",
         RunningTaskName = "New Test task",
         ConfigurationEntries = configurationEntryViewModels
     };
 }
 protected void SetUp()
 {
     taskInstance = new TaskInstanceConfigurationViewModel
                         {
                             AvailableTaskName = "Test task",
                             RunningTaskName = "New Test task",
                             ConfigurationEntries = configWithManyPrioritizedSettingsWithOrderIndex
                         };
 }
 public void InstantiateVM()
 {
     vm = new TaskInstanceConfigurationViewModel();
 }