Esempio n. 1
0
        public async Task <Application> Show(Type appType, ApplicationOptions opts = null)
        {
            LogSharp.Debug("UrhoSurface: Show.");
            await waitWhileSuperviewIsNullTaskSource.Task;

            UrhoPlatformInitializer.DefaultInit();
            await Task.Yield();

            paused = false;
            opts   = opts ?? new ApplicationOptions();
            LogSharp.Debug("UrhoSurface: Show. Wait semaphore.");
            await Semaphore.WaitAsync();

            //await Stop();
            if (Application.HasCurrent)
            {
                await Application.Current.Exit();
            }
            await Task.Yield();

            SDL_SetExternalViewPlaceholder(Handle, Window.Handle);

            Hidden = true;
            var app = Application.CreateInstance(appType, opts);

            Application = app;
            app.Run();
            Semaphore.Release();
            await Application.ToMainThreadAsync();

            InvokeOnMainThread(() => Hidden = false);
            LogSharp.Debug("UrhoSurface: Finished.");
            return(app);
        }
Esempio n. 2
0
 public UrhoSurface(CGRect frame) : base(frame)
 {
     UrhoPlatformInitializer.DefaultInit();
     BackgroundColor = UIColor.Black;
     initTaskSource  = new TaskCompletionSource <bool>();
 }
Esempio n. 3
0
 public UrhoSurface(CGRect frame) : base(frame)
 {
     UrhoPlatformInitializer.DefaultInit();
 }
Esempio n. 4
0
 public override void WillMoveToWindow(UIWindow window)
 {
     UrhoPlatformInitializer.DefaultInit();
     SDL_SetExternalViewPlaceholder(Handle, window?.Handle ?? IntPtr.Zero);
     base.WillMoveToWindow(window);
 }