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()));