/// <summary> /// Handles the Click event of the btnStart control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void btnStart_Click(object sender, EventArgs e) { try { // Perform validation if (!FormHelper.ValidateNotEmpty(txtPath, Resources.MsgWebServerPathRequired)) { return; } if (!FormHelper.ValidateNotEmpty(txtVirtualPath, Resources.MsgWebServerVirtualPathRequired)) { return; } if (!FormHelper.ValidateGreaterThanZero(txtPort, Resources.MsgWebServerPortRequired)) { return; } // Save the existing setting to database AppConfigSettings.Update(ConfigParameter.WebServerAppPath, txtPath.Text); AppConfigSettings.Update(ConfigParameter.WebServerVirtualPath, txtVirtualPath.Text); AppConfigSettings.Update(ConfigParameter.WebServerPort, txtPort.Text); AppConfigSettings.Update(ConfigParameter.WebServerAutoStart, Convert.ToString(chkAutoStart.Checked)); EventAction action = new EventAction(StringEnum.GetStringValue(EventNotificationType.StartWebServer)); EventResponse response = RemotingHelper.NotifyEvent(ServiceEventListenerUrl, action); txtStatus.Text = StringEnum.GetStringValue(WebServerStatus.Starting); } catch (Exception ex) { FormHelper.ShowError(ex.Message); } }
/// <summary> /// Handles the Load event of the mdiStatusConsole control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void mdiStatusConsole_Load(object sender, EventArgs e) { CheckForIllegalCrossThreadCalls = false; LoadFile(AppConfigSettings.GetString(ConfigParameter.ApplicationLogFileName, ModuleName.Console)); LoadFile(AppConfigSettings.GetString(ConfigParameter.ServiceLogFileName, ModuleName.Service)); LayoutMdi(MdiLayout.TileVertical); }
public JwtMiddleware(RequestDelegate next, IOptions <AppConfigSettings> appConfigSettings, ILogger <JwtMiddleware> logger) { _next = next; _appConfigSettings = appConfigSettings.Value; _logger = logger; }
public PBICapacitiesController(ILogger <PBICapacitiesController> logger, ICapacityService capacityService, IOptions <AppConfigSettings> settings, IAzureService azureService) { _logger = logger; _capacityService = capacityService; _settings = settings.Value; _azureService = azureService; }
IEnumerator Start() { //KGameSettings.Instance.InitAction += OnGameSettingsInit; var engine = KEngine.AppEngine.New( gameObject, null, new IModuleInitable[] { //KGameSettings.Instance, // UIModule.Instance, }); while (!engine.IsInited) { yield return(null); } var uiName = "DemoHome"; UIModule.Instance.OpenWindow(uiName); Debug.Log("[SettingModule]Table: " + string.Join(",", ExampleSettings.TabFilePaths)); foreach (ExampleSetting exampleInfo in ExampleSettings.GetAll()) { Debug.Log(string.Format("Name: {0}", exampleInfo.Name)); Debug.Log(string.Format("Number: {0}", exampleInfo.Number)); } var info = ExampleSettings.Get("A_1024"); Debuger.Assert(info.Name == "Test1"); var info2 = SubdirExample2Settings.Get(2); Debuger.Assert(info2.Name == "Test2"); var info3 = AppConfigSettings.Get("Test.Cat1"); Debuger.Assert(info3.Value == "Cat1"); ExampleSettings.OnReload = () => { var reloadedInfo = ExampleSettings.Get("C_9888"); Log.Info("Reload ExampleInfos! Now info: {0} -> {1}", "C_9888", reloadedInfo.Name); }; Log.Info("Start reading streamingAssets Test..."); UIModule.Instance.CallUI(uiName, (ui, args) => { var tip = string.Format("Reading from streamingAssets, content: {0}", Encoding.UTF8.GetString(KResourceModule.LoadSyncFromStreamingAssets("TestFile.txt"))); var demoHome = ui as KUIDemoHome; demoHome.TipLabel.text += tip; // Do some UI stuff }); }
public UserAccountService( IUserAccountRepository repo, IMapper mapper, IOptions <AppConfigSettings> appConfigSettings ) { _repo = repo; _mapper = mapper; _appConfigSettings = appConfigSettings.Value; }
public override void Execute(QueueMessage queueMessage) { AppConfigSettings.Initialize(base.Configuration.SelectNodes("//Phytel.ASE.Process/ProcessConfiguration/appSettings/add")); XmlDocument doc = new XmlDocument(); doc.LoadXml(queueMessage.Body); var message = Mapper.Map <RegistryCompleteMessage>(doc.DocumentElement); _contractName = message.ContractDataBase; Processor.Process(message); }
/// <summary> /// Sets an app setting in the preferences file /// </summary> private static void SetAppSetting(String key, String value) { if (appConfigSettings.AppSettings.Settings[key] != null) { appConfigSettings.AppSettings.Settings[key].Value = value; } else { appConfigSettings.AppSettings.Settings.Add(key, value); } // Persist immediatley AppConfigSettings.Save(); }
/// <summary> /// Handles the Load event of the DatabaseMessenger control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void DatabaseMessenger_Load(object sender, EventArgs e) { if (this.DesignMode) { return; } ServiceEventListenerUrl = AppConfigSettings.GetString(ConfigParameter.ServiceEventListener, ModuleName.Service); PollingInterval = AppConfigSettings.GetInt(ConfigParameter.ChannelPollingInterval); SetupView(); StartPoller(); }
public static async Task <IActionResult> Run([HttpTrigger(AuthorizationLevel.Admin, "post", Route = null)] HttpRequest req, ILogger log, ExecutionContext context) { log.LogInformation("CreateBlogEntry processed a request."); var completeArticle = AppConfigSettings.IngestRequest <CompleteClientArticle>(req, context); var articleInput = AppConfigSettings.IngestRequest <CompleteClientArticle>(req, context); var mOpts = AppConfigSettings.GetOptions(); var bas = new BlogArticleService(new CloudStorageContext(mOpts.StorageAccount), mOpts, log); var article = await bas.Add(completeArticle); return(new OkObjectResult(article)); }
public void GetAppConfigSettings_GivenEmptyKey_Returns_Null() { // Arrange. var config = Substitute.For <IConfiguration>(); config[null] = ""; var appSettings = new AppConfigSettings(config); // Act. var actual = appSettings[""]; // Assert. Assert.AreEqual(string.Empty, actual); }
public void GetAppConfigSettings_GivenKey_Returns_SettingValue() { // Arrange. var config = Substitute.For <IConfiguration>(); config["app:test"] = "Utilities"; var appSettings = new AppConfigSettings(config); // Act. var actual = appSettings["app:test"]; // Assert. Assert.AreEqual("Utilities", actual); }
public static async Task <IActionResult> Run([HttpTrigger(AuthorizationLevel.Function, "get", Route = null)] HttpRequest req, ILogger log, ExecutionContext context) { log.LogInformation("GetArticleHeaders function processed a request."); var headersQuery = AppConfigSettings.IngestRequest <GetArticleHeadersInput>(req, context); List <IArticleDetails> results = new List <IArticleDetails>(); var articleInput = AppConfigSettings.IngestRequest <CompleteClientArticle>(req, context); var mOpts = AppConfigSettings.GetOptions(); var bas = new BlogArticleService(new CloudStorageContext(mOpts.StorageAccount), mOpts, log); results.AddRange(await bas.FindArticlDetails(headersQuery.Start, headersQuery.End, headersQuery.Take, headersQuery.Skip)); return(new OkObjectResult(results)); }
public void Dispose() { SecureSettings.Dispose(); RoamingSettings.Dispose(); AppUserSettings.Dispose(); AppSettings.Dispose(); FileSettings.Dispose(); EnvVarsSettings.Dispose(); RegistrySettings.Dispose(); AppConfigSettings.Dispose(); AppSwitchSettings.Dispose(); CliSettings.Dispose(); }
public static LogManager getLogManager(OutputType type) { LogManager logManager = null; switch (type) { case OutputType.Console: logManager = new ConsoleLogManager(); break; case OutputType.TxtFile: logManager = new TxtFileLogManager(AppConfigSettings.getSetting("FilePath")); break; case OutputType.HTMLFile: logManager = new HTMLLogManager(AppConfigSettings.getSetting("FilePath")); break; } return(logManager); }
/// <summary> /// Initializes the form. /// </summary> private void InitializeForm() { txtPath.Text = AppConfigSettings.GetString(ConfigParameter.WebServerAppPath); txtVirtualPath.Text = AppConfigSettings.GetString(ConfigParameter.WebServerVirtualPath); txtPort.Text = AppConfigSettings.GetString(ConfigParameter.WebServerPort); chkAutoStart.Checked = Convert.ToBoolean(AppConfigSettings.GetString(ConfigParameter.WebServerAutoStart)); if (string.IsNullOrEmpty(txtPath.Text)) { txtPath.Text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Portal"); } btnStart.Focus(); ServiceEventListenerUrl = AppConfigSettings.GetString(ConfigParameter.ServiceEventListener, ModuleName.Service); PollingInterval = AppConfigSettings.GetInt(ConfigParameter.ChannelPollingInterval); StartPoller(); }
public override void DrawSettings(AppConfigSettings settings, float width) { var lostDefineSettings = settings as LostDefineSettings; // Adjusting the first columns width to fit the total size of the space definesGridDefinition[0].Width = (int)(width - definesGridDefinition[1].Width); using (new BeginGridScope(definesGrid)) { foreach (var define in lostDefineSettings.defines) { using (new BeginGridRowScope(definesGrid)) { definesGrid.DrawLabel(define.Name); define.IsEnabled = definesGrid.DrawBool(define.IsEnabled); } } } }
/// <summary> /// Starts the listen. /// </summary> private void StartEventListener() { StopEventListener(); // if there is any channel still open --> close it try { log.Info("Starting event listener"); int port = AppConfigSettings.GetInt(ConfigParameter.ListenerPort, ModuleName.Console); eventListenerChannel = new TcpChannel(port); ChannelServices.RegisterChannel(eventListenerChannel, false); eventInvocation = new EventInvocation(); string serviceName = AppConfigSettings.GetString(ConfigParameter.ListenerServiceName, ModuleName.Console); eventListenerService = RemotingServices.Marshal(eventInvocation, serviceName); //RemotingConfiguration.RegisterWellKnownServiceType(typeof(EventInvocation), // serviceName, WellKnownObjectMode.SingleCall); // define the event which is triggered when the Master calls the CallSlave() function eventInvocation.EventReceived += new EventInvocation.Received(OnEventReceived); // Create the event queue eventLock = new object(); eventQueue = new PriorityQueue <EventAction, EventPriority>(10); eventTrigger = new AutoResetEvent(false); eventProcessor = new Thread(ProcessEvents); eventProcessor.IsBackground = true; eventProcessor.Start(); log.Info(string.Format("Successfully started event listener {0} on port {1}", serviceName, port)); } catch (Exception ex) { log.Error("Error starting event listener: " + ex.Message, ex); StopEventListener(); // calls StopEventListener } }
protected override void OnStart(string[] args) { try { /*Funcionando Inicio*/ /* p = new Process(); * AppConfigSettings app = new AppConfigSettings(); * * string targetDir; * * targetDir = string.Format(@"" + app.GetAppSettings("rutaArchivoServicio")); //directory where the batch script is saved. * * p.StartInfo.UseShellExecute = true; * //p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; * p.StartInfo.WorkingDirectory = targetDir; * p.StartInfo.FileName = app.GetAppSettings("nombreArchivoServicio"); //this is the batch script that needs to run. * p.StartInfo.CreateNoWindow = false; * p.Start(); */ //p.WaitForExit(); /*Funcionando Fin*/ AppConfigSettings app = new AppConfigSettings(); myCSharpProcess = new Process(); myCSharpProcess.StartInfo.FileName = "java.exe"; myCSharpProcess.StartInfo.Arguments = "-jar " + app.GetAppSettings("rutaArchivoServicio") + "\\" + app.GetAppSettings("nombreArchivoServicio") + ""; myCSharpProcess.StartInfo.CreateNoWindow = false; //myProcess.StartInfo.CreateNoWindow = true; myCSharpProcess.Start(); EscribeVisorEventos("Se inició con éxito el Servicio MarcacionApp", null, 1); } catch (Exception ex) { EscribeVisorEventos("Error al iniciar el Servicio MarcacionApp", ex, 2); OnStop(); } }
public CapacityService(HttpClient httpClient, IOptions <AppConfigSettings> settings, IPBIService pbiService) { _httpClient = httpClient; _pbiService = pbiService; _settings = settings.Value; }
public AppConfigViewModelBuilder(AppConfigSettings settings) { _settings = settings; }
public TestHelper(string configSectionName) { _alternateConfig = new AppConfigSettings(configSectionName); _username = _alternateConfig.AdminUserName; _password = _alternateConfig.AdminPassword; }
public AppConfig(AppConfigSettings settings) : this(null, null, settings) { }
private AppConfig(DefaultSection defaultSection, FeaturesSection featuresSection, AppConfigSettings settings) { _default = defaultSection; _features = featuresSection; _settings = settings; }
public WorkspaceService(IOptions <AppConfigSettings> settings, IPBIService pbiService, ILogger <WorkspaceService> logger) { _settings = settings.Value; _pbiService = pbiService; _logger = logger; }
public AzureService(ITokenService tokenService, ILogger <AzureService> logger, IOptions <AppConfigSettings> settings) { _tokenService = tokenService; _logger = logger; _settings = settings.Value; }
private ConfigureAppConfig(IConfigureBehavior control, AppConfigSettings appConfigSettings) { _control = control; _appConfigSettings = appConfigSettings; _configuration = _control.Custom(new AppConfig(_appConfigSettings).IsEnabled); }
public void TestInitialize() { _fixture = new Fixture(); _settings = _fixture.Create <AppConfigSettings>(); _target = new AppConfigViewModelBuilder(_settings); }
private ConfigurationManager() { _iniConfigFileManager = new IniConfigFileManager(); _appConfigSettings = new AppConfigSettings(); Initialize(); }