예제 #1
0
        //Add single verb without affecting existing verbs
        private void addSingleVerbButton_Click(object sender, EventArgs e)
        {
            string extension          = (string)extensionsListBox.SelectedItem;
            ProgramAssociationInfo pa = new ProgramAssociationInfo(programIdTextBox.Text);

            if (!pa.Exists)
            {
                return;
            }

            AddVerbDialog d = new AddVerbDialog();

            if (d.ShowDialog() == DialogResult.OK)
            {
                ProgramVerb[]      verbs   = pa.Verbs;
                ProgramVerb        newVerb = new ProgramVerb(d.VerbName, d.VerbCommand);
                List <ProgramVerb> l       = new List <ProgramVerb>();

                if (!l.Contains(newVerb))
                {
                    pa.AddVerb(newVerb);

                    refreshExtensionsButton_Click(null, null);
                    extensionsListBox.SelectedItem = extension;
                }
            }
        }
예제 #2
0
      //Add single verb without affecting existing verbs
      private void addSingleVerbButton_Click(object sender, EventArgs e)
      {
         string extension = (string)extensionsListBox.SelectedItem;
         ProgramAssociationInfo pa = new ProgramAssociationInfo(programIdTextBox.Text);

         if (!pa.Exists)
         {
            return;
         }

         AddVerbDialog d = new AddVerbDialog();

         if (d.ShowDialog() == DialogResult.OK)
         {
            ProgramVerb[] verbs = pa.Verbs;
            ProgramVerb newVerb = new ProgramVerb(d.VerbName, d.VerbCommand);
            List<ProgramVerb> l = new List<ProgramVerb>();

            if (!l.Contains(newVerb))
            {
               pa.AddVerb(newVerb);

               refreshExtensionsButton_Click(null, null);
               extensionsListBox.SelectedItem = extension;
            }
         }
      }