Changed: near-complete rebuild for 0.3.0.012

This commit is contained in:
Ray 2019-04-24 19:46:37 +01:00
parent da3ffb607f
commit b3303a830b
8 changed files with 546 additions and 6 deletions

4
MainForm.Designer.cs generated
View File

@ -367,11 +367,10 @@ namespace bzit.bomg
//
// optionsToolMenuItem
//
this.optionsToolMenuItem.Enabled = false;
this.optionsToolMenuItem.Image = global::bzit.bomg.Properties.Resources.settings;
this.optionsToolMenuItem.Name = "optionsToolMenuItem";
this.optionsToolMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F12;
this.optionsToolMenuItem.Size = new System.Drawing.Size(141, 22);
this.optionsToolMenuItem.Size = new System.Drawing.Size(180, 22);
this.optionsToolMenuItem.Text = "&Options";
this.optionsToolMenuItem.Click += new System.EventHandler(this.toolsOptionsMenuItem_Click);
//
@ -626,7 +625,6 @@ namespace bzit.bomg
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;

View File

@ -622,8 +622,8 @@ namespace bzit.bomg
return;
}
//OptionsForm frm = new OptionsForm(this);
//frm.ShowDialog();
OptionForm optionForm = new OptionForm(this);
optionForm.ShowDialog();
}
private void helpViewHelpMenuItem_Click(object sender, EventArgs e)

175
OptionForm.Designer.cs generated Normal file
View File

@ -0,0 +1,175 @@
namespace bzit.bomg
{
partial class OptionForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.label5 = new System.Windows.Forms.Label();
this.button1 = new RyzStudio.Windows.ThemedForms.Button();
this.button2 = new RyzStudio.Windows.ThemedForms.Button();
this.horizontalSeparator1 = new RyzStudio.Windows.Forms.HorizontalSeparator();
this.progressBar1 = new RyzStudio.Windows.ThemedForms.ProgressBar();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 25);
this.label1.Margin = new System.Windows.Forms.Padding(3);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(34, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Icons";
//
// pictureBox1
//
this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.pictureBox1.BackColor = System.Drawing.Color.Transparent;
this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.pictureBox1.ErrorImage = null;
this.pictureBox1.InitialImage = null;
this.pictureBox1.Location = new System.Drawing.Point(306, 237);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(32, 32);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.pictureBox1.TabIndex = 60;
this.pictureBox1.TabStop = false;
//
// label5
//
this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label5.ForeColor = System.Drawing.Color.OrangeRed;
this.label5.Location = new System.Drawing.Point(9, 237);
this.label5.Margin = new System.Windows.Forms.Padding(3);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(291, 32);
this.label5.TabIndex = 64;
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// button1
//
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.button1.BackColor = System.Drawing.Color.Transparent;
this.button1.DefaultImage = null;
this.button1.DownImage = null;
this.button1.LabelText = "&Update";
this.button1.Location = new System.Drawing.Point(368, 59);
this.button1.Name = "button1";
this.button1.OverImage = null;
this.button1.Padding = new System.Windows.Forms.Padding(4, 4, 3, 3);
this.button1.Size = new System.Drawing.Size(84, 32);
this.button1.TabIndex = 1;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.button2.BackColor = System.Drawing.Color.Transparent;
this.button2.DefaultImage = null;
this.button2.DownImage = null;
this.button2.LabelText = "&Close";
this.button2.Location = new System.Drawing.Point(344, 237);
this.button2.Name = "button2";
this.button2.OverImage = null;
this.button2.Padding = new System.Windows.Forms.Padding(4, 4, 3, 3);
this.button2.Size = new System.Drawing.Size(108, 32);
this.button2.TabIndex = 4;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// horizontalSeparator1
//
this.horizontalSeparator1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.horizontalSeparator1.Location = new System.Drawing.Point(12, 222);
this.horizontalSeparator1.Margin = new System.Windows.Forms.Padding(3, 10, 3, 10);
this.horizontalSeparator1.MaximumSize = new System.Drawing.Size(4920, 2);
this.horizontalSeparator1.Name = "horizontalSeparator1";
this.horizontalSeparator1.Size = new System.Drawing.Size(440, 2);
this.horizontalSeparator1.TabIndex = 65;
//
// progressBar1
//
this.progressBar1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.progressBar1.BackColor = System.Drawing.Color.Transparent;
this.progressBar1.BarColour = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(225)))), ((int)(((byte)(249)))));
this.progressBar1.BarTextColour = System.Drawing.SystemColors.ControlText;
this.progressBar1.Location = new System.Drawing.Point(96, 17);
this.progressBar1.Margin = new System.Windows.Forms.Padding(3, 10, 3, 10);
this.progressBar1.Maximum = 0;
this.progressBar1.Minimum = 0;
this.progressBar1.Name = "progressBar1";
this.progressBar1.Padding = new System.Windows.Forms.Padding(4, 4, 3, 3);
this.progressBar1.Size = new System.Drawing.Size(356, 29);
this.progressBar1.TabIndex = 66;
this.progressBar1.Value = 0;
//
// OptionForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(464, 281);
this.Controls.Add(this.progressBar1);
this.Controls.Add(this.horizontalSeparator1);
this.Controls.Add(this.label5);
this.Controls.Add(this.button1);
this.Controls.Add(this.button2);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.label1);
this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(480, 320);
this.Name = "OptionForm";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Options";
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.PictureBox pictureBox1;
private RyzStudio.Windows.ThemedForms.Button button2;
private RyzStudio.Windows.ThemedForms.Button button1;
private System.Windows.Forms.Label label5;
private RyzStudio.Windows.Forms.HorizontalSeparator horizontalSeparator1;
private RyzStudio.Windows.ThemedForms.ProgressBar progressBar1;
}
}

