public static IntPtr RequestWindowFactory(ScriptScopeContext scope)
 {
     if (scope.TryGetValue(ScriptConstants.Request, out var oRequest) && oRequest is IRequest req)
     {
         var info = req.GetHeader("X-Desktop-Info");
         if (info != null)
         {
             NativeWin.SetDesktopInfo(info.FromJsv <Dictionary <string, string> >());
         }
         var handle = req.GetHeader("X-Window-Handle");
         if (handle != null && long.TryParse(handle, out var lHandle))
         {
             return((IntPtr)lHandle);
         }
     }
     return(IntPtr.Zero);
 }
示例#2
0
        public void BeforePluginsLoaded(IAppHost appHost)
        {
            appHost.Config.EmbeddedResourceBaseTypes.Add(typeof(DesktopAssets));

            appHost.ScriptContext.ScriptMethods.Add(new DesktopScripts(
                                                        scope => {
                if (scope.TryGetValue(ScriptConstants.Request, out var oRequest) && oRequest is IRequest req)
                {
                    var info = req.GetHeader("X-Desktop-Info");
                    if (info != null)
                    {
                        NativeWin.SetDesktopInfo(info.FromJsv <Dictionary <string, string> >());
                    }
                    var handle = req.GetHeader("X-Window-Handle");
                    if (handle != null && long.TryParse(handle, out var lHandle))
                    {
                        return((IntPtr)lHandle);
                    }
                }
                return(IntPtr.Zero);
            }));
        }
示例#3
0
 public string expandEnvVars(ScriptScopeContext scope, string path) =>
 scope.DoWindow(w => NativeWin.ExpandEnvVars(path));
示例#4
0
 public int messageBox(ScriptScopeContext scope, string text, string caption, uint type) =>
 scope.DoWindow(w => NativeWin.MessageBox(0, text, caption, type));
示例#5
0
 public bool setClipboard(ScriptScopeContext scope, string data) =>
 scope.DoWindow(w => NativeWin.SetStringInClipboard(data));
示例#6
0
 public string clipboard(ScriptScopeContext scope) =>
 scope.DoWindow(w => NativeWin.GetClipboardAsString());
示例#7
0
 public long findWindowByName(ScriptScopeContext scope, string name) =>
 scope.DoWindow(w => (long)NativeWin.FindWindowByName(name));
示例#8
0
 public Dictionary <string, object> deviceScreenResolution(ScriptScopeContext scope) =>
 scope.DoWindow(w => NativeWin.ToObject(NativeWin.GetScreenResolution()));
示例#9
0
 public Dictionary <string, string> desktopInfo(ScriptScopeContext scope) =>
 scope.DoWindow(w => NativeWin.GetDesktopInfo());
示例#10
0
 public bool start(ScriptScopeContext scope, string cmd) =>
 scope.DoWindow(w => NativeWin.Open(cmd));
示例#11
0
 public bool openUrl(ScriptScopeContext scope, string url) =>
 scope.DoWindow(w => NativeWin.Open(new Uri(resolveUrl(scope, url)).ToString()));