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.SiteDescription = memoBox1.Text?.Trim();
treeView?.AddOrUpdateItem_OnSelectedNode(itemModel.ToViewModel());
treeView?.SNode.AddOrUpdateItem(itemModel.ToViewModel());
this.Close();
}

View File

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

View File

@ -87,6 +87,32 @@ namespace bzit.bomg
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()
{
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 = "")
{
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
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.2.1.012")]
[assembly: AssemblyVersion("0.3.0.012")]
[assembly: AssemblyFileVersion("0.1.0.0")]

View File

@ -89,7 +89,7 @@ namespace bzit.bomg.Properties {
}
/// <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>
internal static string app_version {
get {

View File

@ -128,7 +128,7 @@
<value>Bookmark Manager</value>
</data>
<data name="app_version" xml:space="preserve">
<value>0.2.1.012 beta</value>
<value>0.3.0.012 beta</value>
</data>
<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>

View File

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

View File

@ -8,7 +8,8 @@
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()
{

View File

@ -35,7 +35,7 @@ namespace RyzStudio.Windows.Forms
protected IconDatabase iconDatabase = null;
protected TreeNode draggingNode = null;
protected bool allowBeginEdit = false;
protected bool hasChanged = false;
public BookmarkTreeView() : base()
@ -60,10 +60,13 @@ namespace RyzStudio.Windows.Forms
this.PathSeparator = "\n";
}
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool AllowBeginEdit { get; set; } = false;
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public new ImageList ImageList { get => base.ImageList; set => base.ImageList = value; }
[Browsable(false)]
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool HasChanged
{
get { return hasChanged; }
@ -75,7 +78,6 @@ namespace RyzStudio.Windows.Forms
}
}
#region public methods
public bool InitialiseIconDatabase(out string message, string filename)
@ -172,20 +174,34 @@ namespace RyzStudio.Windows.Forms
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.Folder:
addItem_OnSelectedNode(viewModel);
this.HasChanged = true;
AddItem(treeNode, viewModel);
break;
case NodeType.Page:
updateItem_OnSelectedNode(viewModel);
this.HasChanged = true;
UpdateItem(treeNode, viewModel);
break;
default:
break;
@ -353,6 +369,24 @@ namespace RyzStudio.Windows.Forms
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
#region integrated behaviour
@ -423,9 +457,9 @@ namespace RyzStudio.Windows.Forms
protected override void OnBeforeLabelEdit(NodeLabelEditEventArgs e)
{
if (!allowBeginEdit)
if (!AllowBeginEdit)
{
allowBeginEdit = false;
AllowBeginEdit = false;
e.CancelEdit = true;
return;
@ -459,7 +493,7 @@ namespace RyzStudio.Windows.Forms
// e.CancelEdit = true;
//}
allowBeginEdit = false;
AllowBeginEdit = false;
}
protected override void OnPreviewKeyDown(PreviewKeyDownEventArgs e)
@ -497,9 +531,13 @@ namespace RyzStudio.Windows.Forms
break;
case Keys.F2:
allowBeginEdit = true;
if ((nodeType == NodeType.Root) || (nodeType == NodeType.Folder))
{
this.AllowBeginEdit = true;
this.SNode.Edit();
}
this.SNode.Edit();
break;
case Keys.F3:
switch (nodeType)
@ -643,24 +681,6 @@ namespace RyzStudio.Windows.Forms
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 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)
{
TreeNode tn = drop_node;

View File

@ -1,6 +1,7 @@
using bzit.bomg.Models;
using System;
using System.Windows.Forms;
using static RyzStudio.Windows.Forms.BookmarkTreeView;
namespace RyzStudio.Windows.Forms
{
@ -43,6 +44,22 @@ namespace RyzStudio.Windows.Forms
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()
{
if (this.SelectedNode == null)
@ -79,28 +96,16 @@ namespace RyzStudio.Windows.Forms
{
case BookmarkTreeView.NodeType.Root:
case BookmarkTreeView.NodeType.Folder:
this.Treeview.AllowBeginEdit = true;
this.SelectedNode.BeginEdit();
break;
case BookmarkTreeView.NodeType.Page:
this.Treeview.AllowBeginEdit = true;
this.SelectedNode.BeginEdit();
break;
default:
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);