Esempio n. 1
0
        private void ReaderManageForm_Load(object sender, EventArgs e)
        {
            if (this.MainForm != null)
            {
                MainForm.SetControlFont(this, this.MainForm.DefaultFont);
            }

#if NO
            MainForm.AppInfo.LoadMdiChildFormStates(this,
    "mdi_form_state");
            this.Channel.Url = this.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联
#endif

            this.GetValueTable += new GetValueTableEventHandler(ReaderManageForm_GetValueTable);

            // webbrowser
            this.m_webExternalHost.Initial(this.MainForm, this.webBrowser_normalInfo);
            this.webBrowser_normalInfo.ObjectForScripting = this.m_webExternalHost;

            this.commander = new Commander(this);
            this.commander.IsBusy -= new IsBusyEventHandler(commander_IsBusy);
            this.commander.IsBusy += new IsBusyEventHandler(commander_IsBusy);

        }
Esempio n. 2
0
        private void EaccForm_Load(object sender, EventArgs e)
        {
            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联


            this.textBox_unihanFilenames.Text = MainForm.AppInfo.GetString(
                "eacc_form",
                "unihan_filename",
                "");
            this.textBox_e2uFilename.Text = MainForm.AppInfo.GetString(
                "eacc_form",
                "e2u_filename",
                "");
            /*
            this.textBox_u2eFilename.Text = MainForm.applicationInfo.GetString(
                "eacc_form",
                "u2e_filename",
                "");
             * */

            Global.FillEncodingList(this.comboBox_codePage,
                false);

        }
Esempio n. 3
0
        private void EaccForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            if (stop != null) // 脱离关联
            {
                stop.Style = StopStyle.None;    // 需要强制中断
                stop.DoStop();

                stop.Unregister();	// 和容器关联
                stop = null;
            }

            if (this.MainForm != null && this.MainForm.AppInfo != null)
            {
                MainForm.AppInfo.SetString(
                    "eacc_form",
                    "unihan_filename",
                    this.textBox_unihanFilenames.Text);
                MainForm.AppInfo.SetString(
                    "eacc_form",
                    "e2u_filename",
                    this.textBox_e2uFilename.Text);
                /*
                MainForm.applicationInfo.SetString(
                    "eacc_form",
                    "u2e_filename",
                    this.textBox_u2eFilename.Text);
                 * */
            }
        }
Esempio n. 4
0
        private void DtlpLogForm_Load(object sender, EventArgs e)
        {
            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联


            // 初始化ChannelArray
            channelArray.appInfo = MainForm.AppInfo;
            channelArray.AskAccountInfo += new AskDtlpAccountInfoEventHandle(channelArray_AskAccountInfo);
            /*
            channelArray.procAskAccountInfo = new Delegate_AskAccountInfo(
                this.AskAccountInfo);
             * */

            // 准备唯一的通道
            if (this.Channel == null)
            {
                this.Channel = channelArray.CreateChannel(0);
            }

            this.textBox_serverAddr.Text = MainForm.AppInfo.GetString(
    "dtlplogform",
    "serveraddr",
    ""); 

            this.textBox_logFileName.Text = MainForm.AppInfo.GetString(
    "dtlplogform",
    "logfilename",
    "");

            this.marcEditor_record.FieldNameCaptionWidth = 0;

        }
