Exemple #1
0
 public static long GetStamp(this IStampRow row)
 {
     return(BitConverter.ToInt64(CoreTools.LE2BE(row.Stamp), 0));
 }
Exemple #2
0
        private Column createColumn(XmlNode node)
        {
            string header          = null;
            string headerTextAlign = null;
            string headerheight    = null;
            string widthStr        = null;
            string textAling       = null;
            string format          = null;
            string path            = null;
            string readOnly        = null;

            CoreTools.Xml.ParseNodeAttributes(node, (attrName, attrValue) => {
                switch (attrName.ToLower())
                {
                case "headertext":
                    header = attrValue;
                    break;

                case "headertextalign":
                    headerTextAlign = attrValue;
                    break;

                case "headerheight":
                    headerheight = attrValue;
                    break;

                case "width":
                    widthStr = attrValue;
                    break;

                case "textalign":
                    textAling = attrValue;
                    break;

                case "format":
                    format = attrValue;
                    break;

                case "propertypath":
                    path = attrValue;
                    break;

                case "readonly":
                    readOnly = attrValue;
                    break;
                }
            });

            if (!string.IsNullOrEmpty(path))
            {
                Column column = new Column();
                //column.PropertyPath = new PropertyPath(this.context.GetDataType(), path);
                //column.HeaderText = string.IsNullOrEmpty(header) ? column.PropertyPath.Last.Name : header;
                column.PropertyDescriptorPath = new PropertyDescriptorPath(this.context.GetDataType(), path);
                column.HeaderText             = string.IsNullOrEmpty(header) ? column.PropertyDescriptorPath.Last.Name : header;
                int i;

                if (int.TryParse(headerTextAlign, out i))
                {
                    column.HeaderTextAlign = (TextAlign)i;
                }

                if (int.TryParse(widthStr, out i))
                {
                    column.Width = i;
                }
                else
                {
                    column.Width = 100;
                }

                if (int.TryParse(textAling, out i))
                {
                    column.TextAlign = (TextAlign)i;
                }
                else
                {
                    column.TextAlign = TextAlign.None;
                }
                column.Format = format;

                if (!string.IsNullOrEmpty(readOnly))
                {
                    column.ReadOnly = CoreTools.ParseBool(readOnly);
                }

                return(column);
            }
            return(null);
        }