示例#1
0
        public void ProcessSaveToXML(XDocument doc)
        {
            XElement element;

            try
            {
                IEnumerable <XElement> elements = doc.Root.Elements(ArtUI_XML.XML_TAG_CONFIG);
                if (elements.Count() > 0)
                {
                    element = elements.First();
                    element.RemoveAttributes();
                }
                else
                {
                    element = new XElement(ArtUI_XML.XML_TAG_CONFIG);
                    doc.Root.Add(element);
                }
                element.Add(new XAttribute("top", this.Location.Y.ToString()));
                element.Add(new XAttribute("left", this.Location.X.ToString()));
                element.Add(new XAttribute("width", this.Size.Width.ToString()));
                element.Add(new XAttribute("height", this.Size.Height.ToString()));
            }
            catch (Exception)
            {
            }
            ArtUI_XML.SaveToXml(doc);
        }
示例#2
0
        public void ProcessSaveToXML(XDocument doc)
        {
            XElement element;

            try
            {
                element = doc.Root.Element(ArtUI_XML.XML_TAG_PATH);
                if (element == null)
                {
                    element = new XElement(ArtUI_XML.XML_TAG_PATH);
                    doc.Root.Add(element);
                }
                path          = darkTextPath.Text;
                element.Value = path;

                element = doc.Root.Element(ArtUI_XML.XML_TAG_FILE);
                if (element == null)
                {
                    element = new XElement(ArtUI_XML.XML_TAG_FILE);
                    doc.Root.Add(element);
                }
                file          = darkTextFile.Text;
                element.Value = file;
            }
            catch (Exception)
            {
            }
            ArtUI_XML.SaveToXml(doc);
        }
示例#3
0
        private void ProcessSaveToXml(XDocument doc)
        {
            XElement element = null;

            try
            {
                IEnumerable <XElement> elements = doc.Root.Elements(ArtUI_XML.XML_TAG_CONFIG);
                if (elements.Count() > 0)
                {
                    element = elements.First();
                    element.RemoveAll();
                }
                else
                {
                    element = new XElement(ArtUI_XML.XML_TAG_CONFIG);
                    doc.Root.Add(element);
                }

                foreach (DataGridViewRow row in dataGridView.Rows)
                {
                    if (!row.IsNewRow)
                    {
                        IEnumerable <DataGridViewCell> empty = row.Cells
                                                               .Cast <DataGridViewCell>()
                                                               .Where(c => c.FormattedValue.ToString() == string.Empty);

                        if (empty.Count() > 0)
                        {
                            row.Cells["Enabled"].Value = false;
                            break;
                        }

                        XElement matrix = new XElement(ArtUI_XML.XML_TAG_MATRIX);
                        foreach (DataGridViewCell cell in row.Cells)
                        {
                            string columnName = dataGridView.Columns[cell.ColumnIndex].HeaderText;

                            string cellValue = "";
                            if (Convert.ToString(cell.Value) != string.Empty)
                            {
                                cellValue = Convert.ToString(cell.Value);
                            }

                            XAttribute attr = new XAttribute(columnName, cellValue);
                            matrix.Add(attr);
                        }
                        element.Add(matrix);
                    }
                }
            }
            catch (Exception)
            {
            }
            ArtUI_XML.SaveToXml(doc);
        }