Exemplo n.º 1
0
        static void Main(string[] args)
        {
            CancellationTokenSource cancelTokenSource = new CancellationTokenSource();

            FileSystemWatcher watcher = new FileSystemWatcher(@"C:\temp");
            watcher.Created += OnFileCreated;

            host = new JobHost();

            // Run the host on a background thread so we can invoke from dashboard
            host.RunOnBackgroundThread(cancelTokenSource.Token);

            // Enable the file watcher events and wait
            watcher.EnableRaisingEvents = true;
            while (!cancelTokenSource.IsCancellationRequested)
            {
                Thread.Sleep(2000);
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            CancellationTokenSource cancelTokenSource = new CancellationTokenSource();

            FileSystemWatcher watcher = new FileSystemWatcher(@"C:\temp");

            watcher.Created += OnFileCreated;

            host = new JobHost();

            // Run the host on a background thread so we can invoke from dashboard
            host.RunOnBackgroundThread(cancelTokenSource.Token);

            // Enable the file watcher events and wait
            watcher.EnableRaisingEvents = true;
            while (!cancelTokenSource.IsCancellationRequested)
            {
                Thread.Sleep(2000);
            }
        }