/// <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());
}