Example #1
0
        private void btnTable_Click(object sender, EventArgs e)
        {
            this.Hide();
            TableForm table = new TableForm();

            table.Location      = this.Location;
            table.StartPosition = this.StartPosition;
            table.FormClosing  += delegate { this.Show(); };
            table.ShowDialog();
        }
Example #2
0
        public static void ShowTableStatic(Image<Gray, byte> _data, string Title)
        {
            TableForm form = new TableForm();

            if (form.checkBox1.Checked)
                return;
            form.Text = "Table - " + Title;

            // Create the output table.
            DataTable d = new DataTable();

            // Loop through all process names.
            for (int i = 0; i < _data.Width; i++)
            {
                // Add the program name to our columns.
                d.Columns.Add(i.ToString());
            }

            for (int i = 0; i < _data.Height; i++)
            {
                d.Rows.Add();

                for (int j = 0; j < _data.Width; j++)
                {
                    // Add the program name to our columns.
                    d.Rows[i][j] = ((Gray)_data[i, j]).Intensity.ToString();
                }

            }

            form.dataGridView1.DataSource = d;

            for (int i = 0; i < _data.Width; i++)
            {
                form.dataGridView1.Columns[i].Width = 50;
            }

            form.ShowDialog();
        }
Example #3
0
        void TableFormOpen()
        {
            TableForm TB = new TableForm();

            TB.ShowDialog();
        }
Example #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            XmlDocument outF = new XmlDocument();
            XmlElement rootelem = outF.CreateElement("PerovskiySPEC");
            Dictionary<string, string> dict = new Dictionary<string, string>();
            List<string> ff = new List<string>();
            ff.AddRange(richTextBox1.Lines);
            //int strcount = (int)(ff.Length / 6); // Math.Round(ff.Length / 6);

            int i = 0;
            List<Tovar> SpecList = new List<Tovar>();
            while (ff.Count > 0)
            {
                List<string> temp = new List<string>();
                if ((ff.Count > 0) && (ff[0] == ""))
                    ff.RemoveAt(0);
                while ((ff.Count > 0) && (ff[0] != ""))
                {
                    temp.Add(ff[0]);
                    ff.RemoveAt(0);
                }
                //ff[i] = "_" + ff[i];
                //i++;

                Tovar t = new Tovar();
                //string _name = "";
                //string _artc = "";
                //string _code = "";
                //string _size = "";
                //string _pric = "";
                if (temp.Count > 0)
                {
                    t._name = temp[0];
                    t._artc = temp[1].Replace("Артикул:", "").Trim();
                    t._code = temp[2].Replace("Код товара для заказа:", "").Trim();
                    if (temp.Count == 4)
                    {
                        t.Calc( temp[3]);
                    }
                    else
                    {
                        t._size = temp[3];
                        t.Calc( temp[4]);
                    }
                    SpecList.Add(t);
                    //string _price = "";
                    //string _total = "";
                    //float _cnt = 0;
                    //if (!string.IsNullOrEmpty(_pric))
                    //{
                    //    _price = _pric.Substring(0, _pric.IndexOf("р.")).Replace(" ", "");
                    //    _total = _pric.Substring(_pric.IndexOf("Удалить") + 7);
                    //    _total = _total.Substring(0, _total.IndexOf("р")).Replace(" ", "");
                    //    _cnt = int.Parse(_total) / int.Parse(_price);
                    //}

                    XmlElement el = outF.CreateElement("position");
                    el.SetAttribute("Id", rootelem.ChildNodes.Count.ToString());

                    XmlElement code = outF.CreateElement("Code");
                    code.InnerText = t._code;
                    //code.SetAttribute("desc","Код товара для заказа")
                    XmlNode tmp = el.AppendChild(code);

                    XmlElement name = outF.CreateElement("Name");
                    name.InnerText = t._name;
                    //name.SetAttribute("desc","Наименование товара")
                    tmp = el.AppendChild(name);

                    XmlElement art = outF.CreateElement("Article");
                    art.InnerText = t._artc;
                    //art.SetAttribute("desc","Артикул")
                    tmp = el.AppendChild(art);

                    XmlElement sz = outF.CreateElement("Sizes");
                    sz.InnerText = t._size;
                    //sz.SetAttribute("desc","Габариты и вес")
                    tmp = el.AppendChild(sz);

                    XmlElement pr = outF.CreateElement("Price");
                    pr.InnerText = t._price.ToString();
                    //pr.SetAttribute("desc","Цена а шт.")
                    tmp = el.AppendChild(pr);

                    XmlElement ct = outF.CreateElement("Count");
                    ct.InnerText = t._cnt.ToString();
                    tmp = el.AppendChild(ct);
                    tmp = rootelem.AppendChild(el);
                }
            }

            outF.AppendChild(rootelem);
            richTextBox1.Text = outF.OuterXml;
            string savepath = "";
            if (FilePath != "")
            {
                string nf = Path.GetFileNameWithoutExtension(FilePath);
            //System.Environment.GetEnvironmentVariable("USERPROFILE") + @"\desktop\PerovskiSpec[nf].xml";
                savepath = Path.GetDirectoryName(FilePath) + "\\PerovskiSpec[" + nf + "].xml";
                outF.Save(savepath);
                FilePath = "";
            }
            TableForm tf = new TableForm(SpecList, savepath);
            tf.ShowDialog();
        }