Beispiel #1
0
        /// <summary>
        /// Sets up viewmodels to be used in the individual mod loader pages.
        /// </summary>
        private static async Task SetupViewModelsAsync()
        {
            _ = Task.Run(BasicDllInjector.PreloadAddresses); // Fire and Forget
            var loaderConfig = LoaderConfigReader.ReadConfiguration();

            IoC.Kernel.Bind <LoaderConfig>().ToConstant(loaderConfig);
            IoC.GetConstant <MainPageViewModel>();
            IoC.GetConstant <AddAppViewModel>();       // Consumes MainPageViewModel, make sure it goes after it.
            IoC.GetConstant <ManageModsViewModel>();   // Consumes MainPageViewModel, LoaderConfig
            IoC.GetConstant <SettingsPageViewModel>(); // Consumes ManageModsViewModel, AddAppViewModel

            try
            {
                var helper = await NugetHelper.FromSourceUrlAsync(SharedConstants.NuGetApiEndpoint);

                IoC.Kernel.Rebind <NugetHelper>().ToConstant(helper);
                IoC.GetConstant <DownloadModsViewModel>(); // Consumes ManageModsViewModel, NugetHelper
            }
            catch (Exception)
            {
                // Probably no internet access.
            }


            /* Set loader DLL path. */
            SetLoaderPaths(loaderConfig, Path.GetDirectoryName(Environment.GetCommandLineArgs()[0]));
            LoaderConfigReader.WriteConfiguration(loaderConfig);
        }
Beispiel #2
0
 static NugetRepositoryResolver()
 {
     _nugetHelper = Task.Run(() => NugetHelper.FromSourceUrlAsync(SharedConstants.NuGetApiEndpoint)).Result;
 }
Beispiel #3
0
 public NugetHelperTests()
 {
     _nugetHelper = NugetHelper.FromSourceUrlAsync(TestNugetFeed).Result;
 }