Ejemplo n.º 1
0
        private void ReadMyFav()
        {
            List <FavForlder> forlders = Mdb.GetFavForlders();

            foreach (FavForlder forlder in forlders)
            {
                ToolStripDropDownButton dropbutton = new ToolStripDropDownButton(forlder.forlder_name, imageList2.Images[0]);
                dropbutton.MouseUp += new MouseEventHandler(dropbutton_MouseUp);
                dropbutton.Tag      = forlder;
                toolStrip1.Items.Insert(toolStrip1.Items.Count - 2, dropbutton);
                ToolStripMenuItem item = new ToolStripMenuItem("添加到本文件夹", null, new EventHandler(AddFavButton_Click));
                item.Tag = forlder.id;
                dropbutton.DropDownItems.Add(item);
                ToolStripSeparator separator = new ToolStripSeparator();
                dropbutton.DropDownItems.Add(separator);
                List <FavSiteurl> siteurls = Mdb.GetFavSiteurls(forlder.id);
                foreach (FavSiteurl siteurl in siteurls)
                {
                    ToolStripMenuItem button = new ToolStripMenuItem(siteurl.siteurl_name, imageList2.Images[1]);
                    button.Tag      = siteurl;
                    button.MouseUp += new MouseEventHandler(button_MouseUp);
                    dropbutton.DropDownItems.Add(button);
                }
            }
            List <FavSiteurl> siteurlsx = Mdb.GetFavSiteurls(0);

            foreach (FavSiteurl siteurl in siteurlsx)
            {
                ToolStripButton button = new ToolStripButton(siteurl.siteurl_name, imageList2.Images[1]);
                button.Tag      = siteurl;
                button.MouseUp += new MouseEventHandler(button_MouseUp);
                toolStrip1.Items.Insert(toolStrip1.Items.Count - 2, button);
            }
        }
Ejemplo n.º 2
0
 private void Change_SearchShow(ToolStripMenuItem item)
 {
     toolStripDropDownButton2.Image = item.Image;
     toolStripDropDownButton2.Text  = item.Text;
     toolStripDropDownButton2.Tag   = ((string)item.Tag).Split(new string[] { "</>" }, StringSplitOptions.None)[2];
     Mdb.SetOther("searchInfo", (string)item.Tag);
     comboBox1.Focus();
     comboBox1.SelectAll();
 }
Ejemplo n.º 3
0
        private void  除DToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            FavForlder forlder = (FavForlder)contextMenuStrip2.Tag;

            if (MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
            {
                Mdb.DeleteForlder(forlder.id);
                toolStrip1.Items.Remove((ToolStripDropDownButton)forlder.tag);
            }
        }
Ejemplo n.º 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox2.Text == "")
            {
                textBox2.Focus();
                return;
            }
            forlder = forlder == null?Mdb.AddForlder(textBox2.Text) : Mdb.UpdateForlder(forlder.id, textBox2.Text);

            DialogResult = DialogResult.OK;
        }
Ejemplo n.º 5
0
 private void Form1_FormClosing(object sender, FormClosingEventArgs e)
 {
     //记住窗体位置
     Mdb.SetOther("isNormalForm", WindowState == FormWindowState.Normal ? "1" : "0");
     if (WindowState == FormWindowState.Normal)
     {
         Mdb.SetOther("formLeft", Left.ToString());
         Mdb.SetOther("formTop", Top.ToString());
         Mdb.SetOther("formWidth", Width.ToString());
         Mdb.SetOther("formHeight", Height.ToString());
     }
 }
Ejemplo n.º 6
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox2.Text == "")
            {
                textBox2.Focus();
                return;
            }
            if (textBox3.Text == "")
            {
                textBox3.Focus();
                return;
            }
            siteurl = siteurl == null?Mdb.AddSiteurl(0, textBox2.Text, textBox3.Text) : Mdb.UpdateSiteurl(siteurl.id, siteurl.forlder_id, textBox2.Text, textBox3.Text);

            DialogResult = DialogResult.OK;
        }
Ejemplo n.º 7
0
 private void  除DToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
     {
         FavSiteurl siteurl = (FavSiteurl)contextMenuStrip1.Tag;
         Mdb.DeleteSiteurl(siteurl.id);
         if ((siteurl.tag as ToolStripMenuItem) == null)
         {
             ToolStripButton button = (ToolStripButton)siteurl.tag;
             button.GetCurrentParent().Items.Remove(button);
         }
         else
         {
             ToolStripMenuItem item = (ToolStripMenuItem)siteurl.tag;
             item.GetCurrentParent().Items.Remove(item);
         }
     }
 }
