protected void DisplayTestPage(AutoConfigDialog form) { form.Text = String.Format("{0} (converter: {1})", m_strDisplayName, form.FriendlyName); form.ShowDialog(); }
protected bool Configure(AutoConfigDialog form) { m_strFriendlyName = form.FriendlyName; m_eConversionType = form.ConversionType; m_strLhsEncodingID = form.LhsEncodingId; m_strRhsEncodingID = form.RhsEncodingId; DialogResult res = form.ShowDialog(); // update our internal values from the config tab (but only if the user clicked OK or // if it is already in the repository--either editing or MetaCmpd type) // NOTE: I've taken out the OR case with IsInRepository, because even in that case // we have to require the OK result. If the user is editing and cancels, then we *don't* // want to update the results. This might mean that I've broken the MetaCmpd cases. // So we'll probably have to have special handling in that class to gracefully remove // the added converter if the user then cancels the dialog // NO: I figured out why that was there: if the converter "IsInRepository", it may mean that // the user has made changes and clicked the "Save In Repository" button. In that case, it // is in the repository, so this method needs to return 'true' (so the SelectConverter dialog // will update the list of converters (in case this one was added). However, if the user clicks // Cancel after saving in the repository and making some changes, then those changes should be // ignored. So we *do* want to remove the OR IsInRepository case for the following IF statement // and only update the EncConverter properties in the case where the user actually clicks OK. // But make the 'else' case return 'false', only if it isn't "in the repository". // if ((res == DialogResult.OK) || form.IsInRepository) if (res == DialogResult.OK) { if (!String.IsNullOrEmpty(form.FriendlyName)) { m_strFriendlyName = form.FriendlyName; } if (!String.IsNullOrEmpty(form.ConverterIdentifier)) { m_strConverterID = form.ConverterIdentifier; } if (!String.IsNullOrEmpty(form.LhsEncodingId)) { m_strLhsEncodingID = form.LhsEncodingId; } if (!String.IsNullOrEmpty(form.RhsEncodingId)) { m_strRhsEncodingID = form.RhsEncodingId; } if (form.ConversionType != ConvType.Unknown) { m_eConversionType = form.ConversionType; } m_lProcessType = (int)form.ProcessType; m_bIsInRepository = form.IsInRepository; // and... if we have the pointer to the parent EC, then go ahead and update that also // (to save *some* clients a step) if (m_pIECParent != null) { // initialize it with the details we have. m_pIECParent.Initialize(m_strFriendlyName, m_strConverterID, ref m_strLhsEncodingID, ref m_strRhsEncodingID, ref m_eConversionType, ref m_lProcessType, m_pIECParent.CodePageInput, m_pIECParent.CodePageOutput, true); // and update it's temporariness status m_pIECParent.IsInRepository = m_bIsInRepository; } } // it might either have already been in the repository (e.g. editing) or added while there (e.g. compound converters) // however, in any case, if we don't have a ConverterFriendlyName, all bets are off (and the caller will choke) else if (form.IsInRepository && !String.IsNullOrEmpty(ConverterFriendlyName)) { // and update it's temporariness status if (m_pIECParent != null) { m_pIECParent.IsInRepository = m_bIsInRepository; } // fall thru to return true (so the SelectConverter dialog will refresh) } else { return(false); } return(true); }
protected bool Configure(AutoConfigDialog form) { m_strFriendlyName = form.FriendlyName; m_eConversionType = form.ConversionType; m_strLhsEncodingID = form.LhsEncodingId; m_strRhsEncodingID = form.RhsEncodingId; DialogResult res = form.ShowDialog(); // update our internal values from the config tab (but only if the user clicked OK or // if it is already in the repository--either editing or MetaCmpd type) // NOTE: I've taken out the OR case with IsInRepository, because even in that case // we have to require the OK result. If the user is editing and cancels, then we *don't* // want to update the results. This might mean that I've broken the MetaCmpd cases. // So we'll probably have to have special handling in that class to gracefully remove // the added converter if the user then cancels the dialog // NO: I figured out why that was there: if the converter "IsInRepository", it may mean that // the user has made changes and clicked the "Save In Repository" button. In that case, it // is in the repository, so this method needs to return 'true' (so the SelectConverter dialog // will update the list of converters (in case this one was added). However, if the user clicks // Cancel after saving in the repository and making some changes, then those changes should be // ignored. So we *do* want to remove the OR IsInRepository case for the following IF statement // and only update the EncConverter properties in the case where the user actually clicks OK. // But make the 'else' case return 'false', only if it isn't "in the repository". // if ((res == DialogResult.OK) || form.IsInRepository) if (res == DialogResult.OK) { if (!String.IsNullOrEmpty(form.FriendlyName)) m_strFriendlyName = form.FriendlyName; if (!String.IsNullOrEmpty(form.ConverterIdentifier)) m_strConverterID = form.ConverterIdentifier; if (!String.IsNullOrEmpty(form.LhsEncodingId)) m_strLhsEncodingID = form.LhsEncodingId; if (!String.IsNullOrEmpty(form.RhsEncodingId)) m_strRhsEncodingID = form.RhsEncodingId; if (form.ConversionType != ConvType.Unknown) m_eConversionType = form.ConversionType; m_lProcessType = (int)form.ProcessType; m_bIsInRepository = form.IsInRepository; // and... if we have the pointer to the parent EC, then go ahead and update that also // (to save *some* clients a step) if (m_pIECParent != null) { // initialize it with the details we have. m_pIECParent.Initialize(m_strFriendlyName, m_strConverterID, ref m_strLhsEncodingID, ref m_strRhsEncodingID, ref m_eConversionType, ref m_lProcessType, m_pIECParent.CodePageInput, m_pIECParent.CodePageOutput, true); // and update it's temporariness status m_pIECParent.IsInRepository = m_bIsInRepository; } } // it might either have already been in the repository (e.g. editing) or added while there (e.g. compound converters) // however, in any case, if we don't have a ConverterFriendlyName, all bets are off (and the caller will choke) else if (form.IsInRepository && !String.IsNullOrEmpty(ConverterFriendlyName)) { // and update it's temporariness status if (m_pIECParent != null) m_pIECParent.IsInRepository = m_bIsInRepository; // fall thru to return true (so the SelectConverter dialog will refresh) } else return false; return true; }