private void WindowClosed(object sender, EventArgs e) { AppConfigHandler.Save(); AppConfigHandler.Load(); AppConfigHandler.ConfigureEdi(); AppConfigHandler.ConfigureOracle(); }
static void Main(string[] args) { var configHandler = new AppConfigHandler(); var config = configHandler.GetConfig(); var ipChecker = config.IPChecker; var route53Client = new AmazonRoute53Client(config.Route53AccessKey, config.Route53SecretKey, RegionEndpoint.EUWest1); var dnsUpdater = new DnsUpdater(route53Client); HostFactory.Run(x => { x.Service <IScheduledTaskService>(s => { s.ConstructUsing(name => new DnsUpdateService(new SchedulerRegistry(new ScheduledTaskWorker(dnsUpdater, ipChecker, config.DomainList)))); s.WhenStarted(tc => tc.Start()); s.WhenStopped(tc => tc.Stop()); }); x.RunAsLocalSystem(); x.SetDisplayName("DynDns53 Service"); x.SetServiceName("DynDns53"); x.SetDescription("Updates AWS Route53 records with the current external IP of the system"); x.StartAutomatically(); x.EnableServiceRecovery(s => { s.RestartService(1); s.RestartService(2); s.RestartService(5); }); }); }
private void Start() { _configHandler = GameObject.Find("MainPanel").GetComponent <AppConfigHandler>(); square.transform.localScale = new Vector3(5, 5, 0); userInterface.enabled = true; var squareSize = square.GetComponent <SpriteRenderer>().bounds.size; }
//reaction for applying changes button public void ModifyAlarmLanguages() { bool dataOK = CheckIfSuchLanguagAlreadyExists(); if (dataOK) { _logger.Info($"Saving alarm texts languages modifications to DB started."); bool savedSuccessfully = SendModifiedDataToDB(); if (!savedSuccessfully) { _logger.Error($"Saving modified alarm texts languages list went wrong!"); MessageBox.Show("Modifying languages data was not fully successfull", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); } else { AppConfigHandler.RefreshRuntimeLanguagesList(_runtimeData); TryClose(); } } else { _logger.Info($"Two the same languages names - attempt made by user."); MessageBox.Show("There can't be two same languages", "Information", MessageBoxButton.OK, MessageBoxImage.Information); } }
public void Default_application_config_can_be_retrieved() { var args = new AppConfigHandler(); Assert.Equal( "The App", args.Settings[ "AppSetting" ] ); var m = Regex.Match( "foo$(bar)", @"\$\((.+?)\)" ); var v = m.Groups[ 1 ].Value; Assert.True( m.Success ); }
public void BuildReport(List <TestResult> testResultList, Stopwatch watch) { var table = new StringBuilder(); table.AppendLine(_html); table.AppendLine(" <table class='table table-dark'>"); table.AppendLine(" <thead>"); table.AppendLine("<tr>"); table.AppendLine("<th> Test Step </th>"); table.AppendLine("<th> Comment </th>"); table.AppendLine("<th> Test Status </th>"); table.AppendLine("<th> Elapsed Time </ th>"); table.AppendLine(" </tr> "); table.AppendLine(" </thead>"); table.AppendLine(" <tbody>"); var passCount = testResultList.Count(x => x.TestStatus == Status.Pass); var failCount = testResultList.Count(x => x.TestStatus == Status.Fail); var pendingCount = testResultList.Count(x => x.TestStatus == Status.Pending); GetHtmlHead(passCount, failCount, pendingCount); foreach (var testresult in testResultList) { table.AppendLine("<tr>"); table.AppendLine("<td>").Append(testresult.TestStep).Append("</td>"); table.AppendLine("<td>").Append(testresult.Comment).Append("</td>"); table.AppendLine("<td>").Append(testresult.TestStatus).Append("</td>"); table.AppendLine("<td>").Append(testresult.ElapsedTime).Append("</td>"); table.AppendLine("</tr>"); Log.Info("Adding\r\n" + testresult); } table.AppendLine("</tbody>"); table.AppendLine("</table>"); double time = watch.ElapsedMilliseconds; time = time / 1000; table.AppendLine($"<p>Time Spent: {time}S</p>"); var html = GetFooter(table.ToString(), passCount, failCount, pendingCount); html = _html + html; var appconfig = new AppConfigHandler(); var reportPath = appconfig.ReadFolderPathFromConfigurationFile(SolutionSubFolder.Reports); var dateTime = DateTime.Now.ToString("MMMM dd yyyy hh mm ss"); try { reportPath = Path.Combine(reportPath, dateTime + ".html"); File.WriteAllText(reportPath, html); } catch (Exception e) { Log.Error(e); throw; } }
public void Default_application_config_can_be_retrieved() { var args = new AppConfigHandler(); Assert.Equal("The App", args.Settings["AppSetting"]); var m = Regex.Match("foo$(bar)", @"\$\((.+?)\)"); var v = m.Groups[1].Value; Assert.True(m.Success); }
public void LoginToSourcebox() { LoginPage loginPage = homepage.GotoLoginPage(); loginPage.WaitForPageToLoad(); loginPage.AccountName = AppConfigHandler.GetValue("AccountName"); loginPage.UserName = AppConfigHandler.GetValue("UserName"); loginPage.Password = AppConfigHandler.GetValue("Password") + Environment.NewLine; Host.TakeScreenShot("LoginToSourcebox"); Thread.Sleep(5000); }
//method for reading from DB and setting app properties private void ReadAndSetAppConfiguration() { //App startup config loading _logger.Info($"Executing pprocess of handling app startup configuration."); AppConfigHandler.ExecuteStertupConfig(_realmProvider, _runtimeData); //no logged user at the application UI started _logger.Info($"Setting logged user to noone."); LoginHandlingCommonMethod(null, 0); //Automatic logout timer RuntimeLogoutTimer.LogoutCurrentUser += RuntimeLogoutTimer_LogoutCurrentUser; }
public void firingDriver_TakeScreenshotOnException(object sender, WebDriverExceptionEventArgs e) { var timestamp = DateTime.Now.ToString("yyyy-MM-dd-hhmm-ss"); var conf = new AppConfigHandler(); var folderPath = conf.ReadFolderPathFromConfigurationFile(SolutionSubFolder.Logs); var imagePath = Path.Combine(folderPath, "ChromeException-" + timestamp + ".png"); _driver.TakeScreenshot().SaveAsFile(imagePath, ScreenshotImageFormat.Bmp); var filePath = Path.Combine(folderPath, "ChromeException-" + timestamp + ".txt"); File.WriteAllText(filePath, e.ThrownException.ToString()); }
//method from button public void ApplyChanges() { _logger.Info($"Button for applying changes and saving those changes to DB, pressed."); bool success = SendUpdatedDataToDB(); if (!success) { _logger.Error($"Saving modified data of NLog configurationd to DB went wrong!"); MessageBox.Show("Not all data was successfully saved.", "Message", MessageBoxButton.OK, MessageBoxImage.Information); } ReadSavedConfigs(); //changing NLog config during runtime AppConfigHandler.ChangeCurrentNLogConfig(); }
public void AppConfigSectionTest() { //string environment = ConfigurationManager.AppSettings["environment"]; //NameValueCollection test = (NameValueCollection)ConfigurationManager.GetSection("PROD"); //Console.WriteLine(test["host"]); //test = (NameValueCollection)ConfigurationManager.GetSection("QA"); //Console.WriteLine(test["host"]); //test = (NameValueCollection)ConfigurationManager.GetSection(environment); //Console.WriteLine(test["host"]); //Console.WriteLine(test["LoginPage"]); //Console.WriteLine(test["LogoutPage"]); //Console.WriteLine(test["NewUserPage"]); //Console.WriteLine(test["UsersPage"]); Console.WriteLine(AppConfigHandler.GetValue("host")); Console.WriteLine(AppConfigHandler.GetValue("LoginPage")); Console.WriteLine(AppConfigHandler.GetValue("LogoutPage")); Console.WriteLine(AppConfigHandler.GetValue("NewUserPage")); Console.WriteLine(AppConfigHandler.GetValue("UsersPage")); }
public void GivenIHaveAReferenceOfTheAppConfigrationHandler() { appConfigHandler = new AppConfigHandler(); _currentdir = FileAndFolderHandler.GetSolutionDirectory(); }
public SpreadSheetInputOutput() { _configHandler = new AppConfigHandler(); }
private void WindowClosed(object sender, EventArgs e) { AppConfigHandler.Save(); }
static void Main(string[] args) { try { Console.WriteLine(AppConfig.Instance.IsLog); AppConfigHandler.GetConfig <AppConfig>("AppConfig.xml"); AppConfigHandler.EnableRemoteConfig(10008, "56yhgfrt"); //AppConfigHandler.SaveConfig<AppConfig>("AppConfig.xml", true, AppConfig.Instance); string s = string.Empty; while (true) { try { Console.WriteLine(); Console.WriteLine("如何使用 Z.DA 进行数据库访问"); Console.WriteLine("1. 基本数据库操作(从AbstractDA派生)"); Console.WriteLine("2. 基本数据库操作(基本表操作)"); Console.WriteLine("3. 基本数据库操作(执行存储过程)"); Console.WriteLine("4. 基本数据库操作(实现一个长连接, 避免每次执行重复创建和销毁Connection)"); Console.WriteLine("5. 基本数据库操作(实现事务)"); Console.WriteLine("6. 基本数据库操作(打印内部缓存SQL数据)"); Console.WriteLine("7. 基本数据库操作(返回泛型列表的存储过程)"); Console.WriteLine("8. 基本数据库操作(返回存储过程, 不返回任何值)"); Console.WriteLine("9. 基本数据库操作(返回一个字符串数组)"); Console.WriteLine("0, q, x. 退出"); Console.WriteLine("c. 清屏"); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.White; Console.Write("选择样例:"); Console.ForegroundColor = ConsoleColor.Gray; s = Console.ReadLine().ToLower(); Console.ForegroundColor = ConsoleColor.Green; switch (s) { case "1": HowTO_1(); break; case "2": HowTO_2(); break; case "3": HowTO_3(); break; case "4": HowTO_4(); break; case "5": HowTO_5(); break; case "6": HowTO_6(); break; case "7": HowTO_7(); break; case "8": HowTO_8(); break; case "9": HowTO_9(); break; case "0": case "q": case "x": Console.ForegroundColor = ConsoleColor.Gray; return; case "c": Console.Clear(); break; default: Console.Clear(); break; } Console.ForegroundColor = ConsoleColor.Gray; } catch (Exception ex) { Console.WriteLine(ex.Message); } } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public App() { AppConfigHandler.Load(); AppConfigHandler.ConfigureEdi(); AppConfigHandler.ConfigureOracle(); }