public MainWindow() { var model = this.InitViewModels(); this.DataContext = model; this.InitializeComponent(); var logfile = ConfigurationLoader.GetAppSettingsValue("LogFile"); var LoggingLevelsString = ConfigurationLoader.GetAppSettingsValue("LoggingLevels"); LoggingLevels enumLowestTrace = LoggingLevels.Info; if (!string.IsNullOrEmpty(LoggingLevelsString)) { if (!Enum.TryParse(LoggingLevelsString, true, out enumLowestTrace)) { enumLowestTrace = LoggingLevels.Info; } } var fileAppsender = new FileAppender(logfile, enumLowestTrace, LoggingLevels.Trace); Log.AddAppender(fileAppsender); Log.Info("FeltAdmin started"); model.DisableDb += model_DisableDb; AppDomain currentDomain = AppDomain.CurrentDomain; currentDomain.UnhandledException += CurrentDomainUnhandledException; }
public ExportLeonFormatService() { m_serLag = new XmlSerializer(typeof(List <Lag>)); m_leonFormatXsltFile = ConfigurationLoader.GetAppSettingsValue("LeonFormatXsltFile"); m_exportDirLeon = ConfigurationLoader.GetAppSettingsValue("ExportDirLeonFormat"); InitXslt(); }
private void OpenDbExecute() { using (var dlg = new FolderBrowserDialog()) { if (!string.IsNullOrWhiteSpace(SelectedPath) && Directory.Exists(SelectedPath)) { dlg.SelectedPath = SelectedPath; } else { var databasePath = ConfigurationLoader.GetAppSettingsValue("DatabasePath"); if (!string.IsNullOrWhiteSpace(databasePath) && Directory.Exists(databasePath)) { dlg.SelectedPath = databasePath; } } var result = dlg.ShowDialog(); if (result == DialogResult.OK) { SelectedPath = dlg.SelectedPath; if (m_dispatcherTimer == null) { m_dispatcherTimer = new DispatcherTimer(); m_dispatcherTimer.Tick += dispatcherTimer_Tick; m_dispatcherTimer.Interval = new TimeSpan(0, 0, 2); m_dispatcherTimer.Start(); } } } }
public MainWindow() { InitializeComponent(); var logfile = ConfigurationLoader.GetAppSettingsValue("LogFile"); var LoggingLevelsString = ConfigurationLoader.GetAppSettingsValue("LoggingLevels"); LoggingLevels enumLowestTrace = LoggingLevels.Info; if (!string.IsNullOrEmpty(LoggingLevelsString)) { if (Enum.TryParse(LoggingLevelsString, true, out enumLowestTrace)) { enumLowestTrace = enumLowestTrace; } else { enumLowestTrace = LoggingLevels.Info; } } var fileAppsender = new FileAppender(logfile, enumLowestTrace, LoggingLevels.Trace); Log.AddAppender(fileAppsender); }
public LagOppsettConfig GetOppsettConfig() { m_inputFinfeltPath = ConfigurationLoader.GetAppSettingsValue("FinFeltDatabase"); m_inputGrovfeltPath = ConfigurationLoader.GetAppSettingsValue("GrovFeltDatabase"); return(new LagOppsettConfig { PathFinfelt = this.m_inputFinfeltPath, PathGrovfelt = this.m_inputGrovfeltPath }); }
public void Init() { try { this.m_newfileContent = new byte[] { 0x4B }; this.m_parser = new OrionInputParser(); this.m_comDirectory = ConfigurationLoader.GetAppSettingsValue("LeonInputDir"); var feltstevne = ConfigurationLoader.GetAppSettingsValue("SteveType"); if (!string.IsNullOrEmpty(feltstevne)) { if (feltstevne.ToUpper() == "BANE") { this.m_resultParser = new OrionResultParser(false); } else { this.m_resultParser = new OrionResultParser(true); } } else { this.m_resultParser = new OrionResultParser(true); } if (string.IsNullOrEmpty(this.m_comDirectory)) { Log.Error("LeonInputDir Path must be specified"); throw new InvalidOperationException("LeonInputDir must be specified"); } if (!Directory.Exists(this.m_comDirectory)) { var errormsg = string.Format("LeonInputDir does not exsits {0}", this.m_comDirectory); Log.Error(errormsg); throw new InvalidOperationException(errormsg); } m_comBkupDirectory = Path.Combine(this.m_comDirectory, "backup"); if (!Directory.Exists(m_comBkupDirectory)) { Directory.CreateDirectory(m_comBkupDirectory); } } catch (Exception e) { Log.Error(e, "Error init"); throw; } }
public MainWindow() { var model = this.InitViewModels(); this.DataContext = model; this.InitializeComponent(); var databaseBasePath = ConfigurationLoader.GetAppSettingsValue("DatabasePath"); var databasepathwithoutslash = databaseBasePath.Replace('\\', '_'); singleton = new Mutex(true, databasepathwithoutslash); if (!singleton.WaitOne(TimeSpan.Zero, true)) { //there is already another instance running! Log.Error($"En annen prosess kjører allerede på samme konfigurasjon {databaseBasePath}"); System.Windows.Forms.MessageBox.Show($"En annen prosess kjører allerede på samme konfigurasjon {databaseBasePath}. Bare en instans kan kjøre samtidig", "FEIL. En annen prosess kjører allerede", System.Windows.Forms.MessageBoxButtons.OK); Application.Current.Shutdown(); } var logfile = ConfigurationLoader.GetAppSettingsValue("LogFile"); var Skytterlag = ConfigurationLoader.GetAppSettingsValue("Skytterlag"); var Lisens = ConfigurationLoader.GetAppSettingsValue("Lisens"); var LoggingLevelsString = ConfigurationLoader.GetAppSettingsValue("LoggingLevels"); LoggingLevels enumLowestTrace = LoggingLevels.Info; if (!string.IsNullOrEmpty(LoggingLevelsString)) { if (!Enum.TryParse(LoggingLevelsString, true, out enumLowestTrace)) { enumLowestTrace = LoggingLevels.Info; } } var fileAppsender = new FileAppender(logfile, enumLowestTrace, LoggingLevels.Trace); Log.AddAppender(fileAppsender); if (!LisensChecker.Validate(Skytterlag, DateTime.Now, Lisens)) { Log.Error("Lisens not valid for {0}", Skytterlag); System.Windows.Forms.MessageBox.Show($"Lisens ikke gyldig for {Skytterlag}", "FEIL. Lisenssjekk", System.Windows.Forms.MessageBoxButtons.OK); Application.Current.Shutdown(); } Log.Info("FeltAdmin started"); model.DisableDb += model_DisableDb; AppDomain currentDomain = AppDomain.CurrentDomain; currentDomain.UnhandledException += CurrentDomainUnhandledException; }
public RangeViewModel(OrionViewModel parent) { this.CommunicationSetup = new CommunicationSetup(); m_parent = parent; m_countingShoots = 6; var counting = ConfigurationLoader.GetAppSettingsValue("DefaultCountingShoots"); if (!string.IsNullOrWhiteSpace(counting)) { int shots = 0; if (int.TryParse(counting, out shots)) { m_countingShoots = shots; } } }
private static int Intvalue(string paramName) { var strVal = ConfigurationLoader.GetAppSettingsValue(paramName); if (string.IsNullOrEmpty(strVal)) { throw new ArgumentNullException(paramName, "Parameter can not be null"); } int intvalue = 0; if (!int.TryParse(strVal, out intvalue)) { throw new ArgumentNullException(paramName, string.Format("Parameter must be int{0}", strVal)); } return(intvalue); }
public void InitConverter() { try { m_AntallHold = Intvalue("AntallHold"); var holdType = ConfigurationLoader.GetAppSettingsValue("HoldType"); if (string.IsNullOrEmpty(holdType)) { m_definition = new List <HoldDefinition>(); m_definition.Add(new HoldDefinition(1, HoldType.BaneHold)); m_definition.Add(new HoldDefinition(2, HoldType.FeltHold)); m_definition.Add(new HoldDefinition(3, HoldType.FeltHold)); m_definition.Add(new HoldDefinition(4, HoldType.FeltHold)); m_definition.Add(new HoldDefinition(5, HoldType.FeltHold)); m_definition.Add(new HoldDefinition(6, HoldType.FeltHold)); } m_OrionHoldId = Intvalue("OrionHoldId"); m_AntallSkiver = Intvalue("AntallSkiver"); m_AntallSkyttereILaget = Intvalue("AntallSkyttereILaget"); var temp = ConfigurationLoader.GetAppSettingsValue("Avbrekk"); m_Avbrekk = false; if (!string.IsNullOrEmpty(temp)) { bool resVal; if (bool.TryParse(temp, out resVal)) { m_Avbrekk = resVal; } } } catch (Exception e) { Log.Error(e, "InitConverter()"); throw; } }
public OppropDataService() { System.Configuration.Configuration configuration = ConfigurationLoader.GetInstance().GetConfigurationForRunningProcess(); m_inputPath = ConfigurationLoader.GetAppSettingsValue("OppRopDataPath"); }