Changed: colours and version

This commit is contained in:
Ray 2019-04-23 21:57:35 +01:00
parent 95e332941e
commit da3ffb607f
10 changed files with 117 additions and 78 deletions

View File

@ -153,7 +153,7 @@ namespace bzit.bomg
itemModel.SiteAddress = textBox2.Text?.Trim(); itemModel.SiteAddress = textBox2.Text?.Trim();
itemModel.SiteDescription = memoBox1.Text?.Trim(); itemModel.SiteDescription = memoBox1.Text?.Trim();
treeView?.AddOrUpdateItem_OnSelectedNode(itemModel.ToViewModel()); treeView?.SNode.AddOrUpdateItem(itemModel.ToViewModel());
this.Close(); this.Close();
} }

View File

@ -1144,6 +1144,13 @@ namespace bzit.bomg
return; return;
case Keys.Enter: case Keys.Enter:
openBookmark(tn); openBookmark(tn);
break;
case Keys.F2:
if (nodeType == NodeType.Page)
{
(new BookmarkEditForm(treeView1)).ShowDialog();
}
break; break;
case Keys.Insert: case Keys.Insert:
if (e.Modifiers != Keys.Shift) if (e.Modifiers != Keys.Shift)
@ -1165,7 +1172,6 @@ namespace bzit.bomg
} }
} }
#region root context menu #region root context menu
private void addPageContextMenu_Click(object sender, EventArgs e) => (new BookmarkEditForm(treeView1)).ShowDialog(); private void addPageContextMenu_Click(object sender, EventArgs e) => (new BookmarkEditForm(treeView1)).ShowDialog();

View File

