private void SubscribeRunningTaskToEvents(TaskInstanceConfigurationViewModel taskInstanceViewModel) { taskInstanceViewModel.PropertyChanged += TaskConfigNameHasChanged; if (taskInstanceViewModel.ConfigurationEntries != null) { foreach (var configEntries in taskInstanceViewModel.ConfigurationEntries) { configEntries.ConfigChanged += SetHasChanges; } } }
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); } }
partial void OnSetSelectedRunningTask(ref TaskInstanceConfigurationViewModel value);
public void AddTaskInstance(TaskInstanceConfigurationViewModel taskInstanceViewModel) { if (!TaskInstanceNameAlreadyExists(taskInstanceViewModel.RunningTaskName)) SubscribeRunningTaskToEvents(taskInstanceViewModel); RunningTasks.Add(taskInstanceViewModel); }
private void UnsubscribeRemovedTaskInstanceFromEvents(TaskInstanceConfigurationViewModel taskInstanceViewModel) { taskInstanceViewModel.PropertyChanged -= TaskConfigNameHasChanged; if (taskInstanceViewModel.ConfigurationEntries != null) { foreach (var configEntries in taskInstanceViewModel.ConfigurationEntries) { configEntries.ConfigChanged -= SetHasChanges; } } }
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(); }