This commit is contained in:
Ray 2019-04-20 17:05:55 +01:00
parent 0e70f6b56e
commit 18dc43e491
12 changed files with 523 additions and 470 deletions

View File

@ -125,7 +125,7 @@ namespace bzit.bomg
this.memoBox1.Name = "memoBox1";
this.memoBox1.Padding = new System.Windows.Forms.Padding(10, 10, 3, 9);
this.memoBox1.Size = new System.Drawing.Size(336, 83);
this.memoBox1.TabIndex = 69;
this.memoBox1.TabIndex = 3;
//
// textBox2
//
@ -137,7 +137,7 @@ namespace bzit.bomg
this.textBox2.Name = "textBox2";
this.textBox2.Padding = new System.Windows.Forms.Padding(10, 10, 9, 9);
this.textBox2.Size = new System.Drawing.Size(259, 32);
this.textBox2.TabIndex = 67;
this.textBox2.TabIndex = 0;
//
// textBox1
//
@ -149,7 +149,7 @@ namespace bzit.bomg
this.textBox1.Name = "textBox1";
this.textBox1.Padding = new System.Windows.Forms.Padding(10, 10, 9, 9);
this.textBox1.Size = new System.Drawing.Size(259, 32);
this.textBox1.TabIndex = 66;
this.textBox1.TabIndex = 2;
//
// horizontalSeparator1
//
@ -174,7 +174,7 @@ namespace bzit.bomg
this.button1.OverImage = null;
this.button1.Padding = new System.Windows.Forms.Padding(4, 4, 3, 3);
this.button1.Size = new System.Drawing.Size(64, 32);
this.button1.TabIndex = 2;
this.button1.TabIndex = 1;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2

View File

