Beispiel #1
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            AddDataForm adf = new AddDataForm();

            adf.Label1 = pack.comment[0] != "" ? pack.comment[0] : pack.headers[0];
            adf.ShowDialog();
            if (adf.Result == System.Windows.Forms.DialogResult.OK)
            {
                if (!pack.data.ContainsKey(adf.Id))
                {
                    List <String> data = new List <string>();
                    data.Add(adf.Id.ToString());

                    bool doCopy = false;
                    if (pack.data.ContainsKey(selectId) && adf.NeedCopy)
                    {
                        doCopy = true;
                    }

                    for (int i = 1; i < pack.dataTypes.Count; i++)
                    {
                        if (doCopy)
                        {
                            data.Add(pack.data[selectId][i]);
                        }
                        else
                        {
                            if (pack.dataTypes[i] == "char")
                            {
                                data.Add("");
                            }
                            else
                            {
                                data.Add("0");
                            }
                        }
                    }

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