/// <summary> /// Render a window /// </summary> /// <param name="window">window to render</param> public void RenderControl(UXWindow window) { string previous; Projects.Activate(projectName, out previous); Page p = new Page(); window.Get("Constraint-Width", (x, y) => { EnumConstraint c; if (Enum.TryParse <EnumConstraint>(y.Value, out c)) { p.ConstraintWidth = c; } else { p.ConstraintWidth = EnumConstraint.AUTO; } }); window.Get("Constraint-Height", (x, y) => { EnumConstraint c; if (Enum.TryParse <EnumConstraint>(y.Value, out c)) { p.ConstraintHeight = c; } else { p.ConstraintHeight = EnumConstraint.AUTO; } }); window.Get("Disposition", (s, v) => { p.Disposition = Enum.Parse(typeof(Disposition), v.Value); }); window.Get("Width", (x, y) => { p.Width = Convert.ToUInt32(y.Value); }); window.Get("Height", (x, y) => { p.Height = Convert.ToUInt32(y.Value); }); MasterPage mp = new MasterPage(); RenderCSSProperties(window, mp.CSS); mp.Name = "masterPage_" + window.Name; mp.Width = 100; mp.Height = 100; mp.ConstraintWidth = EnumConstraint.RELATIVE; mp.ConstraintHeight = EnumConstraint.RELATIVE; mp.CountColumns = 1; mp.CountLines = 1; mp.Meta = "<meta name='viewport' content='initial-scale=1, maximum-scale=1, user-scalable=no'/>"; HTMLTool def = this.project.Tools.Find(x => x.Path == "html" && x.Name == "default"); HTMLObject obj = new HTMLObject(def); obj.Container = "globalContainer"; mp.Objects.Add(obj); this.project.Instances.Add(obj); List <AreaSizedRectangle> rects = new List <AreaSizedRectangle>(); AreaSizedRectangle sz = new AreaSizedRectangle(0, 0, 1, 1, 0, 0); rects.Add(sz); mp.MakeZones(rects); this.project.MasterPages.Add(mp); p.MasterPageName = mp.Name; p.Name = window.FileName; currentPage = p; currentMasterPage = mp; currentContainer = mp.HorizontalZones[0].VerticalZones[0].Name; currentObject = currentPage; foreach (IUXObject child in window.Children) { RenderControl(child); } using (FileStream fs = new FileStream(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, p.Name), FileMode.Create, FileAccess.Write, FileShare.Write)) { using (StreamWriter sw = new StreamWriter(fs)) { OutputHTML o = currentPage.GenerateProduction(); sw.Write(o.HTML); sw.Close(); } fs.Close(); } Projects.Reactivate(previous); }