示例#1
0
 public IEnumerable<TaskToken> Parse(Task task)
 {
     return task.Content.Split(',')
         .Select(ParseToken)
         .Where(token => token != null)
         .ToList();
 }
示例#2
0
 public TaskViewModel(Task model, IDiagram widget, IMessagingService messagingService)
 {
     _widget = widget;
     _messagingService = messagingService;
     Model = model;
     ToggleCompletedCommand = new CaptionCommand<string>("¨", OnToggleCompleted);
 }
示例#3
0
 public IEnumerable<TaskToken> Parse(Task task)
 {
     if (string.IsNullOrEmpty(task.Content)) return null;
     return task.Content.Split(',')
         .Select(ParseToken)
         .Where(token => token != null)
         .ToList();
 }
示例#4
0
 public TaskViewModel(Task model, TaskType taskType, TaskEditorViewModel widget, IMessagingService messagingService)
 {
     _taskType = taskType;
     _widget = widget;
     _messagingService = messagingService;
     Model = model;
     ToggleCompletedCommand = new CaptionCommand<string>("¨", OnToggleCompleted);
     ExecuteCommand = new DelegateCommand<string>(OnCommandExecute);
 }
示例#5
0
 public Task AddNewTask(int taskTypeId, string taskContent)
 {
     if (taskTypeId == 0) return null;
     var task = new Task { Content = taskContent, TaskTypeId = taskTypeId };
     var tokens = _taskParser.Parse(task);
     foreach (var taskToken in tokens)
         task.TaskTokens.Add(taskToken);
     SaveTask(task);
     return task;
 }
示例#6
0
 public string GetCommandValue(Task task)
 {
     var value = CommandValue;
     if (!string.IsNullOrWhiteSpace(CommandValue) && Regex.IsMatch(value, "\\[(.*)\\]"))
     {
         value = Regex.Match(value, "\\[(.*)\\]").Groups[1].Value;
         value = task.GetCustomDataValue(value);
     }
     return value;
 }
示例#7
0
 public Task AddNewTask(int taskTypeId, string taskContent, Dictionary<string, string> customFields, bool saveTask)
 {
     if (taskTypeId == 0) return null;
     var task = new Task { Content = taskContent, TaskTypeId = taskTypeId };
     var tokens = _taskParser.Parse(task);
     if (tokens != null)
     {
         foreach (var taskToken in tokens)
             task.TaskTokens.Add(taskToken);
     }
     foreach (var customField in customFields)
     {
         task.UpdateCustomDataValue(customField.Key, customField.Value);
     }
     if (saveTask) SaveTask(task);
     return task;
 }
示例#8
0
 public void SaveTask(Task task)
 {
     _taskDao.SaveTask(task);
 }
示例#9
0
 public void SaveTask(Task task)
 {
     Dao.Save(task);
 }
示例#10
0
 private void ExecuteCommand(Task task, TaskCommand command, dynamic dataObject)
 {
     dataObject.AutomationCommandName = command.CommandName;
     dataObject.CommandValue = command.GetCommandValue(task);
     _applicationState.NotifyEvent(RuleEventNames.AutomationCommandExecuted, dataObject);
 }
示例#11
0
 private void ExecuteCommands(IEnumerable<TaskCommand> commands, Task task)
 {
     var dataObject = new ExpandoObject();
     foreach (var command in commands)
     {
         ExecuteCommand(task, command, dataObject);
     }
 }
示例#12
0
 public void ExecuteTaskCommand(Task task, string commandName)
 {
     var command = Settings.TaskCommandList.FirstOrDefault(x => x.DisplayName == commandName);
     if (command != null) ExecuteCommand(task, command, new ExpandoObject());
 }
示例#13
0
 public void ExecuteTaskCreateCommands(Task task)
 {
     ExecuteCommands(Settings.TaskCreateCommandList, task);
 }
示例#14
0
 private void ExecuteCommands(IEnumerable<TaskCommand> commands, Task task)
 {
     foreach (var command in commands)
     {
         ExecuteCommand(task, command);
     }
 }
示例#15
0
 private void ExecuteCommand(Task task, TaskCommand command)
 {
     _applicationState.NotifyEvent(RuleEventNames.AutomationCommandExecuted,
                                   new
                                       {
                                           AutomationCommandName = command.CommandName,
                                           CommandValue = command.GetCommandValue(task)
                                       });
 }
示例#16
0
 public TaskViewModel(Task model, IDiagram widget)
 {
     _widget = widget;
     Model = model;
     ToggleCompletedCommand = new CaptionCommand<string>("£", OnToggleCompleted);
 }