コード例 #1
0
ファイル: TasksViewModel.cs プロジェクト: ArildF/Smeedee
        private void SubscribeRunningTaskToEvents(TaskInstanceConfigurationViewModel taskInstanceViewModel)
        {
            taskInstanceViewModel.PropertyChanged += TaskConfigNameHasChanged;

            if (taskInstanceViewModel.ConfigurationEntries != null)
            {
                foreach (var configEntries in taskInstanceViewModel.ConfigurationEntries)
                {
                        configEntries.ConfigChanged += SetHasChanges;
                }
            }
        }
コード例 #2
0
ファイル: TasksController.cs プロジェクト: ArildF/Smeedee
 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);
     }
 }
コード例 #3
0
ファイル: ViewModel.cs プロジェクト: ArildF/Smeedee
		partial void OnSetSelectedRunningTask(ref TaskInstanceConfigurationViewModel value);
コード例 #4
0
ファイル: TasksViewModel.cs プロジェクト: ArildF/Smeedee
 public void AddTaskInstance(TaskInstanceConfigurationViewModel taskInstanceViewModel)
 {
     if (!TaskInstanceNameAlreadyExists(taskInstanceViewModel.RunningTaskName))
         SubscribeRunningTaskToEvents(taskInstanceViewModel);
         RunningTasks.Add(taskInstanceViewModel);
 }
コード例 #5
0
ファイル: TasksViewModel.cs プロジェクト: ArildF/Smeedee
        private void UnsubscribeRemovedTaskInstanceFromEvents(TaskInstanceConfigurationViewModel taskInstanceViewModel)
        {
            taskInstanceViewModel.PropertyChanged -= TaskConfigNameHasChanged;

            if (taskInstanceViewModel.ConfigurationEntries != null)
            {
                foreach (var configEntries in taskInstanceViewModel.ConfigurationEntries)
                {
                    configEntries.ConfigChanged -= SetHasChanges;
                }
            }
        }
コード例 #6
0
ファイル: TasksViewModel.cs プロジェクト: ArildF/Smeedee
        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;

        }
コード例 #7
0
 protected void CreateTaskInstance(ObservableCollection<ConfigurationEntryViewModel> configurationEntryViewModels)
 {
     taskInstance = new TaskInstanceConfigurationViewModel
     {
         AvailableTaskName = "Test task",
         RunningTaskName = "New Test task",
         ConfigurationEntries = configurationEntryViewModels
     };
 }
コード例 #8
0
 protected void SetUp()
 {
     taskInstance = new TaskInstanceConfigurationViewModel
                         {
                             AvailableTaskName = "Test task",
                             RunningTaskName = "New Test task",
                             ConfigurationEntries = configWithManyPrioritizedSettingsWithOrderIndex
                         };
 }
コード例 #9
0
 public void InstantiateVM()
 {
     vm = new TaskInstanceConfigurationViewModel();
 }