@ -134,6 +134,16 @@ namespace bzit.bomg
return;
}
if (string.IsNullOrWhiteSpace(textBox1.Text))
{
return;
}
if (string.IsNullOrWhiteSpace(textBox2.Text))
{
return;
}
if (itemModel == null)
{
itemModel = new BookmarkItemModel();

View File

@ -3,7 +3,7 @@ using System.Drawing;
using System.IO;
using RyzStudio.Data.SQLite;
namespace bzit.bomg
namespace bzit.bomg.Data
{
public class IconDatabase : SQLiteDatabase2
{
@ -19,19 +19,17 @@ namespace bzit.bomg
return false;
}
return this.DoNonQuery(@"
CREATE TABLE bzt_app_bomg_icons
return this.DoNonQuery(@"
CREATE TABLE bzt_app_bomg_icons
(
ico_id INTEGER PRIMARY KEY,
ico_id INTEGER PRIMARY KEY,
ico_key TEXT,
ico_hash TEXT,
ico_content BLOB
)
)
") >= 0;
}
#region public methods
public bool HasIcon(string url)
{
return this.DoQueryExist("SELECT 1 FROM bzt_app_bomg_icons WHERE ico_key='" + escapeValue(url) + "'");
@ -102,8 +100,6 @@ namespace bzit.bomg
this.DoNonQuery("DELETE FROM bzt_app_bomg_icons WHERE ico_key='" + escapeValue(url) + "';");
}
#endregion
protected string imageToSQLString(Image image)
{
MemoryStream stream = new MemoryStream();
@ -115,10 +111,7 @@ namespace bzit.bomg
return bytesToSQLString(byteArray);
}
protected string bytesToSQLString(byte[] image)
{
return Convert.ToBase64String(image);
}
protected string bytesToSQLString(byte[] image) => Convert.ToBase64String(image);
protected Image sqlStringToImage(string base64_string)
{

309
MainForm.Designer.cs generated
View File

@ -98,6 +98,7 @@ namespace bzit.bomg
this.toolStripMenuItem20 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator13 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripMenuItem22 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
this.treeView1 = new RyzStudio.Windows.Forms.BookmarkTreeView();
this.pageTreeNodeMenu.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).BeginInit();
@ -107,9 +108,9 @@ namespace bzit.bomg
this.toolStrip2.SuspendLayout();
this.rootTreeNodeMenu.SuspendLayout();
this.SuspendLayout();
//
//
// pageTreeNodeMenu
//
//
this.pageTreeNodeMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItem4,
this.toolStripSeparator3,
@ -120,54 +121,54 @@ namespace bzit.bomg
this.moveFileToToolStripMenuItem});
this.pageTreeNodeMenu.Name = "listViewMenu";
this.pageTreeNodeMenu.Size = new System.Drawing.Size(139, 126);
//
//
// toolStripMenuItem4
//
//
this.toolStripMenuItem4.Name = "toolStripMenuItem4";
this.toolStripMenuItem4.Size = new System.Drawing.Size(138, 22);
this.toolStripMenuItem4.Text = "&Open";
this.toolStripMenuItem4.Click += new System.EventHandler(this.openContextMenu_Click);
//
//
// toolStripSeparator3
//
//
this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(135, 6);
//
//
// toolStripMenuItem8
//
//
this.toolStripMenuItem8.Name = "toolStripMenuItem8";
this.toolStripMenuItem8.Size = new System.Drawing.Size(138, 22);
this.toolStripMenuItem8.Text = "E&dit";
this.toolStripMenuItem8.Click += new System.EventHandler(this.editContextMenu3_Click);
//
//
// toolStripMenuItem6
//
//
this.toolStripMenuItem6.Name = "toolStripMenuItem6";
this.toolStripMenuItem6.Size = new System.Drawing.Size(138, 22);
this.toolStripMenuItem6.Text = "D&elete";
this.toolStripMenuItem6.Click += new System.EventHandler(this.deleteContextMenu2_Click);
//
//
// toolStripSeparator2
//
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(135, 6);
//
//
// listViewMenuItem1
//
//
this.listViewMenuItem1.Name = "listViewMenuItem1";
this.listViewMenuItem1.Size = new System.Drawing.Size(138, 22);
this.listViewMenuItem1.Text = "Move &Up";
this.listViewMenuItem1.Click += new System.EventHandler(this.moveUpContextMenu2_Click);
//
//
// moveFileToToolStripMenuItem
//
//
this.moveFileToToolStripMenuItem.Name = "moveFileToToolStripMenuItem";
this.moveFileToToolStripMenuItem.Size = new System.Drawing.Size(138, 22);
this.moveFileToToolStripMenuItem.Text = "Move &Down";
this.moveFileToToolStripMenuItem.Click += new System.EventHandler(this.moveDownContextMenu2_Click);
//
//
// statusBar1
//
//
this.statusBar1.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.statusBar1.Location = new System.Drawing.Point(0, 634);
this.statusBar1.Name = "statusBar1";
@ -178,20 +179,20 @@ namespace bzit.bomg
this.statusBar1.Size = new System.Drawing.Size(304, 20);
this.statusBar1.SizingGrip = false;
this.statusBar1.TabIndex = 9;
//
//
// statusBarPanel1
//
//
this.statusBarPanel1.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
this.statusBarPanel1.Name = "statusBarPanel1";
this.statusBarPanel1.Width = 204;
//
//
// statusBarPanel2
//
//
this.statusBarPanel2.Alignment = System.Windows.Forms.HorizontalAlignment.Center;
this.statusBarPanel2.Name = "statusBarPanel2";
//
//
// toolStrip1
//
//
this.toolStrip1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
this.toolStrip1.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -208,9 +209,9 @@ namespace bzit.bomg
this.toolStrip1.Size = new System.Drawing.Size(304, 25);
this.toolStrip1.TabIndex = 25;
this.toolStrip1.Text = "toolStrip1";
//
//
// toolStripDropDownButton1
//
//
this.toolStripDropDownButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.toolStripDropDownButton1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.newFileMenuItem,
@ -229,89 +230,89 @@ namespace bzit.bomg
this.toolStripDropDownButton1.ShowDropDownArrow = false;
this.toolStripDropDownButton1.Size = new System.Drawing.Size(29, 22);
this.toolStripDropDownButton1.Text = "&File";
//
//
// newFileMenuItem
//
//
this.newFileMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("newFileMenuItem.Image")));
this.newFileMenuItem.Name = "newFileMenuItem";
this.newFileMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N)));
this.newFileMenuItem.Size = new System.Drawing.Size(186, 22);
this.newFileMenuItem.Text = "&New";
this.newFileMenuItem.Click += new System.EventHandler(this.newMenuItem_Click);
//
//
// openFileMenuItem
//
//
this.openFileMenuItem.Image = global::bzit.bomg.Properties.Resources.folder_page;
this.openFileMenuItem.Name = "openFileMenuItem";
this.openFileMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O)));
this.openFileMenuItem.Size = new System.Drawing.Size(186, 22);
this.openFileMenuItem.Text = "&Open";
this.openFileMenuItem.Click += new System.EventHandler(this.openMenuItem_Click);
//
//
// toolStripSeparator1
//
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(183, 6);
//
//
// closeFileMenuItem
//
//
this.closeFileMenuItem.Name = "closeFileMenuItem";
this.closeFileMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.W)));
this.closeFileMenuItem.Size = new System.Drawing.Size(186, 22);
this.closeFileMenuItem.Text = "&Close";
this.closeFileMenuItem.Click += new System.EventHandler(this.closeMenuItem_Click);
//
//
// toolStripSeparator4
//
//
this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(183, 6);
//
//
// saveFileMenuItem
//
//
this.saveFileMenuItem.Image = global::bzit.bomg.Properties.Resources.disk;
this.saveFileMenuItem.Name = "saveFileMenuItem";
this.saveFileMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S)));
this.saveFileMenuItem.Size = new System.Drawing.Size(186, 22);
this.saveFileMenuItem.Text = "&Save";
this.saveFileMenuItem.Click += new System.EventHandler(this.importSnapshotToolStripMenuItem_Click);
//
//
// saveAsFileMenuItem
//
//
this.saveAsFileMenuItem.Image = global::bzit.bomg.Properties.Resources.page_white_disk;
this.saveAsFileMenuItem.Name = "saveAsFileMenuItem";
this.saveAsFileMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
this.saveAsFileMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
| System.Windows.Forms.Keys.S)));
this.saveAsFileMenuItem.Size = new System.Drawing.Size(186, 22);
this.saveAsFileMenuItem.Text = "Save &As";
this.saveAsFileMenuItem.Click += new System.EventHandler(this.exportSnapshotToolStripMenuItem_Click);
//
//
// toolStripSeparator8
//
//
this.toolStripSeparator8.Name = "toolStripSeparator8";
this.toolStripSeparator8.Size = new System.Drawing.Size(183, 6);
//
//
// exportFileMenuItem
//
//
this.exportFileMenuItem.Enabled = false;
this.exportFileMenuItem.Name = "exportFileMenuItem";
this.exportFileMenuItem.Size = new System.Drawing.Size(186, 22);
this.exportFileMenuItem.Text = "&Export";
this.exportFileMenuItem.Click += new System.EventHandler(this.toolStripMenuItem7_Click);
//
//
// toolStripSeparator6
//
//
this.toolStripSeparator6.Name = "toolStripSeparator6";
this.toolStripSeparator6.Size = new System.Drawing.Size(183, 6);
//
//
// exitFileMenuItem
//
//
this.exitFileMenuItem.Name = "exitFileMenuItem";
this.exitFileMenuItem.Size = new System.Drawing.Size(186, 22);
this.exitFileMenuItem.Text = "E&xit";
this.exitFileMenuItem.Click += new System.EventHandler(this.exitMenuItem_Click);
//
//
// toolStripDropDownButton2
//
//
this.toolStripDropDownButton2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.toolStripDropDownButton2.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.findEditMenuItem});
@ -320,18 +321,18 @@ namespace bzit.bomg
this.toolStripDropDownButton2.ShowDropDownArrow = false;
this.toolStripDropDownButton2.Size = new System.Drawing.Size(31, 22);
this.toolStripDropDownButton2.Text = "&Edit";
//
//
// findEditMenuItem
//
//
this.findEditMenuItem.Image = global::bzit.bomg.Properties.Resources.magnifier;
this.findEditMenuItem.Name = "findEditMenuItem";
this.findEditMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F)));
this.findEditMenuItem.Size = new System.Drawing.Size(180, 22);
this.findEditMenuItem.Size = new System.Drawing.Size(137, 22);
this.findEditMenuItem.Text = "&Find";
this.findEditMenuItem.Click += new System.EventHandler(this.toolStripButton5_Click);
//
//
// toolStripDropDownButton3
//
//
this.toolStripDropDownButton3.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.toolStripDropDownButton3.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.expandAllViewMenuItem,
@ -341,25 +342,25 @@ namespace bzit.bomg
this.toolStripDropDownButton3.ShowDropDownArrow = false;
this.toolStripDropDownButton3.Size = new System.Drawing.Size(36, 22);
this.toolStripDropDownButton3.Text = "&View";
//
//
// expandAllViewMenuItem
//
//
this.expandAllViewMenuItem.Enabled = false;
this.expandAllViewMenuItem.Name = "expandAllViewMenuItem";
this.expandAllViewMenuItem.Size = new System.Drawing.Size(180, 22);
this.expandAllViewMenuItem.Size = new System.Drawing.Size(136, 22);
this.expandAllViewMenuItem.Text = "&Expand All";
this.expandAllViewMenuItem.Click += new System.EventHandler(this.expandAllToolStripMenuItem_Click);
//
//
// collapseAllViewMenuItem
//
//
this.collapseAllViewMenuItem.Enabled = false;
this.collapseAllViewMenuItem.Name = "collapseAllViewMenuItem";
this.collapseAllViewMenuItem.Size = new System.Drawing.Size(180, 22);
this.collapseAllViewMenuItem.Size = new System.Drawing.Size(136, 22);
this.collapseAllViewMenuItem.Text = "&Collapse All";
this.collapseAllViewMenuItem.Click += new System.EventHandler(this.collapseAllToolStripMenuItem_Click);
//
//
// toolStripDropDownButton4
//
//
this.toolStripDropDownButton4.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.toolStripDropDownButton4.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.updateIconsToolMenuItem,
@ -370,31 +371,31 @@ namespace bzit.bomg
this.toolStripDropDownButton4.ShowDropDownArrow = false;
this.toolStripDropDownButton4.Size = new System.Drawing.Size(39, 22);
this.toolStripDropDownButton4.Text = "&Tools";
//
//
// updateIconsToolMenuItem
//
//
this.updateIconsToolMenuItem.Name = "updateIconsToolMenuItem";
this.updateIconsToolMenuItem.Size = new System.Drawing.Size(180, 22);
this.updateIconsToolMenuItem.Size = new System.Drawing.Size(143, 22);
this.updateIconsToolMenuItem.Text = "&Update Icons";
this.updateIconsToolMenuItem.Click += new System.EventHandler(this.toolStripMenuItem1_Click);
//
//
// toolStripSeparator14
//
//
this.toolStripSeparator14.Name = "toolStripSeparator14";
this.toolStripSeparator14.Size = new System.Drawing.Size(177, 6);
//
this.toolStripSeparator14.Size = new System.Drawing.Size(140, 6);
//
// optionsToolMenuItem
//
//
this.optionsToolMenuItem.Enabled = false;
this.optionsToolMenuItem.Image = global::bzit.bomg.Properties.Resources.cog;
this.optionsToolMenuItem.Name = "optionsToolMenuItem";
this.optionsToolMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F12;
this.optionsToolMenuItem.Size = new System.Drawing.Size(180, 22);
this.optionsToolMenuItem.Size = new System.Drawing.Size(143, 22);
this.optionsToolMenuItem.Text = "&Options";
this.optionsToolMenuItem.Click += new System.EventHandler(this.optionsToolStripMenuItem1_Click);
//
//
// toolStripDropDownButton5
//
//
this.toolStripDropDownButton5.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.toolStripDropDownButton5.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.viewHelpHelpMenuItem,
@ -405,31 +406,31 @@ namespace bzit.bomg
this.toolStripDropDownButton5.ShowDropDownArrow = false;
this.toolStripDropDownButton5.Size = new System.Drawing.Size(36, 22);
this.toolStripDropDownButton5.Text = "&Help";
//
//
// viewHelpHelpMenuItem
//
//
this.viewHelpHelpMenuItem.Image = global::bzit.bomg.Properties.Resources.help;
this.viewHelpHelpMenuItem.Name = "viewHelpHelpMenuItem";
this.viewHelpHelpMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F1;
this.viewHelpHelpMenuItem.Size = new System.Drawing.Size(180, 22);
this.viewHelpHelpMenuItem.Size = new System.Drawing.Size(146, 22);
this.viewHelpHelpMenuItem.Text = "View &Help";
this.viewHelpHelpMenuItem.Click += new System.EventHandler(this.documentationToolStripMenuItem_Click);
//
//
// toolStripSeparator12
//
//
this.toolStripSeparator12.Name = "toolStripSeparator12";
this.toolStripSeparator12.Size = new System.Drawing.Size(177, 6);
//
this.toolStripSeparator12.Size = new System.Drawing.Size(143, 6);
//
// aboutHelpMenuItem
//
//
this.aboutHelpMenuItem.Image = global::bzit.bomg.Properties.Resources.comment;
this.aboutHelpMenuItem.Name = "aboutHelpMenuItem";
this.aboutHelpMenuItem.Size = new System.Drawing.Size(180, 22);
this.aboutHelpMenuItem.Size = new System.Drawing.Size(146, 22);
this.aboutHelpMenuItem.Text = "&About";
this.aboutHelpMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem1_Click);
//
//
// toolStripDropDownButton7
//
//
this.toolStripDropDownButton7.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.toolStripDropDownButton7.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.alwaysOnTopToolStripMenuItem});
@ -439,23 +440,23 @@ namespace bzit.bomg
this.toolStripDropDownButton7.Size = new System.Drawing.Size(16, 22);
this.toolStripDropDownButton7.Text = "&?";
this.toolStripDropDownButton7.Visible = false;
//
//
// alwaysOnTopToolStripMenuItem
//
//
this.alwaysOnTopToolStripMenuItem.Name = "alwaysOnTopToolStripMenuItem";
this.alwaysOnTopToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F11)));
this.alwaysOnTopToolStripMenuItem.Size = new System.Drawing.Size(205, 22);
this.alwaysOnTopToolStripMenuItem.Text = "Always On Top";
this.alwaysOnTopToolStripMenuItem.Click += new System.EventHandler(this.alwaysOnTopToolStripMenuItem_Click);
//
//
// openFileDialog
//
//
this.openFileDialog.DefaultExt = "ryz";
this.openFileDialog.Filter = "Bookmarks files|*.ryz";
this.openFileDialog.Title = "Open bookmarks file";
//
//
// folderTreeNodeMenu
//
//
this.folderTreeNodeMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItem15,
this.toolStripMenuItem16,
@ -470,102 +471,103 @@ namespace bzit.bomg
this.toolStripMenuItem13});
this.folderTreeNodeMenu.Name = "listViewMenu";
this.folderTreeNodeMenu.Size = new System.Drawing.Size(139, 198);
//
//
// toolStripMenuItem15
//
//
this.toolStripMenuItem15.Name = "toolStripMenuItem15";
this.toolStripMenuItem15.Size = new System.Drawing.Size(138, 22);
this.toolStripMenuItem15.Text = "Add &Page";
this.toolStripMenuItem15.Click += new System.EventHandler(this.addPageContextMenu2_Click);
//
//
// toolStripMenuItem16
//
//
this.toolStripMenuItem16.Name = "toolStripMenuItem16";
this.toolStripMenuItem16.Size = new System.Drawing.Size(138, 22);
this.toolStripMenuItem16.Text = "Add &Folder";
this.toolStripMenuItem16.Click += new System.EventHandler(this.addFolderContextMenu2_Click);
//
//
// toolStripSeparator5
//
//
this.toolStripSeparator5.Name = "toolStripSeparator5";
this.toolStripSeparator5.Size = new System.Drawing.Size(135, 6);
//
//
// toolStripMenuItem14
//
//
this.toolStripMenuItem14.Name = "toolStripMenuItem14";
this.toolStripMenuItem14.Size = new System.Drawing.Size(138, 22);
this.toolStripMenuItem14.Text = "&Open All";
this.toolStripMenuItem14.Click += new System.EventHandler(this.openAllContextMenu_Click);
//
//
// toolStripMenuItem9
//
//
this.toolStripMenuItem9.Name = "toolStripMenuItem9";
this.toolStripMenuItem9.Size = new System.Drawing.Size(138, 22);
this.toolStripMenuItem9.Text = "Edi&t";
this.toolStripMenuItem9.Click += new System.EventHandler(this.editContextMenu2_Click);
//
//
// toolStripMenuItem11
//
//
this.toolStripMenuItem11.Name = "toolStripMenuItem11";
this.toolStripMenuItem11.Size = new System.Drawing.Size(138, 22);
this.toolStripMenuItem11.Text = "D&elete";
this.toolStripMenuItem11.Click += new System.EventHandler(this.deleteContextMenu_Click);
//
//
// toolStripSeparator7
//
//
this.toolStripSeparator7.Name = "toolStripSeparator7";
this.toolStripSeparator7.Size = new System.Drawing.Size(135, 6);
//
//
// sortToolStripMenuItem
//
//
this.sortToolStripMenuItem.Name = "sortToolStripMenuItem";
this.sortToolStripMenuItem.Size = new System.Drawing.Size(138, 22);
this.sortToolStripMenuItem.Text = "&Sort";
this.sortToolStripMenuItem.Click += new System.EventHandler(this.sortContextMenu2_Click);
//
//
// toolStripSeparator11
//
//
this.toolStripSeparator11.Name = "toolStripSeparator11";
this.toolStripSeparator11.Size = new System.Drawing.Size(135, 6);
//
//
// toolStripMenuItem12
//
//
this.toolStripMenuItem12.Name = "toolStripMenuItem12";
this.toolStripMenuItem12.Size = new System.Drawing.Size(138, 22);
this.toolStripMenuItem12.Text = "Move &Up";
this.toolStripMenuItem12.Click += new System.EventHandler(this.moveUpContextMenu_Click);
//
//
// toolStripMenuItem13
//
//
this.toolStripMenuItem13.Name = "toolStripMenuItem13";
this.toolStripMenuItem13.Size = new System.Drawing.Size(138, 22);
this.toolStripMenuItem13.Text = "Move &Down";
this.toolStripMenuItem13.Click += new System.EventHandler(this.moveDownContextMenu_Click);
//
//
// saveFileDialog
//
this.saveFileDialog.DefaultExt = "ryz";
this.saveFileDialog.Filter = "Bookmarks file|*.ryz|Bookmarks file (password protected)|*.ryz";
//
this.saveFileDialog.DefaultExt = "jsnx";
this.saveFileDialog.Filter = "Bookmarks file|*.jsnx|Bookmarks file (password protected)|*.jsnx";
this.saveFileDialog.Title = "Save bookmarks file";
//
//
// toolStrip2
//
//
this.toolStrip2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
this.toolStrip2.CanOverflow = false;
this.toolStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.newMenuBarItem,
this.openMenuBarItem,
this.saveMenuBarItem,
this.toolStripSeparator9});
this.toolStripSeparator9,
this.toolStripButton1});
this.toolStrip2.Location = new System.Drawing.Point(0, 25);
this.toolStrip2.Name = "toolStrip2";
this.toolStrip2.RenderMode = System.Windows.Forms.ToolStripRenderMode.System;
this.toolStrip2.Size = new System.Drawing.Size(304, 25);
this.toolStrip2.TabIndex = 26;
this.toolStrip2.Text = "toolStrip2";
//
//
// newMenuBarItem
//
//
this.newMenuBarItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.newMenuBarItem.Image = ((System.Drawing.Image)(resources.GetObject("newMenuBarItem.Image")));
this.newMenuBarItem.ImageTransparentColor = System.Drawing.Color.Magenta;
@ -574,9 +576,9 @@ namespace bzit.bomg
this.newMenuBarItem.Text = "toolStripButton1";
this.newMenuBarItem.ToolTipText = "New";
this.newMenuBarItem.Click += new System.EventHandler(this.newMenuItem_Click);
//
//
// openMenuBarItem
//
//
this.openMenuBarItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.openMenuBarItem.Image = global::bzit.bomg.Properties.Resources.folder_page;
this.openMenuBarItem.ImageTransparentColor = System.Drawing.Color.Magenta;
@ -585,9 +587,9 @@ namespace bzit.bomg
this.openMenuBarItem.Text = "toolStripButton2";
this.openMenuBarItem.ToolTipText = "Open";
this.openMenuBarItem.Click += new System.EventHandler(this.openMenuItem_Click);
//
//
// saveMenuBarItem
//
//
this.saveMenuBarItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.saveMenuBarItem.Image = global::bzit.bomg.Properties.Resources.disk;
this.saveMenuBarItem.ImageTransparentColor = System.Drawing.Color.Magenta;
@ -596,14 +598,14 @@ namespace bzit.bomg
this.saveMenuBarItem.Text = "toolStripButton3";
this.saveMenuBarItem.ToolTipText = "Save";
this.saveMenuBarItem.Click += new System.EventHandler(this.importSnapshotToolStripMenuItem_Click);
//
//
// toolStripSeparator9
//
//
this.toolStripSeparator9.Name = "toolStripSeparator9";
this.toolStripSeparator9.Size = new System.Drawing.Size(6, 25);
//
//
// rootTreeNodeMenu
//
//
this.rootTreeNodeMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItem17,
this.toolStripMenuItem18,
@ -613,56 +615,68 @@ namespace bzit.bomg
this.toolStripMenuItem22});
this.rootTreeNodeMenu.Name = "listViewMenu";
this.rootTreeNodeMenu.Size = new System.Drawing.Size(133, 104);
//
//
// toolStripMenuItem17
//
//
this.toolStripMenuItem17.Name = "toolStripMenuItem17";
this.toolStripMenuItem17.Size = new System.Drawing.Size(132, 22);
this.toolStripMenuItem17.Text = "Add &Page";
this.toolStripMenuItem17.Click += new System.EventHandler(this.addPageContextMenu_Click);
//
//
// toolStripMenuItem18
//
//
this.toolStripMenuItem18.Name = "toolStripMenuItem18";
this.toolStripMenuItem18.Size = new System.Drawing.Size(132, 22);
this.toolStripMenuItem18.Text = "Add &Folder";
this.toolStripMenuItem18.Click += new System.EventHandler(this.addFolderContextMenu_Click);
//
//
// toolStripSeparator10
//
//
this.toolStripSeparator10.Name = "toolStripSeparator10";
this.toolStripSeparator10.Size = new System.Drawing.Size(129, 6);
//
//
// toolStripMenuItem20
//
//
this.toolStripMenuItem20.Name = "toolStripMenuItem20";
this.toolStripMenuItem20.Size = new System.Drawing.Size(132, 22);
this.toolStripMenuItem20.Text = "Edi&t";
this.toolStripMenuItem20.Click += new System.EventHandler(this.editContextMenu_Click);
//
//
// toolStripSeparator13
//
//
this.toolStripSeparator13.Name = "toolStripSeparator13";
this.toolStripSeparator13.Size = new System.Drawing.Size(129, 6);
//
//
// toolStripMenuItem22
//
//
this.toolStripMenuItem22.Name = "toolStripMenuItem22";
this.toolStripMenuItem22.Size = new System.Drawing.Size(132, 22);
this.toolStripMenuItem22.Text = "&Sort";
this.toolStripMenuItem22.Click += new System.EventHandler(this.sortContextMenu_Click);
//
//
// toolStripButton1
//
this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.toolStripButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton1.Image")));
this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButton1.Name = "toolStripButton1";
this.toolStripButton1.Size = new System.Drawing.Size(23, 22);
this.toolStripButton1.Text = "toolStripButton1";
this.toolStripButton1.Click += new System.EventHandler(this.toolStripButton1_Click);
//
// treeView1
//
//
this.treeView1.AllowDrop = true;
this.treeView1.BackColor = System.Drawing.Color.White;
this.treeView1.Dock = System.Windows.Forms.DockStyle.Fill;
this.treeView1.HasChanged = false;
this.treeView1.HideSelection = false;
this.treeView1.HotTracking = true;
this.treeView1.ImageIndex = 0;
this.treeView1.LabelEdit = true;
this.treeView1.Location = new System.Drawing.Point(0, 50);
this.treeView1.Name = "treeView1";
this.treeView1.PathSeparator = "\n";
this.treeView1.SelectedImageIndex = 0;
this.treeView1.ShowNodeToolTips = true;
this.treeView1.Size = new System.Drawing.Size(304, 584);
@ -670,9 +684,9 @@ namespace bzit.bomg
this.treeView1.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView1_NodeMouseClick);
this.treeView1.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView1_NodeMouseDoubleClick);
this.treeView1.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.treeView1_PreviewKeyDown);
//
//
// MainForm
//
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.SystemColors.Control;
this.ClientSize = new System.Drawing.Size(304, 654);
@ -769,6 +783,7 @@ namespace bzit.bomg
private System.Windows.Forms.ToolStripMenuItem findEditMenuItem;
private System.Windows.Forms.ToolStripMenuItem updateIconsToolMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator14;
private System.Windows.Forms.ToolStripButton toolStripButton1;
}
}

