I have a WinForm which interacts with a WebBrowserControl through the ObjectForScripting. The baseclass of my WinForm is not ComVisible and I can not or will not change it. Because there is a NonComVisibleBaseClass I have created an Interface and set it ComVisible(true) and set the FormAttribute [ClassInterface(ClassInterfaceType.None)]. The methods in the Interface can be called by the JavaScript. And it works perfect:
//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
But now my problem. The Interface contains multiple functions. I want to separate Interfaces for separate task groupings. So I want an Interface which contains Logging functions and an Interface for DataAccess functions and so on.
So it would be something like:
[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
But when I do this the functions of the second Interface (ILogging) are not accessible from the Javascript. If I switch the order of the interfaces the IDataAccess functions are not accessible.
So it seems to be the case that only methods from the first Interface are accessible in Javascript.
What can I do to make every function of each Interface accessible? Once again, making the BaseClass ComVisible and deleting the ClassInterface attribute will work but is not an option.
Thanks in advance!!