Esempio n. 5
0
        private void ClockForm_Load(object sender, EventArgs e)
        {
            if (this.MainForm != null)
            {
                MainForm.SetControlFont(this, this.MainForm.DefaultFont);
            }

            this.dateTimePicker1.Value = DateTime.Now;

#if NO
            this.Channel.Url = this.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            this.Channel.AfterLogin -= new AfterLoginEventHandle(Channel_AfterLogin);
            this.Channel.AfterLogin += new AfterLoginEventHandle(Channel_AfterLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联
#endif

            // API.PostMessage(this.Handle, WM_PREPARE, 0, 0);
            this.BeginInvoke(new Action(Initial));

            this.timer1.Start();
        }
Esempio n. 6
0
 private void BookshelfForm_FormClosed(object sender, FormClosedEventArgs e)
 {
     if (stop != null) // 脱离关联
     {
         stop.Unregister();	// 和容器关联
         stop = null;
     }
 }
Esempio n. 7
0
        private void ChangePasswordForm_Load(object sender, EventArgs e)
        {
            this.Channels = new LibraryChannelCollection();
            this.Channels.BeforeLogin += new BeforeLoginEventHandle(Channels_BeforeLogin);
            this.Channels.AfterLogin += new AfterLoginEventHandle(Channels_AfterLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联

        }
Esempio n. 8
0
        private void QuickChangeBiblioForm_FormClosed(object sender, FormClosedEventArgs e)
        {
#if NO
            if (stop != null) // 脱离关联
            {
                stop.Unregister();	// 和容器关联
                stop = null;
            }
#endif


            // 长操作在进行中?
        }
Esempio n. 9
0
        public void Close()
        {
            if (stop != null) // 脱离关联
            {
                stop.Unregister();	// 和容器关联
                stop = null;
            }

            if (this.Channel != null)
            {
                this.Channel.Close();
                this.Channel = null;
            }
        }
Esempio n. 10
0
        private void XmlDetailForm_Load(object sender, EventArgs e)
        {
            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联

            Global.FillEncodingList(this.comboBox_originDataEncoding,
                false);

            this.NeedIndentXml = this.MainForm.AppInfo.GetBoolean(
                "xmldetailform",
                "need_indent_xml",
                true);

            API.PostMessage(this.Handle, WM_LOADSIZE, 0, 0);
        }
Esempio n. 11
0
        private void HtmlPrintForm_Load(object sender, EventArgs e)
        {
            if (this.MainForm != null)
            {
                MainForm.SetControlFont(this, this.MainForm.DefaultFont);
            }
            // 把第一页装入
            this.LoadPageFile();

            this.EnableButtons();

            DisplayPageInfoLine();

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联
        }
Esempio n. 12
0
        private void QuickChangeBiblioForm_Load(object sender, EventArgs e)
        {
            if (this.MainForm != null)
            {
                MainForm.SetControlFont(this, this.MainForm.DefaultFont);
            }

#if NO
            this.Channel.Url = this.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联
#endif
        }
Esempio n. 13
0
        private void PassGateForm_Load(object sender, EventArgs e)
        {
            if (this.MainForm != null)
            {
                MainForm.SetControlFont(this, this.MainForm.DefaultFont);
            }

#if NO
            this.Channel.Url = this.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联
#endif

            // webbrowser
            this.m_webExternalHost.Initial(this.MainForm, this.webBrowser_readerInfo);
            this.webBrowser_readerInfo.ObjectForScripting = this.m_webExternalHost;

            this.commander = new Commander(this);
            this.commander.IsBusy -= new IsBusyEventHandler(commander_IsBusy);
            this.commander.IsBusy += new IsBusyEventHandler(commander_IsBusy);

            this.AcceptButton = this.button_passGate;

            this.textBox_gateName.Text = this.MainForm.AppInfo.GetString(
                "passgate_form",
                "gate_name",
                "");
            this.checkBox_displayReaderDetailInfo.Checked = this.MainForm.AppInfo.GetBoolean(
                "passgate_form",
                "display_reader_detail_info",
                true);
            this.checkBox_hideBarcode.Checked = this.MainForm.AppInfo.GetBoolean(
                "passgate_form",
                "hide_barcode",
                false);
            this.checkBox_hideReaderName.Checked = this.MainForm.AppInfo.GetBoolean(
                "passgate_form",
                "hide_readername",
                false);

            this.StartWorkerThread();
        }
Esempio n. 14
0
        private void SelectPatronDialog_Load(object sender, EventArgs e)
        {
            _stopManager.Initial(this.toolStripButton_stop,
(object)this.toolStripLabel_message,
(object)null);

            stop = new DigitalPlatform.Stop();
            stop.Register(this._stopManager, true);	// 和容器关联

            FillRecPath();

            EnableControls(false);

            this.m_webExternalHost_patron.Initial(this.MainForm, this.webBrowser_patron);
            this.webBrowser_patron.ObjectForScripting = this.m_webExternalHost_patron;

            MessageVisible = MessageVisible;

            // API.PostMessage(this.Handle, WM_LOAD_ALL_DATA, 0, 0);
            this.BeginInvoke(new Action(Initial));
        }
Esempio n. 15
0
        // 初始化数据成员
        public int Initial(
            MainForm mainform,
            string[] aPaths,
            string strMessage,
            LibraryChannel channel,
            Stop stop,
            out string strError)
        {
            strError = "";

            this.MainForm = mainform;
            this.Channel = channel;
            this.stop = stop;
            this.aPaths = aPaths;

            this.textBox_message.Text = strMessage;

            this.InfoColor = InfoColor.LightRed; // 红色表示警告

            return 0;
        }
Esempio n. 16
0
        private void ActivateForm_Load(object sender, EventArgs e)
        {
            if (this.MainForm != null)
            {
                MainForm.SetControlFont(this, this.MainForm.DefaultFont);
            }
#if NO
            MainForm.AppInfo.LoadMdiChildFormStates(this,
    "mdi_form_state");
            this.Channel.Url = this.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联
#endif

            this.readerEditControl_old.SetReadOnly("librarian");
            this.readerEditControl_old.GetValueTable += new GetValueTableEventHandler(readerEditControl1_GetValueTable);
            this.readerEditControl_old.Initializing = false;   // 如果没有此句,一开始在空模板上修改就不会变色

            this.readerEditControl_new.SetReadOnly("librarian");
            this.readerEditControl_new.GetValueTable += new GetValueTableEventHandler(readerEditControl1_GetValueTable);
            this.readerEditControl_new.Initializing = false;   // 如果没有此句,一开始在空模板上修改就不会变色


            // webbrowser
            this.m_webExternalHost_new.Initial(this.MainForm, this.webBrowser_newReaderInfo);
            this.webBrowser_newReaderInfo.ObjectForScripting = this.m_webExternalHost_new;

            this.m_webExternalHost_old.Initial(this.MainForm, this.webBrowser_oldReaderInfo);
            this.webBrowser_oldReaderInfo.ObjectForScripting = this.m_webExternalHost_old;

            // commander
            this.commander = new Commander(this);
            this.commander.IsBusy -= new IsBusyEventHandler(commander_IsBusy);
            this.commander.IsBusy += new IsBusyEventHandler(commander_IsBusy);
        }
Esempio n. 17
0
        public void Initial(MainForm main_form,
            bool bDoEvents = false)
        {
            this._doEvents = bDoEvents;
            this.MainForm = main_form;

            this.Channel.Url = this.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            this.Channel.AfterLogin -= new AfterLoginEventHandle(Channel_AfterLogin);
            this.Channel.AfterLogin += new AfterLoginEventHandle(Channel_AfterLogin);

            this.Channel.Idle -= new IdleEventHandler(Channel_Idle);
            this.Channel.Idle += new IdleEventHandler(Channel_Idle);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联

            return;
        }
Esempio n. 18
0
        private void CheckBorrowInfoForm_Load(object sender, EventArgs e)
        {
            if (this.MainForm != null)
            {
                MainForm.SetControlFont(this, this.MainForm.DefaultFont);
            }
#if NO
            MainForm.AppInfo.LoadMdiChildFormStates(this,
    "mdi_form_state");
            this.Channel.Url = this.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联
#endif

            Global.ClearForPureTextOutputing(this.webBrowser_resultInfo);

            this.checkBox_displayPriceString.Checked = this.MainForm.AppInfo.GetBoolean(
                "check_borrowinfo_form",
                "display_price_string",
                true);

            this.checkBox_forceCNY.Checked = this.MainForm.AppInfo.GetBoolean(
                "check_borrowinfo_form",
                "force_cny",
                false);

            this.checkBox_overwriteExistPrice.Checked = this.MainForm.AppInfo.GetBoolean(
                "check_borrowinfo_form",
                "overwrite_exist_price",
                false);

        }
Esempio n. 19
0
        private void ChangePasswordForm_Load(object sender, EventArgs e)
        {
            if (this.MainForm != null)
            {
                MainForm.SetControlFont(this, this.MainForm.DefaultFont);
            }
#if NO
            this.Channel.Url = this.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);


            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);	// 和容器关联
#endif

            bool bReader = this.MainForm.AppInfo.GetBoolean(
                "default_account",
                "isreader",
                false);
            if (bReader == false)
            {
                this.textBox_reader_oldPassword.Enabled = false;
            }
            else
            {
                this.textBox_reader_comment.Text = "这是读者为自己修改密码。";
                this.tabControl_main.Controls.Remove(this.tabPage_worker);
                this.AddFreeControl(this.tabPage_worker);   // 2015/11/7
            }

            checkBox_worker_force_CheckedChanged(this, null);

            API.PostMessage(this.Handle, WM_FIRST_SETFOCUS, 0, 0);
        }
Esempio n. 20
0
        // 获得一个日志文件的尺寸
        // return:
        //      -2  此类型的日志尚未启用
        //      -1  error
        //      0   file not found
        //      1   found
        static int GetFileSize(
            Stop stop,
            LibraryChannel channel,
            string strCacheDir,
            string strLogFileName,
            LogType logType,
            out long lServerFileSize,
            out long lCacheFileSize,
            out string strError)
        {
            strError = "";
            lServerFileSize = 0;
            lCacheFileSize = 0;

            string strCacheFilename = PathUtil.MergePath(strCacheDir, strLogFileName);

            FileInfo fi = new FileInfo(strCacheFilename);
            if (fi.Exists == true)
                lCacheFileSize = fi.Length;

            stop.SetMessage("正获得日志文件 " + strLogFileName + " 的尺寸...");

            string strXml = "";
            long lAttachmentTotalLength = 0;
            byte[] attachment_data = null;

            string strStyle = "level-0";
            if ((logType & LogType.AccessLog) != 0)
                strStyle += ",accessLog";

            // 获得日志文件尺寸
            // return:
            //      -1  error
            //      0   file not found
            //      1   succeed
            //      2   超过范围
            long lRet = channel.GetOperLog(
                stop,
                strLogFileName,
                -1,    // lIndex,
                -1, // lHint,
                strStyle,
                "", // strFilter
                out strXml,
                out lServerFileSize,
                0,  // lAttachmentFragmentStart,
                0,  // nAttachmentFramengLength,
                out attachment_data,
                out lAttachmentTotalLength,
                out strError);
            if (lRet == 0)
            {
                lServerFileSize = 0;
                Debug.Assert(lServerFileSize == 0, "");
                return 0;
            }
            if (lRet != 1)
                return -1;
            if (lServerFileSize == -1)
            {
                strError = "日志尚未启用";
                return -2;
            }
            Debug.Assert(lServerFileSize >= 0, "");
            return 1;
        }
