// Called after LookingGlass is initialized public void Initialize() { try { // get a handle to the renderer module in LookingGlass string rendererName = m_lgb.AppParams.ParamString("RadegastWindow.Renderer.Name"); m_framesPerSec = Math.Min(100, Math.Max(1, m_lgb.AppParams.ParamInt("RadegastWindow.FramesPerSec"))); m_frameTimeMs = 1000 / m_framesPerSec; m_frameAllowanceMs = Math.Max(m_framesPerSec - 20, 10); m_renderer = (IRenderProvider)m_lgb.ModManager.Module(rendererName); if (m_renderer == null) { m_log.Log(LogLevel.DBADERROR, "RadegastWindow.Initialize: COULD NOT ATTACH RENDERER '{0};", rendererName); throw new LookingGlassException(String.Format("RadegastWindow.Initialize: COULD NOT ATTACH RENDERER '{0};", rendererName)); } m_log.Log(LogLevel.DVIEWDETAIL, "Initialize. Connecting to renderer {0} at {1}fps", m_renderer, m_framesPerSec); // The linkage to the renderer for display is also a link into it's UI system m_UILink = m_renderer.UserInterface; m_refreshTimer = new System.Threading.Timer(delegate(Object param) { this.LGWindow.Invalidate(); }, null, 2000, m_frameTimeMs); } catch (Exception e) { m_log.Log(LogLevel.DBADERROR, "Initialize. exception: {0}", e.ToString()); throw new LookingGlassException("Exception initializing view"); } }
/// <summary> /// Render a template to string. /// </summary> /// <param name="renderProvider">The render provider implementation.</param> /// <param name="templateKey">The key of the template.</param> /// <param name="dynamicProperties">The dynamic properties.</param> public static string RenderToString( this IRenderProvider renderProvider, string templateKey, IDictionary <string, object> dynamicProperties) { if (renderProvider == null) { throw new ArgumentNullException(nameof(renderProvider)); } using (var writer = new System.IO.StringWriter()) { renderProvider.Render(templateKey, writer, dynamicProperties); return(writer.ToString()); } }
// IModule.AfterAllModulesLoaded public virtual bool AfterAllModulesLoaded() { LogManager.Log.Log(LogLevel.DINIT, "EntityTracker.AfterAllModulesLoaded()"); // connect to the world and listen for entity events (there is only one world) m_world = World.World.Instance; string rendererName = ModuleParams.ParamString(ModuleName + ".Renderer.Name"); m_renderer = (IRenderProvider)ModuleManager.Instance.Module(rendererName); if (ModuleParams.ParamBool(ModuleName + ".Regions.Enable")) { m_world.OnWorldRegionNew += new WorldRegionNewCallback(World_OnWorldRegionNew); m_world.OnWorldRegionRemoved += new WorldRegionRemovedCallback(World_OnWorldRegionRemoved); m_world.OnWorldRegionUpdated += new WorldRegionUpdatedCallback(World_OnWorldRegionUpdated); } if (ModuleParams.ParamBool(ModuleName + ".Regions.Enable")) { m_regionRestHandler = new RestHandler("/Tracker/Regions/", new RegionInformation(this)); } return(true); }
/// <summary> /// Create. /// </summary> /// <param name="emailSettings">The settings to use in order to instanciate an e-mail client.</param> /// <param name="renderProvider">The render provider to use in order to provide the body of the mesage.</param> /// <param name="templateKeyPrefix">Any template key prefix to add when invoking <paramref name="renderProvider"/> to produce the body of the message.</param> public EmailChannel( EmailSettings emailSettings, IRenderProvider renderProvider, string templateKeyPrefix) { if (emailSettings == null) { throw new ArgumentNullException(nameof(emailSettings)); } if (renderProvider == null) { throw new ArgumentNullException(nameof(renderProvider)); } if (templateKeyPrefix == null) { throw new ArgumentNullException(nameof(templateKeyPrefix)); } this.emailSettings = emailSettings; this.renderProvider = renderProvider; this.templateKeyPrefix = templateKeyPrefix; }
internal DynamicControl(IRenderProvider renderProvider) { provider = renderProvider; }
/// <summary> /// Create. /// </summary> /// <param name="emailSettings">The settings to use in order to instanciate an e-mail client.</param> /// <param name="renderProvider">The render provider to use in order to provide the body of the mesage.</param> public EmailChannel( EmailSettings emailSettings, IRenderProvider renderProvider) : this(emailSettings, renderProvider, String.Empty) { }
// IModule.AfterAllModulesLoaded public virtual bool AfterAllModulesLoaded() { LogManager.Log.Log(LogLevel.DINIT, "EntityTracker.AfterAllModulesLoaded()"); // connect to the world and listen for entity events (there is only one world) m_world = World.World.Instance; string rendererName = ModuleParams.ParamString(ModuleName + ".Renderer.Name"); m_renderer = (IRenderProvider)ModuleManager.Instance.Module(rendererName); if (ModuleParams.ParamBool(ModuleName + ".Regions.Enable")) { m_world.OnWorldRegionNew += new WorldRegionNewCallback(World_OnWorldRegionNew); m_world.OnWorldRegionRemoved += new WorldRegionRemovedCallback(World_OnWorldRegionRemoved); m_world.OnWorldRegionUpdated += new WorldRegionUpdatedCallback(World_OnWorldRegionUpdated); } if (ModuleParams.ParamBool(ModuleName + ".Regions.Enable")) { m_regionRestHandler = new RestHandler("/Tracker/Regions/", new RegionInformation(this)); } return true; }