コード例 #1
0
        protected bool QueryForFriendlyName()
        {
            string strFriendlyName     = (String.IsNullOrEmpty(FriendlyName)) ? DefaultFriendlyName : FriendlyName;
            QueryConverterNameForm dlg = new QueryConverterNameForm(strFriendlyName);

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                // means we're saving in the repository
                // update the values from those the dialog box queried
                FriendlyName = dlg.FriendlyName;
                UpdateCompoundConverterNameLabel(FriendlyName);
                return(true);
            }
            return(false);
        }
コード例 #2
0
        protected void buttonSaveInRepositoryEx()
        {
            m_bQueryToUseTempConverter = false;
            if (IsModified && !OnApply())
            {
                return;
            }

            // if the user has gone to the Advanced tab, then the text box has the default (or typed in) friendly name
            if (m_bAdvancedTabVisited)
            {
                FriendlyName = textBoxFriendlyName.Text;
            }

            if (tabControl.SelectedTab == tabPageAdvanced)
            {
                // if we're currently *on* the advanced tab, then put a more specific error message
                if (String.IsNullOrEmpty(FriendlyName))
                {
                    MessageBox.Show(this, "Enter a 'FriendlyName' for the converter above and click again", EncConverters.cstrCaption);
                }
            }
            else
            {
                string strFriendlyName     = (String.IsNullOrEmpty(FriendlyName)) ? DefaultFriendlyName : FriendlyName;
                QueryConverterNameForm dlg = new QueryConverterNameForm(strFriendlyName);
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    // means we're saving in the repository
                    // update the values from those the dialog box queried
                    FriendlyName = dlg.FriendlyName;
                }
            }

            // if by now, we have a friendly name...
            if (!String.IsNullOrEmpty(FriendlyName))
            {
                // then, add it to the repository
                //  (again, some sub-classes do something different at this point, so call a virtual function)
                AddConverterMapping();
                IsModified = false;
            }
        }