public MainWindow() { InitializeComponent(); _UpdateTimer = new Timer(60000); _UpdateTimer.Elapsed += _UpdateTimer_Elapsed; _UpdateTimer.AutoReset = true; _UpdateTimer.Enabled = true; _NOAAClient = new NOAAClient(); _MetNoClient = new MetNoClient(); _PollenClient = new PollenClient(); _OptionsService = new OptionsService(); _ApplicationOptions = _OptionsService.LoadSavedOptions(); _GeographyService = new GeographyService(); _WeatherIconService = new WeatherIconService(); if (_ApplicationOptions.SelectedZip != null) { ZipTextBox.Text = _ApplicationOptions.SelectedZip.Zip.ToString(); } ErrorHelper.ErrorLabel = ErrorText; ErrorHelper.EmitError("Errors will appear here."); GetWeatherForecast(); UpdatePollenForecast(); }
Target ITargetPlugin.Aquire(OptionsService options, InputService input) { return(input.ChooseFromList("Choose site", GetBindings(options.Options, true).Where(x => x.Hidden == false), x => InputService.Choice.Create(x, description: $"{x.Host} (SiteId {x.SiteId}) [@{x.WebRootPath}]"), true)); }
public DefaultInterpreterSetter SelectDefaultInterpreter(PythonVersion interp, string installPackages) { interp.AssertInstalled(); var interpreterService = InterpreterService; var factory = interpreterService.FindInterpreter(interp.Id); var defaultInterpreterSetter = new DefaultInterpreterSetter(factory, ServiceProvider); try { if (!string.IsNullOrEmpty(installPackages)) { var pm = OptionsService.GetPackageManagers(factory).FirstOrDefault(); var ui = new TestPackageManagerUI(); pm.PrepareAsync(ui, CancellationTokens.After60s).WaitAndUnwrapExceptions(); foreach (var package in installPackages.Split(' ', ',', ';').Select(s => s.Trim()).Where(s => !string.IsNullOrEmpty(s))) { pm.InstallAsync(new PackageSpec(package), ui, CancellationTokens.After60s).WaitAndUnwrapExceptions(); } } Assert.AreEqual(factory.Configuration.Id, OptionsService.DefaultInterpreterId); var result = defaultInterpreterSetter; defaultInterpreterSetter = null; return(result); } finally { if (defaultInterpreterSetter != null) { defaultInterpreterSetter.Dispose(); } } }
void SaveOptions(object param) { IOptionsService OptionsDetails = new OptionsService(); //UpdateBindingGroup.CommitEdit(); bool results = false; var optionsDetails = SelectedOptions as OptionsEntity; MessageBoxResult result = MessageBox.Show("Do you want to save changes?", "Save Content", MessageBoxButton.YesNo); switch (result) { case MessageBoxResult.Yes: results = OptionsDetails.AddEditOptions(optionsDetails); break; case MessageBoxResult.No: break; } if (results == true) { //MessageBox.Show("Data saved successfully!"); } else { MessageBox.Show("There was some problem in updating the entries, kindly try again later!\n" + "@ Simple Accounting Software Pte Ltd"); } }
/// <summary> /// Constructor for Inventor controller containing all required services /// </summary> /// <param name="service"></param> /// <param name="listingService"></param> /// <param name="optionsService"></param> /// <param name="imageService"></param> public InventoryController(DbService service, ListingService listingService, OptionsService optionsService, ImageService imageService) { _dbService = service; _listingService = listingService; _optionsService = optionsService; _imageService = imageService; }
public void CreateOptions_FromFlexiOptionsBlock_CreatesOptions() { // Arrange BlockProcessor dummyBlockProcessor = MarkdigTypesFactory.CreateBlockProcessor(); Mock <IDummyBlockOptions> dummyDefaultBlockOptions = _mockRepository.Create <IDummyBlockOptions>(); Mock <IDummyBlockOptions> dummyNewBlockOptions = _mockRepository.Create <IDummyBlockOptions>(); Mock <IDummyBlocksExtensionOptions> mockBlocksExtensionOptions = _mockRepository.Create <IDummyBlocksExtensionOptions>(); mockBlocksExtensionOptions.Setup(f => f.DefaultBlockOptions).Returns(dummyDefaultBlockOptions.Object); Mock <IBlockOptionsFactory <IDummyBlockOptions> > mockBlockOptionsFactory = _mockRepository.Create <IBlockOptionsFactory <IDummyBlockOptions> >(); mockBlockOptionsFactory.Setup(f => f.Create(dummyDefaultBlockOptions.Object, dummyBlockProcessor)).Returns(dummyNewBlockOptions.Object); Mock <IExtensionOptionsFactory <IDummyBlocksExtensionOptions, IDummyBlockOptions> > mockBlocksExtensionOptionsFactory = _mockRepository.Create <IExtensionOptionsFactory <IDummyBlocksExtensionOptions, IDummyBlockOptions> >(); mockBlocksExtensionOptionsFactory.Setup(f => f.Create(dummyBlockProcessor)).Returns(mockBlocksExtensionOptions.Object); OptionsService <IDummyBlockOptions, IDummyBlocksExtensionOptions> testSubject = CreateOptionsService(mockBlockOptionsFactory.Object, mockBlocksExtensionOptionsFactory.Object); // Act (IDummyBlockOptions resultBlockOptions, IDummyBlocksExtensionOptions resultExtensionOptions) = testSubject.CreateOptions(dummyBlockProcessor); // Assert _mockRepository.VerifyAll(); Assert.Same(dummyNewBlockOptions.Object, resultBlockOptions); Assert.Same(mockBlocksExtensionOptions.Object, resultExtensionOptions); }
private IISSiteOptions Options(string commandLine) { var x = new IISSiteOptionsFactory(log, iis, helper); var optionsParser = new ArgumentsParser(log, plugins, commandLine.Split(' ')); var optionsService = new OptionsService(log, optionsParser); return(x.Default(optionsService)); }
Target ITargetPlugin.Default(OptionsService options) { var rawSiteId = options.TryGetRequiredOption(nameof(options.Options.SiteId), options.Options.SiteId); var totalTarget = GetCombinedTarget(GetSites(options.Options, false), rawSiteId); totalTarget.ExcludeBindings = options.Options.ExcludeBindings; return(totalTarget); }
public ValidationContext(IValidationContextOptions options = null) { Id = Guid.NewGuid(); Options = OptionsService.GetVerifiedValidationContextOptions(options ?? new ValidationContextOptions()); SpecificationsRepository = new SpecificationsRepository(Options.Specifications); ValidatorsFactory = new ValidatorsFactory(SpecificationsRepository); TranslatorsRepository = new TranslatorsRepository(Options.Translations.ToArray()); }
public AzureDnsOptions(OptionsService options, InputService input) { TenantId = options.TryGetOption(options.Options.AzureTenantId, input, "Tenant Id"); ClientId = options.TryGetOption(options.Options.AzureClientId, input, "Client Id"); Secret = options.TryGetOption(options.Options.AzureSecret, input, "Secret", true); SubscriptionId = options.TryGetOption(options.Options.AzureSubscriptionId, input, "DNS Subscription ID"); ResourceGroupName = options.TryGetOption(options.Options.AzureResourceGroupName, input, "DNS Resoure Group Name"); }
public AzureDnsOptions(OptionsService options) { TenantId = options.TryGetRequiredOption(nameof(options.Options.AzureTenantId), options.Options.AzureTenantId); ClientId = options.TryGetRequiredOption(nameof(options.Options.AzureTenantId), options.Options.AzureClientId); Secret = options.TryGetRequiredOption(nameof(options.Options.AzureTenantId), options.Options.AzureSecret); SubscriptionId = options.TryGetRequiredOption(nameof(options.Options.AzureTenantId), options.Options.AzureSubscriptionId); ResourceGroupName = options.TryGetRequiredOption(nameof(options.Options.AzureTenantId), options.Options.AzureResourceGroupName); }
public void VerifyTranslationName_Should_VerifyPositive() { var result = OptionsService.VerifyTranslationName(new[] { new Translation("name", new Dictionary <string, string> { { "a", "b" } }) }, "name"); Assert.Equal("name", result); }
public PersonnageInfoViewModel(OptionsService service) { this.service = service; Personnage = new Personnage(); if (Positions == null) { Positions = new ObservableCollection <KeyValuePair <string, Position> >(service.PredefinedPositions); } }
Target ITargetPlugin.Refresh(OptionsService options, Target scheduled) { // TODO: check if the sites still exist, log removed sites // and return null if none of the sites can be found (cancel // the renewal of the certificate). Maybe even save the "S" // switch somehow to add sites if new ones are added to the // server. return(scheduled); }
public override void Default(OptionsService options, Target target) { base.Default(options, target); if (string.IsNullOrEmpty(target.WebRootPath)) { target.WebRootPath = options.TryGetRequiredOption(nameof(options.Options.WebRoot), options.Options.WebRoot); } target.HttpWebDavOptions = new WebDavOptions(options); }
Target ITargetPlugin.Aquire(OptionsService options, InputService input) { List <string> sanList = ParseSanList(input.RequestString("Enter comma-separated list of host names, starting with the primary one")); if (sanList != null) { return(Create(options, sanList)); } return(null); }
Target Create(OptionsService options, List <string> sanList) { return(new Target() { Host = sanList.First(), HostIsDns = true, AlternativeNames = sanList, PluginName = PluginName }); }
public void GetVerifiedSpecificationsDictionary_Should_ThrowException_When_NullSpecificationAsValue() { var specificationsDictionary = new Dictionary <Type, object> { { typeof(User), new Specification <User>(c => c) }, { typeof(Address), null } }; Assert.Throws <InvalidOperationException>(() => { OptionsService.GetVerifiedSpecificationsDictionary(specificationsDictionary); }); }
public void GetVerifiedTranslations_Should_ThrowException_When_NullInCollection() { var translations = new[] { new Translation("test1", new Dictionary <string, string>()), null, new Translation("test2", new Dictionary <string, string>()) }; Assert.Throws <InvalidOperationException>(() => { OptionsService.GetVerifiedTranslations(translations); }); }
public OptionsServiceTest() { //NOTE: If used types are removed, replace them by someone else to satisfy the generic constraint _localOptionsRepository = new Mock <IGenericRepository <LocalRelationFrequencyType> >(); _globalOptionsRepository = new Mock <IGenericRepository <RelationFrequencyType> >(); _localOptionsRepository.Setup(x => x.AsQueryable()).Returns(new List <LocalRelationFrequencyType>().AsQueryable()); _globalOptionsRepository.Setup(x => x.AsQueryable()).Returns(new List <RelationFrequencyType>().AsQueryable()); _sut = new OptionsService <SystemRelation, RelationFrequencyType, LocalRelationFrequencyType>( _localOptionsRepository.Object, _globalOptionsRepository.Object); }
/// <summary> /// Check or get information need for validation (interactive) /// </summary> /// <param name="target"></param> public virtual void Aquire(OptionsService options, InputService input, Target target) { if (target.IIS == null) { target.IIS = options.Options.ManualTargetIsIIS; if (target.IIS == false) { target.IIS = input.PromptYesNo("Copy default web.config before validation?"); } } }
/// <summary> /// Check information need for validation (unattended) /// </summary> /// <param name="target"></param> public virtual void Default(OptionsService options, Target target) { if (target.IIS == null) { target.IIS = options.Options.ManualTargetIsIIS; if (target.IIS == null) { target.IIS = false; } } }
public override void Aquire(OptionsService options, InputService input, Target target) { base.Aquire(options, input, target); if (string.IsNullOrEmpty(target.WebRootPath)) { do { target.WebRootPath = options.TryGetOption(options.Options.WebRoot, input, "Enter a site path (the web root of the host for http authentication)"); }while (!Valid(target.WebRootPath)); } }
private void BuExit_Click(object sender, EventArgs e) { if (OptionsService.ExitCheck()) { Application.Exit(); } else { MessageBox.Show("Cant exit right now"); } }
public void testSetOptions_cryptingMethodWithoutKey() { CipherBase testCipher = CipherTestInstances.cipherWithoutKey; OptionsService.SetOptions(testCipher); Assert.Equal(Options.CryptingMethod, testCipher); Assert.Equal(Options.LbKeyText, testCipher.Name + OptionsService.CIPHER_WITHOUT_KEY_LABEL_PREFIX); OptionsService.SetOptions(testCipher); // TODO find out why is not changing CipherMethod after first SetOptions Assert.False(Options.CryptingMethod.IsKeyBasedCipher()); }
Target ITargetPlugin.Refresh(OptionsService options, Target scheduled) { var match = GetBindings(options.Options, false).FirstOrDefault(binding => string.Equals(binding.Host, scheduled.Host, StringComparison.InvariantCultureIgnoreCase)); if (match != null) { UpdateWebRoot(scheduled, match); return(scheduled); } _log.Error("Binding {host} not found", scheduled.Host); return(null); }
public override void Default(OptionsService options, Target target) { base.Default(options, target); if (string.IsNullOrEmpty(target.WebRootPath)) { target.WebRootPath = options.TryGetRequiredOption(nameof(options.Options.WebRoot), options.Options.WebRoot); if (!Valid(target.WebRootPath)) { throw new ArgumentException(nameof(options.Options.WebRoot)); } } }
Target ITargetPlugin.Aquire(OptionsService options, InputService input) { List <Target> targets = GetSites(options.Options, true).Where(x => x.Hidden == false).ToList(); input.WritePagedList(targets.Select(x => Choice.Create(x, $"{x.Host} ({x.AlternativeNames.Count()} bindings) [@{x.WebRootPath}]", x.SiteId.ToString())).ToList()); var sanInput = input.RequestString("Enter a comma separated list of site IDs, or 'S' to run for all sites").ToLower().Trim(); var totalTarget = GetCombinedTarget(targets, sanInput); input.WritePagedList(totalTarget.AlternativeNames.Select(x => Choice.Create(x, ""))); totalTarget.ExcludeBindings = input.RequestString("Press enter to include all listed hosts, or type a comma-separated lists of exclusions"); return(totalTarget); }
Target ITargetPlugin.Refresh(OptionsService options, Target scheduled) { var match = GetSites(options.Options, false).FirstOrDefault(binding => binding.SiteId == scheduled.SiteId); if (match != null) { UpdateWebRoot(scheduled, match); UpdateAlternativeNames(scheduled, match); return(scheduled); } _log.Error("SiteId {id} not found", scheduled.SiteId); return(null); }
public override void Aquire(OptionsService options, InputService input, Target target) { base.Aquire(options, input, target); if (string.IsNullOrEmpty(target.WebRootPath)) { target.WebRootPath = options.TryGetOption(options.Options.WebRoot, input, new[] { "Enter a site path (the web root of the host for http authentication)", " Example, http://domain.com:80/", " Example, https://domain.com:443/" }); } target.HttpWebDavOptions = new WebDavOptions(options, input); }
public void Init(ServiceContainer sp) { os = sp.GetService<OptionsService>(); enabledCB.Checked = os.Get<bool>("myvar_enabled"); }