前台:
@{
ViewBag.Title = "测试节点";
var X = Html.X();}<a href="DNCS://cid:110&username:xxh">点击这里启动程序</a>*@@(X.Viewport().Layout(LayoutType.Fit).Items( X.Panel().Layout(LayoutType.Border).Region(Region.Center).StyleSpec("border:1px solid #DFDFDF;") .TopBar(X.Toolbar().Items( X.ComboBox().ID("CB_JH").FieldLabel("井号").LabelWidth(40).Width(160).MarginSpec("0px 10px 0px 0px").QueryMode(DataLoadMode.Local), X.ToolbarSeparator(), X.Button().ID("B_Test").Text("测试").Width(70).Icon(Icon.Key) .DirectEvents(B_Save =>{ B_Save.Click.Url = Url.Action("Test"); B_Save.Click.ExtraParams.Add(new Parameter{Name = "sJH",Value = "App.CB_JH.getValue()",Mode = ParameterMode.Raw}); B_Save.Click.EventMask.ShowMask = true; B_Save.Click.EventMask.Msg = "处理中..."; B_Save.Click.EventMask.MinDelay = 1000;})))))
后台:
public ActionResult Index()
{ return View(); } public ActionResult Test(string sJH) { Response.Redirect("DNCS://" + DSU.ID); return this.Direct(); }Reg文件内容:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\DNCS]"URL Protocol"="D:\\11\\DNCS.LJFileUpload.exe"@="DNCSProtocol"[HKEY_CLASSES_ROOT\DNCS\DefaultIcon]@="D:\\11\\DNCS.LJFileUpload.exe,1"[HKEY_CLASSES_ROOT\DNCS\shell][HKEY_CLASSES_ROOT\DNCS\shell\open][HKEY_CLASSES_ROOT\DNCS\shell\open\command]@="\"D:\\11\\DNCS.LJFileUpload.exe\" \"%1\""将名为DNCS.LJFileUpload.exe的文件放到D盘11文件夹下
核心思路就是通过自定义URL协议