接口 Delegate EVETN 的困扰
Delegate 是不是不支持 object 类型的参数, 我用只有string/int类型参数的都没问题,可是有object 类型的系统就报错:
“ININ.Utility.cPredicitveWatcher”不会实现接口成员“PREDICTIVEDIALCOM2Lib.IEICClientCallback2.PostMessage(int, object)”。“ININ.Utility.cPredicitveWatcher.PostMessage(int, object)”或者是静态、非公共的,或者有错误的返回类型。
这是接口程序:
namespace PREDICTIVEDIALCOM2Lib
{
[TypeLibType(4160)]
[Guid( "7E667602-5448-45FB-B4F6-948E3E20AC25 ")]
public interface IEICClientCallback2
{
[DispId(7)]
void CampaignTransition(string p_Workflow, string p_NewCampaign, string p_NewUrl);
[DispId(6)]
void DataPop(object p_Names, object p_Values);
[DispId(9)]
void DebugError(string p_ErrorText);
[DispId(5)]
object PostMessage(int p_Message, object p_Params);
[DispId(1)]
void PreviewCallAdded(object p_Names, object p_Values);
[DispId(8)]
void SetFormDefinition(object p_FormDef, object p_FormDispositions, object p_FormExtensions, object p_FormMisc);
[DispId(4)]
void ShutdownClient(string p_Message);
[DispId(2)]
void WorkflowStarted(string p_Workflow);
[DispId(3)]
void WorkflowStopped(string p_Workflow);
}
}
这是我自己写的:
namespace ININ.Utility
{
public class cPredicitveWatcher : PREDICTIVEDIALCOM2Lib.IEICClientCallback2
{ public cPredicitveWatcher() {}
public delegate void OnCampaignTransitionDelegate(string p_Workflow, string p_NewCampaign, string p_NewUrl);
public delegate void OnDataPopDelegate(object p_Names, object p_Values);
public delegate void OnDebugErrorDelegate(string p_ErrorText);
public delegate void OnPostMessageDelegate(int p_Message, object p_Params);
public delegate void OnPreviewCallAddedDelegate(int p_Message, object p_Params);