diff --git a/BookmarkForm.cs b/BookmarkForm.cs
index 782fb98..1595f2d 100644
--- a/BookmarkForm.cs
+++ b/BookmarkForm.cs
@@ -1,15 +1,14 @@
-using FizzyLauncher.Models;
-using System.Windows.Forms;
+using BookmarkManager;
+using bzit.bomg.Models;
+using RyzStudio.Windows.Forms;
using RyzStudio.Windows.ThemedForms;
using System;
-using RyzStudio.Windows.Forms;
-using bzit.bomg.Models;
-using System.Drawing;
-using BookmarkManager;
-using System.Threading.Tasks;
using System.ComponentModel;
-using System.Net;
+using System.Drawing;
using System.IO;
+using System.Net;
+using System.Threading.Tasks;
+using System.Windows.Forms;
namespace FizzyLauncher
{
@@ -32,10 +31,9 @@ namespace FizzyLauncher
private ToolTip toolTip1;
private System.ComponentModel.IContainer components;
- protected bool isBusy = false;
-
protected WebParser webParser = null;
protected WebClient webClient = null;
+ protected bool isBusy = false;
public BookmarkForm(BookmarkItem model, Image icon) : base()
diff --git a/Classes/IconDatabase.cs b/Classes/IconDatabase.cs
index 2b2df3a..e3eb060 100644
--- a/Classes/IconDatabase.cs
+++ b/Classes/IconDatabase.cs
@@ -1,7 +1,6 @@
using Microsoft.Data.Sqlite;
using System;
using System.Drawing;
-using System.Drawing.Imaging;
using System.IO;
namespace BookmarkManager
@@ -50,11 +49,8 @@ namespace BookmarkManager
{
command.ExecuteNonQuery();
}
- catch (Exception exc)
+ catch (Exception)
{
-//#if DEBUG
-// MessageBox.Show(exc.Message);
-//#endif
return false;
}
@@ -84,11 +80,8 @@ namespace BookmarkManager
{
command.ExecuteNonQuery();
}
- catch (Exception exc)
+ catch (Exception)
{
-//#if DEBUG
-// MessageBox.Show(exc.Message);
-//#endif
return false;
}
@@ -119,11 +112,8 @@ namespace BookmarkManager
command.Dispose();
}
- catch (Exception exc)
+ catch (Exception)
{
-//#if DEBUG
-// MessageBox.Show(exc.Message);
-//#endif
return null;
}
@@ -138,16 +128,12 @@ namespace BookmarkManager
{
img = Image.FromStream(new MemoryStream(iconBytes));
}
- catch (Exception exc)
+ catch (Exception)
{
-//#if DEBUG
-// MessageBox.Show(exc.Message);
-//#endif
return null;
}
return img;
- //return new Bitmap(img, 16, 16);
}
public bool HasIcon(string id)
@@ -168,11 +154,8 @@ namespace BookmarkManager
command.Dispose();
}
- catch (Exception exc)
+ catch (Exception)
{
-//#if DEBUG
-// MessageBox.Show(exc.Message);
-//#endif
return false;
}
@@ -200,11 +183,8 @@ namespace BookmarkManager
{
command.ExecuteNonQuery();
}
- catch (Exception exc)
+ catch (Exception)
{
-//#if DEBUG
-// MessageBox.Show(exc.Message);
-//#endif
return false;
}
@@ -222,11 +202,8 @@ namespace BookmarkManager
command.ExecuteNonQuery();
command.Dispose();
}
- catch (Exception exc)
+ catch (Exception)
{
-//#if DEBUG
-// MessageBox.Show(exc.Message);
-//#endif
return false;
}
@@ -235,12 +212,6 @@ namespace BookmarkManager
protected byte[] ImageToBytes(Image image)
{
- //MemoryStream stream = new MemoryStream();
- //image.Save(stream, image.RawFormat);
- //stream.Close();
-
- //return stream.ToArray();
-
ImageConverter imageConverter = new ImageConverter();
return (byte[])imageConverter.ConvertTo(image, typeof(byte[]));
}
diff --git a/MainForm.cs b/MainForm.cs
index 7342740..57bb500 100644
--- a/MainForm.cs
+++ b/MainForm.cs
@@ -1,7 +1,6 @@
using BookmarkManager;
using bzit.bomg.Models;
using FizzyLauncher.Models;
-using Microsoft.Data.Sqlite;
using Newtonsoft.Json;
using RyzStudio.Windows.Forms;
using System;
@@ -521,7 +520,25 @@ namespace FizzyLauncher
return;
}
- //treeView1.AddItem(.AddFolder("New Folder");
+ if (treeView1.GetNodeType() == BookmarkTreeView.NodeType.Page)
+ {
+ return;
+ }
+
+ if (treeView1.SelectedNode == null)
+ {
+ return;
+ }
+
+ // add placeholder
+ TreeNode node = treeView1.AddItem(treeView1.SelectedNode, new BookmarkItem()
+ {
+ SiteName = "New Bookmark"
+ });
+ node.EnsureVisible();
+ treeView1.SelectedNode = node;
+
+ UpdateBookmarkNode(true);
}
///
@@ -551,9 +568,7 @@ namespace FizzyLauncher
///
///
///
- private void addPageToolStripMenuItem1_Click(object sender, EventArgs e)
- {
- }
+ private void addPageToolStripMenuItem1_Click(object sender, EventArgs e) => addPageToolStripMenuItem_Click(sender, e);
///
/// Add folder
@@ -640,7 +655,16 @@ namespace FizzyLauncher
///
private void editToolStripMenuItem2_Click(object sender, EventArgs e)
{
+ if (this.IsBusy)
+ {
+ return;
+ }
+ BookmarkTreeView.NodeType nodeType = treeView1.GetNodeType();
+ if (nodeType == BookmarkTreeView.NodeType.Page)
+ {
+ UpdateBookmarkNode(false);
+ }
}
///
@@ -684,11 +708,7 @@ namespace FizzyLauncher
await OpenBookmark(tn);
break;
case Keys.F2:
- if (nodeType == BookmarkTreeView.NodeType.Page)
- {
- UpdateBookmarkNode(false);
- }
-
+ editToolStripMenuItem2_Click(sender, null);
break;
case Keys.Insert:
if (e.Modifiers != Keys.Shift)
@@ -702,15 +722,7 @@ namespace FizzyLauncher
treeView1.SelectedNode = tn.Parent;
}
- // add placeholder
- TreeNode node = treeView1.AddItem(treeView1.SelectedNode, new BookmarkItem()
- {
- SiteName = "New Bookmark"
- });
- node.EnsureVisible();
- treeView1.SelectedNode = node;
-
- UpdateBookmarkNode(true);
+ addPageToolStripMenuItem_Click(sender, null);
}
break;
@@ -1073,7 +1085,7 @@ namespace FizzyLauncher
string iconID = Crypto.GetSHA256Hash(bookmarkForm.Model.Item?.SiteName);
if (!string.IsNullOrWhiteSpace(iconID))
{
- iconDatabase.AddIcon(iconID, icon);
+ iconDatabase.AddIcon(iconID, bookmarkForm.Model.Icon);
}
treeView1.UpdateItem(treeView1.SelectedNode, bookmarkForm.Model.Item);
diff --git a/RyzStudio/Windows/ThemedForms/TextBox/TButtonTextBox.cs b/RyzStudio/Windows/ThemedForms/TextBox/TButtonTextBox.cs
index 63231d7..9f8f168 100644
--- a/RyzStudio/Windows/ThemedForms/TextBox/TButtonTextBox.cs
+++ b/RyzStudio/Windows/ThemedForms/TextBox/TButtonTextBox.cs
@@ -2,8 +2,8 @@
{
using RyzStudio.Drawing;
using System;
- using System.ComponentModel;
- using System.Drawing;
+ using System.ComponentModel;
+ using System.Drawing;
using System.Windows.Forms;
public partial class TButtonTextBox : RyzStudio.Windows.ThemedForms.TUserControl
@@ -22,11 +22,19 @@
textBox1.Left = this.Margin.Left;
textBox1.PreviewKeyDown += textBox_PreviewKeyDown;
- imageBox1.Click += imageBox1_Click;
+ imageBox1.MouseClick += imageBox1_MouseClick;
OnResize(null);
}
+ protected virtual void imageBox1_MouseClick(object sender, MouseEventArgs e)
+ {
+ if (e.Button == MouseButtons.Left)
+ {
+ OnButtonClick?.Invoke(sender, e);
+ }
+ }
+
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
@@ -69,8 +77,6 @@
}
}
- protected virtual void imageBox1_Click(object sender, EventArgs e) => OnButtonClick?.Invoke(sender, e);
-
[Category("Action")]
[Browsable(true)]
public event EventHandler OnButtonClick;
diff --git a/RyzStudio/Windows/ThemedForms/TextBox/TFolderTextBox.cs b/RyzStudio/Windows/ThemedForms/TextBox/TFolderTextBox.cs
index 3b74faa..dbf3830 100644
--- a/RyzStudio/Windows/ThemedForms/TextBox/TFolderTextBox.cs
+++ b/RyzStudio/Windows/ThemedForms/TextBox/TFolderTextBox.cs
@@ -1,5 +1,4 @@
-using System;
-using System.IO;
+using System.IO;
using System.Windows.Forms;
using UIResources = BookmarkManager.UIResource;
@@ -16,8 +15,13 @@ namespace RyzStudio.Windows.ThemedForms
public FolderBrowserDialog FolderDialog { get; set; } = null;
- protected override void imageBox1_Click(object sender, EventArgs e)
+ protected override void imageBox1_MouseClick(object sender, MouseEventArgs e)
{
+ if (e.Button != MouseButtons.Left)
+ {
+ return;
+ }
+
if (this.FolderDialog == null)
{
this.FolderDialog = new FolderBrowserDialog();
diff --git a/RyzStudio/Windows/ThemedForms/TextBox/TKeyCodeTextBox.cs b/RyzStudio/Windows/ThemedForms/TextBox/TKeyCodeTextBox.cs
index c23248f..aae9cbb 100644
--- a/RyzStudio/Windows/ThemedForms/TextBox/TKeyCodeTextBox.cs
+++ b/RyzStudio/Windows/ThemedForms/TextBox/TKeyCodeTextBox.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Text;
+using System.Text;
using System.Windows.Forms;
using UIResources = BookmarkManager.UIResource;
@@ -71,8 +70,13 @@ namespace RyzStudio.Windows.ThemedForms
this.Text = this.KeyCodeResults.DisplayText;
}
- protected override void imageBox1_Click(object sender, EventArgs e)
+ protected override void imageBox1_MouseClick(object sender, MouseEventArgs e)
{
+ if (e.Button != MouseButtons.Left)
+ {
+ return;
+ }
+
this.KeyCodeResults.Clear();
this.Text = this.KeyCodeResults.DisplayText;
diff --git a/RyzStudio/Windows/ThemedForms/TextBox/TOpenFileTextBox.cs b/RyzStudio/Windows/ThemedForms/TextBox/TOpenFileTextBox.cs
index 7a66132..8189c51 100644
--- a/RyzStudio/Windows/ThemedForms/TextBox/TOpenFileTextBox.cs
+++ b/RyzStudio/Windows/ThemedForms/TextBox/TOpenFileTextBox.cs
@@ -16,8 +16,13 @@ namespace RyzStudio.Windows.ThemedForms
public OpenFileDialog FileDialog { get; set; } = null;
- protected override void imageBox1_Click(object sender, EventArgs e)
+ protected override void imageBox1_MouseClick(object sender, MouseEventArgs e)
{
+ if (e.Button != MouseButtons.Left)
+ {
+ return;
+ }
+
if (this.FileDialog == null)
{
this.FileDialog = new OpenFileDialog();