/// <summary> /// Removes a warning from the dictionary of unresolved warnings. /// </summary> /// <param name="warningCode">The warning code which the warning to remove contains</param> /// <param name="senderId">The sender Id which the warning to remove contains</param> public void ResolveWarning(string warningCode, string senderId) { Warning theWarning = new Warning(senderId, warningCode); //string theWarningMessage = String.Format(_warningTemplates[warningCode], illegalObjects); if (_unresolvedWarnings.ContainsKey(theWarning)) { _unresolvedWarnings.Remove(theWarning); updateWarningText(); } }
/// <summary> /// Constructs a unique warning message from the provided illegalObjects strings and a warning template /// and adds a new warning to the dictionary of unresolved warnings. /// </summary> /// <param name="warningCode">The warning code which indicates what warning template to use</param> /// <param name="illegalObjects">The names of all of the objects to be plugged into the warning template</param> /// <param name="senderId">The Id of the object reporting the warning</param> /// <returns>The id of the object reporting the warning. Creates a new id if one is not provided.</returns> public string ReportWarning(string warningCode, List<string> illegalObjects, string senderId) { if (senderId == null) senderId = _currentId++ + ""; string theWarningMessage = String.Format(_warningTemplates[warningCode], illegalObjects.ToArray()); Warning theWarning = new Warning(senderId, warningCode); if (_unresolvedWarnings.ContainsKey(theWarning)) { _unresolvedWarnings.Remove(theWarning); } _unresolvedWarnings.Add(theWarning, theWarningMessage); updateWarningText(); return senderId; }