View File

@ -1,8 +1,10 @@
using bzit.bomg.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Windows.Forms;
using static RyzStudio.Windows.Forms.BookmarkTreeView;
namespace bzit.bomg
{
@ -382,7 +384,7 @@ namespace bzit.bomg
/**
* File -> Exit
*/
private void exitMenuItem_Click(object sender, EventArgs e) { this.Close(); }
private void exitMenuItem_Click(object sender, EventArgs e) => this.Close();
/**
* Find
@ -490,89 +492,6 @@ namespace bzit.bomg
#endregion
//#region TreeView Menu - item
/**
* Node -> Open
*/
//private void toolStripMenuItem4_Click(object sender, EventArgs e)
//{
// openBookmark(treeView1.SelectedNode);
//}
/**
* Node -> Edit
*/
//private void toolStripMenuItem8_Click(object sender, EventArgs e)
//{
// if (treeView1.SelectedNode == null)
// {
// return;
// }
// treeView1.HasChanged = true;
// TreeNode tn = treeView1.SelectedNode;
// //##BookmarkEditForm oBookmarkEdit = new BookmarkEditForm(ref tn);
// //##oBookmarkEdit.ShowDialog();
//}
/**
* Node -> Delete
*/
//private void toolStripMenuItem6_Click(object sender, EventArgs e) => treeView1.SNode.Delete();
//{
// treeView1.DeleteNode();
//}
//#endregion
//#region TreeView Menu - folder
/**
* Add Page
*/
//private void toolStripMenuItem15_Click(object sender, EventArgs e) { treeView1.AddBookmarkPage(); }
/**
* Add Folder
*/
//private void toolStripMenuItem16_Click(object sender, EventArgs e) => treeView1.SelectedNode = treeView1.SNode.AddFolder();
/**
* Open All
*/
//private void toolStripMenuItem14_Click(object sender, EventArgs e)
//{
// if (treeView1.SelectedNode == null)
// {
// return;
// }
// foreach (TreeNode tn in treeView1.SelectedNode.Nodes)
// {
// if (tn.Tag == null)
// {
// continue;
// }
// openBookmark(tn);
// }
//}
/**
* Edit
*/
//private void toolStripMenuItem9_Click(object sender, EventArgs e)
//{
// treeView1.HasChanged = true;
// //##treeView1.EditNode();
//}
//#endregion
protected void OpenBookmarkFile(string filename)
{
treeView1.HasChanged = false;
@ -640,6 +559,9 @@ namespace bzit.bomg
return rv;
}
private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
if (e.Button != MouseButtons.Right)
@ -673,59 +595,31 @@ namespace bzit.bomg
return;
}
NodeType nodeType = treeView1.SNode.GetNodeType();
switch (e.KeyCode)
{
case Keys.Apps:
treeView1_NodeMouseClick(sender, new TreeNodeMouseClickEventArgs(tn, MouseButtons.Right, 1, tn.Bounds.X, tn.Bounds.Y));
return;
//case Keys.F2:
//if (tn.Tag == null)
//{
// return;
//}
//if (!(tn.Tag is BookmarkItem))
//{
// return;
//}
//toolStripMenuItem8_Click(sender, null);
//break;
case Keys.F3:
if (tn.Tag == null)
{
return;
}
if (!(tn.Tag is BookmarkItem))
{
return;
}
BookmarkItem bookmarkItem = (BookmarkItem)tn.Tag;
if (bookmarkItem == null)
{
return;
}
if (string.IsNullOrEmpty(bookmarkItem.SiteAddress))
{
return;
}
try
{
Clipboard.SetText(bookmarkItem.SiteAddress.Trim());
}
catch
{
// do nothing
}
break;
case Keys.Enter:
openBookmark(tn);
break;
case Keys.Insert:
if (e.Modifiers != Keys.Shift)
{
if ((nodeType == NodeType.Root) || (nodeType == NodeType.Folder))
{
(new BookmarkEditForm(treeView1)).ShowDialog();
}
else if (nodeType == NodeType.Page)
{
treeView1.SelectedNode = tn.Parent;
(new BookmarkEditForm(treeView1)).ShowDialog();
}
}
break;
default: break;
}
@ -881,8 +775,15 @@ namespace bzit.bomg
private void moveUpContextMenu2_Click(object sender, EventArgs e) => treeView1.SNode.MoveUp();
private void moveDownContextMenu2_Click(object sender, EventArgs e) => treeView1.SNode.MoveDown();
#endregion
private void toolStripButton1_Click(object sender, EventArgs e)
{
List<BookmarkItemViewModel> rs = treeView1.GetBookmarkList();
//MessageBox.Show(treeView1.GetNodePath(treeView1.SelectedNode));
MessageBox.Show("!");
}
}
}

