Example #1
0
 /// <summary>
 /// 初始化停止管理器
 /// </summary>
 /// <param name="buttonStop">停止按钮</param>
 /// <param name="labelMessage">消息标签</param>
 public void InitialStopManager(Button buttonStop,
                                Label labelMessage)
 {
     stopManager.Initial(buttonStop,
                         labelMessage,
                         null);
     stop = new DigitalPlatform.Stop();
     stop.Register(this.stopManager, true);      // 和容器关联
 }
Example #2
0
        private void SelectDictionaryItemDialog_Load(object sender, EventArgs e)
        {
#if NO
            // 第一次检索装载
            {
                this.toolStripLabel_currentKey.Text = this.Key;

                string        strError = "";
                List <string> results  = new List <string>();
                int           nRet     = Search(this.DbName,
                                                this.Key,
                                                "exact",
                                                1000,
                                                ref results,
                                                out strError);
                if (nRet == -1)
                {
                    MessageBox.Show(this, strError);
                }

                FillListView(results);
            }
#endif
            _stopManager.Initial(this.toolStripButton_stop,
                                 (object)this.label_message,
                                 (object)null);

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


#if NO
            if (string.IsNullOrEmpty(ColumnWidthList) == false)
            {
                ListViewUtil.SetColumnHeaderWidth(this.listView_list,
                                                  ColumnWidthList,
                                                  true);
            }
#endif
            this.SetUiState(this.UiStates);

            this.BeginInvoke(new Delegate_FillLevels(this.FillLevels));
        }
Example #3
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));
        }
Example #4
0
        private void SelectItemDialog_Load(object sender, EventArgs e)
        {
            Program.MainForm.FillBiblioFromList(this.comboBox_from);

#if NO
            {
                _floatingMessage         = new FloatingMessageForm(this);
                _floatingMessage.Font    = new System.Drawing.Font(this.Font.FontFamily, this.Font.Size * 2, FontStyle.Bold);
                _floatingMessage.Opacity = 0.7;
                _floatingMessage.Show(this);
            }
#endif
            this._floatingMessage.RectColor = Color.Purple;

            stopManager.Initial(this.button_stop,
                                (object)this.toolStripStatusLabel1,
                                (object)this.toolStripProgressBar1);

            if (stop != null)
            {
                stop.Unregister();
            }

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

            if (this.AutoSearch == true &&
                string.IsNullOrEmpty(this.textBox_queryWord.Text) == false)
            {
                this.BeginInvoke(new Action <object, EventArgs>(button_search_Click), this, new EventArgs());
            }

            if (StringUtil.CompareVersion(Program.MainForm.ServerVersion, "2.33") < 0)
            {
                MessageBox.Show(this, "选择册记录功能要求 dp2Library 版本必须在 2.33 以上。当前 dp2Library 的版本为 " + Program.MainForm.ServerVersion.ToString() + ",请及时升级");
            }
        }
Example #5
0
        private void MainFormNew_Load(object sender, EventArgs e)
        {
            Searching(false);   // 隐藏searching ToolStripLabel

            if (ApplicationDeployment.IsNetworkDeployed == true)
            {
                // MessageBox.Show(this, "network");
                DataDir = Application.LocalUserAppDataPath;
            }
            else
            {
                // MessageBox.Show(this, "no network");
                DataDir = Environment.CurrentDirectory;
            }


            this.SetMenuItemState();                 //任延华加 2006/1/5
            this.toolBarButton_stop.Enabled = false; //任延华加 2006/1/5


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

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

            string strError = "";
            int    nRet     = cfgCache.Load(this.DataDir
                                            + "\\cfgcache.xml",
                                            out strError);

            if (nRet == -1)
            {
                if (IsFirstRun == false)
                {
                    MessageBox.Show(strError + "\r\n\r\n程序稍后会尝试自动创建这个文件");
                }
            }


            cfgCache.TempDir = this.DataDir
                               + "\\cfgcache";
            cfgCache.InstantSave = true;


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

                MainForm.SetControlFont(this, this.DefaultFont);

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


            stopManager.Initial(toolBarButton_stop,
                                (object)this.toolStripStatusLabel_main,
                                (object)this.toolStripProgressBar_main);

            // 存在上次遗留的窗口
            int nLastSearchWindow = this.AppInfo.GetInt(
                "main_form",
                "last_search_window",
                1);

            if (nLastSearchWindow == 1)
            {
                MenuItem_openSearch_Click(null, null);  // 打开一个检索窗
            }

            if (IsFirstRun == true && this.Servers.Count == 0)
            {
                MessageBox.Show(this, "欢迎您安装使用dp2rms -- 资源管理。");
                ManageServers(true);
                ManagePreference();
            }
        }
Example #6
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);
            }
        }