Esempio n. 1
0
 public void HideForm()
 {
     if (mHunterConfig.notifyOption.FirstMinimize)
     {
         HunterNotify.ShowBalloonTip(5, "Hunter 3", "Hunter 3 已经最小化到通知区域,请单击它还原窗口。", ToolTipIcon.Info);
     }
     Hide();
     mHunterConfig.notifyOption.FirstMinimize = false;
 }
Esempio n. 2
0
        private void Init()
        {
            hunterFormTitle.Owner          = this;
            HunterNotify.MouseDoubleClick += NotifyDbClick;
            HunterNotify.MouseMove        += NotifyMove;

            //绑定事件
            this.miQuick.Click         += new System.EventHandler(this.miQuick_Click);
            this.miNew.Click           += new System.EventHandler(this.miNew_Click);
            this.miOpen.Click          += new System.EventHandler(this.miOpen_Click);
            this.miClose.Click         += new System.EventHandler(this.miClose_Click);
            this.miModify.Click        += new System.EventHandler(this.miModify_Click);
            this.miQuit.Click          += new System.EventHandler(this.miQuit_Click);
            this.miNewStrategy.Click   += new System.EventHandler(this.miNewStrategy_Click);
            this.miEditStrategy.Click  += new System.EventHandler(this.miEditStrategy_Click);
            this.miConfig.Size          = new System.Drawing.Size(60, 21);
            this.miProxyList.Click     += new System.EventHandler(this.miProxyList_Click);
            this.miFilter.Click        += new System.EventHandler(this.miFilter_Click);
            this.miToogleProxy.Click   += new System.EventHandler(this.miToogleProxy_Click);
            this.miCls.Click           += new System.EventHandler(this.miCls_Click);
            this.miDownloaded.Click    += new System.EventHandler(this.miDownloaded_Click);
            this.miAbandonLinks.Click  += new System.EventHandler(this.miAbandonLinks_Click);
            this.miAbandonFiles.Size    = new System.Drawing.Size(181, 22);
            this.miAbandonFiles.Text    = "显示已抛弃文件";
            this.miAbandonFiles.Click  += new System.EventHandler(this.miAbandonFiles_Click);
            this.miExceptions.Click    += new System.EventHandler(this.miExceptions_Click);
            this.miPause.Click         += new System.EventHandler(this.miPause_Click);
            this.miHunter3Editor.Click += new System.EventHandler(this.miOpenH3Editor_Click);
            this.miAbout.Click         += new System.EventHandler(this.miAbout_Click);

            //---

            cbViewAbandonFiles.ForeColor = HunterConfig.ColorAbandonFile;
            cbViewDetails.ForeColor      = HunterConfig.ColorDetails;
            cbViewDownloads.ForeColor    = HunterConfig.ColorDownload;
            cbViewExceptions.ForeColor   = HunterConfig.ColorException;
            cbViewAbandonLinks.ForeColor = HunterConfig.ColorAbandonLink;
            cbViewProxy.ForeColor        = HunterConfig.ColorProxy;
            cbViewHTML.ForeColor         = HunterConfig.ColorHTML;

            lbDownloads.ForeColor    = HunterConfig.ColorDownload;
            lbExceptions.ForeColor   = HunterConfig.ColorException;
            lbAbandonFiles.ForeColor = HunterConfig.ColorAbandonFile;
            lbAbandonLinks.ForeColor = HunterConfig.ColorAbandonLink;

            hunterTextBox.Dock        = DockStyle.Fill;
            hunterTextBox.ReadOnly    = true;
            hunterTextBox.ScrollBars  = RichTextBoxScrollBars.Vertical;
            hunterTextBox.BorderStyle = BorderStyle.None;
            HContainer.Panel1.Controls.Add(hunterTextBox);
            HContainer.SplitterDistance = splitterdistance;


            lbDownloads.Text    = strDownloads + Downloads;
            lbExceptions.Text   = strExceptions + Exceptions;
            lbAbandonFiles.Text = strAbandonFiles + AbandonFiles;
            lbAbandonLinks.Text = strAbandonLinks + AbandonLinks;

            mHunterConfig = HunterConfig.Load();
            cbViewAbandonFiles.Checked = mHunterConfig.viewOption.AbandonFiles;
            cbViewAbandonLinks.Checked = mHunterConfig.viewOption.AbandonLinks;
            cbViewDownloads.Checked    = mHunterConfig.viewOption.DownloadItems;
            cbViewDetails.Checked      = mHunterConfig.viewOption.Details;
            cbViewExceptions.Checked   = mHunterConfig.viewOption.Exceptions;
            cbViewProxy.Checked        = mHunterConfig.viewOption.Proxies;
            cbViewHTML.Checked         = mHunterConfig.viewOption.HTML;
            miToogleProxy.Checked      = mHunterConfig.UseProxy;
            miPause.Enabled            = false;

            switch (mHunterConfig.HunterCore)
            {
            case HunterConfig.Core.Default:
                miCoreAuto.Checked = true;
                break;

            case HunterConfig.Core.IE:
                miCoreIE.Checked = true;
                break;

            case HunterConfig.Core.WebRequest:
                miCoreHunter.Checked = true;
                break;
            }

            WriteMessage("搜索策略文件:" + mHunterConfig.CurrentStrategyFile);
            try
            {
                LoadStrategy(mHunterConfig.CurrentStrategyFile).GetStrategyInformation();
                WriteMessage("Hunter 准备就绪,可以打开任务进行爬虫下载了!");
            }
            catch (Exception ex)
            {
                WriteMessage("错误:" + ex.Message);
            }

            LoadStrategyList();
            LoadPluginList();

            if (mHunterConfig.notifyOption.FirstBallon)
            {
                HunterNotify.ShowBalloonTip(2, "Hunter 3", "这里是Hunter 3 的通知区域图标,单击它可以隐藏窗口。", ToolTipIcon.Info);
                mHunterConfig.notifyOption.FirstBallon = false;
            }

            flowMain.MouseDown  += SaveLocation;
            flowMain.MouseMove  += MoveWindow;
            flowMain.MouseLeave += ResetLocOffset;

            picLogo.MouseDown  += SaveLocation;
            picLogo.MouseMove  += MoveWindow;
            picLogo.MouseLeave += ResetLocOffset;

            msMenu.MouseDown  += SaveLocation;
            msMenu.MouseMove  += MoveWindow;
            msMenu.MouseLeave += ResetLocOffset;

            hunterFormTitle.AddMouseDown(SaveLocation);
            hunterFormTitle.AddMouseMove(MoveWindow);
            hunterFormTitle.AddMouseLeave(ResetLocOffset);
        }