@ -87,6 +87,32 @@ namespace bzit.bomg
return true; return true;
} }
public bool UpdateFavicon()
{
string sourceCode = retrieveSourceCode();
if (string.IsNullOrWhiteSpace(sourceCode))
{
return false;
}
HtmlDocument document = new HtmlDocument();
document.LoadHtml(sourceCode);
// favicon
this.FaviconAddress = parseSiteIcon(document);
if (!string.IsNullOrWhiteSpace(this.FaviconAddress))
{
Uri iconAddressURI;
bool rv = Uri.TryCreate(new Uri(this.SiteAddress), this.FaviconAddress, out iconAddressURI);
if (rv)
{
this.FaviconAddress = iconAddressURI.ToString();
}
}
return true;
}
public Bitmap RetrieveFavicon() public Bitmap RetrieveFavicon()
{ {
if (string.IsNullOrWhiteSpace(this.FaviconAddress)) if (string.IsNullOrWhiteSpace(this.FaviconAddress))
@ -134,9 +160,6 @@ namespace bzit.bomg
} }
} }
//protected string encodePath(string text) => System.Web.HttpUtility.UrlEncode(text);
//protected string decodePath(string text) => System.Web.HttpUtility.UrlDecode(text);
protected string parseTagValue(HtmlDocument doc, string xpath, string defaultValue = "") protected string parseTagValue(HtmlDocument doc, string xpath, string defaultValue = "")
{ {
HtmlNodeCollection hnc = doc.DocumentNode.SelectNodes(xpath); HtmlNodeCollection hnc = doc.DocumentNode.SelectNodes(xpath);

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.2.1.012")] [assembly: AssemblyVersion("0.3.0.012")]
[assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyFileVersion("0.1.0.0")]

View File

@ -89,7 +89,7 @@ namespace bzit.bomg.Properties {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to 0.2.1.012 beta. /// Looks up a localized string similar to 0.3.0.012 beta.
/// </summary> /// </summary>
internal static string app_version { internal static string app_version {
get { get {

View File

@ -128,7 +128,7 @@
<value>Bookmark Manager</value> <value>Bookmark Manager</value>
</data> </data>
<data name="app_version" xml:space="preserve"> <data name="app_version" xml:space="preserve">
<value>0.2.1.012 beta</value> <value>0.3.0.012 beta</value>
</data> </data>
<data name="arrow_down_circle" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="arrow_down_circle" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\2\arrow-down-circle.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\2\arrow-down-circle.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>

View File

@ -93,13 +93,13 @@
public Image DefaultImage { get; set; } = null; public Image DefaultImage { get; set; } = null;
[Browsable(false)] [Browsable(false)]
public ButtonStyle StyleOver { get; set; } = new ButtonStyle(Color.Black, Color.White); public ButtonStyle StyleOver { get; set; } = new ButtonStyle(Color.FromArgb(71, 142, 203), Color.FromArgb(250, 250, 250));
[Browsable(false)] [Browsable(false)]
public ButtonStyle StyleDown { get; set; } = new ButtonStyle(Color.LightGray, Color.Black); public ButtonStyle StyleDown { get; set; } = new ButtonStyle(Color.FromArgb(61, 132, 193), Color.FromArgb(250, 250, 250));
[Browsable(false)] [Browsable(false)]
public ButtonStyle StyleDefault { get; set; } = new ButtonStyle(Color.White, Color.Black); public ButtonStyle StyleDefault { get; set; } = new ButtonStyle(Color.FromArgb(51, 122, 183), Color.FromArgb(250, 250, 250));
public void PerformClick() => this.OnClick(null); public void PerformClick() => this.OnClick(null);
} }

View File

@ -8,7 +8,8 @@
public partial class UserControl : System.Windows.Forms.UserControl public partial class UserControl : System.Windows.Forms.UserControl
{ {
protected ThemeStyle styleActive = new ThemeStyle(1, 3, 2, Color.FromArgb(112, 112, 112), Color.White); //protected ThemeStyle styleActive = new ThemeStyle(1, 3, 2, Color.FromArgb(112, 112, 112), Color.White);
protected ThemeStyle styleActive = new ThemeStyle(1, 3, 2, Color.FromArgb(212, 212, 212), Color.White);
public UserControl() public UserControl()
{ {

View File

@ -35,7 +35,7 @@ namespace RyzStudio.Windows.Forms
protected IconDatabase iconDatabase = null; protected IconDatabase iconDatabase = null;
protected TreeNode draggingNode = null; protected TreeNode draggingNode = null;
protected bool allowBeginEdit = false;
protected bool hasChanged = false; protected bool hasChanged = false;
public BookmarkTreeView() : base() public BookmarkTreeView() : base()
@ -60,10 +60,13 @@ namespace RyzStudio.Windows.Forms
this.PathSeparator = "\n"; this.PathSeparator = "\n";
} }
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool AllowBeginEdit { get; set; } = false;
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public new ImageList ImageList { get => base.ImageList; set => base.ImageList = value; } public new ImageList ImageList { get => base.ImageList; set => base.ImageList = value; }
[Browsable(false)] [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool HasChanged public bool HasChanged
{ {
get { return hasChanged; } get { return hasChanged; }
@ -75,7 +78,6 @@ namespace RyzStudio.Windows.Forms
} }
} }
#region public methods #region public methods
public bool InitialiseIconDatabase(out string message, string filename) public bool InitialiseIconDatabase(out string message, string filename)
@ -172,20 +174,34 @@ namespace RyzStudio.Windows.Forms
this.HasChanged = true; this.HasChanged = true;
} }
public void AddOrUpdateItem_OnSelectedNode(BookmarkItemViewModel viewModel) public void AddItem(TreeNode treeNode, BookmarkItemViewModel viewModel)
{ {
switch (this.SNode.GetNodeType()) if (treeNode == null)
{
return;
}
int iconIndex = addIcon(viewModel);
TreeNode tn = new TreeNode(viewModel.SiteName, iconIndex, iconIndex);
tn.Tag = viewModel;
tn.ToolTipText = viewModel.ToString();
treeNode.Nodes.Add(tn);
this.HasChanged = true;
}
public void AddOrUpdateItem(TreeNode treeNode, BookmarkItemViewModel viewModel)
{
switch (this.GetNodeType(treeNode))
{ {
case NodeType.Root: case NodeType.Root:
case NodeType.Folder: case NodeType.Folder:
addItem_OnSelectedNode(viewModel); AddItem(treeNode, viewModel);
this.HasChanged = true;
break; break;
case NodeType.Page: case NodeType.Page:
updateItem_OnSelectedNode(viewModel); UpdateItem(treeNode, viewModel);
this.HasChanged = true;
break; break;
default: default:
break; break;
@ -353,6 +369,24 @@ namespace RyzStudio.Windows.Forms
return rt; return rt;
} }
public void UpdateItem(TreeNode treeNode, BookmarkItemViewModel viewModel)
{
if (treeNode == null)
{
return;
}
int iconIndex = addIcon(viewModel);
treeNode.Text = viewModel.SiteName;
treeNode.ImageIndex = iconIndex;
treeNode.SelectedImageIndex = iconIndex;
treeNode.Tag = viewModel;
treeNode.ToolTipText = viewModel.ToString();
this.HasChanged = true;
}
#endregion #endregion
#region integrated behaviour #region integrated behaviour
@ -423,9 +457,9 @@ namespace RyzStudio.Windows.Forms
protected override void OnBeforeLabelEdit(NodeLabelEditEventArgs e) protected override void OnBeforeLabelEdit(NodeLabelEditEventArgs e)
{ {
if (!allowBeginEdit) if (!AllowBeginEdit)
{ {
allowBeginEdit = false; AllowBeginEdit = false;
e.CancelEdit = true; e.CancelEdit = true;
return; return;
@ -459,7 +493,7 @@ namespace RyzStudio.Windows.Forms
// e.CancelEdit = true; // e.CancelEdit = true;
//} //}
allowBeginEdit = false; AllowBeginEdit = false;
} }
protected override void OnPreviewKeyDown(PreviewKeyDownEventArgs e) protected override void OnPreviewKeyDown(PreviewKeyDownEventArgs e)
@ -497,9 +531,13 @@ namespace RyzStudio.Windows.Forms
break; break;
case Keys.F2: case Keys.F2:
allowBeginEdit = true; if ((nodeType == NodeType.Root) || (nodeType == NodeType.Folder))
{
this.AllowBeginEdit = true;
this.SNode.Edit();
}
this.SNode.Edit();
break; break;
case Keys.F3: case Keys.F3:
switch (nodeType) switch (nodeType)
@ -643,24 +681,6 @@ namespace RyzStudio.Windows.Forms
return tn; return tn;
} }
protected void addItem_OnSelectedNode(BookmarkItemViewModel viewModel)
{
if (this.SelectedNode == null)
{
return;
}
int iconIndex = addIcon(viewModel);
TreeNode tn = new TreeNode(viewModel.SiteName, iconIndex, iconIndex);
tn.Tag = viewModel;
tn.ToolTipText = viewModel.ToString();
int n = this.SelectedNode.Nodes.Add(tn);
this.SelectedNode = this.SelectedNode.Nodes[n];
}
protected string decodePath(string value) => System.Web.HttpUtility.UrlDecode(value); protected string decodePath(string value) => System.Web.HttpUtility.UrlDecode(value);
protected string encodePath(string value) => System.Web.HttpUtility.UrlEncode(value); protected string encodePath(string value) => System.Web.HttpUtility.UrlEncode(value);
@ -687,22 +707,6 @@ namespace RyzStudio.Windows.Forms
} }
} }
protected void updateItem_OnSelectedNode(BookmarkItemViewModel viewModel)
{
if (this.SelectedNode == null)
{
return;
}
int iconIndex = addIcon(viewModel);
this.SelectedNode.Text = viewModel.SiteName;
this.SelectedNode.ImageIndex = iconIndex;
this.SelectedNode.SelectedImageIndex = iconIndex;
this.SelectedNode.Tag = viewModel;
this.SelectedNode.ToolTipText = viewModel.ToString();
}
protected bool isNodeChild(TreeNode drag_node, TreeNode drop_node) protected bool isNodeChild(TreeNode drag_node, TreeNode drop_node)
{ {
TreeNode tn = drop_node; TreeNode tn = drop_node;

View File

@ -1,6 +1,7 @@
using bzit.bomg.Models; using bzit.bomg.Models;
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;
using static RyzStudio.Windows.Forms.BookmarkTreeView;
namespace RyzStudio.Windows.Forms namespace RyzStudio.Windows.Forms
{ {
@ -43,6 +44,22 @@ namespace RyzStudio.Windows.Forms
return tn; return tn;
} }
public void AddOrUpdateItem(BookmarkItemViewModel viewModel)
{
switch (this.GetNodeType())
{
case NodeType.Root:
case NodeType.Folder:
Treeview.AddItem(this.SelectedNode, viewModel);
break;
case NodeType.Page:
Treeview.UpdateItem(this.SelectedNode, viewModel);
break;
default:
break;
}
}
public void Delete() public void Delete()
{ {
if (this.SelectedNode == null) if (this.SelectedNode == null)
@ -79,28 +96,16 @@ namespace RyzStudio.Windows.Forms
{ {
case BookmarkTreeView.NodeType.Root: case BookmarkTreeView.NodeType.Root:
case BookmarkTreeView.NodeType.Folder: case BookmarkTreeView.NodeType.Folder:
this.Treeview.AllowBeginEdit = true;
this.SelectedNode.BeginEdit(); this.SelectedNode.BeginEdit();
break; break;
case BookmarkTreeView.NodeType.Page: case BookmarkTreeView.NodeType.Page:
this.Treeview.AllowBeginEdit = true;
this.SelectedNode.BeginEdit(); this.SelectedNode.BeginEdit();
break; break;
default: default:
break; break;
} }
//this.HasChanged = true;
//if (this.SelectedNode == null)
//{
// return;
//}
//if (!this.SelectedNode.IsEditing)
//{
// allowBeginEdit = true;
// this.SelectedNode.BeginEdit();
//}
} }
public bool FindTextNode(string term) => this.Treeview.FindTextNode(this.SelectedNode, term); public bool FindTextNode(string term) => this.Treeview.FindTextNode(this.SelectedNode, term);