前言:开发架构 BS & CS ;实现地图导航功能。
BS:Spring+hibernate、Java、JDK1.7 (设想环境)
CS:webservice、C#、.Net framwork 3.5&Windows mobile 6.0 SDK
1、创建“智能设备项目”。
2、使用“webBrowser”空间创建框架内置浏览器。
引入COM下面 windows web程序支持包,在窗体源码中编写如下代码:
- using System;
- using System.Linq;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
-
- namespace MapSmart
- {
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class FrmMap : Form
- {
- public FrmMap()
- {
- InitializeComponent();
- }
-
- private void FrmMap_Load(object sender, EventArgs e)
- {
- // JSP中 调用window方法
- // οnclick="window.external.functionname()";
-
- //为HTML文件传递JS参数
- //object oSum = wb.Document.InvokeScript("sayHello", new object[] { 1, 2 });
-
- string url = "http://map.baidu.com/";
- Uri uri = new Uri(url);
- this.wb.Navigate(uri, "");
-
- }
- }
- }
引入webbrowser所需要的库:
3、启动调试查看结果(引入html地址后)效果图。
4、参数传递
1、REST风格URL传递参数。
2、脚本方法调用参数传递:如2中代码注释处。