private static void RunTest() { var workersBuilder = new WorkersBuilder(); var worker = workersBuilder.Resolve(_arguments.Parameter); worker.Run(); }
public static JobBuilder AddWorkers(this JobBuilder jobBuilder, Action <WorkersBuilder> builder) { jobBuilder.AddDefaultScopeFactory(); var workers = new WorkersBuilder(jobBuilder.Services); builder(workers); return(jobBuilder); }
private void btnStartWorker_Click(object sender, RoutedEventArgs e) { if(comboWorkers.SelectedItem == null) return; var selectedValue = ((ComboBoxItem)comboWorkers.SelectedItem).Content.ToString(); var workersBuilder = new WorkersBuilder(); var worker = workersBuilder.Resolve(selectedValue); worker.SetCanvas(MainCanvas); worker.Run(); }
public static void Main(string[] args) { string sourcePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "sample_tweets.tsv"); string logPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "analysis.log"); string resPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "sentiment.tsv"); resWritter = new CsvFileWriter(resPath); resWritter.Delimiter = '\t'; resWritter.WriteRow(new List <string>() { "Id", "Sentiment score", "Sentiment Polarity" }); logWritter = new StreamWriter(File.OpenWrite(logPath)); CSVFileDataProvider provider = new CSVFileDataProvider(sourcePath) { Delimiter = '\t', IdColumnIndex = 0, TextColumnIndex = 6 }; WorkersBuilder builder = new WorkersBuilder(provider); builder.SemantriaAPIkey = apiKey; builder.SemantriaAPIsecret = apiSecret; builder.Configuration = configId; for (int index = 0; index < threadsCount; index++) { IWorker worker = builder.CreateSemantriaWorker(); worker.ExecutedMethodCallback = MethodExecuted; worker.ErrorOccurredCallback = ErrorOccurred; worker.RecordQueuedCallback = RecordQueued; worker.OutputReceivedCallback = OutputReceived; worker.Initialize(); Task task = new Task(() => worker.Process()); task.Start(); } Console.ReadLine(); }