165
OptionForm.cs Normal file
View File

@ -0,0 +1,165 @@
using bzit.bomg.Models;
using RyzStudio.Windows.Forms;
using RyzStudio.Windows.ThemedForms;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;
using Form = System.Windows.Forms.Form;
using Resources = bzit.bomg.Properties.Resources;
namespace bzit.bomg
{
public partial class OptionForm : Form
{
protected BackgroundWorker threadWorker = null;
protected BookmarkItemModel itemModel = null;
protected MainForm parentForm = null;
public OptionForm(MainForm mainForm) : base()
{
InitializeComponent();
parentForm = mainForm;
this.StartPosition = FormStartPosition.WindowsDefaultLocation;
if (threadWorker == null)
{
threadWorker = new BackgroundWorker();
threadWorker.WorkerReportsProgress = threadWorker.WorkerSupportsCancellation = true;
threadWorker.DoWork += threadWorker1_DoWork;
threadWorker.RunWorkerCompleted += threadWorker1_RunWorkerCompleted;
}
}
protected void threadWorker1_DoWork(object sender, DoWorkEventArgs e)
{
if (threadWorker.CancellationPending)
{
return;
}
List<TreeNode> nodeList = parentForm.treeView1.GetBookmarkNodeList();
if (progressBar1.InvokeRequired)
{
progressBar1.Invoke(new MethodInvoker(() => {
progressBar1.Maximum = nodeList.Count;
progressBar1.Value = 0;
}));
}
else
{
progressBar1.Maximum = nodeList.Count;
progressBar1.Value = 0;
}
for (int i=0; i<nodeList.Count; i++)
{
if (threadWorker.CancellationPending)
{
return;
}
if (progressBar1.InvokeRequired)
{
progressBar1.Invoke(new MethodInvoker(() => {
progressBar1.Value = (i + 1);
}));
}
else
{
progressBar1.Value = (i + 1);
}
BookmarkItemViewModel viewModel = (BookmarkItemViewModel)nodeList[i].Tag;
BookmarkItemModel model = viewModel.ToModel();
bool rv = model.UpdateFavicon();
if (rv)
{
if (parentForm.treeView1.InvokeRequired)
{
parentForm.treeView1.Invoke(new MethodInvoker(() => {
parentForm.treeView1.UpdateItem(nodeList[i], model.ToViewModel());
}));
}
else
{
parentForm.treeView1.UpdateItem(nodeList[i], model.ToViewModel());
}
}
}
}
protected void threadWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
this.IsBusy = false;
setLabelText("&Update");
}
protected override void OnClosing(CancelEventArgs e)
{
base.OnClosing(e);
if (this.IsBusy)
{
e.Cancel = true;
}
}
protected bool IsBusy
{
get => threadWorker.IsBusy;
set
{
pictureBox1.Image = (value) ? Resources.aniZomq2x32 : null;
}
}
private void button1_Click(object sender, EventArgs e)
{
if (this.IsBusy)
{
setLabelText("&Cancelling...");
threadWorker.CancelAsync();
}
else
{
this.IsBusy = true;
setLabelText("&Updating...");
threadWorker.RunWorkerAsync();
}
}
private void button2_Click(object sender, EventArgs e)
{
if (this.IsBusy)
{
return;
}
this.Close();
}
protected void setLabelText(string text)
{
if (button1.InvokeRequired)
{
button1.Invoke(new MethodInvoker(() => {
button1.LabelText = text;
}));
}
else
{
button1.LabelText = text;
}
}
}
}

