Example #1
0
        async void Initialize(object startupObject)
        {
            var args = (StartupEventArgs)startupObject;

            if (!singleInstance.IsFirstInstance)
            {
                await singleInstance.SendMessageAsync(args.Args);

                Environment.Exit(0);
            }

            // Finish starting your app (you'll need to use Current.Dispatcher to get back on the UI thread)
            var services = new ServiceCollection();

            var config = new Destiny2.Destiny2Config(APP_NAME, "1.0", "30077", "", "");

            config.ApiKey = "c50bb382b1b84e1ba9640125c8f8f299";
            config.CustomClientHandlerFunc = () => new HttpClientHandler
            {
                CookieContainer = new CookieContainer()
            };

            services.AddDestiny2(config);
            var oauthManager = new OAuthManager("30077", "oopA-AwO0TL.uN5WEgyTzB0Tv76ewm4PKLEzN1IqmvY", "55593");

            services.AddSingleton(oauthManager);
            var accountManager = new AccountManager();

            services.AddSingleton(accountManager);
            var manifestManager = new ManifestManager();

            services.AddSingleton(manifestManager);
            var inventoryManager = new InventoryManager();

            services.AddSingleton(inventoryManager);
            services.AddSingleton(new InputManager());
            services.AddSingleton(new InventorySearcher());

            provider = services.BuildServiceProvider();

            accountManager.SetupServices();
            manifestManager.SetupServices();
            inventoryManager.SetupServices();

            _ = manifestManager.DownloadManifest();

            await OnUiThreadAsync(async() =>
            {
                await oauthManager.StartAuth();
            });
        }