SIL.FieldWorks.TE.ImportWizard.m_btnModify_Click C# (CSharp) Method

m_btnModify_Click() protected method

protected m_btnModify_Click ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void
		protected void m_btnModify_Click(object sender, EventArgs e)
		{
			if (m_lvCurrentMappingList.SelectedIndices.Count == 0)
				return;

			ListViewItem item = m_lvCurrentMappingList.SelectedItems[0];
			ImportMappingInfo mapping = (ImportMappingInfo)item.Tag;
			DialogResult result;

			// This is part of a work-around to a Windows 32 API bug.
			m_lvCurrentMappingList.PrepareToModifyItem(item);

			if (mapping.IsInline && !mapping.IsInUse)
			{
				// create a CharaterMappingSettings dialog
				m_sMarkerBeingModified = mapping.BeginMarker;
				DisplayInlineMappingDialog(mapping);

				result = m_inlineMappingDialog.DialogResult;
			}
			else
			{
				if (m_MappingDialog == null)
					m_MappingDialog = new ModifyMapping();

				// If this is a P6 import or non-interleaved file import, some of the marker domain
				// info can be inferred from the source project from which the mapping was created,
				// so don't allow the user to modify it incorrectly.
				bool fLockBtDomain = (m_projectType == ProjectTypes.Paratext &&
					m_settings.ParatextBTProj != null);
				bool isAnnotationMapping = m_lvCurrentMappingList == lvAnnotationMappings;
				m_MappingDialog.Initialize((m_projectType == ProjectTypes.Paratext), mapping,
					m_StyleSheet, m_cache, m_helpTopicProvider, isAnnotationMapping, fLockBtDomain);

				DisplayMappingDialog(m_MappingDialog);

				result = m_MappingDialog.GetDialogResult;
			}

			if (result == DialogResult.OK)
			{
				// Update listview item.
				LoadLVMappingItem(m_lvCurrentMappingList, item, mapping);

				// update selection
				//while (lvMappings.SelectedItems.Count > 0)
				//    lvMappings.SelectedItems[0].Selected = false;

				item.Selected = true;
				item.Focused = true;
				m_lvCurrentMappingList.Focus();
			}
		}