Esempio n. 21
0
        // AppDomain m_scriptDomain = null;

        private void EntityForm_Load(object sender, EventArgs e)
        {
            if (this.MainForm != null)
            {
                MainForm.SetControlFont(this, this.MainForm.DefaultFont);
            }

            // 2015/5/27
            this._genData = new GenerateData(this, null);
            this._genData.SynchronizeMarcEvent += _genData_SynchronizeMarcEvent;

            // m_scriptDomain = AppDomain.CreateDomain("script");

            this.m_webExternalHost_biblio.Initial(this.MainForm, this.webBrowser_biblioRecord);
            this.webBrowser_biblioRecord.ObjectForScripting = this.m_webExternalHost_biblio;

            // this.m_webExternalHost_comment.Initial(this.MainForm);

            this.MainForm.AppInfo.LoadMdiSize += new EventHandler(AppInfo_LoadMdiSize);
            this.MainForm.AppInfo.SaveMdiSize += new EventHandler(AppInfo_SaveMdiSize);

            // LoadLayout0();
            if (this.AcceptMode == false)
            {
#if NO
                // 设置窗口尺寸状态
                MainForm.AppInfo.LoadMdiChildFormStates(this,
                    "mdi_form_state");
#endif
            }
            else
            {
                Form form = this;
                FormWindowState savestate = form.WindowState;
                bool bStateChanged = false;
                if (form.WindowState != FormWindowState.Normal)
                {
                    form.WindowState = FormWindowState.Normal;
                    bStateChanged = true;
                }

                AppInfo_LoadMdiSize(this, null);

                if (bStateChanged == true)
                    form.WindowState = savestate;
            }

            if (this.AcceptMode == true)
            {
#if ACCEPT_MODE
                if (this.WindowState == FormWindowState.Maximized)
                {
                    this.WindowState = FormWindowState.Normal;
                }
#endif
            }


            // 如果为禁止编目功能
            if (this.Cataloging == false)
            {
                this.tabControl_biblioInfo.TabPages.Remove(this.tabPage_marc);
                this.AddFreeControl(this.tabPage_marc); // 2015/11/7
                this.toolStrip_marcEditor.Enabled = false;

                // 对象管理功能也被禁止
                this.tabControl_itemAndIssue.TabPages.Remove(this.tabPage_object);
                this.AddFreeControl(this.tabPage_object);   // 2015/11/7
                this.binaryResControl1.Enabled = false;
            }


            this.MainForm.FillBiblioFromList(this.comboBox_from);

            // 恢复上次退出时保留的检索途径
            string strFrom = this.MainForm.AppInfo.GetString(
            "entityform",
            "search_from",
            "");
            if (String.IsNullOrEmpty(strFrom) == false)
                this.comboBox_from.Text = strFrom;

            this.checkedComboBox_biblioDbNames.Text = this.MainForm.AppInfo.GetString(
                "entityform",
                "search_dbnames",
                "<全部>");

            this.comboBox_matchStyle.Text = this.MainForm.AppInfo.GetString(
                "entityform",
                "search_matchstyle",
                "前方一致");


            /*
            // 2008/6/25 
            this.checkBox_autoDetectQueryBarcode.Checked = this.MainForm.AppInfo.GetBoolean(
                "entityform",
                "auto_detect_query_barcode",
                true);
             * */

            this.checkBox_autoSavePrev.Checked = this.MainForm.AppInfo.GetBoolean(
                "entityform",
                "auto_save_prev",
                true);

            this.BiblioChanged = false;

            // 保存当前活动的属性页名字,因为后面可能要清除有关page
            this.m_strUsedActiveItemPage = GetActiveItemPageName();

            // 初始化册控件
            this.entityControl1.GetMacroValue -= new GetMacroValueHandler(issueControl1_GetMacroValue);
            this.entityControl1.GetMacroValue += new GetMacroValueHandler(issueControl1_GetMacroValue);

            this.entityControl1.ContentChanged -= new ContentChangedEventHandler(issueControl1_ContentChanged);
            this.entityControl1.ContentChanged += new ContentChangedEventHandler(issueControl1_ContentChanged);

            this.entityControl1.GetParameterValue -= new GetParameterValueHandler(entityControl1_GetParameterValue);
            this.entityControl1.GetParameterValue += new GetParameterValueHandler(entityControl1_GetParameterValue);

            this.entityControl1.VerifyBarcode -= new VerifyBarcodeHandler(entityControl1_VerifyBarcode);
            this.entityControl1.VerifyBarcode += new VerifyBarcodeHandler(entityControl1_VerifyBarcode);

            this.entityControl1.EnableControlsEvent -= new EnableControlsHandler(entityControl1_EnableControls);
            this.entityControl1.EnableControlsEvent += new EnableControlsHandler(entityControl1_EnableControls);

            this.entityControl1.LoadRecord -= new LoadRecordHandler(entityControl1_LoadRecord111);
            this.entityControl1.LoadRecord += new LoadRecordHandler(entityControl1_LoadRecord111);

            // 2009/2/24 
            this.entityControl1.GenerateData -= new GenerateDataEventHandler(entityControl1_GenerateData);
            this.entityControl1.GenerateData += new GenerateDataEventHandler(entityControl1_GenerateData);

            /*
            // 2009/2/24 
            this.entityControl1.GenerateAccessNo -= new GenerateDataEventHandler(entityControl1_GenerateAccessNo);
            this.entityControl1.GenerateAccessNo += new GenerateDataEventHandler(entityControl1_GenerateAccessNo); 
             * */

            this.entityControl1.ShowMessage -= entityControl1_ShowMessage;
            this.entityControl1.ShowMessage += entityControl1_ShowMessage;

            ////this.entityControl1.Channel = this.Channel;
            this.entityControl1.Stop = this.Progress;
            this.entityControl1.MainForm = this.MainForm;

            this.EnableItemsPage(false);


            // 初始化期控件

            // 2008/12/27 
            this.issueControl1.GenerateEntity -= new GenerateEntityEventHandler(issueControl1_GenerateEntity);
            this.issueControl1.GenerateEntity += new GenerateEntityEventHandler(issueControl1_GenerateEntity);

            // 2008/12/24 
            this.issueControl1.GetOrderInfo -= new GetOrderInfoEventHandler(issueControl1_GetOrderInfo);
            this.issueControl1.GetOrderInfo += new GetOrderInfoEventHandler(issueControl1_GetOrderInfo);

            this.issueControl1.GetItemInfo -= new GetItemInfoEventHandler(issueControl1_GetItemInfo);
            this.issueControl1.GetItemInfo += new GetItemInfoEventHandler(issueControl1_GetItemInfo);

            this.issueControl1.GetMacroValue -= new GetMacroValueHandler(issueControl1_GetMacroValue);
            this.issueControl1.GetMacroValue += new GetMacroValueHandler(issueControl1_GetMacroValue);

            this.issueControl1.ContentChanged -= new ContentChangedEventHandler(issueControl1_ContentChanged);
            this.issueControl1.ContentChanged += new ContentChangedEventHandler(issueControl1_ContentChanged);

            this.issueControl1.EnableControlsEvent -= new EnableControlsHandler(entityControl1_EnableControls);
            this.issueControl1.EnableControlsEvent += new EnableControlsHandler(entityControl1_EnableControls);

            this.issueControl1.ChangeItem -= new ChangeItemEventHandler(issueControl1_ChangeItem);
            this.issueControl1.ChangeItem += new ChangeItemEventHandler(issueControl1_ChangeItem);

            // 2010/4/27
            this.issueControl1.LoadRecord -= new LoadRecordHandler(entityControl1_LoadRecord111);
            this.issueControl1.LoadRecord += new LoadRecordHandler(entityControl1_LoadRecord111);

            // 2012/9/22
            this.issueControl1.GenerateData -= new GenerateDataEventHandler(entityControl1_GenerateData);
            this.issueControl1.GenerateData += new GenerateDataEventHandler(entityControl1_GenerateData);

            this.issueControl1.GetBiblio -= issueControl1_GetBiblio;
            this.issueControl1.GetBiblio += issueControl1_GetBiblio;

            ////this.issueControl1.Channel = this.Channel;
            this.issueControl1.Stop = this.Progress;
            this.issueControl1.MainForm = this.MainForm;

            this.EnableIssuesPage(false);

            // 2010/4/27
            this.issueControl1.InputItemsBarcode = this.MainForm.AppInfo.GetBoolean(
                "entity_form",
                "issueControl_input_item_barcode",
                true);
            // 2011/9/8
            this.issueControl1.SetProcessingState = this.MainForm.AppInfo.GetBoolean(
                "entity_form",
                "issueControl_set_processing_state",
                true);
            // 2012/5/7
            this.issueControl1.CreateCallNumber = this.MainForm.AppInfo.GetBoolean(
                "entity_form",
                "create_callnumber",
                false);

            // 初始化采购控件
            this.orderControl1.GetMacroValue -= new GetMacroValueHandler(issueControl1_GetMacroValue);
            this.orderControl1.GetMacroValue += new GetMacroValueHandler(issueControl1_GetMacroValue);

            this.orderControl1.ContentChanged -= new ContentChangedEventHandler(issueControl1_ContentChanged);
            this.orderControl1.ContentChanged += new ContentChangedEventHandler(issueControl1_ContentChanged);

            this.orderControl1.EnableControlsEvent -= new EnableControlsHandler(entityControl1_EnableControls);
            this.orderControl1.EnableControlsEvent += new EnableControlsHandler(entityControl1_EnableControls);

            this.orderControl1.GenerateEntity -= new GenerateEntityEventHandler(orderControl1_GenerateEntity);
            this.orderControl1.GenerateEntity += new GenerateEntityEventHandler(orderControl1_GenerateEntity);

            // 2008/11/4 
            this.orderControl1.OpenTargetRecord -= new OpenTargetRecordEventHandler(orderControl1_OpenTargetRecord);
            this.orderControl1.OpenTargetRecord += new OpenTargetRecordEventHandler(orderControl1_OpenTargetRecord);

            this.orderControl1.HilightTargetItem -= new HilightTargetItemsEventHandler(orderControl1_HilightTargetItem);
            this.orderControl1.HilightTargetItem += new HilightTargetItemsEventHandler(orderControl1_HilightTargetItem);

            // 2009/11/8 
            this.orderControl1.SetTargetRecPath -= new SetTargetRecPathEventHandler(orderControl1_SetTargetRecPath);
            this.orderControl1.SetTargetRecPath += new SetTargetRecPathEventHandler(orderControl1_SetTargetRecPath);

            // 2009/11/23 
            this.orderControl1.LoadRecord -= new LoadRecordHandler(entityControl1_LoadRecord111);
            this.orderControl1.LoadRecord += new LoadRecordHandler(entityControl1_LoadRecord111);

            this.orderControl1.VerifyLibraryCode -= new VerifyLibraryCodeEventHandler(orderControl1_VerifyLibraryCode);
            this.orderControl1.VerifyLibraryCode += new VerifyLibraryCodeEventHandler(orderControl1_VerifyLibraryCode);

            ////this.orderControl1.Channel = this.Channel;
            this.orderControl1.Stop = this.Progress;
            this.orderControl1.MainForm = this.MainForm;

            this.EnableOrdersPage(false);

            // 初始化评注控件
            this.commentControl1.GetMacroValue -= new GetMacroValueHandler(issueControl1_GetMacroValue);
            this.commentControl1.GetMacroValue += new GetMacroValueHandler(issueControl1_GetMacroValue);

            this.commentControl1.ContentChanged -= new ContentChangedEventHandler(issueControl1_ContentChanged);
            this.commentControl1.ContentChanged += new ContentChangedEventHandler(issueControl1_ContentChanged);

            this.commentControl1.EnableControlsEvent -= new EnableControlsHandler(entityControl1_EnableControls);
            this.commentControl1.EnableControlsEvent += new EnableControlsHandler(entityControl1_EnableControls);

            /*
            this.commentControl1.GenerateEntity -= new GenerateEntityEventHandler(orderControl1_GenerateEntity);
            this.commentControl1.GenerateEntity += new GenerateEntityEventHandler(orderControl1_GenerateEntity);

            this.commentControl1.OpenTargetRecord -= new OpenTargetRecordEventHandler(orderControl1_OpenTargetRecord);
            this.commentControl1.OpenTargetRecord += new OpenTargetRecordEventHandler(orderControl1_OpenTargetRecord);

            this.commentControl1.HilightTargetItem -= new HilightTargetItemsEventHandler(orderControl1_HilightTargetItem);
            this.commentControl1.HilightTargetItem += new HilightTargetItemsEventHandler(orderControl1_HilightTargetItem);

            this.commentControl1.SetTargetRecPath -= new SetTargetRecPathEventHandler(orderControl1_SetTargetRecPath);
            this.commentControl1.SetTargetRecPath += new SetTargetRecPathEventHandler(orderControl1_SetTargetRecPath);

            */
            this.commentControl1.LoadRecord -= new LoadRecordHandler(entityControl1_LoadRecord111);
            this.commentControl1.LoadRecord += new LoadRecordHandler(entityControl1_LoadRecord111);

            this.CommentControl.AddSubject -= new AddSubjectEventHandler(CommentControl_AddSubject);
            this.CommentControl.AddSubject += new AddSubjectEventHandler(CommentControl_AddSubject);

            ////this.commentControl1.Channel = this.Channel;
            this.commentControl1.Stop = this.Progress;
            this.commentControl1.MainForm = this.MainForm;
            // this.commentControl1.WebExternalHost = this.m_webExternalHost_comment;

            this.EnableCommentsPage(false);

            // 初始化对象控件
            if (this.Cataloging == true)
            {
                Program.MainForm.StreamProgressChanged += MainForm_StreamProgressChanged;

                this.binaryResControl1.ContentChanged -= new ContentChangedEventHandler(binaryResControl1_ContentChanged);
                this.binaryResControl1.ContentChanged += new ContentChangedEventHandler(binaryResControl1_ContentChanged);

                this.binaryResControl1.GetChannel -= binaryResControl1_GetChannel;
                this.binaryResControl1.GetChannel += binaryResControl1_GetChannel;

                this.binaryResControl1.ReturnChannel -= binaryResControl1_ReturnChannel;
                this.binaryResControl1.ReturnChannel += binaryResControl1_ReturnChannel;

                //this.binaryResControl1.Channel = this.Channel;
                this.binaryResControl1.Stop = this.Progress;

                this.binaryResControl1.RightsCfgFileName = Path.Combine(this.MainForm.UserDir, "objectrights.xml");

                this.m_macroutil.ParseOneMacro -= new ParseOneMacroEventHandler(m_macroutil_ParseOneMacro);
                this.m_macroutil.ParseOneMacro += new ParseOneMacroEventHandler(m_macroutil_ParseOneMacro);

                // 2009/2/24 
                this.binaryResControl1.GenerateData -= new GenerateDataEventHandler(entityControl1_GenerateData);
                this.binaryResControl1.GenerateData += new GenerateDataEventHandler(entityControl1_GenerateData);

                this.binaryResControl1.TempDir = this.MainForm.UserTempDir;

                LoadFontToMarcEditor();

                this.m_marcEditor.AppInfo = this.MainForm.AppInfo;    // 2009/9/18 
            }



            if (this.AcceptMode == true)
            {
                this.flowLayoutPanel_query.Visible = false;
            }
            else
            {
                this.flowLayoutPanel_query.Visible = this.MainForm.AppInfo.GetBoolean(
"entityform",
"queryPanel_visibie",
true);
            }

            this.panel_itemQuickInput.Visible = this.MainForm.AppInfo.GetBoolean(
"entityform",
"itemQuickInputPanel_visibie",
true);

            // 
            this.EnableControls(true);  // 促使“保存”按钮状态被设置

            // API.PostMessage(this.Handle, WM_LOADLAYOUT, 0, 0);


            // 2008/11/2 
            // RegisterType
            {
                string strRegisterType = this.MainForm.AppInfo.GetString("entity_form",
                    "register_type",
                    "");
                if (String.IsNullOrEmpty(strRegisterType) == false)
                {
                    try
                    {
                        this.RegisterType = (RegisterType)Enum.Parse(typeof(RegisterType), strRegisterType, true);
                    }
                    catch
                    {
                    }
                }
            }

            string strSelectedTemplates = this.MainForm.AppInfo.GetString(
                "entity_form",
                "selected_templates",
                "");
            if (String.IsNullOrEmpty(strSelectedTemplates) == false)
            {
                selected_templates.Build(strSelectedTemplates);
            }

        }
