Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 4
0
 private void darkOK_Click(object sender, EventArgs e)
 {
     ProcessSaveToXml(ArtUI_XML.LoadFromXml());
     CreateMatrix();
     Close();
 }
Exemplo n.º 5
0
 private void ArtUI_Config_Load(object sender, EventArgs e)
 {
     ProcessLoadFromXml(ArtUI_XML.LoadFromXml());
 }
Exemplo n.º 6
0
 private void exitToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ProcessSaveToXML(ArtUI_XML.LoadFromXml());
     Application.Exit();
 }
Exemplo n.º 7
0
 public string GetFilePath()
 {
     ProcessLoadFromXML(ArtUI_XML.LoadFromXml());
     return(path + "\\" + file);
 }