public static int Run(string[] args, Func <string[], QGuiApplication, QQmlApplicationEngine, NetRunCallbackDelegate, int> action) { if (args.Length < 4) { throw new Exception("Args is invalid, must contain three entries which are pointers to native types."); } var appPtr = new IntPtr((long)ulong.Parse(args[0])); var enginePtr = new IntPtr((long)ulong.Parse(args[1])); var callbackPtr = new IntPtr((long)ulong.Parse(args[2])); var exportedSymbolPtr = new IntPtr((long)ulong.Parse(args[3])); GetExportedSymbol = Marshal.GetDelegateForFunctionPointer <GetExportedSymbolDelegate>(exportedSymbolPtr); using (var app = new QGuiApplication(appPtr)) { using (var engine = new QQmlApplicationEngine(enginePtr)) { var runCallback = new NetRunCallbackDelegate(() => { var callback = Marshal.GetDelegateForFunctionPointer <NativeRunCallbackDelegate>(callbackPtr); // ReSharper disable AccessToDisposedClosure return(callback.Invoke(app.InternalPointer, engine.InternalPointer)); // ReSharper restore AccessToDisposedClosure }); return(action(args.Skip(2).ToArray(), app, engine, runCallback)); } } }
public QtSynchronizationContext(QGuiApplication guiApp) { _guiApp = guiApp; }