public virtual void Initialize(DataMode dataMode = DataMode.Any) { try { var exportTypes = _attributedTypeDiscovery.DiscoverAttributedTypes <ExportTypeAttribute>(); foreach (var tTo in exportTypes) { foreach (var exportAttribute in tTo.GetCustomAttributes(true).OfType <ExportTypeAttribute>()) { if (dataMode == DataMode.Any || exportAttribute.DataMode == DataMode.Any || exportAttribute.DataMode == dataMode) { if (exportAttribute.CreateAs == CreateAs.Singleton) { Log.DebugFormat("Registering Singleton: {0} as {1}", tTo.Name, exportAttribute.TFrom.Name); _container.RegisterType(exportAttribute.TFrom, tTo, new ContainerControlledLifetimeManager()); } else { Log.DebugFormat("Registering: {0} as {1}", tTo.Name, exportAttribute.TFrom.Name); _container.RegisterType(exportAttribute.TFrom, tTo); } } } } } catch (ReflectionTypeLoadException ex) { foreach (var lex in ex.LoaderExceptions) { Log.Error(lex); } Log.Error(ex); throw; } catch (Exception ex) { Log.Error(ex); throw; } }
public virtual void Initialize() { var exportTypes = _attributedTypeDiscovery.DiscoverAttributedTypes <ExportTypeAttribute>(); foreach (var tTo in exportTypes) { foreach (var exportAttribute in tTo.GetCustomAttributes(true).OfType <ExportTypeAttribute>()) { if (exportAttribute.CreateAs == CreateAs.Singleton) { Log.DebugFormat("Registering Singleton: {0} as {1}", tTo.Name, exportAttribute.TFrom.Name); _container.RegisterType(exportAttribute.TFrom, tTo, new ContainerControlledLifetimeManager()); } else { Log.DebugFormat("Registering: {0} as {1}", tTo.Name, exportAttribute.TFrom.Name); _container.RegisterType(exportAttribute.TFrom, tTo); } } } }
private void Application_Startup(object sender, StartupEventArgs e) { if (e.Args.Contains(_devMode)) { DeveloperModManager.Manage.IsDeveloperMode = true; } try { Thread.CurrentThread.Name = "UI Thread"; Log.Debug("--------------------------------------------------------------"); Log.DebugFormat("SciChart.Examples.Demo: Session Started {0}", DateTime.Now.ToString("dd MMM yyyy HH:mm:ss")); Log.Debug("--------------------------------------------------------------"); var assembliesToSearch = new[] { typeof(MainWindowViewModel).Assembly, typeof(AbtBootstrapper).Assembly, // SciChart.UI.Bootstrap typeof(IViewModelTrait).Assembly, // SciChart.UI.Reactive }; _bootStrapper = new Bootstrapper(ServiceLocator.Container, new AttributedTypeDiscoveryService(new ExplicitAssemblyDiscovery(assembliesToSearch))); _bootStrapper.InitializeAsync().Then(() => { //Syncing usages var syncHelper = ServiceLocator.Container.Resolve <ISyncUsageHelper>(); syncHelper.LoadFromIsolatedStorage(); //Try sync with service syncHelper.GetRatingsFromServer(); syncHelper.SendUsagesToServer(); syncHelper.SetUsageOnExamples(); _bootStrapper.OnInitComplete(); }).Catch(ex => { Log.Error("Exception:\n\n{0}", ex); MessageBox.Show("Exception occurred in SciChart.Examples.Demo.\r\n. Please send log files located at %CurrentUser%\\AppData\\Local\\SciChart\\SciChart.Examples.Demo.log to support"); }); } catch (Exception caught) { Log.Error("Exception:\n\n{0}", caught); MessageBox.Show("Exception occurred in SciChart.Examples.Demo.\r\n. Please send log files located at %CurrentUser%\\AppData\\Local\\SciChart\\SciChart.Examples.Demo.log to support"); } }
public virtual void Initialize(DataMode dataMode = DataMode.Any) { try { var exportTypes = _attributedTypeDiscovery.DiscoverAttributedTypes <ExportTypeAttribute>(); foreach (var tTo in exportTypes) { var exportAttributes = tTo.GetCustomAttributes(true).OfType <ExportTypeAttribute>(); bool preRegistered = false; if (exportAttributes.Count() > 1 && exportAttributes.All(e => e.CreateAs == CreateAs.Singleton)) { Log.DebugFormat("Registering Singleton: {0} in preparation for multiple mapping", tTo.Name); _container.RegisterType(tTo, new ContainerControlledLifetimeManager()); preRegistered = true; } foreach (var exportAttribute in exportAttributes) { if (dataMode == DataMode.Any || exportAttribute.DataMode == DataMode.Any || exportAttribute.DataMode == dataMode) { if (exportAttribute.CreateAs == CreateAs.Singleton && !preRegistered) { if (string.IsNullOrEmpty(exportAttribute.Name)) { Log.DebugFormat("Registering Singleton: {0} as {1}", tTo.Name, exportAttribute.TFrom.Name); _container.RegisterType(exportAttribute.TFrom, tTo, new ContainerControlledLifetimeManager()); } else { Log.DebugFormat("Registering Singleton: {0} as {1} with name {2}", tTo.Name, exportAttribute.TFrom.Name, exportAttribute.Name); _container.RegisterType(exportAttribute.TFrom, tTo, exportAttribute.Name, new ContainerControlledLifetimeManager()); } } else { if (string.IsNullOrEmpty(exportAttribute.Name)) { Log.DebugFormat("Registering: {0} as {1}", tTo.Name, exportAttribute.TFrom.Name); _container.RegisterType(exportAttribute.TFrom, tTo); } else { Log.DebugFormat("Registering: {0} as {1} with name {2}", tTo.Name, exportAttribute.TFrom.Name, exportAttribute.Name); _container.RegisterType(exportAttribute.TFrom, tTo, exportAttribute.Name); } } } } } } catch (ReflectionTypeLoadException ex) { foreach (var lex in ex.LoaderExceptions) { Log.Error(lex); } Log.Error(ex); throw; } catch (Exception ex) { Log.Error(ex); throw; } }