ObjectForScripting을 통해 WebBrowserControl과 상호 작용하는 WinForm이 있습니다. 내 WinForm의 기본 클래스는 ComVisible이 아니므로 변경할 수 없거나 변경하지 않습니다. NonComVisibleBaseClass가 있기 때문에 인터페이스를 만들고 ComVisible (true)을 설정하고 FormAttribute [ClassInterface (ClassInterfaceType.None)]를 설정했습니다. 인터페이스의 메소드는 JavaScript에 의해 호출 될 수 있습니다. 그리고 그것은 완벽하게 작동합니다 :여러 인터페이스가 작동하지 않는 ObjectForScripting
//Make the class visible for COM so we can set the ObjectForScripting
//Specify ClassInterfaceType.None to use the ComVisible Interface
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
public partial class GeekBrowser : GeekBasePage, IMapControlInteractable
...
public class GeekBasePage : System.Windows.Forms.Form
...
[ComVisible(true)]
public interface IMapControlInteractable
하지만 지금 내 문제. 인터페이스에는 여러 기능이 있습니다. 별도의 작업 그룹을 위해 인터페이스를 분리하고 싶습니다. 그래서 로깅 기능과 DataAccess 기능을위한 인터페이스 등을 포함하는 인터페이스가 필요합니다.
그래서 같은 것이다 :
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
public partial class GeekBrowser : GeekBasePage, IDataAccess, ILogging
...
public class GeekBasePage : System.Windows.Forms.Form
...
[ComVisible(true)]
public interface IDataAccess
...
[ComVisible(true)]
public interface ILogging
을하지만 그렇게되면 두 번째 인터페이스 (ILogging)의 기능은 자바 스크립트에서 액세스 할 수 없습니다. 인터페이스의 순서를 바꾸면 IDataAccess 함수에 액세스 할 수 없습니다.
첫 번째 인터페이스의 메소드 만 Javascript로 액세스 할 수있는 것처럼 보입니다.
각 인터페이스의 모든 기능에 액세스하려면 어떻게해야합니까? 다시 한번, BaseClass를 ComVisible로 만들고 ClassInterface 속성을 삭제하면 작동하지만 옵션이 아닙니다.
미리 감사드립니다.