public void ErrorOccurred(int elementId, String errorMessage) { Ares.Data.IElement element = Ares.Data.DataModule.ElementRepository.GetElement(elementId); if (element != null) { String message = String.Format(StringResources.PlayError, element.Title, errorMessage); Messages.AddMessage(MessageType.Error, message); } else { Messages.AddMessage(MessageType.Error, errorMessage); } }
private static bool IsEndless(HashSet <IElement> checkedReferences, IElement element) { if (element is IRepeatableElement) { if ((element as IRepeatableElement).RepeatCount == -1) { return(true); } } if (element is IContainerElement) { IElement inner = (element as IContainerElement).InnerElement; if (inner != element && IsEndless(checkedReferences, inner)) { return(true); } } else if (element is IGeneralElementContainer) { foreach (IContainerElement subElement in ((element as IGeneralElementContainer).GetGeneralElements())) { if (IsEndless(checkedReferences, subElement)) { return(true); } } } else if (element is Ares.Data.IReferenceElement) { if (checkedReferences.Contains(element)) { return(false); } checkedReferences.Add(element); Ares.Data.IElement referencedElement = Ares.Data.DataModule.ElementRepository.GetElement((element as Ares.Data.IReferenceElement).ReferencedId); if (referencedElement != null && IsEndless(checkedReferences, referencedElement)) { return(true); } } else if (element is IMusicByTags) { return(true); } else if (element is IWebRadioElement) { return(true); } return(false); }