private static void EvaluatePageScheme(XmlElement root, PageScheme page) { EvaluateGeneral(root, page); EvaluateMeta(root, page); EvaluateParameters(root, page); EvaluateChildren(root, page); }
private static void EvaluateMeta(XmlElement root, PageScheme page) { var element = root.SelectSingleNode("Meta") as XmlElement; page.Meta = new PageMeta(); page.Meta.Interval = XmlUtility.GetAttrValue(element, "Interval"); page.Meta.LayoutStyle = XmlUtility.GetAttrValue(element, "LayoutStyle"); }
public static PageScheme TransformToPageScheme(string content) { var result = new PageScheme(); var doc = new XmlDocument(); doc.LoadXml(content); var root = doc.DocumentElement; EvaluatePageScheme(root, result); return result; }
private static List<PageParameter> EvaluateParameters(AchieveRequest request, PageScheme scheme) { List<PageParameter> result = new List<PageParameter>(); foreach (var item in scheme.Parameters) { result.Add(item.Clone() as PageParameter); } return result; }
public static PageContext TransformToPageContext(AchieveRequest request, PageScheme scheme) { var result = new PageContext(); result.Id = request.Id; result.Parameters = request.Parameters; result.UserToken = request.UserToken; EvaluatePage(request, scheme, result); return result; }
private void CreateParameters(PageScheme page, XmlElement parent) { var element = XmlUtility.CreateChild(parent, "Parameters"); foreach (var pageParameter in page.Parameters) { var childElement = XmlUtility.CreateChild(element, "Parameter"); childElement.SetAttribute("Name", pageParameter.Name); childElement.SetAttribute("Type", pageParameter.Type); XmlUtility.SetCData(childElement, pageParameter.Value); } }
private static void EvaluateParameters(XmlElement root, PageScheme page) { var nodeList = root.SelectNodes("Parameters/Parameter"); foreach (XmlNode node in nodeList) { var parameter = new PageParameter(); parameter.Name = XmlUtility.GetAttrValue(node as XmlElement, "Name"); parameter.Type = XmlUtility.GetAttrValue(node as XmlElement, "Type"); parameter.Value = XmlUtility.GetElementCDataValue(node as XmlElement); page.Parameters.Add(parameter); } }
public XmlDocument ToXml(PageScheme page, FrameProperty property) { var xmlDoc = new XmlDocument(); var element = xmlDoc.CreateElement("Page"); element.SetAttribute("Id", page.Id); element.SetAttribute("Name", page.Name); var metaElement = XmlUtility.CreateChild(element, "Meta"); metaElement.SetAttribute("Interval", property.Interval); metaElement.SetAttribute("LayoutStyle", property.LayoutStyle); CreateParameters(page, element); property.JoinToXmlElement(element); xmlDoc.AppendChild(element); return xmlDoc; }
private static void EvaluatePage(AchieveRequest request, PageScheme scheme, PageContext context) { var expression = new PageExpression(); var evaluate = new PageEvaluataion(); expression.Id = request.Id; expression.InstanceId = request.InstanceId; expression.Meta = scheme.Meta.Clone() as PageMeta; evaluate.InputParameters = request.Parameters; evaluate.InputUserName = request.UserName; evaluate.InputUserToken = request.UserToken; evaluate.PageParameters = EvaluateParameters(request, scheme); EvaluatePageControl(scheme, expression, evaluate); context.Expression = expression; context.Evaluataion = evaluate; }
public void ToPage(PageScheme page) { if (page != null) { var frame = ConfigToolContext.Instance.ToolDrawArea.Root as FrameProperty; var root = frame.ToPageControl(); var controls = ConfigToolContext.Instance.ToolDrawArea.GraphicsCollection; root.Children.Clear(); root.Children = controls.ToPageControls(); page.Children.Clear(); page.Children.Add(root); page.Meta.Interval = frame.Interval; page.Meta.LayoutStyle = frame.LayoutStyle; page.Parameters = frame.PageParameters; } }
public Object Clone() { var result = new PageScheme(); result.Id = Id; result.Name = Name; result.ParentId = ParentId; result.Meta = Meta.Clone() as PageMeta; result.AdminIdx = AdminIdx; foreach (var item in Parameters) { result.Parameters.Add(item.Clone() as PageParameter); } foreach (var item in Children) { result.Children.Add(item.Clone() as PageControl); } return result; }
private List<String> GatherResource(PageScheme page) { var result = new List<String>(); foreach (var child in page.Children) { if (IsControlExport(child)) { var id = GetResourceId(child); if (!String.IsNullOrEmpty(id) && !result.Contains(id)) { result.Add(id); } GatherResource(result, child); } } return result; }
public void ToDrawArea(PageScheme page) { if (page != null) { ConfigToolContext.Instance.ToolDrawArea.ClearHistory(); ConfigToolContext.Instance.ToolDrawArea.GraphicsCollection.Clear(); ConfigToolContext.Instance.ToolDrawArea.ActiveToolBox = ToolBoxType.Pointer; ConfigToolContext.Instance.ToolDrawArea.Schema = page; foreach (var child in page.Children) { var drawObject = CreateDrawObject(child); if (drawObject != null) { ConfigToolContext.Instance.ToolDrawArea.AddNewDrawObject(drawObject); } Recurit(child); } } }
private static void EvaluatePageControl(PageScheme scheme, PageExpression expression, PageEvaluataion evaluate) { foreach (var control in scheme.Children) { var expressionControl = control.Clone() as PageControl; expressionControl.Children.Clear(); var evaluationControl = new ControlEvaluataion(); evaluationControl.ControlId = control.Id; EvaluatePageControlProperty(control, expressionControl, evaluationControl); EvaluatePageControlEvent(control, expressionControl, evaluationControl); expression.Children.Add(expressionControl); if (evaluationControl.Propertys.Count > 0 || evaluationControl.Events.Count > 0) { evaluate.PageControls.Add(evaluationControl); } foreach (var childControl in control.Children) { RecursionEvaluatePageControl(childControl, expressionControl, evaluate); } } }
private void CreateDefaultFrameProperty(PageScheme page) { var frame = new FrameProperty(); frame.InitProperty(); frame.Interval = page.Meta.Interval; frame.LayoutStyle = page.Meta.LayoutStyle; frame.ZIndex = "0"; frame.Size = "800,600"; frame.Location = "0,0"; frame.CopyToPage(page); }
private static void EvaluateGeneral(XmlElement root, PageScheme page) { page.Id = XmlUtility.GetAttrValue(root, "Id"); page.Name = XmlUtility.GetAttrValue(root, "Name"); }
public void InitializeOperands() { scheme = PageSchemeTransform.TransformToPageScheme(TestTransform.content); }
public void SaveScheme(PageScheme scheme) { MongoDBUtility.Save<PageScheme>(m_Name, scheme); }
public void Copy(PageScheme page) { if (page != null) { this.Meta = page.Meta.Clone() as PageMeta; this.Parameters.Clear(); foreach (var paremeter in page.Parameters) { this.Parameters.Add(paremeter.Clone() as PageParameter); } this.Children.Clear(); foreach (var child in page.Children) { this.Children.Add(child.Clone() as PageControl); } this.LastUpdate = DateTime.Now; } }
private TreeNode CreatePageNode(PageScheme page, TreeNode parentNode) { var node = new TreeNode(page.Name); node.ImageKey = "pagescheme"; node.SelectedImageKey = "pagescheme"; node.Tag = page; if (page.ParentId == TOPPAGEPARENTID) tvPageSchemes.Nodes.Add(node); else parentNode.Nodes.Add(node); node.Expand(); tvPageSchemes.SelectedNode = node; return node; }
private void CreateDefaultPage() { var page = Pages.FirstOrDefault(p => p.IsDefault == true); if (page == null) { page = new PageScheme(); page.Id = Guid.NewGuid().ToString().ToLower(); page.IsDefault = true; page.AdminIdx = ConfigToolContext.Instance.CurrentUser.GetAdminIdx(); page.Meta = new PageMeta(); page.Name = MultilingualUtility.GetString("Default"); page.ParentId = TOPPAGEPARENTID; CreateDefaultFrameProperty(page); DALFacade.GetPageSchemeDAL().SaveScheme(page); Pages.Add(page); } if (page.Children.Count <= 0) { CreateDefaultFrameProperty(page); DALFacade.GetPageSchemeDAL().SaveScheme(page); } }
private static void EvaluateChildren(XmlElement root, PageScheme page) { page.Children = RecursiveCreatePageControl(root); }
public void AddScheme(PageScheme scheme) { var path = String.Format("{0}/{1}.{2}", FileUtility.PageFileBasePath, scheme.Key, PAGE); var content =PageSchemeTransform.TransformToString(scheme); FileUtility.Create(path, content); }