I have one project, and in that project I have loaded a dll dynamically. It looks like:
AssemblyPart assemblyPart = new AssemblyPart();
WebClient downloader = new WebClient();
string path = string.Format("../ClientBin/{0}.xap", "AgileTax");
downloader.OpenReadCompleted += (e, sa) =>
{
getdllinStream = GetStream(sa.Result, _CurReturnType.PackageName + "ERC", true);
_formsAssembly = assemblyPart.Load(getdllinStream);
foreach (var item in _formsAssembly.GetTypes())
{
if (item.FullName == _CurReturnType.PackageName + "ERC.State.StateMain")
{
ATSpgm = item;
}
}
var class_instance = _formsAssembly1.CreateInstance(PackageName + "ERC.State.StateMain");
if (class_instance != null)
{
MethodInfo[] infomem = ATSpgm.GetMethods();
MethodInfo SetVarDllNG1 = ATSpgm.GetMethod("ProcessERC");
SetVarDllNG1.Invoke(class_instance, parametersArray);
}
}
downloader.OpenReadAsync(new Uri(path, UriKind.Relative));
Now my problem is that in the .dll I have code like:
public event ERCErrorHandling OnERCErrorHandler;
public delegate string ERCErrorHandling(Exception ex);
Now my question is how to call this ERCErrorHandling event same above i have called method like ProcessERC.