private void button1_Click(object sender, EventArgs e) { var client = new FoodleServiceClient(); var result = client.GetVoteOptions(); var vote = new Vote { Prio1 = result.Restaurants[0], Prio2 = result.Restaurants[1], Prio3 = result.Restaurants[2] }; var submitted = client.SubmitVote(vote); var res = client.GetResults(); Console.WriteLine(); }
private void GetResults(string statusInformation) { var msgBuilder = new StringBuilder(); using (var client = new FoodleServiceClient()) { var response = client.GetResults(); var results = response.Results; if (!results.Items.Any()) { msgBuilder.AppendLine("No votes yet"); } else { msgBuilder.AppendLine(string.Format("[1] -> {0} ({1} votes)", results.Items[0].Prio1.Name, results.Items[0].Prio1.Points)); msgBuilder.AppendLine(string.Format("[2] -> {0} ({1} votes)", results.Items[0].Prio2.Name, results.Items[0].Prio2.Points)); msgBuilder.AppendLine(string.Format("[3] -> {0} ({1} votes)", results.Items[0].Prio3.Name, results.Items[0].Prio3.Points)); } } if (!string.IsNullOrEmpty(statusInformation)) { msgBuilder.AppendLine(); msgBuilder.AppendLine(statusInformation); } contentControl1.Content = msgBuilder.ToString(); }