Esempio n. 22
0
        // 停止所有Stop对象,包括当前激活的Stop对象。这是指stopExclude参数==null
        // 用stopExclude参数可以改变函数行为,不停止某个指定的对象。
        // locks: 集合写锁
        public void DoStopAll(Stop stopExclude)
        {
            WriteDebugInfo("collection write lock 6\r\n");
            this.m_collectionlock.AcquireWriterLock(Stop.m_nLockTimeout);
            try
            {
                for (int i = 0; i < stops.Count; i++)
                {
                    Stop temp = (Stop)stops[i];
                    if (stopExclude != temp)
                        temp.DoStop();
                }
            }
            finally
            {
                this.m_collectionlock.ReleaseWriterLock();
                WriteDebugInfo("collection write unlock 6\r\n");

            }

            //SetToolTipText();
        }
Esempio n. 23
0
        // 设状态, 供Stop调
        // locks: 集合读锁(如果bLock == true)
        public void ChangeState(Stop stop,
            StateParts parts,
            bool bLock)
        {
            if (stops.Count == 0)
                return;

            // TODO: 这里的整个逻辑有问题: 即便视觉上不表现,内存也应当兑现修改,以备后面切换时显示出来。动态不那么及时更新是可以的,但是关键状态变化,例如显示、隐藏等动作,一定要兑现到内存
            if (stop != null && stop.ProgressValue == -1)
            {
                if ((parts & StateParts.ProgressValue) != 0)
                {
                    // 如果为隐藏progress的意图,
                    // 将max和min都设置为-1,以便将来刷新的时候能体现隐藏
                    // 2011/10/12
                    stop.ProgressMax = -1;
                    stop.ProgressMin = -1;
                }
            }

            if (bLock == true)
            {
                WriteDebugInfo("collection read lock 7\r\n");
                this.m_collectionlock.AcquireReaderLock(Stop.m_nLockTimeout);
            }
            bool bLoop = false;
            Stop active = null;

            try
            {

                if (bMultiple == false)
                {
                    if (stop == null)
                    {
                        stop = (Stop)stops[stops.Count - 1];
                    }
                    else
                    {
                        if (stop != stops[stops.Count - 1])
                            return;
                    }
                    bLoop = stop.State == 0 ? true : false;
                    active = stop;
                }
                else
                {
                    bool bFound = false;
                    for (int i = 0; i < stops.Count; i++)
                    {
                        Stop temp = (Stop)stops[i];
                        if (bLoop == false)
                        {
                            if (temp.State == 0)
                                bLoop = true;
                        }

                        if (stop == temp)
                        {
                            bFound = true;
                            active = temp;
                            break;
                        }
                    }
                    if (bFound == false)
                        return;

                }
                // 移走


            }
            finally
            {
                if (bLock == true)
                {
                    this.m_collectionlock.ReleaseReaderLock();
                    WriteDebugInfo("collection read unlock 7\r\n");
                }
            }

            //if (m_stopToolButton != null) //???
            //{
            if ((parts & StateParts.StopButton) != 0)
                EnableStopButtons(bLoop);

            if ((parts & StateParts.ReverseButtons) != 0)
                EnableReverseButtons(!bLoop,
                    parts);
            //}

            //if (m_messageStatusBar != null) 
            //{
            if ((parts & StateParts.Message) != 0)
                InternalSetMessage(active.Message);
            //}

            if ((parts & StateParts.ProgressRange) != 0)
            {
                // active.ProgressValue = 0;   // 初始化
                active.ProgressValue = active.ProgressMin;   // 初始化 2008/5/16 changed
                InternalSetProgressBar(active.ProgressMin, active.ProgressMax, -1);
            }

            if ((parts & StateParts.ProgressValue) != 0)
            {
                /*
                if (active.ProgressValue == -1)
                {
                    // 如果为隐藏progress的意图,
                    // 将max和min都设置为-1,以便将来刷新的时候能体现隐藏
                    // 2008/3/10
                    active.ProgressMax = -1;
                    active.ProgressMin = -1;
                }
                 * */

                InternalSetProgressBar(-1, -1, active.ProgressValue);
            }

        }
