protected WordGatheringTaskBase(ITaskConfiguration config, LexEntryRepository lexEntryRepository, ViewTemplate viewTemplate, TaskMemoryRepository taskMemoryRepository) : base(config, lexEntryRepository, taskMemoryRepository) { if (viewTemplate == null) { throw new ArgumentNullException("viewTemplate"); } _viewTemplate = viewTemplate; _lexicalFormWritingSystem = viewTemplate.GetDefaultWritingSystemForField(Field.FieldNames.EntryLexicalForm.ToString()); var glossField = _viewTemplate.GetField(LexSense.WellKnownProperties.Gloss); if (glossField == null) { _glossMeaningField = false; } else { _glossMeaningField = glossField.IsMeaningField; } }
public bool AreEquivalent(ITaskConfiguration taskConfiguration) { var task = taskConfiguration as MissingInfoConfiguration; if (task == null) { return(false); } if (task.TaskName != TaskName) { return(false); } if (task.MissingInfoFieldName != MissingInfoFieldName) { return(false); } if (task.Label != Label) { return(false); } return(true); }
public DefaultTaskConfigurationControl(ITaskConfiguration config, bool haveSetupControls) { _config = config; InitializeComponent(); _description.Text = config.Description; _setupLabel.Visible = haveSetupControls; }
public TaskExecution(ITask task, DateTime startTime, ITaskConfiguration configuration = null) { _task = task; _logs = new List <ILog>(); TaskExecutionId = Guid.NewGuid(); StartTime = startTime; Configuration = configuration; Status = TaskStatus.Initial; }
public ITaskExecution Create(string taskName, DateTime dateTime, ITaskConfiguration configuration = null) { var task = _taskRegistry.Tasks.FirstOrDefault(x => x.Key == taskName); if (task.Key != null) { return(new TaskExecution((ITask)Activator.CreateInstance(task.Value), dateTime, configuration)); } return(null); }
/// <summary> /// Image Dequeue Setup /// </summary> /// <param name="config"></param> public ImageDequeueSetup(ITaskConfiguration config) { if (null == config) { throw new ArgumentNullException("config"); } this.Images = config.Versions.Images; this.Name = config.StorageElements.Queue; this.Priority = config.Priority; this.connectionString = config.ConnectionString; }
public TaskBase(ITaskConfiguration config, LexEntryRepository lexEntryRepository, TaskMemoryRepository taskMemoryRepository) { if (config.Label == null) { throw new ArgumentNullException("label"); } if (config.LongLabel == null) { throw new ArgumentNullException("longLabel"); } if (config.Description == null) { throw new ArgumentNullException("description"); } if (config.RemainingCountText == null) { throw new ArgumentNullException("remainingCountText"); } if (config.ReferenceCountText == null) { throw new ArgumentNullException("referenceCountText"); } if (lexEntryRepository == null) { throw new ArgumentNullException("lexEntryRepository"); } _lexEntryRepository = lexEntryRepository; _taskMemory = taskMemoryRepository.FindOrCreateSettingsByTaskId(config.TaskName); // convert any amount of whitespace to one space Regex rgx = new Regex("\\s+"); _label = rgx.Replace(config.Label.Trim(), " "); _longLabel = rgx.Replace(config.LongLabel.Trim(), " "); _description = rgx.Replace(config.Description.Trim(), " "); _remainingCountText = rgx.Replace(config.RemainingCountText.Trim(), " "); _referenceCountText = rgx.Replace(config.ReferenceCountText.Trim(), " "); _isPinned = config.IsPinned; // _cachePath = WeSayWordsProject.Project.PathToCache; // _cacheFilePath = Path.Combine(_cachePath, MakeSafeName(Label + ".cache")); // // ReadCacheFile(); _remainingCount = _taskMemory.Get("RemainingCount", CountNotComputed); _referenceCount = _taskMemory.Get("ReferenceCount", CountNotComputed); }
public DictionaryBrowseEditTaskConfigControl(ITaskConfiguration config) : base(config, true) { InitializeComponent(); switch (Configuration.MeaningField) { case "definition": _definition.Checked = true; break; case "gloss": _gloss.Checked = true; break; } }
protected WordGatheringTaskBase(ITaskConfiguration config, LexEntryRepository lexEntryRepository, ViewTemplate viewTemplate, TaskMemoryRepository taskMemoryRepository) : base(config, lexEntryRepository, taskMemoryRepository) { if (viewTemplate == null) { throw new ArgumentNullException("viewTemplate"); } _viewTemplate = viewTemplate; _lexicalFormWritingSystem = viewTemplate.GetDefaultWritingSystemForField(Field.FieldNames.EntryLexicalForm.ToString()); }
static public Control Create(IComponentContext diContainer, ITaskConfiguration config) { //nb: I tried but didn't figure out how to make autofac select the correct //control based on the type of the configuration: // if(diContainer.TryResolve<ITaskConfigurationControl>(out x, new TypedParameter(config.GetType(), config))) if (config.GetType() == typeof(MissingInfoConfiguration)) { return(diContainer.Resolve <MissingInfoTaskConfigControl>(new TypedParameter(config.GetType(), config))); } if (config.TaskName == "GatherWordsBySemanticDomains") { return(new GatherBySemDomTaskConfigControl(config)); } return(new DefaultTaskConfigurationControl(config, false)); }
public bool AreEquivalent(ITaskConfiguration taskConfiguration) { var task = taskConfiguration as MissingInfoConfiguration; if (task == null) { return(false); } if (task.TaskName != TaskName) { return(false); } if (task.MissingInfoFieldName != MissingInfoFieldName) { // The field of "Add Meanings" will be definition or gloss depending what the meaning field is // the default config has it as definition so must be considered as equivalent to gloss if (task.MissingInfoFieldName == LexSense.WellKnownProperties.Definition) { if (MissingInfoFieldName != LexSense.WellKnownProperties.Gloss) { return(false); } } else if (task.MissingInfoFieldName == LexSense.WellKnownProperties.Gloss) { if (MissingInfoFieldName != LexSense.WellKnownProperties.Definition) { return(false); } } else { return(false); } } if (task.Label != Label) { return(false); } return(true); }
private void GetTasks(string xml, IComponentContext context, List <ITaskConfiguration> configs) { XPathDocument doc = new XPathDocument(new StringReader(xml)); XPathNavigator navigator = doc.CreateNavigator(); XPathNodeIterator taskListNodeIterator = navigator.Select("configuration/tasks/task"); foreach (XPathNavigator taskNode in taskListNodeIterator) { ITaskConfiguration configuration = CreateTaskConfiguration(context, _taskTypes, taskNode); if (configuration != null) { if (!configs.Exists(t => t.AreEquivalent(configuration))) { configs.Add(configuration); } } } }
private static ITask CreateTask(IContext context, ITaskConfiguration config) { try { //make the task itself, handing it this configuration object. //its other constructor arguments come "automatically" out of the context return context.Resolve<ITask>(config.TaskName, new Parameter[] { new NamedParameter("config", config) }); } catch (Exception e) { string message = e.Message; while (e.InnerException != null) //the user will see this, so lets dive down to the actual cause { e = e.InnerException; message = e.Message; } return new FailedLoadTask(config.TaskName, "", message); } }
private static ITask CreateTask(IComponentContext context, ITaskConfiguration config) { try { //make the task itself, handing it this configuration object. //its other constructor arguments come "automatically" out of the context return(context.ResolveNamed <ITask>(config.TaskName, new Parameter[] { new NamedParameter("config", config) })); } catch (Exception e) { string message = e.Message; while (e.InnerException != null) //the user will see this, so lets dive down to the actual cause { e = e.InnerException; message = e.Message; } return(new FailedLoadTask(config.TaskName, "", message)); } }
public TaskBase(ITaskConfiguration config, LexEntryRepository lexEntryRepository) { if (config.Label == null) { throw new ArgumentNullException("label"); } if (config.LongLabel == null) { throw new ArgumentNullException("longLabel"); } if (config.Description == null) { throw new ArgumentNullException("description"); } if (config.RemainingCountText == null) { throw new ArgumentNullException("remainingCountText"); } if (config.ReferenceCountText == null) { throw new ArgumentNullException("referenceCountText"); } if (lexEntryRepository == null) { throw new ArgumentNullException("lexEntryRepository"); } _lexEntryRepository = lexEntryRepository; // convert any amount of whitespace to one space Regex rgx = new Regex("\\s+"); _label = rgx.Replace (config.Label.Trim(), " "); _longLabel = rgx.Replace (config.LongLabel.Trim(), " "); _description = rgx.Replace (config.Description.Trim(), " "); _remainingCountText = rgx.Replace (config.RemainingCountText.Trim(), " "); _referenceCountText = rgx.Replace (config.ReferenceCountText.Trim(), " "); _isPinned = config.IsPinned; _cachePath = WeSayWordsProject.Project.PathToCache; _cacheFilePath = Path.Combine(_cachePath, MakeSafeName(Label + ".cache")); ReadCacheFile(); }
private void Configure(string configFile) { if (configFile != null && !File.Exists(configFile)) { ColorConsole.WriteLine($"{configFile} does not exist.".Red()); ColorConsole.WriteLine("Using default configuration.".Red()); configFile = null; } if (configFile == null) { configFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".todo.json"); } IServiceCollection serviceCollection = new ServiceCollection(); serviceCollection .AddApplication() .AddInfrastructure(configFile); Services = serviceCollection.BuildServiceProvider(); Mediator = Services.GetService <IMediator>(); Configuration = Services.GetService <ITaskConfiguration>(); }
protected WordGatheringTaskBase(ITaskConfiguration config, LexEntryRepository lexEntryRepository, ViewTemplate viewTemplate) : base( config, lexEntryRepository) { if (viewTemplate == null) { throw new ArgumentNullException("viewTemplate"); } _viewTemplate = viewTemplate; Field lexicalFormField = viewTemplate.GetField(Field.FieldNames.EntryLexicalForm.ToString()); WritingSystemCollection writingSystems = BasilProject.Project.WritingSystems; if (lexicalFormField == null || lexicalFormField.WritingSystemIds.Count < 1) { _lexicalFormWritingSystem = writingSystems.UnknownVernacularWritingSystem; } else { _lexicalFormWritingSystem = writingSystems[lexicalFormField.WritingSystemIds[0]]; } }
public bool AreEquivalent(ITaskConfiguration taskConfiguration) { return(taskConfiguration is GatherWordListConfig && WordListFileName == ((GatherWordListConfig)taskConfiguration).WordListFileName); }
public bool AreEquivalent(ITaskConfiguration taskConfiguration) { return(taskConfiguration is DictionaryBrowseAndEditConfiguration); }
public ArchiveTasksCommandHandler(ITaskFile taskFile, ITaskConfiguration config) { _taskFile = taskFile; _config = config; }
public GatherBySemDomTaskConfigControl(ITaskConfiguration config) : base(config, true) { InitializeComponent(); _showMeaningField.Checked = Configuration.ShowMeaningField; }
public void Execute(ITaskConfiguration configuration) { Execute((MessageTaskConfiguration)configuration); }
public AddPriorityCommandHandler(ITaskFile taskFile, ITaskConfiguration config) { _taskFile = taskFile; _config = config; }
public ITaskExecution Create(string taskName, ITaskConfiguration configuration = null) { return(Create(taskName, DateTime.Now, configuration)); }
public DeprioritizeCommandHandler(ITaskFile taskFile, ITaskConfiguration config) { _taskFile = taskFile; _config = config; }
public bool AreEquivalent(ITaskConfiguration taskConfiguration) { return(taskConfiguration is NotesBrowserConfig); }
public bool AreEquivalent(ITaskConfiguration taskConfiguration) { return taskConfiguration is GatherBySemanticDomainConfig; }
public bool AreEquivalent(ITaskConfiguration taskConfiguration) { return(taskConfiguration is AddPicturesConfig); }
public TaskExecution(ITask task, ITaskConfiguration configuration = null) : this(task, DateTime.Now, configuration) { }
public bool DoShowTask(ITaskConfiguration task) { return(task.Label != "Dashboard"); }
public DeleteTaskCommandHandler(ITaskFile taskFile, ITaskConfiguration config) { _taskFile = taskFile; _config = config; }
public void Execute(ITaskConfiguration configuration) { }
public TaskQueryHandler(ITaskFile taskFile, ITaskConfiguration config) { _taskFile = taskFile; _config = config; }