View File

@ -156,15 +156,30 @@
<data name="newMenuBarItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAHaSURBVDhPjZO9S1tRGMZtnfo/VHASCkWkCRlFKB0KdVB0
KIWCDgpuanHoWOlklxJCcBG3QoeCe5dEpEXRBBW/oCIOSfNlbnI/zjn3Xn36vofe670mpb7wI8N9n1+e
c3LTE5nHRIJI/Yd+4iHRMQnHcYxcLnft+z66IaVEOp3+TLtdJSkOW5YF27ZDWq0Wms0mKpWKlpTLZWQy
mQ7JAyLFC0IIKKX0J2OaJgzDQLVa1QJqCf6SbDYbSPRogdcqQl7taEEg4UC73UatVosdh+GMTtNogThd
gDiaDRc8z9PnDo5Sr9d1k1KpdCu4uZx/ZB68Gdn79nxNHs9A7r+GPF+B29iC71oxCTfh+2g0GrcCeTK9
qk7mIM8W4V6sQP36ALE3BmvzGcTBUqwJH4fvhEWhAJjsdfbHN+TZOxJ8IsEynOIEnMIUfE/pRcZ1XX0v
LGFCAc/V7uigKL6COl+GOn0PK/cUrnEYhhluEVwut4kJrO0XL0VhFPaPIZibT6h+Aur3dx0K4AYMhzsF
P4ffFr4MrPuyDo8Qxx8hL792hKPEBDThi3SXaIso/IwzOk2jBfl8/uau4F/Q7jVndPrvJOnnsflBt0AU
3qHX2aQM/3vD6SOSBFvvA4V7+v4ABhqcM6lhVZQAAAAASUVORK5CYII=
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAHZSURBVDhPjZM7SxxRGIY1qfwPClaCICFkZUsRxELQQkmK
EAjEQsHOCxYpFSttZFmWNJJOsAik2yKwBAkJiu6i4g0iYrGbvbmzO5dzzszE1+87OOOOay4fPEyx5332
PWfmtDVNJxEj4v+gm3hCtEzMcRwjk8n89n0fjyGlRCKRWKe1j0riHLYsC7Zth9TrddRqNRSLRS0pFApI
JpMtknYizguEEFBK6SdjmiYMw0CpVNICagn+k1QqFUj0aIFXz0Fe72pBIOFAo9FAuVyObIfhjE7TaIE4
m4M4ng4XeJ6n9x1spVKp6Cb5fP5ecHM122Eevhnc/zS0IU+mIA9eQ16swq1+g+9aEQk34fOoVqv3Ank6
+UGdzkCez8O9XIX6uQSxPw5r+wXE4WKkCW+Hz4RFoQB49dQ5mPgszxdIsEaCZTi5l3Cy7+B7Si9kXNfV
58ISJhTwXO+NPRO5UaiLZaiz97C+9sE1jsIwwy2Cw+U2EYG1MzwismOwvz+Hud1L9WNQv77oUAA3YDjc
Kvgx8Da72fPRlxV4hDhZgbzaagk3ExHQhB/SQ5pbNMO/cUanabQgnU7fPBT8Cf7sOaPTd9NPr8f+22UK
uLszJmX49obTRfQTbP0fKNzWdQu5+pvuDaXQ3AAAAABJRU5ErkJggg==
</value>
</data>
<data name="toolStripButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
</value>
</data>
<metadata name="rootTreeNodeMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">

