Skip to content

Instantly share code, notes, and snippets.

@jfromaniello
Created September 1, 2010 02:36
Show Gist options
  • Save jfromaniello/560140 to your computer and use it in GitHub Desktop.
Save jfromaniello/560140 to your computer and use it in GitHub Desktop.
public interface IErrorList
{
void AddError(string message);
}
[Export(typeof(IErrorList)), PartCreationPolicy(CreationPolicy.Shared)]
public class ErrorList : IErrorList
{
private static readonly Guid ProviderGuid = new Guid("A97E9FD2-1974-4889-8B3C-D4410164A229");
private ErrorListProvider backProvider;
[Import(typeof(SVsServiceProvider))]
public IServiceProvider ServiceProvider { get; set; }
public ErrorListProvider GetErrorListProvider()
{
return backProvider ?? (backProvider = new ErrorListProvider(ServiceProvider)
{
ProviderName = "HqlErrorProvider",
ProviderGuid = ProviderGuid
});
}
public void AddError(string message)
{
var provider = GetErrorListProvider();
provider.Tasks.Add(new Task
{
Text = message,
Category = TaskCategory.BuildCompile,
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment