using Microsoft.Extensions.DependencyInjection; using OemanTrader.FinantialModelingPrepAPI.Services; using OemanTrader.WPF.ViewModels; using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Linq; using System.Threading.Tasks; using System.Windows; namespace OemanTrader.WPF { /// /// Interaction logic for App.xaml /// public partial class App : Application { protected override void OnStartup(StartupEventArgs e) { //new MajorIndexService().GetMajorIndex(Domain.Models.MajorIndexType.DowJones).ContinueWith((t) => //{ // var index = t.Result; //}); Window window = new MainWindow(); window.DataContext = new MainViewModel(); window.Show(); base.OnStartup(e); } private IServiceProvider CreateServiceProvider() { // 1. Singelton - one instance per application // 2. Transient - different instance everytime // 3. Scoped - one instance per "scope" IServiceCollection services = new ServiceCollection(); return services.BuildServiceProvider(); } } }