Esempio n. 24
0
        // 激活按钮
        // 因为StopManager管辖很多Stop对象, 当一个Stop对象需要处于焦点状态,
        // 需要在StopManager内部数组中把这个Stop对象挪到队列尾部, 也就是相当于堆栈顶部
        // 的效果。然后, 把StopManager所关联的button设置为和Stop对象当前状态对应的
        // Enabled或者Disabled状态, 因为只有这样用户才能触发按钮。
        // StopManager管理了很多Stop状态,Active()函数相当于把某个Stop状态翻到可见的顶部。
        // locks: 集合写锁
        public bool Active(Stop stop)
        {
            if (stop == null)
            {
                // 2007/8/1
                EnableStopButtons(false);
                EnableReverseButtons(true, StateParts.None);
                InternalSetMessage("");
                InternalSetProgressBar(-1, -1, -1);

                return false;
            }

            bool bFound = false;

            WriteDebugInfo("collection write lock 4\r\n");
            this.m_collectionlock.AcquireWriterLock(Stop.m_nLockTimeout);
            try
            {

                for (int i = 0; i < stops.Count; i++)
                {
                    if (stops[i] == stop)
                    {
                        bFound = true;
                        stops.RemoveAt(i);
                        stops.Add(stop);
                        break;
                    }

                }
            }
            finally
            {
                this.m_collectionlock.ReleaseWriterLock();
                WriteDebugInfo("collection write unlock 4\r\n");

            }


            if (bFound == false)
            {
                // 2007/8/1
                EnableStopButtons(false);
                EnableReverseButtons(true,
                    StateParts.None);
                InternalSetMessage("");
                InternalSetProgressBar(-1, -1, -1);

                return false;
            }

            // Debug.Assert(stop.State != -1, "");

            //if (m_stopToolButton != null) //??
            //{
            if (stop.State == 0)
            {
                EnableStopButtons(true);
                EnableReverseButtons(false,
                    StateParts.None);
            }
            else
            {
                EnableStopButtons(false);
                EnableReverseButtons(true,
                    StateParts.None);
            }
            //}

            // 文字也要变化
            //if (m_messageStatusBar != null) 
            //{
            InternalSetMessage(stop.Message);
            //}

            InternalSetProgressBar(stop.ProgressMin, stop.ProgressMax, stop.ProgressValue);


            //SetToolTipText();


            return true;
        }
