private void Desktop_Startup(object sender, ControlledApplicationLifetimeStartupEventArgs e)
        {
            var syncContext = AvaloniaSynchronizationContext.Current;

            new Thread(_ =>
            {
                // Every other solution make deadlocks when the host is disposed
                using (Host)
                {
                    try
                    {
                        Host.Start();
                        Host.WaitForShutdown();
                    }
                    catch (Exception)
                    {
                        syncContext?.Post(_ => { try { Desktop?.Shutdown(1); } catch { } }, null);
                    }
                }
            })
            {
                IsBackground = false,
                Name         = "WebHost thread"
            }.Start();
        }
示例#2
0
        private async void Desktop_Startup(object sender, ControlledApplicationLifetimeStartupEventArgs e)
        {
            var version = Assembly.GetEntryAssembly()?.GetName().Version;

            _logger.LogInfoMessage($"App startup begin. version:{version}");
            var settings = _settingsManager.GetAppSettings();

            _logger.LogInfoMessage($"App starting with user settings => :\n{JsonConvert.SerializeObject(settings, Formatting.Indented)}");

            _logger.LogInfoMessage("Connect to UGCS");
            await _ugcsConnection.ConnectAsync(settings.UGCSHost, settings.UGCSPort, settings.UGCSLogin, settings.UGCSPassword);

            if (_ugcsConnection.ConnectionStatus == UgcsConnectionStatus.Connected)
            {
                _logger.LogInfoMessage("Connected to UGCS");

                _logger.LogInfoMessage("Initialize VehicleManager");
                await _vehiclesManager.Initialize();

                _logger.LogInfoMessage("VehicleManager initialized");
            }
            else
            {
                _logger.LogError("Not connected to UGCS");
            }

            _logger.LogInfoMessage("Initialize PTZ transport");
            // TODO
            //await _ptzTransport.Initialize();
            _ptzTransport.Initialize();
            _logger.LogInfoMessage("PTZ transport initialized");

            _logger.LogInfoMessage("App startup end");
        }
示例#3
0
        private void Desktop_Startup(object?sender, ControlledApplicationLifetimeStartupEventArgs e)
        {
            if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
            {
                var window = new MainWindow();
                _graphicView = new GraphicView(window, 80, 24);
                _engine      = new Engine(_graphicView);

                window.Opened  += Window_Opened;
                window.Closing += Window_Closing;

                desktop.MainWindow = window;
            }
        }
示例#4
0
        private void Desktop_Startup(object sender, ControlledApplicationLifetimeStartupEventArgs e)
        {
            MessageHandlers.RegisterMessageHandlers(this);

            AppViewModel.Initialize(e.Args);

            if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
            {
                var window = new MainWindow
                {
                    VM = new MainViewModel()
                };
                desktop.MainWindow = window;
            }
        }
示例#5
0
        private void Startup(object sender, ControlledApplicationLifetimeStartupEventArgs e)
        {
            string cefPath;
            bool   externalMessagePump = e.Args.Contains("--external-message-pump");

            string projectPath = GetProjectPath();


            string filePathLog = System.AppDomain.CurrentDomain.BaseDirectory + "Log";

            if (PlatformInfo.IsMacOS)
            {
                externalMessagePump = true;
                cefPath             = Path.Combine(projectPath, "Contents", "Frameworks", "Chromium Embedded Framework.framework");
            }
            else if (PlatformInfo.IsLinux)
            {
                //cefPath = Path.Combine(Path.GetDirectoryName(GetProjectPath()), "cef");
                cefPath = System.AppDomain.CurrentDomain.BaseDirectory + "win_cef";
            }
            else
            {
                //cefPath = Path.Combine(Path.GetDirectoryName(GetProjectPath()), "cef");
                cefPath = System.AppDomain.CurrentDomain.BaseDirectory + "win_cef";
            }

            var settings = new CefSettings();

            settings.MultiThreadedMessageLoop = !externalMessagePump;
            settings.ExternalMessagePump      = externalMessagePump;
            settings.NoSandbox = true;
            settings.WindowlessRenderingEnabled = true;
            settings.LocalesDirPath             = Path.Combine(cefPath, "Resources", "locales");
            settings.ResourcesDirPath           = Path.Combine(cefPath, "Resources");
            settings.LogSeverity                = CefLogSeverity.Warning;
            settings.IgnoreCertificateErrors    = true;
            settings.UncaughtExceptionStackSize = 8;

            app = new CefAppImpl();
            app.ScheduleMessagePumpWorkCallback = OnScheduleMessagePumpWork;
            app.Initialize(PlatformInfo.IsMacOS ? cefPath : Path.Combine(cefPath, "Release"), settings);

            if (externalMessagePump)
            {
                messagePump = new Timer(_ => Dispatcher.UIThread.Post(CefApi.DoMessageLoopWork), null, messagePumpDelay, messagePumpDelay);
            }
        }
示例#6
0
        private void Startup(object sender, ControlledApplicationLifetimeStartupEventArgs e)
        {
            string cefPath = Path.Combine(Path.GetDirectoryName(GetProjectPath()), "cef");


            var settings = new CefSettings();

            settings.MultiThreadedMessageLoop = true;
            settings.NoSandbox = true;
            settings.WindowlessRenderingEnabled = true;
            settings.LocalesDirPath             = Path.Combine(cefPath, "Resources", "locales");
            settings.ResourcesDirPath           = Path.Combine(cefPath, "Resources");
            settings.LogSeverity                = CefLogSeverity.Warning;
            settings.IgnoreCertificateErrors    = true;
            settings.UncaughtExceptionStackSize = 8;

            app = new CefAppImpl();
            app.Initialize(Path.Combine(cefPath, "Release"), settings);
        }
示例#7
0
 private void Startup(object sender, ControlledApplicationLifetimeStartupEventArgs e)
 {
     FrameworkInitialized?.Invoke(this, EventArgs.Empty);
 }
示例#8
0
 void MainWindow_Startup(object sender, ControlledApplicationLifetimeStartupEventArgs e)
 {
     ApplicationHelpers.MainWindowDataContext.LoadSettings();
     ApplicationHelpers.MainWindowDataContext.LoadDatabase();
 }
示例#9
0
 private void OnDesktopStart(object sender, ControlledApplicationLifetimeStartupEventArgs e)
 {
 }