View File

@ -43,7 +43,7 @@ namespace bzit.bomg
this.textBox2.Margin = new System.Windows.Forms.Padding(10, 6, 10, 6);
this.textBox2.Name = "textBox2";
this.textBox2.Padding = new System.Windows.Forms.Padding(10, 10, 9, 9);
this.textBox2.Size = new System.Drawing.Size(276, 33);
this.textBox2.Size = new System.Drawing.Size(276, 32);
this.textBox2.TabIndex = 68;
//
// label2
@ -98,6 +98,7 @@ namespace bzit.bomg
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.Text = "New Session";
this.ResumeLayout(false);
this.PerformLayout();

View File

@ -60,34 +60,34 @@ namespace bzit.bomg
protected override void saveToXmlTextWriter(ref XmlTextWriter writer)
{
if (parentForm.treeView1.Nodes.Count <= 0)
{
return;
}
//if (parentForm.treeView1.Nodes.Count <= 0)
//{
// return;
//}
writer.Formatting = Formatting.Indented;
writer.WriteStartDocument();
writer.WriteStartElement(CONST_PRODUCT);
writer.WriteStartElement("b");
writer.WriteStartElement("g");
writer.WriteAttributeString("name", parentForm.treeView1.Nodes[0].Text);
//writer.Formatting = Formatting.Indented;
//writer.WriteStartDocument();
//writer.WriteStartElement(CONST_PRODUCT);
//writer.WriteStartElement("b");
//writer.WriteStartElement("g");
//writer.WriteAttributeString("name", parentForm.treeView1.Nodes[0].Text);
foreach (TreeNode tn in parentForm.treeView1.NodeList)
{
BookmarkItem bi = (BookmarkItem)tn.Tag;
//foreach (TreeNode tn in parentForm.treeView1.NodeList)
//{
// BookmarkItem bi = (BookmarkItem)tn.Tag;
writer.WriteStartElement("m");
writer.WriteElementString("name", parentForm.treeView1.GetNodeFullPath(tn));
writer.WriteElementString("address", bi.SiteAddress);
writer.WriteElementString("description", bi.Description);
writer.WriteElementString("created", bi.Created.ToString());
writer.WriteEndElement();
}
// writer.WriteStartElement("m");
// writer.WriteElementString("name", parentForm.treeView1.GetNodeFullPath(tn));
// writer.WriteElementString("address", bi.SiteAddress);
// writer.WriteElementString("description", bi.Description);
// writer.WriteElementString("created", bi.Created.ToString());
// writer.WriteEndElement();
//}
writer.WriteEndElement();
writer.WriteEndElement();
writer.WriteEndElement();
writer.WriteEndDocument();
//writer.WriteEndElement();
//writer.WriteEndElement();
//writer.WriteEndElement();
//writer.WriteEndDocument();
}
}
}

