Exemplo n.º 1
0
        /// <summary>
        /// Called when we want to add a new registry mapping
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bnAddKey_Click(object sender, EventArgs e)
        {
            FormShadedAskInput2 form = new FormShadedAskInput2("Please enter the registry key name and value name to map to the application.  Do not specify the registry hive as HKEY_LOCAL_MACHINE is assumed."
                                                               , "Enter Registry Key (beneath HKEY_LOCAL_MACHINE)"
                                                               , "Registry Key Name:", "Value Name", "", "", Properties.Resources.application_serial_number_corner
                                                               , true);

            if (form.ShowDialog() == DialogResult.OK)
            {
                // OK add the new mapping to our list
                RegistryMapping        mapping      = new RegistryMapping(form.Value1Entered(), form.Value2Entered());
                UltraListViewSubItem[] subItemArray = new UltraListViewSubItem[1];
                subItemArray[0]       = new UltraListViewSubItem();
                subItemArray[0].Value = mapping.ValueName;
                UltraListViewItem item = new UltraListViewItem(mapping.RegistryKey, subItemArray);
                item.Tag = mapping;
                lvRegistryKeys.Items.Add(item);

                // Build the mappings string
                String mappingString = BuildMappingString();

                // ..and update the configuration file
                _applicationsFile.SetString(cbApplications.SelectedItem.ToString(), mappingString, true);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Called to add a new Publisher to the list of those available to filter on.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bnNewPublisher_Click(object sender, EventArgs e)
        {
            FormAskInput1 form = new FormAskInput1("Please enter a name for the new Publisher.", "New Publisher", "Name:");

            if (form.ShowDialog() == DialogResult.OK)
            {
                string newPublisher = form.ValueEntered();

                // Ensure that this value does not duplicate an existing publisher either in the available or selected lists
                foreach (string publisher in lbAvailablePublishers.Items)
                {
                    if (newPublisher == publisher)
                    {
                        MessageBox.Show("The Publisher Specified already exists an has not been added.", "Publisher Exists");
                        return;
                    }
                }

                // Ensure that this value does not duplicate an existing publisher in the selected lists
                foreach (string publisher in lbFilteredPublishers.Items)
                {
                    if (newPublisher == publisher)
                    {
                        MessageBox.Show("The publisher specified already exists and has not been added.", "Publisher Exists");
                        return;
                    }
                }

                // Ok this is a new Publisher so add it to the definitions file
                ApplicationDefinitionsFile definitionsFile = new ApplicationDefinitionsFile();
                definitionsFile.SetSection(ApplicationDefinitionsFile.PUBLISHERS_SECTION);
                definitionsFile.SetString(newPublisher, "", true);

                // ...and add it to the 'available' publishers list
                lbAvailablePublishers.Items.Add(newPublisher);
            }
        }