private async void update() { var cts = new CancellationTokenSource(); var lastString = ""; do { string JsnString; try { JsnString = await ServerAPI.GetComments(Event.EventId); } catch (Exception e) { string s = e.ToString(); continue; } var deser = JsonConvert.DeserializeObject <ObservableCollection <Comment> >(JsnString); if (!lastString.Equals(JsnString)) { eComments.Clear(); foreach (var elem in deser) { eComments.Add(new Comment(elem.CommentId, elem.User.UserId, elem.Text, elem.DateCreate)); } } await loop(cts.Token); cts.Cancel(); lastString = JsnString; } while (true); }