View File

@ -59,57 +59,57 @@ namespace bzit.bomg
private void mainThread_DoWork(object sender, DoWorkEventArgs e)
{
TreeNode[] nodeList = parentForm.treeView1.NodeList;
for (int i=0; i< nodeList.Length; i++)
{
if (progressBar1.InvokeRequired)
{
progressBar1.Invoke(new Action(() => progressBar1.Value = (i + 1) ));
}
else
{
progressBar1.Value = (i + 1);
}
//TreeNode[] nodeList = parentForm.treeView1.NodeList;
//for (int i=0; i< nodeList.Length; i++)
//{
// if (progressBar1.InvokeRequired)
// {
// progressBar1.Invoke(new Action(() => progressBar1.Value = (i + 1) ));
// }
// else
// {
// progressBar1.Value = (i + 1);
// }
if (label2.InvokeRequired)
{
label2.Invoke(new Action(() => label2.Text = string.Concat((i + 1).ToString(), "/", progressBar1.Maximum.ToString())));
}
else
{
label2.Text = string.Concat((i + 1).ToString(), "/", progressBar1.Maximum.ToString());
}
// if (label2.InvokeRequired)
// {
// label2.Invoke(new Action(() => label2.Text = string.Concat((i + 1).ToString(), "/", progressBar1.Maximum.ToString())));
// }
// else
// {
// label2.Text = string.Concat((i + 1).ToString(), "/", progressBar1.Maximum.ToString());
// }
TreeNode node = nodeList[i];
if (node == null)
{
continue;
}
// TreeNode node = nodeList[i];
// if (node == null)
// {
// continue;
// }
if (node.Tag == null)
{
continue;
}
// if (node.Tag == null)
// {
// continue;
// }
if (!(node.Tag is BookmarkItem))
{
continue;
}
// if (!(node.Tag is BookmarkItem))
// {
// continue;
// }
BookmarkItem bookmarkItem = (BookmarkItem)node.Tag;
if (bookmarkItem == null)
{
continue;
}
// BookmarkItem bookmarkItem = (BookmarkItem)node.Tag;
// if (bookmarkItem == null)
// {
// continue;
// }
bookmarkItem.GetFaviconAddress();
if (bookmarkItem.IconData == null)
{
continue;
}
// bookmarkItem.GetFaviconAddress();
// if (bookmarkItem.IconData == null)
// {
// continue;
// }
//##parentForm.treeView1.AddIcon(bookmarkItem);
}
//}
}
private void mainThread_OnCompleted(object sender, RunWorkerCompletedEventArgs e)