Esempio n. 25
0
        // 是否处在当前激活位置?
        public bool IsActive(Stop stop)
        {
            int index = this.stops.IndexOf(stop);

            if (index == -1)
                return false;

            if (index == this.stops.Count - 1)
                return true;

            return false;
        }
Esempio n. 26
0
        // 加入一个Stop对象。加入在非活动位置
        // locks: 集合写锁
        public void Add(Stop stop)
        {
            WriteDebugInfo("collection write lock 2\r\n");
            this.m_collectionlock.AcquireWriterLock(Stop.m_nLockTimeout);
            try
            {
                // stops.Add(stop);
                stops.Insert(0, stop);  // 修改后的效果,就不会改变激活的stop对象了
            }
            finally
            {
                this.m_collectionlock.ReleaseWriterLock();
                WriteDebugInfo("collection write unlock 2\r\n");
            }

            //SetToolTipText();
        }
Esempio n. 27
0
        // 移走一个Stop对象
        // locks: 集合写锁
        public void Remove(Stop stop, bool bChangeState = true)
        {
            WriteDebugInfo("collection write lock 3\r\n");
            this.m_collectionlock.AcquireWriterLock(Stop.m_nLockTimeout);
            try
            {
                stops.Remove(stop);

                if (bChangeState == true)
                    ChangeState(null,
                        StateParts.All,
                        false); // false表示不加集合锁
            }
            finally
            {
                this.m_collectionlock.ReleaseWriterLock();
                WriteDebugInfo("collection write unlock 3\r\n");

            }

            //SetToolTipText();

        }
Esempio n. 28
0
        /// <summary>
        /// 结束检索
        /// </summary>
        /// <returns>返回 0</returns>
        public int EndSearch()
        {
            if (Stop != null) // 脱离关联
            {
                Stop.Unregister();	// 和容器关联
                Stop = null;
            }

            this.Channel.BeforeLogin -= new DigitalPlatform.LibraryClient.BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.Close();
            this.Channel = null;

            return 0;
        }
Esempio n. 29
0
        private void Form1_Load(object sender, System.EventArgs e)
        {
            if (ApplicationDeployment.IsNetworkDeployed == true)
            {
                // MessageBox.Show(this, "network");
                DataDir = Application.LocalUserAppDataPath;
            }
            else
            {
                // MessageBox.Show(this, "no network");
                DataDir = Environment.CurrentDirectory;
            }

            // 从文件中装载创建一个ServerCollection对象
            // parameters:
            //		bIgnorFileNotFound	是否不抛出FileNotFoundException异常。
            //							如果==true,函数直接返回一个新的空ServerCollection对象
            // Exception:
            //			FileNotFoundException	文件没找到
            //			SerializationException	版本迁移时容易出现

            try
            {
                Servers = ServerCollection.Load(this.DataDir
                                                + "\\manager_servers.bin",
                                                true);
                Servers.ownerForm = this;
            }
            catch (SerializationException ex)
            {
                MessageBox.Show(this, ex.Message);
                Servers = new ServerCollection();
                // 设置文件名,以便本次运行结束时覆盖旧文件
                Servers.FileName = this.DataDir
                                   + "\\manager_servers.bin";
            }

            this.Servers.ServerChanged += new ServerChangedEventHandle(Servers_ServerChanged);

            // 从文件中装载创建一个LinkInfoCollection对象
            // parameters:
            //		bIgnorFileNotFound	是否不抛出FileNotFoundException异常。
            //							如果==true,函数直接返回一个新的空ServerCollection对象
            // Exception:
            //			FileNotFoundException	文件没找到
            //			SerializationException	版本迁移时容易出现
            try
            {
                LinkInfos = LinkInfoCollection.Load(this.DataDir
                                                    + "\\manager_linkinfos.bin",
                                                    true);
            }
            catch (SerializationException ex)
            {
                MessageBox.Show(this, ex.Message);
                LinkInfos = new LinkInfoCollection();
                // 设置文件名,以便本次运行结束时覆盖旧文件
                LinkInfos.FileName = this.DataDir
                                     + "\\manager_linkinfos.bin";
            }



            // 设置窗口尺寸状态
            if (AppInfo != null)
            {
                SetFirstDefaultFont();

                MainForm.SetControlFont(this, this.DefaultFont);

                AppInfo.LoadFormStates(this,
                                       "mainformstate");
            }

            stopManager.Initial(toolBarButton_stop,
                                this.toolStripStatusLabel_main,
                                this.toolStripProgressBar_main);
            stop = new DigitalPlatform.Stop();
            stop.Register(this.stopManager, true);              // 和容器关联

            /*
             *          this.Channels.procAskAccountInfo =
             *                  new Delegate_AskAccountInfo(this.Servers.AskAccountInfo);
             */
            this.Channels.AskAccountInfo += new AskAccountInfoEventHandle(this.Servers.OnAskAccountInfo);



            // 简单检索界面准备工作
            treeView_res.AppInfo = this.AppInfo;                // 便于treeview中popup菜单修改配置文件时保存dialog尺寸位置

            treeView_res.stopManager = this.stopManager;

            treeView_res.Servers = this.Servers;                // 引用

            treeView_res.Channels = this.Channels;              // 引用

            treeView_res.Fill(null);

            //
            LinkInfos.Channels = this.Channels;

            int    nRet     = 0;
            string strError = "";

            nRet = this.LinkInfos.Link(out strError);
            if (nRet == -1)
            {
                MessageBox.Show(this, strError);
            }
        }
