public async static Task addComment(string formation, string comment) { Task addCommentTask; if (commentDictionary.ContainsKey(formation)) { addCommentTask = Task.Run(() => { commentDictionary[formation].Add(comment); }); } else { addCommentTask = Task.Run(() => { List <string> commentList = new List <string>(); commentList.Add(comment); commentDictionary.Add(formation, commentList); }); } await addCommentTask; AppEventHandler.emitNoteUpdate(ADD_OPERATION, formation, comment); AppEventHandler.emitInfoTextUpdate("Comment for formation " + formation + " added"); }
public async static Task removeComment(string formation, string comment) { await Task.Run(() => { commentDictionary[formation].Remove(comment); }); AppEventHandler.emitNoteUpdate(REMOVE_OPERATION, formation, comment); AppEventHandler.emitInfoTextUpdate("Comment for formation " + formation + " removed"); }