예제 #1
0
파일: Form1.cs 프로젝트: keji56/chord
        async Task Present()
        {
            PresentDialog dlg = new PresentDialog();

            dlg.UiState = _uiState;
            dlg.ShowDialog(this);
            _uiState = dlg.UiState;
            if (dlg.DialogResult == DialogResult.Cancel)
            {
                return;
            }

            int nStart = Convert.ToInt32(dlg.PresentStart);
            int nCount = Convert.ToInt32(dlg.PresentCount);

            EnableControls(false);  // 暂时禁用
            try
            {
                PresentResult present_result = await _zclient.Present(
                    dlg.ResultSetName,
                    nStart,
                    nCount,
                    1000,   // 10
                    "F",
                    _targetInfo.PreferredRecordSyntax);

                if (present_result.Value == -1)
                {
                    this.Invoke((Action)(() => MessageBox.Show(this, present_result.ToString())));
                }
                else
                {
                    // 把 MARC 记录显示出来
                    AppendMarcRecords(present_result.Records,
                                      _zclient.ForcedRecordsEncoding == null ? _targetInfo.DefaultRecordsEncoding : _zclient.ForcedRecordsEncoding,
                                      _fetched);
                    if (present_result.Records != null)
                    {
                        _fetched += present_result.Records.Count;
                    }
                }
            }
            finally
            {
                EnableControls(true);
            }
        }
예제 #2
0
파일: Form1.cs 프로젝트: keji56/chord
        async Task FetchRecords(TargetInfo targetinfo)
        {
            EnableControls(false);  // 暂时禁用
            try
            {
                if (_resultCount - _fetched > 0)
                {
                    PresentResult present_result = await _zclient.Present(
                        "default",
                        _fetched,
                        Math.Min((int)_resultCount - _fetched, 10),
                        10,
                        "F",
                        targetinfo.PreferredRecordSyntax);

                    if (present_result.Value == -1)
                    {
                        this.Invoke((Action)(() => MessageBox.Show(this, present_result.ToString())));
                    }
                    else
                    {
                        // 把 MARC 记录显示出来
                        AppendMarcRecords(present_result.Records,
                                          _zclient.ForcedRecordsEncoding == null ? targetinfo.DefaultRecordsEncoding : _zclient.ForcedRecordsEncoding,
                                          _fetched);
                        _fetched += present_result.Records.Count;
                    }
                }
            }
            finally
            {
                EnableControls(true);
            }

#if NO
            if (_resultCount - _fetched > 0)
            {
                this.button_nextBatch.Enabled = true;
            }
            else
            {
                this.button_nextBatch.Enabled = false;
            }

            this.button_nextBatch.Text = ">> " + _fetched + "/" + _resultCount;
#endif
        }