private void btnProcTestQueue_Click(object sender, EventArgs e) { //disable the button btnProcTestQueue.Enabled = false; //init the queue var queue = new Queues(Properties.Settings.Default.AzureConnection, "testqueue"); //build a object to be serialized and sent to the queue var obj = new QueueObject() { PartitionKey = tbQPartitionKey.Text, RowKey = tbQRowKey.Text }; //add it to the queue queue.Insert(JsonConvert.SerializeObject(obj), 20); //lets go ahead and start a task to wait for the queue and process it var taskList = new List <Task>(); var task = StartThread(); taskList.Add(task); var context = TaskScheduler.FromCurrentSynchronizationContext(); Task.Factory.ContinueWhenAll(taskList.ToArray(), ThreadsComplete, CancellationToken.None, TaskContinuationOptions.ExecuteSynchronously, context); }
private void btnProcTestQueue_Click(object sender, EventArgs e) { //disable the button btnProcTestQueue.Enabled = false; //init the queue var queue = new Queues(Properties.Settings.Default.AzureConnection, "testqueue"); //build a object to be serialized and sent to the queue var obj = new QueueObject() {PartitionKey = tbQPartitionKey.Text, RowKey = tbQRowKey.Text }; //add it to the queue queue.Insert(JsonConvert.SerializeObject(obj), 20); //lets go ahead and start a task to wait for the queue and process it var taskList = new List<Task>(); var task = StartThread(); taskList.Add(task); var context = TaskScheduler.FromCurrentSynchronizationContext(); Task.Factory.ContinueWhenAll(taskList.ToArray(), ThreadsComplete, CancellationToken.None, TaskContinuationOptions.ExecuteSynchronously, context); }