Exemple #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            System.Globalization.CultureInfo.CurrentCulture   = new CultureInfo("en-US");
            System.Globalization.CultureInfo.CurrentUICulture = new CultureInfo("en-US");
            var configDirArg = e.Args.FirstOrDefault(a => a.ToLower().StartsWith(ConfigDirArgName.ToLower()));

            if (configDirArg != null)
            {
                configDirArg = configDirArg.Substring(ConfigDirArgName.Length);
                SerializationHelper.Instance.SetConfigFolder(configDirArg);
            }

            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

            var logConfiguration = new LoggingConfiguration();

            logConfiguration.Initialize();
            ExceptionHandlingInitialization.Initialize();

            this.config    = SerializationHelper.Instance.LoadOrCreateConfiguration();
            this.scheduler = new ObservationScheduler();

            // call the plugins with the application args, so plugins can process them
            foreach (var connectorPlugin in PluginManager.Instance.ConnectorPlugins)
            {
                try
                {
                    connectorPlugin.OnStartup(e.Args);
                }
                catch (Exception ex)
                {
                    log.Error(ex);
                }
            }

            // add each connector to the observation scheduler
            foreach (var connectorConfiguration in this.config.ConnectorsConfiguration)
            {
                var connector = PluginManager.Instance.GetConnector(connectorConfiguration);
                this.scheduler.Observe(connector);
            }

            this.handler = new TrayHandler(this.scheduler, this.config);
            this.themeHelper.Initialize(this.handler.VisualSettings?.ColorSettings);
            this.ApplyTheme();

            if (!this.config.OpenMinimized)
            {
                this.handler.ShowOrHideWindow();
            }

            Timeline.DesiredFrameRateProperty.OverrideMetadata(typeof(Timeline), new FrameworkPropertyMetadata {
                DefaultValue = 15
            });

            this.scheduler.Start();
            ComponentDispatcher.ThreadPreprocessMessage += this.ComponentDispatcherThreadPreprocessMessage;

            base.OnStartup(e);
        }
Exemple #2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            Task.Run(async() =>
            {
                using (var mgr = UpdateManager.GitHubUpdateManager("https://github.com/lorokl2/whatsONUpdater", null, null, null, true))
                {
                    await mgr.Result.UpdateApp();
                }
            });

            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

            var logConfiguration = new LoggingConfiguration();

            logConfiguration.Initialize();
            ExceptionHandlingInitialization.Initialize();

            this.config    = SerializationHelper.LoadOrCreateConfiguration();
            this.scheduler = new ObservationScheduler();

            foreach (var connectorConfiguration in this.config.ConnectorsConfiguration)
            {
                var connector = PluginsManager.Instance.GetConnector(connectorConfiguration);
                this.scheduler.Observe(connector);
            }

            this.themeHelper.Initialize();
            this.ApplyTheme();

            this.handler = new TrayHandler(this.scheduler, this.config);
            this.scheduler.Start();
            ComponentDispatcher.ThreadPreprocessMessage += this.ComponentDispatcherThreadPreprocessMessage;
        }