protected override void OnCreate()
        {
            base.OnCreate();

            var windowProperties = new FlutterDesktopWindowProperties
            {
                headed = false,
            };

            Utils.ParseEngineArgs(EngineArgs);

            using var switches       = new StringArray(EngineArgs);
            using var entrypointArgs = new StringArray(DartEntrypointArgs);
            var engineProperties = new FlutterDesktopEngineProperties
            {
                assets_path          = "../res/flutter_assets",
                icu_data_path        = "../res/icudtl.dat",
                aot_library_path     = "../lib/libapp.so",
                switches             = switches.Handle,
                switches_count       = (uint)switches.Length,
                entrypoint           = DartEntrypoint,
                dart_entrypoint_argc = entrypointArgs.Length,
                dart_entrypoint_argv = entrypointArgs.Handle,
            };

            Handle = FlutterDesktopRunEngine(ref windowProperties, ref engineProperties);
            if (Handle.IsInvalid)
            {
                throw new Exception("Could not launch a service application.");
            }
        }
示例#2
0
        protected override void OnCreate()
        {
            base.OnCreate();

            Utils.ParseEngineArgs(EngineArgs);

            using (var switches = new StringArray(EngineArgs))
                using (var entrypointArgs = new StringArray(DartEntrypointArgs))
                {
                    var engineProperties = new FlutterDesktopEngineProperties
                    {
                        assets_path          = "../res/flutter_assets",
                        icu_data_path        = "../res/icudtl.dat",
                        aot_library_path     = "../lib/libapp.so",
                        switches             = switches.Handle,
                        switches_count       = (uint)switches.Length,
                        entrypoint           = DartEntrypoint,
                        dart_entrypoint_argc = entrypointArgs.Length,
                        dart_entrypoint_argv = entrypointArgs.Handle,
                    };

                    Engine = FlutterDesktopEngineCreate(ref engineProperties);
                    if (Engine.IsInvalid)
                    {
                        throw new Exception("Could not create a Flutter engine.");
                    }
                }

            var windowProperties = new FlutterDesktopWindowProperties
            {
                x           = WindowOffsetX,
                y           = WindowOffsetY,
                width       = WindowWidth,
                height      = WindowHeight,
                transparent = IsWindowTransparent,
                focusable   = IsWindowFocusable,
                top_level   = IsTopLevel,
            };

            View = FlutterDesktopViewCreateFromNewWindow(ref windowProperties, Engine);
            if (View.IsInvalid)
            {
                throw new Exception("Could not launch a Flutter application.");
            }
        }
示例#3
0
 public static extern FlutterDesktopEngine FlutterDesktopRunEngine(
     ref FlutterDesktopWindowProperties window_properties,
     ref FlutterDesktopEngineProperties engine_properties);
示例#4
0
 public static extern FlutterDesktopView FlutterDesktopViewCreateFromNewWindow(
     ref FlutterDesktopWindowProperties window_properties,
     FlutterDesktopEngine engine);