예제 #1
0
        public static void UpdateTask(ServiceTask task, string note)
        {
            HttpClient client = new HttpClient();
            Uri        uri    = new Uri("http://localhost:5000/api/tasks/" + task.ID.ToString() + "/" + task.Status);

            SetTaskStatusAsync(client, uri, task);


            if (note != "")
            {
                uri = new Uri("http://localhost:5000/api/tasks/" + task.ID.ToString() + "/notes");
                AddNoteToTaskAsync(client, uri, note);
            }
        }
예제 #2
0
        private static async void SetTaskStatusAsync(HttpClient client, Uri uri, ServiceTask task)
        {
            HttpResponseMessage result;

            var data = new HttpFormUrlEncodedContent(
                new Dictionary <string, string>
            {
                ["status"] = task.Status,
                ["id"]     = task.ID.ToString()
            });

            try
            {
                result = await client.PutAsync(uri, data);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
예제 #3
0
 public static void SetActiveTasks(ServiceTask task)
 {
     activeTask = task;
 }