/// <summary> /// /// </summary> public string Serialize() { if (this.CombineModuleID) { this.Module.ModuleID = this.Parent.ID + this.Module.ModuleID; this.Module.Shortcut.SetModule(this.Module.ModuleID); this.CombineModuleID = false; } var desktop = "Ext.ComponentQuery.query('desktop')[0].app"; StringBuilder sb = new StringBuilder(); sb.AppendFormat(desktop + ".addModule({0});", this.Module.RenderToString()); if (this.Module.Launcher != null) { var script = DefaultScriptBuilder.Create(this.Module.Launcher).Build(RenderMode.AddTo, "{0}.getModule(\"{1}\")".FormatWith(desktop, this.Module.ModuleID), null, true, false, "addLauncher", true); sb.Append(script); } if (this.Module.Window.Count > 0) { this.Module.Window.Primary.SuspendScripting(); this.Module.Window.Primary.AutoRender = false; this.Module.Window.Primary.ResumeScripting(); var script = DefaultScriptBuilder.Create(this.Module.Window.Primary).Build(RenderMode.AddTo, "{0}.getModule(\"{1}\")".FormatWith(desktop, this.Module.ModuleID), null, true, false, "setWindow", true); sb.Append(string.Format("{0}.getModule(\"{1}\").addWindow(function(){{{2}}});", desktop, this.Module.ModuleID, script)); } this.added = true; return(sb.ToString()); }
/// <summary> /// /// </summary> /// <param name="window"></param> public virtual void CreateWindow(AbstractWindow window) { window.AutoRender = false; var script = DefaultScriptBuilder.Create(window).Build(RenderMode.AddTo, this.ClientID + ".desktop", null, true, false, "showWindow", true); this.AddScript(script); }
public string ToScript(RenderMode mode, string element, int index, bool selfRendering) { if (this.AlreadyRendered) { return(this.directScript); } this.directScript = DefaultScriptBuilder.Create(this).Build(mode, element, index, selfRendering); return(this.directScript); }
public virtual string ToScript(bool selfRendering) { if (this.AlreadyRendered && this.directScript != null) { return(this.directScript); } this.directScript = DefaultScriptBuilder.Create(this).Build(selfRendering); return(this.directScript); }
public string ToScript(RenderMode mode, string element, int?index, bool?selfRendering, bool forceResources, string method, bool forceLazy, bool clearContainer) { if (this.AlreadyRendered) { return(this.directScript); } this.directScript = DefaultScriptBuilder.Create(this).Build(mode, element, index, selfRendering ?? this.Page == null, forceResources, method, forceLazy, clearContainer); return(this.directScript); }
/// <summary> /// /// </summary> /// <param name="module"></param> public virtual void AddModule(DesktopModule module) { this.Call("addModule", JRawValue.From(module.RenderToString())); if (module.Launcher != null) { var script = DefaultScriptBuilder.Create(module.Launcher).Build(RenderMode.AddTo, "{0}.getModule(\"{1}\")".FormatWith(this.ClientID, module.ModuleID), null, true, false, "addLauncher", true); this.AddScript(script); } if (module.Window.Count > 0) { var script = DefaultScriptBuilder.Create(module.Window.Primary).Build(RenderMode.AddTo, "{0}.getModule(\"{1}\")".FormatWith(this.ClientID, module.ModuleID), null, true, false, "addWindow", true); this.AddScript(script); } }