Esempio n. 1
0
        private void btnSelect_Click(object sender, EventArgs e)
        {
            this.dataGridProtect.CurrentCell = null;
            this.dataGridSet.CurrentCell     = null;
            this.dataGridShow.CurrentCell    = null;
            frmList fl = new frmList();

            if (fl.ShowDialog() == DialogResult.Yes)
            {
                if (!fl.isError)
                {
                    cModeSet ModeSet;
                    if (DataFileToClass(fl.ReturnId, out ModeSet, true))
                    {
                        if (DataClassToFrm(this, ModeSet))
                        {
                            frmMideaSn.mSnSet = (cSnSet)cXml.readXml(string.Format("{0}{1}.xml", frmMideaSn.SnIdDirectory, ModeSet.mId), typeof(cSnSet), frmMideaSn.mSnSet);
                            return;
                        }
                    }
                    MessageBox.Show("数据加载错误,将自动生成默认数据", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    if (File.Exists(fl.ReturnId))
                    {
                        File.Delete(fl.ReturnId);
                    }
                    cModeSet modeSet = new cModeSet();
                    DataClassToFile(modeSet);
                    DataClassToFrm(this, modeSet);
                }
            }
            fl.Dispose();
        }
Esempio n. 2
0
        private void btnSelect_Click(object sender, EventArgs e)
        {
            frmList fl = new frmList();

            if (fl.ShowDialog() == DialogResult.Yes)
            {
                if (!fl.isError)
                {
                    cModeSet ModeSet = new cModeSet();
                    if (ModeSet.Load(fl.ReturnId.Trim()))
                    {
                        DataClassToFrm(ModeSet);
                    }
                }
            }
            fl.Dispose();
        }