View File

@ -1,9 +1,12 @@
using bzit.bomg;
using bzit.bomg.Data;
using bzit.bomg.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Text;
using System.Windows.Forms;
using Resources = bzit.bomg.Properties.Resources;
@ -37,12 +40,12 @@ namespace RyzStudio.Windows.Forms
//public EventHandler OnChanged = null;
//public NodeCountUpdated OnNodeCountUpdate = null;
protected const char pathSeparator = '|';
//protected const char pathSeparator = '|';
protected TreeNode draggingNode = null;
protected bool allowBeginEdit = false;
//protected ulong nodeCount = 0;
protected bool hasChanged = false;
//protected ulong nodeCount = 0;
public BookmarkTreeView() : base()
{
@ -62,30 +65,32 @@ namespace RyzStudio.Windows.Forms
this.ImageList.Images.Add(Resources.folder);
this.ImageList.Images.Add(Resources.folder_explore);
this.ImageList.Images.Add(Resources.page_white_world_bw);
this.PathSeparator = "\n";
}
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public new ImageList ImageList { get => base.ImageList; set => base.ImageList = value; }
[Browsable(false)]
public TreeNode[] NodeList
{
get
{
TreeNode[] rv = new TreeNode[0];
if (this.Nodes.Count <= 0)
{
return rv;
}
//[Browsable(false)]
//public TreeNode[] NodeList
//{
// get
// {
// TreeNode[] rv = new TreeNode[0];
// if (this.Nodes.Count <= 0)
// {
// return rv;
// }
foreach (TreeNode tn in this.Nodes)
{
traverseNodeList(ref rv, tn);
}
// foreach (TreeNode tn in this.Nodes)
// {
// traverseNodeList(ref rv, tn);
// }
return rv;
}
}
// return rv;
// }
//}
//[Browsable(false)]
//public ulong NodeCount
@ -172,6 +177,27 @@ namespace RyzStudio.Windows.Forms
return true;
}
public TreeNode AddFolder(TreeNode node)
{
//return this.AddFolder("New Folder " + (new Random()).Next(10001, 99999).ToString());
return this.AddFolder(node, "New Folder (" + DateTime.Now.ToString("yyyy-MM-dd-HHmmss") + ")");
}
public TreeNode AddFolder(TreeNode node, string name)
{
if (node == null)
{
return null;
}
if (node.Tag != null)
{
return null;
}
return node.Nodes.Add(encodePath(name), name, (int)IconSet.Folder1, (int)IconSet.Folder2);
}
public void AddItem(BookmarkItemViewModel viewModel)
{
int iconIndex = addIcon(viewModel);
@ -233,31 +259,78 @@ namespace RyzStudio.Windows.Forms
}
}
public string GetNodeFullPath(TreeNode node)
public string GetNodePath(TreeNode node)
{
string rv = PathEncode(node.Text);
TreeNode tn = node;
while (true)
string[] folderList = node.FullPath.Split('\n');
if (folderList.Length < 2)
{
tn = tn.Parent;
if (tn == null)
{
break;
}
if (tn.Level == 0)
{
break;
}
rv = PathEncode(tn.Text) + pathSeparator.ToString() + rv;
return null;
}
return rv;
if (folderList.Length < 2)
{
return "/";
}
StringBuilder sb = new StringBuilder();
for (int i=1; i<(folderList.Length - 1); i++)
{
sb.Append("\\");
sb.Append(encodePath(folderList[i] ?? string.Empty));
}
sb.Append("\\");
return sb.ToString();
}
public BookmarkItemViewModel GetViewModel(TreeNode node) => (BookmarkItemViewModel)node.Tag;
public List<BookmarkItemViewModel> GetBookmarkList()
{
List<BookmarkItemViewModel> rs = new List<BookmarkItemViewModel>();
if (this.Nodes.Count <= 0)
{
return rs;
}
traverseBookmarkList(rs, this.Nodes[0]);
return rs;
}
//public string GetNodeFullPath(TreeNode node)
//{
// string rv = PathEncode(node.Text);
// TreeNode tn = node;
// while (true)
// {
// tn = tn.Parent;
// if (tn == null)
// {
// break;
// }
// if (tn.Level == 0)
// {
// break;
// }
// //rv = PathEncode(tn.Text) + pathSeparator.ToString() + rv;
// }
// return rv;
//}
public bool FindTextNode(TreeNode node, string term)
{
if (node == null)
@ -470,16 +543,22 @@ namespace RyzStudio.Windows.Forms
return;
}
NodeType nodeType = this.SNode.GetNodeType();
switch (e.KeyCode)
{
case Keys.Insert:
if (e.Modifiers == Keys.Shift)
{
this.SelectedNode = this.SNode.AddFolder();
}
else
{
//##AddBookmarkPage();
if ((nodeType == NodeType.Root) || (nodeType == NodeType.Folder))
{
this.SelectedNode = this.SNode.AddFolder();
}
else if (nodeType == NodeType.Page)
{
this.SelectedNode = tn.Parent;
this.SelectedNode = this.SNode.AddFolder();
}
}
break;
@ -494,6 +573,39 @@ namespace RyzStudio.Windows.Forms
allowBeginEdit = true;
this.SNode.Edit();
break;
case Keys.F3:
switch (nodeType)
{
case NodeType.Root:
case NodeType.Folder:
try
{
Clipboard.SetText(tn.Text ?? string.Empty);
}
catch
{
}
break;
case NodeType.Page:
BookmarkItemViewModel viewModel = this.SNode.GetViewModel();
if (viewModel != null)
{
try
{
Clipboard.SetText(viewModel.SiteAddress ?? string.Empty);
}
catch
{
}
}
break;
default:
break;
}
break;
case Keys.Up:
if (e.Modifiers == Keys.Control)
@ -617,6 +729,32 @@ namespace RyzStudio.Windows.Forms
this.SelectedNode = this.SelectedNode.Nodes[n];
}
protected string decodePath(string value) => System.Web.HttpUtility.UrlDecode(value);
protected string encodePath(string value) => System.Web.HttpUtility.UrlEncode(value);
protected void traverseBookmarkList(List<BookmarkItemViewModel> rs, TreeNode node)
{
foreach (TreeNode tn in node.Nodes)
{
NodeType nodeType = this.GetNodeType(tn);
if (nodeType == NodeType.Folder)
{
traverseBookmarkList(rs, tn);
}
else if (nodeType == NodeType.Page)
{
BookmarkItemViewModel nodeTag = this.GetViewModel(tn);
nodeTag.TreeviewPath = this.GetNodePath(tn);
if (nodeTag != null)
{
rs.Add(nodeTag);
}
}
}
}
protected void updateItem_OnSelectedNode(BookmarkItemViewModel viewModel)
{
if (this.SelectedNode == null)
@ -654,36 +792,36 @@ namespace RyzStudio.Windows.Forms
return false;
}
protected void traverseNodeList(ref TreeNode[] results, TreeNode node)
{
foreach (TreeNode tn in node.Nodes)
{
if (tn.Tag == null)
{
traverseNodeList(ref results, tn);
}
else
{
Array.Resize(ref results, (results.Length + 1));
results[(results.Length - 1)] = tn;
}
}
}
//protected void traverseNodeList(ref TreeNode[] results, TreeNode node)
//{
// foreach (TreeNode tn in node.Nodes)
// {
// if (tn.Tag == null)
// {
// traverseNodeList(ref results, tn);
// }
// else
// {
// Array.Resize(ref results, (results.Length + 1));
// results[(results.Length - 1)] = tn;
// }
// }
//}
protected void traverseNodeCount(ref ulong results, TreeNode node)
{
foreach (TreeNode tn in node.Nodes)
{
if (tn.Tag == null)
{
traverseNodeCount(ref results, tn);
}
else
{
results++;
}
}
}
//protected void traverseNodeCount(ref ulong results, TreeNode node)
//{
// foreach (TreeNode tn in node.Nodes)
// {
// if (tn.Tag == null)
// {
// traverseNodeCount(ref results, tn);
// }
// else
// {
// results++;
// }
// }
//}
@ -698,8 +836,7 @@ namespace RyzStudio.Windows.Forms
////protected string PathEncode(string text) { return RyzStudio.String.EncodeTo64(text); }
//protected string PathDecode(string text) { return RyzStudio.String.DecodeFrom64(text); }
protected string PathEncode(string text) { return System.Web.HttpUtility.UrlEncode(text); }
protected string PathDecode(string text) { return System.Web.HttpUtility.UrlDecode(text); }

