Ejemplo n.º 1
0
 private static void EvaluatePageScheme(XmlElement root, PageScheme page)
 {
     EvaluateGeneral(root, page);
     EvaluateMeta(root, page);
     EvaluateParameters(root, page);
     EvaluateChildren(root, page);
 }
Ejemplo n.º 2
0
 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");
 }
Ejemplo n.º 3
0
 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;
 }
Ejemplo n.º 4
0
        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;
        }
Ejemplo n.º 5
0
 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;
 }
Ejemplo n.º 6
0
 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);
     }
 }
Ejemplo n.º 7
0
 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);
     }
 }
Ejemplo n.º 8
0
 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;
 }
Ejemplo n.º 9
0
 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;
 }
Ejemplo n.º 10
0
 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;
     }
 }
Ejemplo n.º 11
0
 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;
 }
Ejemplo n.º 12
0
 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;
 }
Ejemplo n.º 13
0
 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);
         }
     }
 }
Ejemplo n.º 14
0
        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);
                }
	        }
        }
Ejemplo n.º 15
0
 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);
 }
Ejemplo n.º 16
0
 private static void EvaluateGeneral(XmlElement root, PageScheme page)
 {
     page.Id = XmlUtility.GetAttrValue(root, "Id");
     page.Name = XmlUtility.GetAttrValue(root, "Name");
 }
Ejemplo n.º 17
0
 public void InitializeOperands() 
 {
     scheme = PageSchemeTransform.TransformToPageScheme(TestTransform.content);
 }
Ejemplo n.º 18
0
		public void SaveScheme(PageScheme scheme)
		{
            MongoDBUtility.Save<PageScheme>(m_Name, scheme);
		}
Ejemplo n.º 19
0
 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;
     }
 }
Ejemplo n.º 20
0
 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;
 }
Ejemplo n.º 21
0
 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);
     }
 }
Ejemplo n.º 22
0
 private static void EvaluateChildren(XmlElement root, PageScheme page)
 {
     page.Children = RecursiveCreatePageControl(root);
 }
Ejemplo n.º 23
0
		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);
		}