void BChangeNameClick(object sender, EventArgs e)
        {
            ListViewItem         lvi = lvProfiles.SelectedItems[0];
            UserTranslateProfile pf  = lvi.Tag as UserTranslateProfile;

            string             oldName  = pf.Name;
            SetProfileNameForm nameForm = new SetProfileNameForm(pf as UserTranslateProfile, profiles);

            DialogResult dr = nameForm.ShowDialog(FindForm());

            nameForm.Dispose();
            if (dr == DialogResult.Cancel)
            {
                pf.Name = oldName;
                return;
            }
            else
            {
                profilesHistory.RenameProfile(oldName, pf.Name);
            }


            lvi.Text          = pf.Name;
            lProfileName.Text = pf.Name;

            lvi.SubItems[1].Text = (LangPack.TranslateLanguage(pf.TranslationDirection.From) +
                                    " -> " +
                                    LangPack.TranslateLanguage(pf.TranslationDirection.To)
                                    );
            lvi.SubItems[2].Text = LangPack.TranslateString(pf.Subject);


            LvProfilesSelectedIndexChanged(lvProfiles, new EventArgs());
        }
        void AAddProfileExecute(object sender, EventArgs e)
        {
            UserTranslateProfile pf = new UserTranslateProfile();

            SetProfileNameForm nameForm = new SetProfileNameForm(pf, profiles);
            DialogResult       dr       = nameForm.ShowDialog(FindForm());

            nameForm.Dispose();
            if (dr == DialogResult.Cancel)
            {
                return;
            }

            profiles.Add(pf);

            ListViewItem lvi = new ListViewItem();

            lvi.Text = pf.Name;
            lvi.Tag  = pf;

            lvi.SubItems.Add(LangPack.TranslateLanguage(pf.TranslationDirection.From) +
                             " -> " +
                             LangPack.TranslateLanguage(pf.TranslationDirection.To)
                             );
            lvi.SubItems.Add(LangPack.TranslateString(pf.Subject));

            lvProfiles.Items.Add(lvi);
            lvProfiles.Focus();

            foreach (ListViewItem lv in lvProfiles.SelectedItems)
            {
                lv.Selected = false;
                lv.Focused  = false;
            }

            lvi.Selected = true;
            lvi.Focused  = true;

            AEditServicesExecute(this, new EventArgs());
        }
        void ASetProfilePropertiesExecute(object sender, EventArgs e)
        {
            UserTranslateProfile pf = currentProfile as UserTranslateProfile;
            if(pf == null)
                return;

            string oldName = pf.Name;
            SetProfileNameForm nameForm = new SetProfileNameForm(pf, TranslateOptions.Instance.Profiles);

            DialogResult dr = nameForm.ShowDialog(FindForm());
            nameForm.Dispose();
            if(dr == DialogResult.Cancel)
            {
                pf.Name = oldName;
                return;
            }
            else
                TranslateOptions.Instance.ProfilesHistory.RenameProfile(oldName, pf.Name);

            int actionIdx = 0;
            foreach(ToolStripItem tsi in tsTranslate.Items)
            {
                if(tsi.Tag == currentProfile)
                {
                    tsi.Text = pf.Name;
                    tsi.ToolTipText = GetProfileName(pf);
                    if(actionIdx < 9)
                    {
                        string displayString =	System.ComponentModel.TypeDescriptor.GetConverter(typeof(Keys)).ConvertToString(profileSwitchOnCtrl1Actions[actionIdx].Shortcut);
                        tsi.ToolTipText += " (" + displayString + ")";
                    }
                    break;
                }
                actionIdx++;
            }
            UpdateCaption();
        }
        void AAddProfileExecute(object sender, EventArgs e)
        {
            UserTranslateProfile pf = new UserTranslateProfile();

            SetProfileNameForm nameForm = new SetProfileNameForm(pf, TranslateOptions.Instance.Profiles);
            DialogResult dr = nameForm.ShowDialog(FindForm());
            nameForm.Dispose();
            if(dr == DialogResult.Cancel)
                return;

            CustomProfileServicesForm form = new CustomProfileServicesForm(pf);
            form.ShowDialog(this);
            form.Dispose();

            TranslateOptions.Instance.Profiles.Add(pf);
            TranslateOptions.Instance.CurrentProfile = pf;

            pf.Subjects.AddRange(pf.GetSupportedSubjects());

            UpdateProfiles();
        }
        void BChangeNameClick(object sender, EventArgs e)
        {
            ListViewItem lvi = lvProfiles.SelectedItems[0];
            UserTranslateProfile pf = lvi.Tag as UserTranslateProfile;

            string oldName = pf.Name;
            SetProfileNameForm nameForm = new SetProfileNameForm(pf as UserTranslateProfile, profiles);

            DialogResult dr = nameForm.ShowDialog(FindForm());
            nameForm.Dispose();
            if(dr == DialogResult.Cancel)
            {
                pf.Name = oldName;
                return;
            }
            else
                profilesHistory.RenameProfile(oldName, pf.Name);

            lvi.Text = pf.Name;
            lProfileName.Text = pf.Name;

            lvi.SubItems[1].Text = (LangPack.TranslateLanguage(pf.TranslationDirection.From) +
                     " -> " +
                     LangPack.TranslateLanguage(pf.TranslationDirection.To)
                    );
            lvi.SubItems[2].Text = LangPack.TranslateString(pf.Subject);

            LvProfilesSelectedIndexChanged(lvProfiles, new EventArgs());
        }
        void AAddProfileExecute(object sender, EventArgs e)
        {
            UserTranslateProfile pf = new UserTranslateProfile();

            SetProfileNameForm nameForm = new SetProfileNameForm(pf, profiles);
            DialogResult dr = nameForm.ShowDialog(FindForm());
            nameForm.Dispose();
            if(dr == DialogResult.Cancel)
                return;

            profiles.Add(pf);

            ListViewItem lvi = new ListViewItem();
            lvi.Text = pf.Name;
            lvi.Tag = pf;

            lvi.SubItems.Add(LangPack.TranslateLanguage(pf.TranslationDirection.From) +
                         " -> " +
                         LangPack.TranslateLanguage(pf.TranslationDirection.To)
                        );
            lvi.SubItems.Add(LangPack.TranslateString(pf.Subject));

            lvProfiles.Items.Add(lvi);
            lvProfiles.Focus();

            foreach(ListViewItem lv in lvProfiles.SelectedItems)
            {
                lv.Selected = false;
                lv.Focused = false;
            }

            lvi.Selected = true;
            lvi.Focused = true;

            AEditServicesExecute(this, new EventArgs());
        }