/// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { var commandLine = new CommandLine(args); if (commandLine.RunAsService) { ServiceBase[] servicesToRun = new ServiceBase[] { new ShredHostService() }; ServiceBase.Run(servicesToRun); } else if (!String.IsNullOrEmpty(commandLine.PreviousExeConfigurationFilename)) { var groups = SettingsGroupDescriptor.ListInstalledSettingsGroups(SettingsGroupFilter.LocalStorage); foreach (var group in groups) { SettingsMigrator.MigrateSharedSettings(group, commandLine.PreviousExeConfigurationFilename); } ShredSettingsMigrator.MigrateAll(commandLine.PreviousExeConfigurationFilename); } else { Thread.CurrentThread.Name = "Main thread"; if (!ManifestVerification.Valid) { Console.WriteLine("The manifest detected an invalid installation."); } ShredHostService.InternalStart(); Console.WriteLine("Press <Enter> to terminate the ShredHost."); Console.WriteLine(); Console.ReadLine(); ShredHostService.InternalStop(); } }
private void DoImport() { var groups = SettingsGroupDescriptor.ListInstalledSettingsGroups(SettingsGroupFilter.SupportEnterpriseStorage); var task = new BackgroundTask( delegate(IBackgroundTaskContext context) { for (var i = 0; i < groups.Count; i++) { if (context.CancelRequested) { context.Cancel(); break; } var group = groups[i]; context.ReportProgress(new BackgroundTaskProgress(i, groups.Count, string.Format("Importing {0}", group.Name))); var props = SettingsPropertyDescriptor.ListSettingsProperties(group); _settingsStore.ImportSettingsGroup(group, props); } }, true) { ThreadUICulture = Desktop.Application.CurrentUICulture }; ProgressDialog.Show(task, this.Host.DesktopWindow); }
/// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { Platform.Log(LogLevel.Info, ProductInformation.GetNameAndVersion(true, true, true, true)); var commandLine = new CommandLine(args); if (commandLine.RunAsService) { var ServicesToRun = new ServiceBase[] { new ShredHostService() }; ServiceBase.Run(ServicesToRun); } else if (!String.IsNullOrEmpty(commandLine.PreviousExeConfigurationFilename)) { var groups = SettingsGroupDescriptor.ListInstalledSettingsGroups(SettingsGroupFilter.LocalStorage); groups.Add(new SettingsGroupDescriptor(typeof(ShredSettingsMigrator).Assembly.GetType("ClearCanvas.Server.ShredHost.ShredHostServiceSettings"))); foreach (var group in groups) { SettingsMigrator.MigrateSharedSettings(group, commandLine.PreviousExeConfigurationFilename); } ShredSettingsMigrator.MigrateAll(commandLine.PreviousExeConfigurationFilename); } else { ShredHostService.InternalStart(); Console.WriteLine("Press <Enter> to terminate the ShredHost."); Console.WriteLine(); Console.ReadLine(); ShredHostService.InternalStop(); } }
private void DoImport() { List <SettingsGroupDescriptor> groups = SettingsGroupDescriptor.ListInstalledSettingsGroups(true); BackgroundTask task = new BackgroundTask( delegate(IBackgroundTaskContext context) { for (int i = 0; i < groups.Count; i++) { if (context.CancelRequested) { context.Cancel(); break; } SettingsGroupDescriptor group = groups[i]; context.ReportProgress(new BackgroundTaskProgress(i, groups.Count, string.Format("Importing {0}", group.Name))); List <SettingsPropertyDescriptor> props = SettingsPropertyDescriptor.ListSettingsProperties(group); _configStore.ImportSettingsGroup(group, props); } }, true); ProgressDialog.Show(task, this.Host.DesktopWindow, true); }
private static void MigrateSharedSettings(string previousExeConfigFilename) { foreach (var group in SettingsGroupDescriptor.ListInstalledSettingsGroups(false)) { SettingsMigrator.MigrateSharedSettings(group, previousExeConfigFilename); } }
public void RunApplication(string[] args) { CommandLine commandLine = new CommandLine(args); foreach (SettingsGroupDescriptor group in SettingsGroupDescriptor.ListInstalledSettingsGroups(SettingsGroupFilter.LocalStorage)) { Type type = Type.GetType(group.AssemblyQualifiedTypeName, true); var settings = ApplicationSettingsHelper.GetSettingsClassInstance(type); ApplicationSettingsExtensions.ImportSharedSettings(settings, commandLine.ConfigurationFilename); } }
public void RunApplication(string[] args) { var commandLine = new CommandLine(args); var groups = SettingsGroupDescriptor.ListInstalledSettingsGroups(SettingsGroupFilter.LocalStorage); foreach (var group in groups) { SettingsMigrator.MigrateSharedSettings(group, commandLine.PreviousExeConfigurationFilename); } }
private IEnumerable <Group> GetSettingsGroups() { var groups = new List <Group>(); // add all groups from the enterprise settings store groups.AddRange(_settingsStore.ListSettingsGroups().Select(d => new SettingsStoreGroup(d, _settingsStore))); // add locally installed groups that support editing of shared profiles // note that many groups may be both locally installed and in the settings store, so we need to filter duplicates var locals = SettingsGroupDescriptor.ListInstalledSettingsGroups(SettingsGroupFilter.SupportsEditingOfSharedProfile); groups.AddRange(locals.Where(l => !groups.Any(g => Equals(g.Descriptor, l))).Select(d => new LocallyInstalledGroup(d))); return(groups); }
public void ReloadSettings() { try { Platform.Log(LogLevel.Info, "Forcing reload of MemoryManagementSettings."); var groups = SettingsGroupDescriptor.ListInstalledSettingsGroups(SettingsGroupFilter.LocalStorage); var settingsGroups = groups.First(g => g.Name == "ClearCanvas.ImageViewer.Common.MemoryManagementSettings"); var instance = ApplicationSettingsHelper.GetSettingsClassInstance(Type.GetType(settingsGroups.AssemblyQualifiedTypeName)); instance.Reload(); } catch (Exception e) { ExceptionHandler.Report(e, Context.DesktopWindow); } }
private static void MigrateSharedSettings(string previousExeConfigFilename) { foreach (var group in SettingsGroupDescriptor.ListInstalledSettingsGroups()) { try { SettingsMigrator.MigrateSharedSettings(group, previousExeConfigFilename); } catch (Exception e) { //Failure to migrate a settings is not good enough reason to cause the whole app to fail. //Some of the viewer settings classes SHOULD actually fail to migrate in the context of the ImageServer. // Platform.Log(LogLevel.Warn, e, "Failed to migrate settings '{0}'", group.AssemblyQualifiedTypeName); } } }
/// <summary> /// Import settings groups defined in local plugins. /// </summary> private static void ImportSettingsGroups() { var groups = SettingsGroupDescriptor.ListInstalledSettingsGroups(SettingsGroupFilter.SupportEnterpriseStorage); foreach (var g in groups) { Platform.Log(LogLevel.Info, "Import settings group {0}, Version={1}, Type={2}", g.Name, g.Version.ToString(), g.AssemblyQualifiedTypeName); } Platform.GetService( delegate(Configuration.IConfigurationService service) { foreach (var group in groups) { var props = SettingsPropertyDescriptor.ListSettingsProperties(group); service.ImportSettingsGroup(new Configuration.ImportSettingsGroupRequest(group, props)); } }); }
/// <summary> /// Returns settings groups installed on local machine /// </summary> /// <returns></returns> public IList <SettingsGroupDescriptor> ListSettingsGroups() { return(SettingsGroupDescriptor.ListInstalledSettingsGroups(false)); }