Esempio n. 1
0
        public static void Run <TStartup>(IPhotinoWindow iphotinoWindow)
        {
            //DesktopSynchronizationContext.UnhandledException += (sender, exception) =>
            //{
            //    UnhandledException(exception);
            //};

            photinoWindow = iphotinoWindow;

            var completed = new ManualResetEventSlim();

            CancellationTokenSource appLifetimeCts = new CancellationTokenSource();

            Task.Factory.StartNew(async() =>
            {
                try
                {
                    var ipc = new IPC(photinoWindow);
                    await RunAsync <TStartup>(ipc, appLifetimeCts.Token, completed);
                }
                catch (Exception ex)
                {
                    UnhandledException(ex);
                    throw;
                }
            });

            try
            {
                completed.Wait(); // TODO We need to wait for the new IPC to finish before trying to navigate
                photinoWindow.Load(BlazorAppScheme + "://app/");
                photinoWindow.WaitForClose();
            }
            finally
            {
                appLifetimeCts.Cancel();
            }
        }
Esempio n. 2
0
 public IPC(IPhotinoWindow photinoWindow)
 {
     _photinoWindow = photinoWindow ?? throw new ArgumentNullException(nameof(photinoWindow));
     _photinoWindow.WebMessageReceived += HandleScriptNotify;
 }