Esempio n. 30
0
        /// <summary>
        /// 准备进行检索
        /// </summary>
        /// <returns>0: 没有成功; 1: 成功</returns>
        public int PrepareSearch()
        {
            if (String.IsNullOrEmpty(this.LibraryServerUrlList) == true)
                return 0;

            if (this.Channel == null)
                this.Channel = new LibraryChannel();

            this.Channel.Url = GetFirstUrl(this.LibraryServerUrlList);

            this.Channel.BeforeLogin -= new DigitalPlatform.LibraryClient.BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new DigitalPlatform.LibraryClient.BeforeLoginEventHandle(Channel_BeforeLogin);

            Stop = new DigitalPlatform.Stop();
            Stop.Register(stopManager, true);	// 和容器关联

            return 1;
        }
Esempio n. 31
0
        // 检索出盘点库内全部批次号名称
        int SearchAllBatchNo(
            LibraryChannel channel,
            Stop stop,
            string strInventoryDbName,
            out string strError)
        {
            strError = "";

            this.listView_records.Items.Clear();

            // EnableControls(false);
            stop.OnStop += new StopEventHandler(channel.DoStop);
            stop.Initial("正在列出全部批次号 ...");
            stop.BeginLoop();

            try
            {
                // 构造检索式
                StringBuilder text = new StringBuilder();

                text.Append("<target list='"
                        + StringUtil.GetXmlStringSimple(strInventoryDbName + ":" + "批次号")
                        + "'>");
                // 当前是否为全局用户
                bool bGlobalUser = this._libraryCodeList.Count == 0 || this._libraryCodeList.IndexOf("") != -1;
                    // 全局用户只认列表中 "" 一个值。这样可以检索出全部批次号,包括各个分馆的
                if (bGlobalUser == true && this._libraryCodeList.Count != 1)
                {
                    this._libraryCodeList.Clear();
                    this._libraryCodeList.Add("");
                }
                int i = 0;
                foreach (string librarycode in this.LibraryCodeList)
                {
                    if (i > 0)
                        text.Append("<operator value='OR' />");

                    text.Append("<item><word>"
                        + StringUtil.GetXmlStringSimple(bGlobalUser ? "" : librarycode + "-")
                        + "</word><match>left</match><relation>=</relation><dataType>string</dataType><maxCount>-1</maxCount></item><lang>zh</lang>");
                    i++;
                }

                if (bGlobalUser == true)
                {
                    if (i > 0)
                        text.Append("<operator value='OR' />");

                    // 针对空批次号的检索。空只能被全局用户可见
                    text.Append("<item><word>"
            + StringUtil.GetXmlStringSimple("")
            + "</word><match>exact</match><relation>=</relation><dataType>string</dataType><maxCount>-1</maxCount></item><lang>zh</lang>");
                    i++;
                }

                text.Append("</target>");

#if NO
                // 构造检索式
                string strQueryXml = "<target list='"
                        + StringUtil.GetXmlStringSimple(strInventoryDbName + ":" + "批次号")
                        + "'><item><word>"
                        + StringUtil.GetXmlStringSimple("")
                        + "</word><match>left</match><relation>=</relation><dataType>string</dataType><maxCount>-1</maxCount></item><lang>zh</lang>";
                strQueryXml += "<operator value='OR' />";
                strQueryXml += "<item><word>"
        + StringUtil.GetXmlStringSimple("")
        + "</word><match>exact</match><relation>=</relation><dataType>string</dataType><maxCount>-1</maxCount></item><lang>zh</lang></target>";
#endif

                long lRet = channel.Search(
                    stop,
                    text.ToString(),
                    "batchno",
                    "keycount", // strOutputStyle
                    out strError);
                if (lRet == 0)
                {
                    strError = "not found";
                    return 0;   // not found
                }
                if (lRet == -1)
                    return -1;

                long lHitCount = lRet;

                long lStart = 0;
                long lCount = lHitCount;
                DigitalPlatform.CirculationClient.localhost.Record[] searchresults = null;

                // 装入浏览格式
                for (; ; )
                {
                    Application.DoEvents();	// 出让界面控制权

                    if (stop != null && stop.State != 0)
                    {
                        strError = "用户中断";
                        return -1;
                    }

                    lRet = channel.GetSearchResult(
                        stop,
                        "batchno",   // strResultSetName
                        lStart,
                        lCount,
                        "keycount",
                        "zh",
                        out searchresults,
                        out strError);
                    if (lRet == -1)
                    {
                        strError = "GetSearchResult() error: " + strError;
                        return -1;
                    }

                    if (lRet == 0)
                    {
                        // MessageBox.Show(this, "未命中");
                        return 0;
                    }

                    // 处理浏览结果
                    foreach (Record record in searchresults)
                    {
                        if (record.Cols == null)
                        {
                            strError = "请更新应用服务器和数据库内核到最新版本,才能使用列出批次号的功能";
                            return -1;
                        }

                        // 跳过数字为 0 的事项
                        if (record.Cols.Length > 0 && record.Cols[0] == "0")
                            continue;

                        ListViewItem item = new ListViewItem();
                        item.Text = string.IsNullOrEmpty(record.Path) == false ? record.Path : "[空]";
                        ListViewUtil.ChangeItemText(item, 1, record.Cols[0]);

                        this.listView_records.Items.Add(item);
                    }

                    lStart += searchresults.Length;
                    lCount -= searchresults.Length;

                    stop.SetMessage("共命中 " + lHitCount.ToString() + " 条,已装入 " + lStart.ToString() + " 条");

                    if (lStart >= lHitCount || lCount <= 0)
                        break;
                }

            }
            finally
            {
                stop.EndLoop();
                stop.OnStop -= new StopEventHandler(channel.DoStop);
                stop.Initial("");

                // EnableControls(true);
            }
            return 1;
        }
