SIL.FieldWorks.TE.TeImportUi.OnCancelPressed C# (CSharp) Method

OnCancelPressed() private method

Called when the user pressed the cancel button on the progress dialog.
private OnCancelPressed ( object sender, System.CancelEventArgs e ) : void
sender object
e System.CancelEventArgs
return void
		private void OnCancelPressed(object sender, CancelEventArgs e)
		{
			CheckDisposed();
			Debug.Assert(!m_ctrl.InvokeRequired);

			try
			{
				// pause the import thread, while we ask if they really want to cancel
				m_importer.Pause();
				if (m_importer.PrevBook != null)
				{
					string sMsg = string.Format(TeResourceHelper.GetResourceString("kstidConfirmStopImport"),
												m_importer.PrevBook);

					if (MessageBox.Show(sMsg, FwUtils.ksTeAppName,
										MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
					{
						// the user does not wish to cancel the import, so cancel the event
						e.Cancel = true;
						return;
					}
				}
				//Display "stopping" message in progress bar
				m_progressDialog.Message = TeResourceHelper.GetResourceString("kstidStoppingImport");
				m_progressDialog.Position = m_progressDialog.Maximum;
			}
			finally
			{
				// resume the import thread
				m_importer.Resume();
			}
		}
		#endregion