Ejemplo n.º 8
0
        private void Refresh_Searches()
        {
            List <object[]> searches = Mdb.GetSearches();

            for (int i = toolStripDropDownButton2.DropDownItems.Count - 3; i >= 0; i--)
            {
                toolStripDropDownButton2.DropDownItems.RemoveAt(i);
            }
            foreach (object[] search in searches)
            {
                string            imgPath = search[1].ToString() == "" ? "" : ((((string)search[1])[1] == ':' ? "" : Application.StartupPath + @"\") + (string)search[1]);
                ToolStripMenuItem item    = new ToolStripMenuItem((string)search[0], File.Exists(imgPath)?Image.FromFile(imgPath):imageList2.Images[1]);
                item.Tag    = string.Format("{0}</>{1}</>{2}", search[0], search[1], search[2]);
                item.Click += new EventHandler(item_Click);
                toolStripDropDownButton2.DropDownItems.Insert(toolStripDropDownButton2.DropDownItems.Count - 2, item);
            }
            string[] searchInfos = Mdb.GetOther("searchInfo").Split(new string[] { "</>" }, StringSplitOptions.RemoveEmptyEntries);
            toolStripDropDownButton2.Text  = searchInfos[0];
            toolStripDropDownButton2.Image = File.Exists(searchInfos[1]) ? Image.FromFile(searchInfos[1]) : imageList2.Images[1];
            toolStripDropDownButton2.Tag   = searchInfos[2];
        }
Ejemplo n.º 9
0
 private void 收藏夹SToolStripMenuItem_Click(object sender, EventArgs e)
 {
     panel1.Visible = splitter1.Visible = 收藏夹SToolStripMenuItem.Checked;
     Mdb.SetOther("collectionStyle", 收藏夹SToolStripMenuItem.Checked ? "1" : "0");
     if (收藏夹SToolStripMenuItem.Checked)
     {
         收藏BToolStripMenuItem_DropDownOpening(null, null);
         Application.DoEvents();
         历史记录HToolStripMenuItem.Checked = false;
         panel1.Width = int.Parse(Mdb.GetOther("collectionWidth"));
         if (treeView1.Nodes.Count == 0)
         {
             for (int i = 3; i < 收藏BToolStripMenuItem.DropDownItems.Count; i++)
             {
                 string tag = (string)收藏BToolStripMenuItem.DropDownItems[i].Tag;
                 if (tag != "folder")
                 {
                     TreeNode node = new TreeNode(收藏BToolStripMenuItem.DropDownItems[i].Text, 2, 2);
                     node.Tag = tag;
                     treeView1.Nodes.Add(node);
                 }
                 else
                 {
                     TreeNode nodex = new TreeNode(收藏BToolStripMenuItem.DropDownItems[i].Text, 1, 1);
                     nodex.Tag = tag;
                     treeView1.Nodes.Add(nodex);
                     foreach (ToolStripMenuItem item in ((ToolStripMenuItem)收藏BToolStripMenuItem.DropDownItems[i]).DropDownItems)
                     {
                         TreeNode nodey = new TreeNode(item.Text, 2, 2);
                         nodey.Tag = item.Tag;
                         nodex.Nodes.Add(nodey);
                     }
                 }
             }
         }
         treeView1.BringToFront();
     }
 }
Ejemplo n.º 10
0
 private void Form1_Load(object sender, EventArgs e)
 {
     toolStripButton9.Image      = imageList1.Images[0];
     toolStripButton19.Image     = imageList1.Images[0];
     toolStripStatusLabel3.Image = imageList2.Images[1];
     toolStripStatusLabel1.Image = imageList1.Images[0];
     //读取自身收藏夹
     //ReadMyFav();
     //读取皮肤
     skin.SkinFile = Application.StartupPath + @"\skin.ssk";
     Application.DoEvents();
     //设置任务栏位置
     toolStrip3.Dock = Mdb.GetOther("taskbarStyle") == "top" ? DockStyle.Top : DockStyle.Bottom;
     //设置搜索器
     Refresh_Searches();
     //设置收藏夹样式
     if (Mdb.GetOther("collectionStyle") == "1")
     {
         toolStripButton5.Checked = true;
         toolStripButton5_Click(null, null);
     }
     else if (Mdb.GetOther("collectionStyle") == "2")
     {
         历史记录HToolStripMenuItem.Checked = true;
         收藏夹SToolStripMenuItem_Click(null, null);
     }
     if (Mdb.GetOther("isNormalForm") != "1")
     {
         WindowState = FormWindowState.Maximized;
     }
     else
     {
         Left   = int.Parse(Mdb.GetOther("formLeft"));
         Top    = int.Parse(Mdb.GetOther("formTop"));
         Width  = int.Parse(Mdb.GetOther("formWidth"));
         Height = int.Parse(Mdb.GetOther("formHeight"));
     }
 }
Ejemplo n.º 11
0
 private void 历史记录HToolStripMenuItem_Click(object sender, EventArgs e)
 {
     panel1.Visible = splitter1.Visible = 历史记录HToolStripMenuItem.Checked;
     Mdb.SetOther("collectionStyle", 历史记录HToolStripMenuItem.Checked ? "2" : "0");
     if (历史记录HToolStripMenuItem.Checked)
     {
         收藏夹SToolStripMenuItem.Checked = toolStripButton5.Checked = false;
         panel1.Width = int.Parse(Mdb.GetOther("collectionWidth"));
         if (treeView2.Nodes.Count == 0)
         {
             UrlHistoryWrapperClass.STATURLEnumerator enumerator = new UrlHistoryWrapperClass().GetEnumerator();
             while (enumerator.MoveNext())
             {
                 if (!string.IsNullOrEmpty(enumerator.Current.Title))
                 {
                     TreeNode node = new TreeNode(enumerator.Current.Title, 2, 2);
                     node.Tag = enumerator.Current.URL;
                     treeView2.Nodes.Add(node);
                 }
             }
         }
         treeView2.BringToFront();
     }
 }
Ejemplo n.º 12
0
 private void splitter1_SplitterMoved(object sender, SplitterEventArgs e)
 {
     Mdb.SetOther("collectionWidth", panel1.Width.ToString());
 }
Ejemplo n.º 13
0
 private void toolStripButton19_Click(object sender, EventArgs e)
 {
     toolStrip3.Dock = toolStrip3.Dock == DockStyle.Bottom ? DockStyle.Top : DockStyle.Bottom;
     Mdb.SetOther("taskbarStyle", toolStrip3.Dock == DockStyle.Top ? "top" : "bottom");
 }