Esempio n. 32
0
        // 注: Stop 的使用有 Bug 2016/6/28
        public int RunScript(string strProjectName,
                             string strProjectLocate,
                             out string strError)
        {
            EnableControls(false);

#if NO
            // BUG!!!
            Stop = new DigitalPlatform.Stop();
            Stop.Register(stopManager, true);   // 和容器关联
#endif

            this.Stop.OnStop += new StopEventHandler(this.DoStop);
            this.Stop.Initial("正在执行脚本 ...");
            this.Stop.BeginLoop();

            _dllPaths.Clear();
            _dllPaths.Add(strProjectLocate);
            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);

            try
            {
                int nRet = 0;
                strError = "";

                this.objStatis    = null;
                this.AssemblyMain = null;

                // 2009/11/5
                // 防止以前残留的打开的文件依然没有关闭
                Global.ForceGarbageCollection();

                nRet = PrepareScript(strProjectName,
                                     strProjectLocate,
                                     out this.objStatis,
                                     out strError);
                if (nRet == -1)
                {
                    goto ERROR1;
                }

                objStatis.ProjectDir = strProjectLocate;
                // objStatis.Console = this.Console;

                // 执行脚本的Main()

                if (objStatis != null)
                {
                    EventArgs args = new EventArgs();
                    objStatis.Main(this, args);
                }

                return(0);

ERROR1:
                return(-1);
            }
            catch (Exception ex)
            {
                strError = "脚本 '" + strProjectName + "' 执行过程抛出异常: \r\n" + ExceptionUtil.GetDebugText(ex);
                return(-1);
            }
            finally
            {
                this.Stop.EndLoop();
                this.Stop.OnStop -= new StopEventHandler(this.DoStop);
                this.Stop.Initial("");

                this.AssemblyMain = null;

#if NO
                // BUG!!!
                if (Stop != null)      // 脱离关联
                {
                    Stop.Unregister(); // 和容器关联
                    Stop = null;
                }
#endif

                EnableControls(true);
                AppDomain.CurrentDomain.AssemblyResolve -= new ResolveEventHandler(CurrentDomain_AssemblyResolve);
            }
        }
Esempio n. 33
0
        private async void Iso2709StatisForm_Load(object sender, EventArgs e)
        {
            if (Program.MainForm != null)
            {
                MainForm.SetControlFont(this, Program.MainForm.DefaultFont);
            }



#if NO
            this.Channel.Url = Program.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);  // 和容器关联
#endif

            ScriptManager.CfgFilePath = Path.Combine(
                Program.MainForm.UserDir,
                "iso2709_statis_projects.xml");

#if NO
            ScriptManager.applicationInfo = Program.MainForm.AppInfo;
            ScriptManager.CfgFilePath     =
                Program.MainForm.DataDir + "\\iso2709_statis_projects.xml";
            ScriptManager.DataDir = Program.MainForm.DataDir;

            ScriptManager.CreateDefaultContent -= new CreateDefaultContentEventHandler(scriptManager_CreateDefaultContent);
            ScriptManager.CreateDefaultContent += new CreateDefaultContentEventHandler(scriptManager_CreateDefaultContent);

            try
            {
                ScriptManager.Load();
            }
            catch (FileNotFoundException)
            {
                // 不必报错 2009/2/4
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message);
            }
#endif

            // 输入的ISO2709文件名
            this._openMarcFileDialog.FileName = Program.MainForm.AppInfo.GetString(
                "iso2709statisform",
                "input_iso2709_filename",
                "");

            // 编码方式
            this._openMarcFileDialog.EncodingName = Program.MainForm.AppInfo.GetString(
                "iso2709statisform",
                "input_iso2709_file_encoding",
                "");

            this._openMarcFileDialog.MarcSyntax = Program.MainForm.AppInfo.GetString(
                "iso2709statisform",
                "input_marc_syntax",
                "unimarc");

            this._openMarcFileDialog.Mode880 = Program.MainForm.AppInfo.GetBoolean(
                "iso2709statisform",
                "input_mode880",
                false);

            // 方案名
            this.textBox_projectName.Text = Program.MainForm.AppInfo.GetString(
                "iso2709statisform",
                "projectname",
                "");

            /*
             * var ret = await Program.MainForm.EnsureConnectLibraryServerAsync();
             * if (ret == false)
             * {
             *  MessageBox.Show(this, "连接到 dp2library 失败,ISO2709 统计窗无法打开");
             *  this.Close();
             * }
             */
        }
Esempio n. 34
0
        private void OperLogStatisForm_Load(object sender, EventArgs e)
        {
            if (Program.MainForm != null)
            {
                MainForm.SetControlFont(this, Program.MainForm.DefaultFont);
            }
#if NO
            this.Channel.Url = Program.MainForm.LibraryServerUrl;

            this.Channel.BeforeLogin -= new BeforeLoginEventHandle(Channel_BeforeLogin);
            this.Channel.BeforeLogin += new BeforeLoginEventHandle(Channel_BeforeLogin);

            stop = new DigitalPlatform.Stop();
            stop.Register(MainForm.stopManager, true);  // 和容器关联
#endif

            ScriptManager.CfgFilePath = Path.Combine(
                Program.MainForm.UserDir,
                "statis_projects.xml");

#if NO
            ScriptManager.applicationInfo = Program.MainForm.AppInfo;
            ScriptManager.CfgFilePath     =
                Program.MainForm.DataDir + "\\statis_projects.xml";
            ScriptManager.DataDir = Program.MainForm.DataDir;

            ScriptManager.CreateDefaultContent -= new CreateDefaultContentEventHandler(scriptManager_CreateDefaultContent);
            ScriptManager.CreateDefaultContent += new CreateDefaultContentEventHandler(scriptManager_CreateDefaultContent);

            try
            {
                ScriptManager.Load();
            }
            catch (FileNotFoundException)
            {
                // 不必报错 2009/2/4
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message);
            }
#endif

            // 方案名
            this.textBox_projectName.Text = Program.MainForm.AppInfo.GetString(
                "operlogstatisform",
                "projectname",
                "");

            // 起始日期
            this.dateControl_start.Text = Program.MainForm.AppInfo.GetString(
                "operlogstatisform",
                "start_date",
                "");

            // 结束日期
            this.dateControl_end.Text = Program.MainForm.AppInfo.GetString(
                "operlogstatisform",
                "end_date",
                "");

            /*
             * // 如何输出表格
             * this.checkBox_startToEndTable.Checked = Program.MainForm.AppInfo.GetBoolean(
             *  "operlogstatisform",
             *  "startToEndTable",
             *  true);
             * this.checkBox_perYearTable.Checked = Program.MainForm.AppInfo.GetBoolean(
             *  "operlogstatisform",
             *  "perYearTable",
             *  false);
             * this.checkBox_perMonthTable.Checked = Program.MainForm.AppInfo.GetBoolean(
             *  "operlogstatisform",
             *  "perMonthTable",
             *  false);
             * this.checkBox_perDayTable.Checked = Program.MainForm.AppInfo.GetBoolean(
             *  "operlogstatisform",
             *  "perDayTable",
             *  false);
             * */
        }