In C#, what and how to pass IServiceProvider in ErrorListProvider(IServiceProvider isp)?

  • Thread starter Thread starter TanmayT
  • Start date Start date
T

TanmayT

Guest
I am creating a vsix project where I need to add some custom errors in Error List window. Now I am stuck in IServiceProvider. What it contains and why I need this and how I can get this? In my code, I need to initialize with a service provider. How can I do this? Following is code :

internal class ErrorListManager
{
public static ErrorListProvider errorListProvider;

public static void Initialize(IServiceProvider serviceProvider)
{
errorListProvider = new ErrorListProvider(serviceProvider);

}

public static void AddError(string errorMsg) {
AddTask(errorMsg, TaskErrorCategory.Error);
}

private static void AddTask(string errorMsg, TaskErrorCategory category)
{
errorListProvider.Tasks.Add(new ErrorTask
{
Category = TaskCategory.User,
ErrorCategory = category,
Text = errorMsg
});
}
}


Please help. I am a beginner for C# and VSIX. Thanks!


Continue reading...
 
Back
Top