Ejemplo n.º 1
0
        private void Frm_OnAddTemplateGroup(string templateGroupName, object sender)
        {
            FormAddGroup frm = (FormAddGroup)sender;

            frm.Close();

            List <CodeTemplateGroup> groups = GetAllCodeTemplateGroups();
            CodeTemplateGroup        group  = null;

            if (frm.IsEdit)
            {
                CodeTemplateGroup curGroup = GetSelectedTemplateGroup();
                group = FindTemplateGroupByName(groups, curGroup.TemplateGroupName);
                if (group != null)
                {
                    group.TemplateGroupName = templateGroupName;
                }
            }
            else
            {
                group = CreateNewTemplateGroup(templateGroupName);
                groups.Add(group);
            }

            SaveCodeTemplateGroups(groups);
            MessageBox.Show("Saved");
            LoadCmbTemplateGroups();
            cmbTemplateGroup.SelectedIndex = cmbTemplateGroup.Items.Count - 1;
        }
Ejemplo n.º 2
0
        private void btnAddTemplateGroup_Click(object sender, EventArgs e)
        {
            FormAddGroup frm = new FormAddGroup();

            frm.OnAddTemplateGroup += Frm_OnAddTemplateGroup;
            frm.ShowDialog();
        }
Ejemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            FormAddGroup frm = new FormAddGroup();

            frm.OnAddTemplateGroup += Frm_OnAddTemplateGroup;
            if (cmbTemplateGroup.SelectedIndex > -1)
            {
                frm.TemplateGroupName = (string)cmbTemplateGroup.SelectedValue;
            }
            frm.IsEdit = true;
            frm.ShowDialog();
        }