public MainViewModel(QuestCollectionWrapper config, HttpClientHandler handler, IPageProvider pageProvider, ITextResultsProvider textResults, IErrorLogger errorLogger, Func <string, CompareInfo, CompareOptions, int> hashFunction) { ErrorLog.LogUsing(errorLogger); Agnostic.HashStringsUsing(hashFunction); if (config != null) { QuestList = config.QuestCollection; QuestList.Sort(); SelectQuest(config.CurrentQuest); } else { QuestList = new QuestCollection(); SelectQuest(null); } SetupNetwork(pageProvider, handler); SetupTextResults(textResults); AllVotesCollection = new ObservableCollectionExt <string>(); AllVotersCollection = new ObservableCollectionExt <string>(); BuildCheckForNewRelease(); BuildTally(); BindVoteCounter(); SetupCommands(); }
public static IServiceProvider ConfigureServices() { IServiceCollection services = new ServiceCollection(); // Get the services provided by the core library. NetTally.Startup.ConfigureServices(services); //services.AddSingleton<IPageProvider, TestPageProvider>(); //services.AddSingleton<IHash, NormalHash>(); services.AddSingleton <IClock, StaticClock>(); var serviceProvider = services.BuildServiceProvider(); var loggerFactory = serviceProvider.GetRequiredService <ILoggerFactory>(); var logger = loggerFactory.CreateLogger("TestStartup"); logger.LogInformation("Services defined for testing!"); var hash = serviceProvider.GetRequiredService <IHash>(); Agnostic.Init(hash); var agnostic = serviceProvider.GetRequiredService <IAgnostic>(); var logger2 = serviceProvider.GetRequiredService <Logger2>(); return(serviceProvider); }
public static void ClassInit(TestContext context) { serviceProvider = TestStartup.ConfigureServices(); var hash = serviceProvider.GetRequiredService <IHash>(); Agnostic.HashStringsUsing(hash.HashFunction); }
protected override void OnStartup(StartupEventArgs e) { // Create a service collection and configure our dependencies var serviceCollection = new ServiceCollection(); ConfigureServices(serviceCollection); // Build the IServiceProvider and set our reference to it serviceProvider = serviceCollection.BuildServiceProvider(); var hash = serviceProvider.GetRequiredService <IHash>(); Agnostic.Init(hash); var loggerFactory = ServiceProvider.GetService <ILoggerFactory>(); var logger = loggerFactory.CreateLogger <App>(); var logger2 = serviceProvider.GetRequiredService <Logger2>(); logger.LogInformation($"Services defined. Starting application. Version: {ProductInfo.Version}"); // Request the navigation service and create our main window. var navigationService = ServiceProvider.GetRequiredService <IoCNavigationService>(); _ = navigationService.ShowAsync <MainWindow>(); }
public static void ClassInit(TestContext context) { Agnostic.HashStringsUsing(UnicodeHashFunction.HashFunction); sampleQuest = new Quest(); ViewModelService.Instance.Build(); }
public static void ClassInit(TestContext context) { Agnostic.HashStringsUsing(UnicodeHashFunction.HashFunction); ViewModelService.Instance.Build(); VotingRecords.Instance.PropertyChanged += Instance_PropertyChanged; defaultIdentity = new Identity("Name", "1"); defaultPlanPartition = new VotePartition(new VoteLine("[X] Plan Name\n-[X] Some content"), VoteType.Plan); }
public static void ClassInit(TestContext context) { Agnostic.HashStringsUsing(UnicodeHashFunction.HashFunction); sampleQuest = new Quest(); ViewModelService.Instance.Build(); voteConstructor = ViewModelService.MainViewModel.VoteCounter.VoteConstructor; }
public MainViewModel( HttpClientHandler httpClientHandler, IPageProvider pageProvider, IVoteCounter voteCounter, ITextResultsProvider textResults, Func <string, CompareInfo, CompareOptions, int> hashFunction) { PropertyChanged += Agnostic.HashStringsUsing(hashFunction); SetupNetwork(pageProvider, httpClientHandler); SetupTextResults(textResults); AllVotesCollection = new ObservableCollectionExt <string>(); AllVotersCollection = new ObservableCollectionExt <string>(); BuildCheckForNewRelease(); SetupVoteCounter(voteCounter); BuildTally(); SetupCommands(); }
public static void ClassInit(TestContext context) { Agnostic.HashStringsUsing(UnicodeHashFunction.HashFunction); }
public static void ClassInit(TestContext context) { Agnostic.HashStringsUsing(UnicodeHashFunction.HashFunction); VotingRecords.Instance.PropertyChanged += Instance_PropertyChanged; }