Ejemplo n.º 1
0
        public static Dictionary<int, TabCell> ReadXMLCells(string FileName)
        {
            Dictionary<int, TabCell> TabCells = new Dictionary<int, TabCell>();
            XDocument xdoc = XDocument.Load(FileName);
            int row = 1;
            int col = 0;

            string RowName = "";
            string RowNumber = "";

            foreach (XElement el in xdoc.Root.Elements("TabRow"))
            {
                if (el.HasAttributes)
                {
                    RowName = el.Attribute("Name").Value;
                    RowNumber = el.Attribute("Number").Value;
                }
                else
                {
                    RowName = "  ";
                    RowNumber = "  ";
                }

                foreach (XElement elem in el.Elements())
                {
                    TabCell temp = new TabCell();
                    Coords coordinate = new Coords(row, col);

                    temp.tabCellAlign = elem.Attribute("Align").Value;
                    temp.tabCellParametr = elem.Attribute("Parametr").Value;
                    temp.tabCellPrecision = elem.Attribute("Precision").Value;

                    temp.Name = RowName;
                    temp.Number = RowNumber;

                    TabCells.Add(coordinate.GetHashCode(), temp);

                    col++;
                    temp = null;

                }
                col = 0;
                row++;
            }
            return TabCells;
        }
Ejemplo n.º 2
0
 public static bool EqualCells(TabCell first, TabCell Second)
 {
     return (first.Name == Second.Name &&
         first.Number == Second.Number &&
         first.tabCellAlign == Second.tabCellAlign &&
         first.tabCellParametr == Second.tabCellParametr &&
         first.tabCellPrecision == Second.tabCellPrecision);
 }
Ejemplo n.º 3
0
        public static void SaveCell(EditTableCell w,ObjectXML objectXML)
        {
            TabCell t = new TabCell(
                w.AlignField.Text,
                w.PrecisionField.Text,
                w.ParametrField.Text);

            objectXML.cells[new Coords(int.Parse(w.row.Text), int.Parse(w.col.Text)).GetHashCode()] = t;

            MainWindow.objectXML = objectXML;

            save();
        }
Ejemplo n.º 4
0
        public static Dictionary<int, TabCell> ReadXMLCells(string FileName)
        {
            Dictionary<int, TabCell> TabCells = new Dictionary<int, TabCell> ();
            XDocument xdoc = XDocument.Load(FileName);
            int row = 1;
            int col = 0;

            string RowName = "";
            string RowNumber = "";

            foreach (XElement el in xdoc.Root.Elements("TabRow"))
            {
                try
                {
                    RowName = el.Attribute("Name").Value;
                    RowNumber = el.Attribute("Number").Value;
                }
                catch
                {
                    RowName = "  ";
                    RowNumber = "  ";
                }

                foreach (XElement elem in el.Elements())
                {
                    TabCell temp = new TabCell();
                    Coords coordinate = new Coords(row, col);

                    temp.tabCellAlign = elem.Attribute("Align").Value;
                    temp.tabCellParametr = elem.Attribute("Parametr").Value;
                    temp.tabCellPrecision = elem.Attribute("Precision").Value;
                    temp.Name = RowName;
                    temp.Number = RowNumber;

                    try
                    {
                        TabCells.Add(coordinate.GetHashCode(), temp);
                    }
                    catch (ArgumentException)
                    {
                        Console.WriteLine("An element with Key = \"txt\" already exists.");
                    }

                    col++;
                    temp = null;

                }
                col = 0;
                row++;
            }
            return TabCells;
        }
Ejemplo n.º 5
0
        public static void OpenEditTableCellWindow( EditTableCell w, TabCell cell, Coords coord)
        {
            w.ParametrField.Text = cell.tabCellParametr;
            w.AlignField.Text = cell.tabCellAlign;
            w.PrecisionField.Text = cell.tabCellPrecision;

            w.col.Text = coord.colCoord.ToString();
            w.row.Text = coord.rowCoord.ToString();

            w.ShowDialog();
        }
Ejemplo n.º 6
0
        public static void EditCellClick(object sender, RoutedEventArgs e)
        {
            Coords t = new Coords();
            EditTableCell w = new EditTableCell();
            ObjectXML xml = new ObjectXML();
            TabCell cell = new TabCell();

            t = GetCoords((sender as Button).Name.ToString());
            xml = MainWindow.GetObjectXML();
            cell=xml.cells[t.GetHashCode()];

            OpenEditTableCellWindow(w, cell, t);
        }