コード例 #1
0
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            AddTriDataForm adf = new AddTriDataForm();

            adf.Id     = selectId;
            adf.Text   = "删除数据";
            adf.Label1 = pack.comment[0] != "" ? pack.comment[0] : pack.header[0];
            adf.Label2 = pack.comment[1] != "" ? pack.comment[1] : pack.header[1];
            adf.Label3 = pack.comment[2] != "" ? pack.comment[2] : pack.header[2];
            adf.ShowDialog();
            if (adf.Result == System.Windows.Forms.DialogResult.OK)
            {
                TriData bd = new TriData(adf.Id, adf.Id2, adf.Id3);
                if (pack.data.ContainsKey(bd))
                {
                    pack.RemovePackData(bd);
                    refreshList(0);
                }
            }
        }
コード例 #2
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            AddTriDataForm adf = new AddTriDataForm();

            adf.Id     = selectId;
            adf.Text   = "添加数据";
            adf.Label1 = pack.comment[0] != "" ? pack.comment[0] : pack.header[0];
            adf.Label2 = pack.comment[1] != "" ? pack.comment[1] : pack.header[1];
            adf.Label3 = pack.comment[2] != "" ? pack.comment[2] : pack.header[2];
            adf.ShowDialog();
            if (adf.Result == System.Windows.Forms.DialogResult.OK)
            {
                TriData bd = new TriData(adf.Id, adf.Id2, adf.Id3);
                if (!pack.data.ContainsKey(bd))
                {
                    List <String> data = new List <string>();
                    data.Add(adf.Id.ToString());
                    data.Add(adf.Id2.ToString());
                    data.Add(adf.Id3.ToString());
                    for (int i = 3; i < pack.datatype.Count; i++)
                    {
                        if (pack.datatype[i] == "char")
                        {
                            data.Add("");
                        }
                        else
                        {
                            data.Add("0");
                        }
                    }

                    pack.AddPackData(data);
                    refreshList(adf.Id);
                }
            }
        }