示例#1
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            Loc = Location;

            if (File.Exists(Define.SaveFileName))
            {
                var load = new TableMgr();
                var sr   = new StreamReader(Define.SaveFileName);
                load.Load(sr);
                sr.Close();

                load.Tables.ForEach(t =>
                {
                    var formTable = new FormTable(t);
                    formTable.Show(this);
                    TableList.Add(formTable);
                });
            }
        }
示例#2
0
        private void miSave_Click(object sender, EventArgs e)
        {
            var save = new TableMgr();

            TableList.ForEach(t =>
            {
                var table = new Table()
                {
                    Name = t.Text
                };
                var lv = t.GetListView();
                for (int i = 0; i < lv.Columns.Count; i++)
                {
                    var ca = (ColumnAttribute)lv.Columns[i].Tag;
                    table.Columns.Add(ca);
                    table.ColumnNames.Add(lv.Columns[i].Text);
                }
                foreach (ListViewItem item in lv.Items)
                {
                    var datas = new List <string>();
                    for (int i = 0; i < lv.Columns.Count; i++)
                    {
                        datas.Add(item.SubItems[i].Text);
                    }
                    table.Values.Add(datas);
                }
                save.Tables.Add(table);
            });

            var sw = new StreamWriter(Define.SaveFileName);

            save.Save(sw);
            sw.Close();

            MessageBox.Show("저장되었습니다.");
        }