private void btnFindNext_Click(object sender, System.EventArgs e) { DisableUpdate(); SetNext sn = new SetNext(true, 0, 0); if(sn.ShowDialog(this) == DialogResult.OK) { lock(m_lockobj) { object obj = getValue(sn.Value); if(obj == null) { txtMessages.Text = Resources.ErrorFailedToConvert; goto Done; } txtMessages.Text = String.Format(Resources.SearchingForFormatString, sn.Value); ProgressBarWindow pb = new ProgressBarWindow(); pb.Owner = this; pb.Show(); try { UInt64 count = m_pm.FindNext(obj, pb); txtMessages.Text = String.Format(Resources.FindNextFoundFormatString, count); } catch(System.Exception f) { txtMessages.Text = String.Format(Resources.FindNextFailedFormatString, f.Message); } Thread.Sleep(500); pb.Hide(); pb.Close(); pb = null; UpdateList(); } } else { txtMessages.Text = Resources.FindNextCanceled; } Done: EnableUpdate(); }
private void btnFindFirst_Click(object sender, System.EventArgs e) { DisableUpdate(); FindFirst ff = new FindFirst(); if(ff.ShowDialog(this) != DialogResult.OK) { txtMessages.Text = Resources.FindFirstCanceled; goto Done; } if(ff.radioByte.Checked) { m_searchType = typeof(Byte); lblSearchSize.Text = Resources.SearchSize1Byte; } else if(ff.radioShort.Checked) { m_searchType = typeof(UInt16); lblSearchSize.Text = Resources.SearchSize2Bytes; } else if(ff.radioInt.Checked) { m_searchType = typeof(UInt32); lblSearchSize.Text = Resources.SearchSize4Bytes; } else if(ff.radioLong.Checked) { m_searchType = typeof(UInt64); lblSearchSize.Text = Resources.SearchSize8Bytes; } else m_searchType = null; lock(m_lockobj) { object obj = getValue(ff.textValue.Text); if(obj == null) { txtMessages.Text = Resources.ErrorFailedToConvert; goto Done; } ProgressBarWindow pb = new ProgressBarWindow(); pb.Owner = this; pb.Show(); txtMessages.Text = String.Format(Resources.SearchingForFormatString, ff.textValue.Text); try { UInt64 count = m_pm.FindFirst(obj, pb); txtMessages.Text = String.Format(Resources.FindFirstFoundFormatString, count); } catch(System.Exception f) { txtMessages.Text = String.Format(Resources.FindFirstFailedFormatString, f.Message); } Thread.Sleep(500); pb.Hide(); pb.Close(); pb = null; m_last = null; lstAddresses.Items.Clear(); UpdateList(); } Done: EnableUpdate(); }