Exemple #1
0
        /// <summary>
        /// Raises the Startup event that is fired when an application is starting. This event is raised by the OnStartup method.
        /// </summary>
        /// <param name="sender">Object that raises the event.</param>
        /// <param name="e">Event argument.</param>
        private void App_Startup(object sender, StartupEventArgs e)
        {
            var builder = new ContainerBuilder();

            builder.Register(p => GitHubClientSettings.CreateInstance()).As <IGitHubClientSettings>().InstancePerLifetimeScope();
            builder.RegisterType <GitHubClientHelper>().As <IGitHubClientHelper>().InstancePerLifetimeScope();
            builder.RegisterType <ConverterService>().As <IConverterService>().InstancePerLifetimeScope();

            var container = builder.Build();

            var csl = new AutofacServiceLocator(container);

            ServiceLocator.SetLocatorProvider(() => csl);

            Current.MainWindow = new MainWindow(ServiceLocator.Current.GetInstance <IConverterService>());
            Current.MainWindow.Show();
        }
Exemple #2
0
 public GitHubAuthController(GitHubClientSettings settings, Func <IGitHubClient> clientFactory)
 {
     _settings      = settings;
     _clientFactory = clientFactory;
 }
Exemple #3
0
 public void Init()
 {
     this._settings  = GitHubClientSettings.CreateInstance();
     this._helper    = new Services.GitHubClientHelper(this._settings);
     this._converter = new ConverterService(this._helper);
 }