//---------------------------------------------------------------------------
void __fastcall TfrmSearch::OnSearchComplete(TObject * Sender)
{
  //if(BillSearchThread->ErrorMessage != "")
  //  MessageBox(Handle,BillSearchThread->ErrorMessage.c_str(),"警告",MB_OK | MB_ICONWARNING);
  //else
  if(BillSearchThread->ErrorCount > 0)
    MessageBox(Handle,("在查找过程中发生了" + IntToStr(BillSearchThread->ErrorCount) + "个文件错误,查找结果可能是不完整的,建议重新查找一次.").c_str(),"警告",MB_OK | MB_ICONWARNING);
  FoundCount = BillSearchThread->FoundCount;
  if(FoundCount > 0)
  {
    TfrmBillFile * frmBillFile = (TfrmBillFile * )Owner;
    frmBillFile->TempFileList->Insert(0,TempFileName);
    TMenuItem * MenuItem = new TMenuItem(Owner);
    MenuItem->Caption = "查询结果" + IntToStr(frmBillFile->TempFileList->Count) + "[在" + FormatDateTime("mm-dd hh:nn",Now()) + " 共" + IntToStr(FoundCount) + "条记录]";
    //MenuItem->Tag = frmBillFile->TempFileList->Count - 1;
    MenuItem->OnClick = frmBillFile->btnReviewClick;
    MenuItem->ImageIndex = 4;
    frmBillFile->PopupMenu4->Items->Insert(0,MenuItem);
    for(int n = 0;n < frmBillFile->PopupMenu4->Items->Count;n++)
    {
      frmBillFile->PopupMenu4->Items->Items[n]->Tag = n;
    }
  }
  else
  {
    DeleteFile(TempFileName.c_str());
  }
  BillSearchThread = NULL;
  Label1->Caption = "共找到" + IntToStr(FoundCount) + "条记录";
  Label2->Caption = "共找到" + IntToStr(FoundCount) + "条记录,耗时   " + AnsiString(Now() - StartTime); 
  RzGroupBox2->Enabled = true;
  lvParams->Enabled = true;
  btnQuery->Enabled = true;
  btnAddParameter->Enabled = lvParams->Visible;
  btnDelParameter->Enabled = lvParams->Visible;
  cbxBillType->Enabled = true;
  rbAnd->Enabled  = true;
  rbOr->Enabled   = true;
  Label9->Enabled      = cbxBillType->Items->Count > 0;
  cbxBillType->Enabled = cbxBillType->Items->Count > 0;
  btnQuery->Caption = "查找";
  btnQuery->Enabled = true;
  btnVBScript->Enabled = true;
  btnQuery->ImageIndex    = 114;
  RzProgressBar1->Visible = false;
  RzProgressBar2->Visible = false;
  Label10->Visible = false;
  Label11->Visible = false;
  Label1->Caption = "共找到" + IntToStr(FoundCount) + "条记录";
  if(FoundCount > 0)
    ShowSearchResult();
  else
    MessageBox(Handle,"没有找到符合条件的记录!","信息",MB_OK | MB_ICONINFORMATION);
}
Beispiel #2
0
 virtual void Execute() {
     if (!WindowInfoStillValid(win))
         return;
     if (win->findThread != thread) {
         // Race condition: FindTextOnThread/AbortFinding was
         // called after the previous find thread ended but
         // before this FindEndTask could be executed
         return;
     }
     if (!win->IsDocLoaded()) {
         // the UI has already been disabled and hidden
     } else if (textSel) {
         ShowSearchResult(*win, textSel, wasModifiedCanceled);
         ftd->HideUI(true, loopedAround);
     } else {
         // nothing found or search canceled
         ClearSearchResult(win);
         ftd->HideUI(false, !wasModifiedCanceled);
     }
     win->findThread = NULL;
 }