120
OptionForm.resx Normal file
View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -9,7 +9,7 @@ namespace RyzStudio.Windows.ThemedForms
{
InitializeComponent();
styleActive = new ThemeStyle(1, 3, 2, Color.FromArgb(112, 112, 112), Color.White);
styleActive = new ThemeStyle(1, 3, 2, Color.FromArgb(212, 212, 212), Color.White);
}
public int Minimum { get => userControl1.Minimum; set => userControl1.Minimum = value; }

View File

@ -228,6 +228,24 @@ namespace RyzStudio.Windows.Forms
iconDatabase.Close();
}
public int CountBookmarkItem()
{
int itemCount = 0;
if (this.Nodes.Count <= 0)
{
return itemCount;
}
foreach (TreeNode item in this.Nodes)
{
traverseBookmarkList(ref itemCount, item);
}
return itemCount;
}
public NodeType GetNodeType(TreeNode node)
{
if (node.Tag == null)
@ -299,6 +317,23 @@ namespace RyzStudio.Windows.Forms
return rs;
}
public List<TreeNode> GetBookmarkNodeList()
{
List<TreeNode> rs = new List<TreeNode>();
if (this.Nodes.Count <= 0)
{
return rs;
}
foreach (TreeNode item in this.Nodes)
{
traverseBookmarkList(rs, item);
}
return rs;
}
public bool FindTextNode(TreeNode node, string term)
{
if (node == null)
@ -707,6 +742,44 @@ namespace RyzStudio.Windows.Forms
}
}
protected void traverseBookmarkList(List<TreeNode> 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(tn);
}
}
}
}
protected void traverseBookmarkList(ref int itemCount, TreeNode node)
{
foreach (TreeNode tn in node.Nodes)
{
NodeType nodeType = this.GetNodeType(tn);
if (nodeType == NodeType.Folder)
{
traverseBookmarkList(ref itemCount, tn);
}
else if (nodeType == NodeType.Page)
{
itemCount++;
}
}
}
protected bool isNodeChild(TreeNode drag_node, TreeNode drop_node)
{
TreeNode tn = drop_node;

View File

@ -99,6 +99,12 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="OptionForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="OptionForm.Designer.cs">
<DependentUpon>OptionForm.cs</DependentUpon>
</Compile>
<Compile Include="Models\BookmarkItemModel.cs" />
<Compile Include="Windows\Forms\BookmarkTreeViewSNode.cs" />
<Compile Include="RyzStudio\Windows\Forms\HorizontalSeparator.cs">
@ -189,6 +195,9 @@
<Compile Include="Windows\Forms\BookmarkTreeView.cs">
<SubType>Component</SubType>
</Compile>
<EmbeddedResource Include="OptionForm.resx">
<DependentUpon>OptionForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="RyzStudio\Windows\ThemedForms\MemoBox.resx">
<DependentUpon>MemoBox.cs</DependentUpon>
</EmbeddedResource>