Exemplo n.º 1
0
        private void btnAddAssociation_Click(object sender, EventArgs e)
        {
            // add a new file association
            FrmFileAssociation form = new FrmFileAssociation();

            if (form.ShowDialog() == DialogResult.OK)
            {
                lvAssociations.Items.Add(CreateAssociationItem(form.FileExtension, form.ExecutablePath, true));
                lvAssociations.Focus();
                modified = true;
            }
        }
Exemplo n.º 2
0
        private void btnEditAssociation_Click(object sender, EventArgs e)
        {
            // edit the selected file association
            if (lvAssociations.SelectedItems.Count > 0)
            {
                ListViewItem       item = lvAssociations.SelectedItems[0];
                FrmFileAssociation form = new FrmFileAssociation
                {
                    FileExtension  = item.SubItems[0].Text,
                    ExecutablePath = item.SubItems[1].Text
                };

                if (form.ShowDialog() == DialogResult.OK)
                {
                    lvAssociations.Items.RemoveAt(item.Index);
                    lvAssociations.Items.Add(CreateAssociationItem(form.FileExtension, form.ExecutablePath, true));
                    lvAssociations.Focus();
                    modified = true;
                }
            }
        }