windrobin / winforms-geplugin-control-library

Automatically exported from code.google.com/p/winforms-geplugin-control-library
GNU General Public License v3.0
0 stars 1 forks source link

Winform desktop application vs. local file access forbidden #7

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The Software is a winform DESKTOP APPLICATION, BUT the nature of the 
WEBBROWSER forbid the local file(image) access.

Is it kind of a conflict?

Original issue reported on code.google.com by qin.z...@gmail.com on 8 Apr 2009 at 3:51

GoogleCodeExporter commented 9 years ago
The webBrowser is capable of using local files. e.g.

webBrowserGe.Navigate(@"C:\test\test.html");

Also the loaded html can contain local file links. e.g. 

<img src="C:\test\1.gif" />

The issue you are facing is that local file paths are not supported by the 
actual 
google earth plugin or javascript. If you need to use local paths in Kml then 
it 
must be generated pragmatically and parsed using the Api. I will try and post 
an 
example of this soon. 

Original comment by fraser.c...@gmail.com on 9 Apr 2009 at 10:30

GoogleCodeExporter commented 9 years ago
Thanks. My major issue is that I want to use the application to load the local 
image, which I generate on the fly. So I have to setup an iis  WEBSERVER, then 
save 
the image to local disk which is also set as http address. And in the end, set 
href 
to that HTTP Address. 

Original comment by qin.z...@gmail.com on 9 Apr 2009 at 4:09

GoogleCodeExporter commented 9 years ago
Hi, you could also implement a simple socket server in you application to serve 
the 
files on an ip and port. This is something I have successfully employed to send 
view-
based-refresh queries from the embedded plug-in to the main windows form.

See this simple example of a TCP server in c#: 
http://www.java2s.com/Code/CSharp/Network/SimpleTcpServer.htm

Original comment by fraser.c...@gmail.com on 9 Apr 2009 at 4:18

GoogleCodeExporter commented 9 years ago
Thanks. But still confused about how to write a URL for my local file after I 
have 
established the simple TCP server on my computer at the startup of the 
Application.
Is that like  
Protocal://ipadress:port/  ?
for example my file is D:\pngfile\temp.png

In my case I share the pngfile.
None of the followings  work:

var icon = ge.createIcon('');
    icon.setHref('http://192.168.1.104:9050/pngfile/tem.png');

var icon = ge.createIcon('');
    icon.setHref('file://192.168.1.104:9050/pngfile/tem.png');

var icon = ge.createIcon('');
    icon.setHref('file://192.168.1.104:9050/d:/pngfile/tem.png');

Original comment by qin.z...@gmail.com on 12 Apr 2009 at 3:32

GoogleCodeExporter commented 9 years ago

Original comment by fraser.c...@gmail.com on 17 Sep 2009 at 11:04

GoogleCodeExporter commented 9 years ago
{{{
var icon = ge.createIcon('');
icon.setHref('http://localhost:9050/pngfile/tem.png');
}}}

It should work, can you confirm the image is being served? For example, what 
happens 
if you enter the url in your browser?

Original comment by fraser.c...@gmail.com on 22 Sep 2009 at 10:24

GoogleCodeExporter commented 9 years ago
See http://code.google.com/p/winforms-geplugin-control-library/wiki/Server

Original comment by fraser.c...@gmail.com on 26 Nov 2009 at 4:25