예제 #1
0
        private static void RunTest()
        {
            var workersBuilder = new WorkersBuilder();
            var worker         = workersBuilder.Resolve(_arguments.Parameter);

            worker.Run();
        }
예제 #2
0
        public static JobBuilder AddWorkers(this JobBuilder jobBuilder, Action <WorkersBuilder> builder)
        {
            jobBuilder.AddDefaultScopeFactory();
            var workers = new WorkersBuilder(jobBuilder.Services);

            builder(workers);
            return(jobBuilder);
        }
예제 #3
0
 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();
 }
예제 #4
0
        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();
        }