private void RegisterRenderers() { try { Type t = typeof(DxResultRendererFactory); IResultRendererFactory factory = Activator.CreateInstance(t) as IResultRendererFactory; ResultRendererSpec spec = new ResultRendererSpec(); spec.Name = factory.FactoryName; spec.Description = factory.FactoryDescription; spec.FullName = String.Format("{0}, {1}", t.FullName, t.Assembly.FullName); spec.RendererType = t; HostServicesSingleton.HostServices.ResultRendererService.Register(spec); t = typeof(DxResultRendererFactory_AllInOne); factory = Activator.CreateInstance(t) as IResultRendererFactory; spec = new ResultRendererSpec(); spec.Name = factory.FactoryName; spec.Description = factory.FactoryDescription; spec.FullName = String.Format("{0}, {1}", t.FullName, t.Assembly.FullName); spec.RendererType = t; HostServicesSingleton.HostServices.ResultRendererService.Register(spec); } catch (Exception ex) { GenericErrorDialog.ShowError("PragmaSQL.DxResultRenderer Error", "Can not register result renderers.", ex); } }
public void Register(ResultRendererSpec spec) { if (spec == null) { throw new NullParameterException("ResultRendererSpec parameter is null."); } if (String.IsNullOrEmpty(spec.Name)) { throw new Exception("Name property of ResultRendererSpec instance is null or empty."); } if (String.IsNullOrEmpty(spec.FullName)) { throw new Exception("FullName property of ResultRendererSpec instance is null or empty."); } string fullName = spec.FullName.ToLowerInvariant().Trim(); if (_renderers.ContainsKey(fullName)) { throw new Exception(String.Format("Renderer of type \"{0}\" already registered.", spec.FullName)); } _renderers.Add(fullName, spec); }
internal void RegisterDefaultResultRenderers() { Type t = typeof(ResultRendererFactory_SeperatePageForEach); IResultRendererFactory factory = Activator.CreateInstance(t) as IResultRendererFactory; ResultRendererSpec spec = new ResultRendererSpec(); spec.Name = factory.FactoryName; spec.Description = factory.FactoryDescription; spec.FullName = String.Format("{0}, {1}", t.FullName, t.Assembly.FullName); spec.RendererType = t; _resultRendererService.Register(spec); if (String.IsNullOrEmpty(Program.MainForm.DefaultResultRenderer)) { Program.MainForm.DefaultResultRenderer = spec.Name; } t = typeof(ResultRendererFactory_AllInOnePage); factory = Activator.CreateInstance(t) as IResultRendererFactory; spec = new ResultRendererSpec(); spec.Name = factory.FactoryName; spec.Description = factory.FactoryDescription; spec.FullName = String.Format("{0}, {1}", t.FullName, t.Assembly.FullName); spec.RendererType = t; _resultRendererService.Register(spec); }