Beispiel #1
0
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
        private static async void RunLogin(string apiAddress, string userName, string password, string jobId)
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
        {
            var token = TokenSource.Token;
            var invoker = new Invoker(apiAddress, userName, password, jobId);
            var taskList = new List<Task> { Task.Factory.StartNew(() => invoker.RunJob(token), token).Unwrap() };

            Task.WaitAll(taskList.ToArray());

            System.Console.WriteLine("Complete");
        }
Beispiel #2
0
 private void OnJobStarted(object sender, DoWorkEventArgs e)
 {
     var webInvoker = new Invoker(UrlText.Text, NameTxt.Text, PasswordTxt.Text, JobIdTxt.Text);
     var token = TokenSource.Token;
     webInvoker.RunJob(token).Wait(token);
 }