Problem making an Interface
4 posts
• Page 1 of 1
Problem making an Interface
I am evaluating DotNetBrowser and I need to make the following interface as described here. The interface looks like this:
The following code does not work:
The error is:
declared interface member not found. Either the member does not exist or the function syntax is incompatible ":Implements Method IProtocolHandler".
In the WS with the same ⎕USING IProtocolHandler is found (the complete name is: DotNetBrowser.Protocols.IProtocolHandler).
What it is that I am doing wrong? Thanks in advance.
- Code: Select all
public class HttpsHandler : IProtocolHandler
{
//This method should provide the response for the specified request
public IUrlResponse Handle(IUrlRequest request)
{
string htmlContent = "Request Url: " + request.Url + "\n";
return new UrlResponse(Encoding.UTF8.GetBytes(htmlContent));
}
}
The following code does not work:
:Interface HttpsHandler
∇ urlResponse←IUrlResponse request
:Implements Method IProtocolHandler
⎕USING∪←⊂'DotNetBrowser.Protocols,C:\DotNetBrowser32.dll'
⎕←request.url
urlResponse←'to do'
∇
:EndInterface
The error is:
declared interface member not found. Either the member does not exist or the function syntax is incompatible ":Implements Method IProtocolHandler".
In the WS with the same ⎕USING IProtocolHandler is found (the complete name is: DotNetBrowser.Protocols.IProtocolHandler).
What it is that I am doing wrong? Thanks in advance.
-
PGilbert - Posts: 440
- Joined: Sun Dec 13, 2009 8:46 pm
- Location: Montréal, Québec, Canada
Re: Problem making an Interface
Hello Pierre,
I've not tried your example, but I suspect you just need the function name:
Best Regards
John Daintree.
I've not tried your example, but I suspect you just need the function name:
- Code: Select all
:Implements Method IProtocolHandler.Handle
Best Regards
John Daintree.
-
JohnD|Dyalog - Posts: 74
- Joined: Wed Oct 01, 2008 9:35 am
Re: Problem making an Interface
Hello again Pierre,
There are a couple of key issues here.
* You need to define a class that implements the interface. Your code is defining an interface
* You need to tweak your :Implements statement as per my previous suggestion.
* You need to "emit" the code as a .NET assembly.
** The interpreter does not create MSIL and .NET Metadata for classes as you close the editor.
((In the past you may have used the “Export…” item on the session “file..” menu to create . NET assembly as a dll. Also on the session menu is “Export to Memory…”, which creates the assembly “in memory”. This is required if you want to use the .Net nature of a class without creating a file (which is what you require in this case). 2100⌶ performs this “Export to memory” without the need to select the menu item.
This has worked for me with the following code:
There are a couple of key issues here.
* You need to define a class that implements the interface. Your code is defining an interface
* You need to tweak your :Implements statement as per my previous suggestion.
* You need to "emit" the code as a .NET assembly.
** The interpreter does not create MSIL and .NET Metadata for classes as you close the editor.
((In the past you may have used the “Export…” item on the session “file..” menu to create . NET assembly as a dll. Also on the session menu is “Export to Memory…”, which creates the assembly “in memory”. This is required if you want to use the .Net nature of a class without creating a file (which is what you require in this case). 2100⌶ performs this “Export to memory” without the need to select the menu item.
This has worked for me with the following code:
∇ test
[1]
[2] ⎕USING←'DotNetBrowser,e:\downloads\DotNetBrowser.Chromium32\DotNetBrowser32.dll'
[3]
[4] 2100⌶0
[5]
[6] browser←BrowserFactory.Create ⍬
[7]
[8] browser.Context.ProtocolService.Register('https'(⎕NEW HttpsHandler))
∇
:Class HttpsHandler : IProtocolHandler
:using ,
:using DotNetBrowser.Protocols,e:\downloads\DotNetBrowser.Chromium32\DotNetBrowser32.dll
∇ urlResponse←Handle request
:Implements Method IProtocolHandler.Handle
:Signature IUrlResponse←Handle IUrlRequest
⎕←request.url
urlResponse←'to do'
∇
:EndClass
-
JohnD|Dyalog - Posts: 74
- Joined: Wed Oct 01, 2008 9:35 am
Re: Problem making an Interface
Many thanks John, it is working now.
-
PGilbert - Posts: 440
- Joined: Sun Dec 13, 2009 8:46 pm
- Location: Montréal, Québec, Canada
4 posts
• Page 1 of 1
Return to Windows: GUI, COM/OLE/ActiveX
Who is online
Users browsing this forum: No registered users and 0 guests
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group