/// <summary> /// Initializes a new instance of the <see cref="LanguageControlVm"/> class. /// </summary> /// <param name="imsOpcBridgeSettings">The ims opc bridge settings.</param> public LanguageControlVm(ImsOpcBridgeSettings imsOpcBridgeSettings) { this.host = null; this.CurrentLanguages = new ObservableCollection <LanguageControlItemVm>(); this.nextPageCommand = new DelegateCommand(this.GoToNextPage); this.previousPageCommand = new DelegateCommand(this.GoToPreviousPage); this.Title = Resources.SelectLanguage; this.imsOpcBridgeSettings = imsOpcBridgeSettings; this.FillAvailableLanguages(); this.UpdatePage(); }
/// <summary> /// Initializes a new instance of the <see cref="UIHost" /> class. /// </summary> /// <param name="baseHost">The base host.</param> public UIHost(IBaseHost baseHost) { this.baseHost = baseHost; }
public static void ConfigureLogging(IBaseHost host) { if (host == null) { throw new ArgumentNullException(@"host"); } var isService = host.IsService; var myOtherProcesses = Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName); var baseRelativePathItems = new[] { RelativeLoggingPath }; var basePath = ConfigurationFileSupport.GetConfigurationPath(host.Manufacturer, host.ApplicationName, @"ImsOpcBridge", isService, false, baseRelativePathItems, true); try { foreach (var subDirectory in basePath.EnumerateDirectories()) { int subDirectoryNameAsInt; if (int.TryParse(subDirectory.Name, NumberStyles.Integer, CultureInfo.InvariantCulture, out subDirectoryNameAsInt)) { if (myOtherProcesses.All(p => p.Id != subDirectoryNameAsInt)) { try { subDirectory.Delete(true); } catch (Exception) { } } } } } catch (Exception) { } string[] relativePathItems; if (isService) { // relative path { "Logging" } leads to ...\Users\UserX\AppData\Local\<manufacturer>\<application>\ImsOpcBridge\Shared\Logging relativePathItems = new[] { RelativeLoggingPath }; } else { // relative path { "Logging" } leads to ...\Users\UserX\AppData\Local\<manufacturer>\<application>\ImsOpcBridge\Shared\Logging\<ProcessId> relativePathItems = new[] { RelativeLoggingPath, Process.GetCurrentProcess().Id.ToString(CultureInfo.InvariantCulture) }; } // ReSharper disable LocalizableElement Log4NetConfigurationFile = ConfigurationFileSupport.GetConfigurationFileInfo(host.Manufacturer, host.ApplicationName, @"ImsOpcBridge", isService, false, relativePathItems, Log4NetConfigurationFileName, false); // ReSharper restore LocalizableElement if (!Log4NetConfigurationFile.Exists) { InstallDefaultLog4NetConfiguration(Log4NetConfigurationFile); Log4NetConfigurationFile.Refresh(); } if (Log4NetConfigurationFile.Exists) { ConfigureLogging(Log4NetConfigurationFile, true); } }
/// <summary> /// Initializes a new instance of the <see cref="ConfiguratorHost"/> class. /// </summary> public ConfiguratorHost() { this.baseHost = new BaseHost(); }
/// <summary> /// Initializes a new instance of the <see cref="AgentHost"/> class. /// </summary> public AgentHost() { this.baseHost = new BaseHost(); }