Ejemplo n.º 1
0
 public AFComponent(AFSwinxConnectionPack connectionPack, Skin skin)
 {
     this.connectionPack = connectionPack;
     this.skin = skin;
 }
Ejemplo n.º 2
0
 public void setConnectionPack(AFSwinxConnectionPack connectionPack)
 {
     this.connectionPack = connectionPack;
 }
Ejemplo n.º 3
0
 public AFForm(AFSwinxConnectionPack connectionPack, Skin skin) : base(connectionPack, skin)
 {
 }
Ejemplo n.º 4
0
 public AFList(AFSwinxConnectionPack connectionPack, Skin skin) : base(connectionPack, skin)
 {
     rows = new List<Dictionary<String, String>>();
 }
Ejemplo n.º 5
0
 public AFSwinxConnectionPack parseDocument(XmlDocument documentToParse)
 {
     // Prepare connection pack
     AFSwinxConnectionPack connectionPack = new AFSwinxConnectionPack();
     // Find root of document
     XmlNodeList childs = documentToParse.GetElementsByTagName(CONNECTION_TAG);
     foreach (IXmlNode connectionRoot in childs)
     {
         if (connectionRoot.NodeType != NodeType.ElementNode)
         {
             continue;
         }
         // For each connection check if it's id is id which must be parsed
         XmlElement nodeElement = (XmlElement)connectionRoot;
         if (nodeElement.GetAttribute(CONNECTION_ID_ATTRIBUTE).Equals(connectionId))
         {
             XmlNodeList connectionsTypes = connectionRoot.ChildNodes;
             for (uint j = 0; j < connectionsTypes.Length; j++)
             {
                 IXmlNode concreteConnection = connectionsTypes.Item(j);
                 if (concreteConnection.NodeType != NodeType.ElementNode)
                 {
                     continue;
                 }
                 String connectionName = concreteConnection.NodeName;
                 XmlNodeList nodeProperties = concreteConnection.ChildNodes;
                 // Create new connection
                 AFSwinxConnection connection = new AFSwinxConnection();
                 for (uint k = 0; k < nodeProperties.Length; k++)
                 {
                     // Set connection properties
                     IXmlNode property = nodeProperties.Item(k);
                     String nodeName = property.NodeName;
                     String nodeValue = property.InnerText;
                     if (nodeName.Equals(END_POINT))
                     {
                         connection.setAddress(evaluateEL(nodeValue));
                     }
                     else if (nodeName.Equals(END_POINT_PARAMETERS))
                     {
                         connection.setParameters(evaluateEL(nodeValue));
                     }
                     else if (nodeName.Equals(PROTOCOL))
                     {
                         connection.setProtocol(evaluateEL(nodeValue));
                     }
                     else if (nodeName.Equals(PORT))
                     {
                         String port = evaluateEL(nodeValue);
                         if (!String.IsNullOrEmpty(port))
                         {
                             connection.setPort(Convert.ToInt32(evaluateEL(nodeValue)));
                         }
                     }
                     else if (nodeName.Equals(HEADER_PARAM))
                     {
                         parseHeaderParam(connection, property.ChildNodes);
                     }
                     else if (nodeName.Equals(HTTP_METHOD))
                     {
                         String method = evaluateEL(nodeValue);
                         if (method.ToLower().Equals("get"))
                         {
                             connection.setHttpMethod(HttpMethod.Get);
                         }
                         else if (method.ToLower().Equals("post"))
                         {
                             connection.setHttpMethod(HttpMethod.Post);
                         }
                         else if (method.ToLower().Equals("put"))
                         {
                             connection.setHttpMethod(HttpMethod.Put);
                         }
                         else if (method.ToLower().Equals("delete"))
                         {
                             connection.setHttpMethod(HttpMethod.Delete);
                         }
                         else
                         {
                             //method not supported
                         }
                         //get method
                     }
                     else if (nodeName.Equals(SECURITY_PARAMS))
                     {
                         parseSecurityParams(connection, property.ChildNodes);
                     }
                 }
                 // Set created connection to connection holder based on connection type
                 if (connectionName.Equals(METAMODEL_CONNECTION))
                 {
                     connection.setHttpMethod(HttpMethod.Get);
                     connectionPack.setMetamodelConnection(connection);
                 }
                 else if (connectionName.Equals(DATA_CONNECTION))
                 {
                     connection.setHttpMethod(HttpMethod.Get);
                     connectionPack.setDataConnection(connection);
                 }
                 else if (connectionName.Equals(SEND_CONNECTION))
                 {
                     if (connection.getHttpMethod() == null)
                     {
                         connection.setHttpMethod(HttpMethod.Post);
                     }
                     connectionPack.setSendConnection(connection);
                 }
                 else if (connectionName.Equals(REMOVE_CONNECTION))
                 {
                     if (connection.getHttpMethod() == null)
                     {
                         connection.setHttpMethod(HttpMethod.Delete);
                     }
                 }
             }
         }
     }
     return connectionPack;
 }