Exemplo n.º 1
0
        private void LoadTemplate(FileInfo fileInfo)
        {
            ChartColorTemplateXmlDocument templateXmlDocument = new ChartColorTemplateXmlDocument();

            ((XmlDocument)templateXmlDocument).Load(fileInfo.FullName);
            ChartColorTemplate chartColorTemplate = new ChartColorTemplate(templateXmlDocument.TemplateName);
            IEnumerator        enumerator         = ((ListXmlNode <PropertyXmlNode>)templateXmlDocument.Properties).GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    PropertyXmlNode propertyXmlNode = (PropertyXmlNode)enumerator.Current;
                    string[]        strArray        = propertyXmlNode.Value.Split(new char[]  { ',' });
                    int             alpha           = int.Parse(strArray[0]);
                    int             red             = int.Parse(strArray[1]);
                    int             green           = int.Parse(strArray[2]);
                    int             blue            = int.Parse(strArray[3]);
                    chartColorTemplate.Settings[propertyXmlNode.Name] = Color.FromArgb(alpha, red, green, blue);
                }
            }
            finally
            {
                IDisposable disposable = enumerator as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
            this.templateNameList.Add(chartColorTemplate.Name);
            this.templates.Add(chartColorTemplate.Name.ToLower(), chartColorTemplate);
        }
Exemplo n.º 2
0
        private void SaveTemplate(string name, ChartColorTemplate template)
        {
            ChartColorTemplateXmlDocument doc = new ChartColorTemplateXmlDocument();

            doc.TemplateName = template.Name;
            foreach (KeyValuePair <string, Color> pair in template.Settings)
            {
                Color  color = pair.Value;
                string str   = (string)(object)color.A + "," + (string)(object)color.R + "," + (string)(object)color.G + "," + (string)(object)color.B;
                doc.Properties.Add(pair.Key, typeof(Color), str);
            }
            doc.Save(Path.Combine(this.directory.FullName, string.Format("{0}{1}" + name + TEMPLATE_EXT)));
        }
Exemplo n.º 3
0
        private void SaveTemplate(string name, ChartColorTemplate template)
        {
            ChartColorTemplateXmlDocument templateXmlDocument = new ChartColorTemplateXmlDocument();

            templateXmlDocument.TemplateName = template.Name;
            foreach (KeyValuePair <string, Color> keyValuePair in template.Settings)
            {
                Color  color = keyValuePair.Value;
                string str   = (string)(object)color.A + (object)"," + (string)(object)color.R + "," + (string)(object)color.G + "," + (string)(object)color.B;
                templateXmlDocument.Properties.Add(keyValuePair.Key, typeof(Color), str);
            }
            ((XmlDocument)templateXmlDocument).Save(this.directory.FullName + "\\" + name + ".cctp");
        }
Exemplo n.º 4
0
        private void LoadTemplate(FileInfo fileInfo)
        {
            ChartColorTemplateXmlDocument doc = new ChartColorTemplateXmlDocument();

            doc.Load(fileInfo.FullName);
            ChartColorTemplate template = new ChartColorTemplate(doc.TemplateName);

            foreach (PropertyXmlNode node in doc.Properties)
            {
                string[] array = node.Value.Split(new char[]  { ',' });
                int      a     = int.Parse(array[0]);
                int      r     = int.Parse(array[1]);
                int      g     = int.Parse(array[2]);
                int      b     = int.Parse(array[3]);
                template.Settings[node.Name] = Color.FromArgb(a, r, g, b);
            }

//            IEnumerator enumerator = ((ListXmlNode<PropertyXmlNode>)doc.Properties).GetEnumerator();
//            try
//            {
//                while (enumerator.MoveNext())
//                {
//                    PropertyXmlNode propertyXmlNode = (PropertyXmlNode)enumerator.Current;
//                    string[] strArray = propertyXmlNode.Value.Split(new char[]  { ',' });
//                    int alpha = int.Parse(strArray[0]);
//                    int red = int.Parse(strArray[1]);
//                    int green = int.Parse(strArray[2]);
//                    int blue = int.Parse(strArray[3]);
//                    template.Settings[propertyXmlNode.Name] = Color.FromArgb(alpha, red, green, blue);
//                }
//            }
//            finally
//            {
//                IDisposable disposable = enumerator as IDisposable;
//                if (disposable != null)
//                    disposable.Dispose();
//            }
            this.templateNameList.Add(template.Name);
            this.templates.Add(template.Name.ToLower(), template);
        }
