Example #1
0
 private void CreateViewModelTasks(IEnumerable<TaskDefinition> tasksFromDb)
 {
     foreach (var taskDefinition in tasksFromDb)
     {
         var taskViewModel = new TaskViewModel
                                 {
                                     Name = taskDefinition.Name,
                                     ConfigurationEntries =
                                         new ObservableCollection<ConfigurationEntryViewModel>(
                                         (from setting in taskDefinition.SettingDefinitions
                                          select new ConfigurationEntryViewModel
                                                     {
                                                         OrderIndex = setting.OrderIndex,
                                                         Name = setting.SettingName,
                                                         Type = setting.Type ?? typeof (string),
                                                         Value = setting.DefaultValue,
                                                         HelpText = setting.HelpText
                                                     }).ToArray()),
                                     Author = taskDefinition.Author,
                                     Description = taskDefinition.Description,
                                     Version = taskDefinition.Version,
                                     Webpage = taskDefinition.Webpage
                                 };
         _viewModel.AddTask(taskViewModel);
     }
 }
Example #2
0
 private bool TaskAlreadyExist(TaskViewModel taskViewModel)
 {
     return AvailableTasks.Any(task => task.Name == taskViewModel.Name && task.Version == taskViewModel.Version && task.Description == taskViewModel.Description);
 }
Example #3
0
		partial void OnSetSelectedAvailableTask(ref TaskViewModel value);
Example #4
0
 public void AddTask(TaskViewModel taskViewModel)
 {
     if(!TaskAlreadyExist(taskViewModel))
         AvailableTasks.Add(taskViewModel);
 }