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