Ejemplo n.º 1
0
        private bool ProcessQueueItem(ActivityExecutionContext context)
        {
            WorkflowQueuingService qService = context.GetService <WorkflowQueuingService>();

            if (!qService.Exists(this.QueueName))
            {
                return(false);
            }

            WorkflowQueue queue = qService.GetWorkflowQueue(this.QueueName);

            // If the queue has messages, then process the first one
            if (queue.Count == 0)
            {
                return(false);
            }

            FileWatcherEventArgs e = (FileWatcherEventArgs)queue.Dequeue();

            // Raise the FileSystemEvent
            base.RaiseGenericEvent <FileWatcherEventArgs>(FileSystemEvent.FileWatcherEventHandlerEvent, this, e);

            DoUnsubscribe(context, this);
            DeleteQueue(context);
            return(true);
        }
Ejemplo n.º 2
0
        private void DeliverToWorkflow(FileWatcherSubscription subscription, FileSystemEventArgs fileSystemEventArgs)
        {
            try
            {
                // We can't just use the FileSystemEventArgs because it's not serializable
                FileWatcherEventArgs eventArgs = new FileWatcherEventArgs(fileSystemEventArgs);

                WorkflowInstance workflowInstance = this.runtime.GetWorkflow(subscription.WorkflowInstanceId);
                workflowInstance.EnqueueItem(subscription.QueueName, eventArgs, null, null);
            }
            catch (Exception e)
            {
                // Write the exception out to the Debug console and throw the exception
                System.Diagnostics.Debug.WriteLine(e);
                throw e;
            }
        }
Ejemplo n.º 3
0
        private void DeliverToWorkflow(FileWatcherSubscription subscription, FileSystemEventArgs fileSystemEventArgs)
        {
            try
            {
                // We can't just use the FileSystemEventArgs because it's not serializable
                FileWatcherEventArgs eventArgs = new FileWatcherEventArgs(fileSystemEventArgs);

                WorkflowInstance workflowInstance = this.runtime.GetWorkflow(subscription.WorkflowInstanceId);
                workflowInstance.EnqueueItem(subscription.QueueName, eventArgs, null, null);
            }
            catch (Exception e)
            {
                // Write the exception out to the Debug console and throw the exception
                System.Diagnostics.Debug.WriteLine(e);
                throw e;
            }
        }
Ejemplo n.º 4
0
 private void AfterFileSystemEvent(object sender, FileWatcherEventArgs e)
 {
     FileSystemEvent activity = sender as FileSystemEvent;
     Console.WriteLine("FileSystemEvent '" + activity.Name + "' is handling an event...");
 }
Ejemplo n.º 5
0
        private void AfterFileSystemEvent(object sender, FileWatcherEventArgs e)
        {
            FileSystemEvent activity = sender as FileSystemEvent;

            Console.WriteLine("FileSystemEvent '" + activity.Name + "' is handling an event...");
        }