Esempio n. 1
0
        /// <summary>
        /// Runs the application.
        /// </summary>
        private static void RunApplication(ApplicationPaths appPaths, ILogManager logManager, IEnvironmentInfo environmentInfo, StartupOptions options)
        {
            var fileSystem = new ManagedFileSystem(logManager.GetLogger("FileSystem"), environmentInfo, appPaths.TempDirectory);

            FileSystem = fileSystem;

            INetworkManager networkManager = new NetworkManager(logManager.GetLogger("NetworkManager"));

            using (var appHost = new ApplicationHost(appPaths,
                                                     logManager,
                                                     options,
                                                     fileSystem,
                                                     null,
                                                     UpdatePackageName,
                                                     environmentInfo,
                                                     new Emby.Theater.App.SystemEvents(logManager.GetLogger("SystemEvents")),
                                                     networkManager))
            {
                var initProgress = new Progress <double>();

                Func <IHttpClient> httpClient = () => appHost.HttpClient;

                using (new ElectronApp(_logger, appPaths, httpClient, environmentInfo))
                {
                    var task = appHost.Init(initProgress);
                    Task.WaitAll(task);

                    //task = InstallVcredist2015IfNeeded(appHost.HttpClient, _logger);
                    //Task.WaitAll(task);

                    task = InstallCecDriver(appPaths, appHost.HttpClient);
                    Task.WaitAll(task);

                    using (var server = new TheaterServer(_logger, appHost))
                    {
                        task = appHost.RunStartupTasks();
                        Task.WaitAll(task);

                        Application.EnableVisualStyles();
                        Application.SetCompatibleTextRenderingDefault(false);

                        Application.Run(new AppContext(server));
                    }
                }
            }
        }
Esempio n. 2
0
 public AppContext(TheaterServer server)
 {
     server.StartServer(Dispatcher.CurrentDispatcher);
     _server = server;
 }