Exemplo n.º 5
0
        private void LoadTemplate(FileInfo fileInfo)
        {
            ChartColorTemplateXmlDocument doc = new ChartColorTemplateXmlDocument();
            doc.Load(fileInfo.FullName);
            ChartColorTemplate template = new ChartColorTemplate(doc.TemplateName);

            foreach (PropertyXmlNode node in doc.Properties)
            {
                string[] array = node.Value.Split(new char[]  { ',' });
                int a = int.Parse(array[0]);
                int r = int.Parse(array[1]);
                int g = int.Parse(array[2]);
                int b = int.Parse(array[3]);
                template.Settings[node.Name] = Color.FromArgb(a, r, g, b);
            }

//            IEnumerator enumerator = ((ListXmlNode<PropertyXmlNode>)doc.Properties).GetEnumerator();
//            try
//            {
//                while (enumerator.MoveNext())
//                {
//                    PropertyXmlNode propertyXmlNode = (PropertyXmlNode)enumerator.Current;
//                    string[] strArray = propertyXmlNode.Value.Split(new char[]  { ',' });
//                    int alpha = int.Parse(strArray[0]);
//                    int red = int.Parse(strArray[1]);
//                    int green = int.Parse(strArray[2]);
//                    int blue = int.Parse(strArray[3]);
//                    template.Settings[propertyXmlNode.Name] = Color.FromArgb(alpha, red, green, blue);
//                }
//            }
//            finally
//            {
//                IDisposable disposable = enumerator as IDisposable;
//                if (disposable != null)
//                    disposable.Dispose();
//            }
            this.templateNameList.Add(template.Name);
            this.templates.Add(template.Name.ToLower(), template);
        }
Exemplo n.º 6
0
 private void SaveTemplate(string name, ChartColorTemplate template)
 {
     ChartColorTemplateXmlDocument templateXmlDocument = new ChartColorTemplateXmlDocument();
     templateXmlDocument.TemplateName = template.Name;
     foreach (KeyValuePair<string, Color> keyValuePair in template.Settings)
     {
         Color color = keyValuePair.Value;
         string str = (string)(object)color.A + (object)"," + (string)(object)color.R + "," + (string)(object)color.G + "," + (string)(object)color.B;
         templateXmlDocument.Properties.Add(keyValuePair.Key, typeof(Color), str);
     }
     ((XmlDocument)templateXmlDocument).Save(this.directory.FullName + "\\" + name + ".cctp");
 }
Exemplo n.º 7
0
 private void LoadTemplate(FileInfo fileInfo)
 {
     ChartColorTemplateXmlDocument templateXmlDocument = new ChartColorTemplateXmlDocument();
     ((XmlDocument)templateXmlDocument).Load(fileInfo.FullName);
     ChartColorTemplate chartColorTemplate = new ChartColorTemplate(templateXmlDocument.TemplateName);
     IEnumerator enumerator = ((ListXmlNode<PropertyXmlNode>)templateXmlDocument.Properties).GetEnumerator();
     try
     {
         while (enumerator.MoveNext())
         {
             PropertyXmlNode propertyXmlNode = (PropertyXmlNode)enumerator.Current;
             string[] strArray = propertyXmlNode.Value.Split(new char[]  { ',' });
             int alpha = int.Parse(strArray[0]);
             int red = int.Parse(strArray[1]);
             int green = int.Parse(strArray[2]);
             int blue = int.Parse(strArray[3]);
             chartColorTemplate.Settings[propertyXmlNode.Name] = Color.FromArgb(alpha, red, green, blue);
         }
     }
     finally
     {
         IDisposable disposable = enumerator as IDisposable;
         if (disposable != null)
             disposable.Dispose();
     }
     this.templateNameList.Add(chartColorTemplate.Name);
     this.templates.Add(chartColorTemplate.Name.ToLower(), chartColorTemplate);
 }
Exemplo n.º 8
0
 private void SaveTemplate(string name, ChartColorTemplate template)
 {
     ChartColorTemplateXmlDocument doc = new ChartColorTemplateXmlDocument();
     doc.TemplateName = template.Name;
     foreach (KeyValuePair<string, Color> pair in template.Settings)
     {
         Color color = pair.Value;
         string str = (string)(object)color.A + "," + (string)(object)color.R + "," + (string)(object)color.G + "," + (string)(object)color.B;
         doc.Properties.Add(pair.Key, typeof(Color), str);
     }
     doc.Save(Path.Combine(this.directory.FullName, string.Format("{0}{1}" + name + TEMPLATE_EXT)));
 }