예제 #1
0
        public MainWindow()
        {
            InitializeComponent();
            //setup application

            IMeasureRepository _repository = new MeasureRepository();
            IAppProcessor      _app        = new AppProcessor();

            //get measure data

            Console.WriteLine("Type file path of MEASURE:");
            List <string> paths = new List <string>();

            paths.Add(Console.ReadLine());
            _repository.Measures = _app.LoadMeasureFiles(paths);

            //copy to excel file

            Console.WriteLine("Type file path of template:");
            //string templatePath = Console.ReadLine();
            Application excel = new Application();
            //Workbook template = excel.Workbooks.Open(templatePath);
            Workbook template = excel.Workbooks.Open(@"C:\Users\pawel.iwanowski\Desktop\test\template.xlsx");

            _app.SaveMeasureFilesInExcel(_repository, template);

            //display collected data

            foreach (var measure in _repository.Measures)
            {
                Console.WriteLine($"DragHi = {measure.DragHi}");
                Console.WriteLine($"DragLo = {measure.DragLo}");

                Console.WriteLine("Friction:");
                foreach (var f in measure.Friction)
                {
                    Console.WriteLine($"{f}");
                }
            }

            Console.ReadLine();
        }
예제 #2
0
파일: app.cs 프로젝트: DominikTorhan/DoKey
        private void OnKeyPressed(object sender, KeyboardHookEventArgs e)
        {
            if (isSending)
            {
                return;
            }
            if (IsSystemCapsLock(e))
            {
                return;
            }
            isSending = true;
            var keyEvent = CreateKeyEvent(e);
            var output   = new AppProcessor(appConfig, session, keyEvent).PerformKeyPress();

            isSending = false;
            if (output == null)
            {
                return;
            }
            e.Handled = output.preventKeyProcess;
            session   = new Session(session.config, output.appState);
        }
        public Processor Build(IRuntimeBuilder runtimeBuilder, AppProcessor config)
        {
            if (runtimeBuilder == null)
            {
                throw new ArgumentNullException(nameof(runtimeBuilder));
            }
            else if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            var producerEngine1 = BuildProducerEngine(runtimeBuilder, null);
            var producerEngine2 = BuildProducerEngine(runtimeBuilder, null);

            var consumerEngine = BuildConsumerEngine();

            return(new ProducerConsumerProcessor <int>(
                       config.Name,
                       new CancellationSourceFactory(),
                       new[] { producerEngine1, producerEngine2 },
                       consumerEngine));
        }