コード例 #1
0
ファイル: Program.cs プロジェクト: rustd/WebJobsSDKSamples
        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);
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: kausikng/WebJobsSDKSamples
        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);
            }
        }