View File

@ -19,28 +19,9 @@ namespace RyzStudio.Windows.Forms
set => this.Treeview.SelectedNode = value;
}
protected string encodeName(string name) => Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(name));
public TreeNode AddFolder() => this.Treeview.AddFolder(this.SelectedNode);
public TreeNode AddFolder()
{
//return this.AddFolder("New Folder " + (new Random()).Next(10001, 99999).ToString());
return this.AddFolder("New Folder (" + DateTime.Now.ToString("yyyy-MM-dd-HHmmss") + ")");
}
public TreeNode AddFolder(string name)
{
if (this.SelectedNode == null)
{
return null;
}
if (this.SelectedNode.Tag != null)
{
return null;
}
return this.SelectedNode.Nodes.Add(encodeName(name), name, (int)BookmarkTreeView.IconSet.Folder1, (int)BookmarkTreeView.IconSet.Folder2);
}
public TreeNode AddFolder(string name) => this.Treeview.AddFolder(this.SelectedNode, name);
public TreeNode AddItem(string name, object tag)
{
@ -124,6 +105,8 @@ namespace RyzStudio.Windows.Forms
public BookmarkTreeView.NodeType GetNodeType() => this.Treeview.GetNodeType(this.SelectedNode);
public BookmarkItemViewModel GetViewModel() => this.Treeview.GetViewModel(this.SelectedNode);
public void MoveDown()
{
if (this.SelectedNode == null)

View File

@ -159,7 +159,7 @@
<DependentUpon>UpdateIconForm.cs</DependentUpon>
</Compile>
<Compile Include="SessionFileFormat.cs" />
<Compile Include="IconDatabase.cs" />
<Compile Include="Data\IconDatabase.cs" />
<Compile Include="BookmarkEditForm.cs">
<SubType>Form</SubType>
</Compile>
@ -311,9 +311,7 @@
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Folder Include="Data\" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="packages\System.Data.SQLite.Core.1.0.110.0\build\net46\System.Data.SQLite.Core.targets" Condition="Exists('packages\System.Data.SQLite.Core.1.0.110.0\build\net46\System.Data.SQLite.Core.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">