Changed: show loading file dialog

This commit is contained in:
Ray 2020-08-29 23:46:36 +01:00
parent fa8f2c046d
commit ac117cbfc4
9 changed files with 244 additions and 600 deletions

View File

@ -52,13 +52,13 @@ namespace bzit.bomg
return; return;
} }
if (parentForm.treeView1.Nodes.Count <= 0) if (parentForm.TreeView.Nodes.Count <= 0)
{ {
return; return;
} }
findNextNew = false; findNextNew = false;
parentForm.treeView1.FindTextNode(parentForm.treeView1.Nodes[0], textBox1.Text?.Trim()); parentForm.TreeView.FindTextNode(parentForm.TreeView.Nodes[0], textBox1.Text?.Trim());
} }
private void button2_Click(object sender, EventArgs e) private void button2_Click(object sender, EventArgs e)
@ -73,19 +73,19 @@ namespace bzit.bomg
return; return;
} }
if (parentForm.treeView1.Nodes.Count <= 0) if (parentForm.TreeView.Nodes.Count <= 0)
{ {
return; return;
} }
if (parentForm.treeView1.SelectedNode == null) if (parentForm.TreeView.SelectedNode == null)
{ {
parentForm.treeView1.SelectedNode = parentForm.treeView1.Nodes[0]; parentForm.TreeView.SelectedNode = parentForm.TreeView.Nodes[0];
} }
findNextNew = false; findNextNew = false;
bool rv = parentForm.treeView1.SNode.FindTextNode(textBox1.Text?.Trim()); bool rv = parentForm.TreeView.SNode.FindTextNode(textBox1.Text?.Trim());
if (!rv) if (!rv)
{ {
findNextNew = true; findNextNew = true;

View File

@ -7,11 +7,12 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.IO; using System.IO;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using System.Xml;
using AppMode = bzit.bomg.MainForm.AppMode; using AppMode = bzit.bomg.MainForm.AppMode;
using Form = System.Windows.Forms.Form; using Form = System.Windows.Forms.Form;
using Resources = bzit.bomg.Properties.Resources;
namespace bzit.bomg namespace bzit.bomg
{ {
@ -43,11 +44,13 @@ namespace bzit.bomg
} }
} }
protected override void OnShown(EventArgs e) protected async override void OnShown(EventArgs e)
{ {
base.OnShown(e); base.OnShown(e);
loadFile(sessionFilename); await loadFile(sessionFilename);
this.Close();
} }
protected bool IsBusy protected bool IsBusy
@ -63,76 +66,6 @@ namespace bzit.bomg
} }
} }
private async void button1_Click(object sender, EventArgs e)
{
if (this.IsBusy)
{
//requestCancel = true;
//ThreadControl.SetText(button1, "&Cancelling...");
return;
}
this.IsBusy = true;
await Task.Run(() =>
{
//ThreadControl.SetText(button1, "&Updating...");
//if (requestCancel)
//{
// this.IsBusy = false;
// ThreadControl.SetText(button1, "&Update");
// requestCancel = false;
// return;
//}
//List<TreeNode> nodeList = parentForm.treeView1.GetBookmarkNodeList();
//ThreadControl.SetValue(progressBar1, 0, nodeList.Count);
//for (int i = 0; i < nodeList.Count; i++)
//{
// if (requestCancel)
// {
// this.IsBusy = false;
// ThreadControl.SetText(button1, "&Update");
// requestCancel = false;
// return;
// }
// ThreadControl.SetValue(progressBar1, (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());
// }
// }
//}
this.IsBusy = false;
//ThreadControl.SetText(button1, "&Update");
//requestCancel = false;
});
}
private void button2_Click(object sender, EventArgs e) private void button2_Click(object sender, EventArgs e)
{ {
if (this.IsBusy) if (this.IsBusy)
@ -143,16 +76,19 @@ namespace bzit.bomg
this.Close(); this.Close();
} }
protected async Task loadFile(string filename)
protected void loadFile(string filename)
{ {
parentForm.ClearSession(); parentForm.ClearSession();
parentForm.TreeView.Clear();
parentForm.TreeView.HasChanged = false;
if (string.IsNullOrWhiteSpace(filename)) if (string.IsNullOrWhiteSpace(filename))
{ {
return; return;
} }
ThreadControl.SetValue(progressBar1, 0, 0);
string password = string.Empty; string password = string.Empty;
if (RyzStudio.IO.SharpZipLib.IsZipEncrypted(filename)) if (RyzStudio.IO.SharpZipLib.IsZipEncrypted(filename))
@ -173,6 +109,11 @@ namespace bzit.bomg
break; break;
} }
} }
if (string.IsNullOrWhiteSpace(password))
{
return;
}
} }
this.IsBusy = true; this.IsBusy = true;
@ -180,11 +121,11 @@ namespace bzit.bomg
string ext = Path.GetExtension(filename).Trim('.').ToLower(); string ext = Path.GetExtension(filename).Trim('.').ToLower();
if (ext.Equals("jsnx")) if (ext.Equals("jsnx"))
{ {
loadJSNXBookmarkFile(filename, password); await loadJSNXBookmarkFile(filename, password);
} }
else if (ext.Equals("ryz")) else if (ext.Equals("ryz"))
{ {
//##loadFileType = LoadFileType.Ryz; await loadRYZBookmarkFile(filename, password);
} }
else else
{ {
@ -193,9 +134,14 @@ namespace bzit.bomg
this.IsBusy = false; this.IsBusy = false;
parentForm.AllowSave = false; parentForm.AllowSave = false;
parentForm.TreeView.HasChanged = false;
if (parentForm.TreeView.Nodes.Count > 0) parentForm.TreeView.Nodes[0].Expand();
} }
protected void loadJSNXBookmarkFile(string filename, string password) protected async Task loadJSNXBookmarkFile(string filename, string password)
{
await Task.Run(() =>
{ {
int size = 2048; int size = 2048;
byte[] buffer = new byte[size]; byte[] buffer = new byte[size];
@ -254,160 +200,161 @@ namespace bzit.bomg
readStream.Dispose(); readStream.Dispose();
readStream = null; readStream = null;
parentForm.SetBookmarkItem(rs); // load bookmark items
ThreadControl.SetValue(progressBar1, 0, rs.Count);
for (int i=0; i<rs.Count; i++)
{
ThreadControl.SetValue(progressBar1, (i + 1));
parentForm.TreeView.AddItem(rs[i]);
}
parentForm.ApplicationMode = AppMode.Open; parentForm.ApplicationMode = AppMode.Open;
});
//// RyzStudio.Windows.Forms.ThreadControl.SetText(this, Path.GetFileNameWithoutExtension(filename) + " - " + Resources.app_name);
} }
//protected void loadBookmarkFile_ForRYZ(string filename, string password = "") protected async Task loadRYZBookmarkFile(string filename, string password)
//{ {
// int size = 2048; await Task.Run(() =>
// byte[] buffer = new byte[size]; {
// int bufferSize = 0; int size = 2048;
byte[] buffer = new byte[size];
int bufferSize = 0;
// List<BookmarkItemViewModel> rs = new List<BookmarkItemViewModel>(); List<BookmarkItemViewModel> rs = new List<BookmarkItemViewModel>();
// ZipEntry readEntry = null; ZipEntry readEntry = null;
// ZipInputStream readStream = new ZipInputStream(File.OpenRead(filename)); ZipInputStream readStream = new ZipInputStream(File.OpenRead(filename));
// readStream.Password = password; readStream.Password = password;
// while (true) while (true)
// { {
// readEntry = readStream.GetNextEntry(); readEntry = readStream.GetNextEntry();
// if (readEntry == null) if (readEntry == null)
// { {
break;
}
if (string.IsNullOrWhiteSpace(readEntry.Name))
{
continue;
}
if (!readEntry.IsFile)
{
continue;
}
if (!readEntry.Name.Equals("bookmarks.xml"))
{
continue;
}
MemoryStream ms = new MemoryStream();
buffer = new byte[size];
bufferSize = 0;
do
{
bufferSize = readStream.Read(buffer, 0, buffer.Length);
ms.Write(buffer, 0, bufferSize);
}
while (bufferSize > 0);
ms.Position = 0;
// read stream
StreamReader sr = new StreamReader(ms);
// load xml
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.LoadXml(sr.ReadToEnd());
// parse
XmlNode xnl = xmlDocument.SelectSingleNode("bomg/b/g");
if (xnl == null)
{
break;
}
string rootName = (xnl.Attributes["name"] == null) ? "Bookmarks" : (string.IsNullOrWhiteSpace(xnl.Attributes["name"].InnerText) ? "Bookmarks" : xnl.Attributes["name"].InnerText.Trim());
foreach (XmlNode xn in xnl.ChildNodes)
{
BookmarkItemViewModel viewModel = new BookmarkItemViewModel();
foreach (XmlNode xn2 in xn.ChildNodes)
{
switch (xn2.LocalName)
{
case "name":
viewModel.SiteName = xn2.InnerText?.Trim();
break;
case "address":
viewModel.SiteAddress = xn2.InnerText?.Trim();
break;
case "description":
viewModel.SiteDescription = xn2.InnerText?.Trim();
break;
//case "created":
// bi.Created = xn2.InnerText?.Trim();
// break; // break;
// } default:
break;
}
}
// if (string.IsNullOrWhiteSpace(readEntry.Name)) // fix fullpath and name
// { if (viewModel.SiteName.Contains("|"))
// continue; {
// } StringBuilder sb = new StringBuilder();
sb.Append("\\");
sb.Append(System.Web.HttpUtility.UrlEncode(rootName));
sb.Append("\\");
// if (!readEntry.IsFile) string[] pathParts = viewModel.SiteName.Split('|');
// { for (int i = 0; i < (pathParts.Length - 1); i++)
// continue; {
// } sb.Append(pathParts[i]);
//sb.Append(System.Web.HttpUtility.UrlDecode(pathParts[i]));
sb.Append("\\");
}
// if (!readEntry.Name.Equals("bookmarks.xml")) viewModel.SiteName = System.Web.HttpUtility.UrlDecode(pathParts[(pathParts.Length - 1)] ?? string.Empty);
// { viewModel.TreeviewPath = sb.ToString();
// continue; }
// } else
{
viewModel.SiteName = System.Web.HttpUtility.UrlDecode(viewModel.SiteName);
viewModel.TreeviewPath = string.Format("\\{0}\\", System.Web.HttpUtility.UrlEncode(rootName));
}
// MemoryStream ms = new MemoryStream(); rs.Add(viewModel);
// buffer = new byte[size]; }
// bufferSize = 0;
// do break;
// { }
// bufferSize = readStream.Read(buffer, 0, buffer.Length);
// ms.Write(buffer, 0, bufferSize);
// }
// while (bufferSize > 0);
// ms.Position = 0; readStream.Flush();
readStream.Close();
// // read stream readStream.Dispose();
// StreamReader sr = new StreamReader(ms); readStream = null;
// // load xml
// XmlDocument xmlDocument = new XmlDocument();
// xmlDocument.LoadXml(sr.ReadToEnd());
// // parse
// XmlNode xnl = xmlDocument.SelectSingleNode("bomg/b/g");
// if (xnl == null)
// {
// break;
// }
// string rootName = (xnl.Attributes["name"] == null) ? "Bookmarks" : (string.IsNullOrWhiteSpace(xnl.Attributes["name"].InnerText) ? "Bookmarks" : xnl.Attributes["name"].InnerText.Trim());
// foreach (XmlNode xn in xnl.ChildNodes)
// {
// BookmarkItemViewModel viewModel = new BookmarkItemViewModel();
// foreach (XmlNode xn2 in xn.ChildNodes)
// {
// switch (xn2.LocalName)
// {
// case "name":
// viewModel.SiteName = xn2.InnerText?.Trim();
// break;
// case "address":
// viewModel.SiteAddress = xn2.InnerText?.Trim();
// break;
// case "description":
// viewModel.SiteDescription = xn2.InnerText?.Trim();
// break;
// //case "created":
// // bi.Created = xn2.InnerText?.Trim();
// // break;
// default:
// break;
// }
// }
// // fix fullpath and name
// if (viewModel.SiteName.Contains("|"))
// {
// StringBuilder sb = new StringBuilder();
// sb.Append("\\");
// sb.Append(System.Web.HttpUtility.UrlEncode(rootName));
// sb.Append("\\");
// string[] pathParts = viewModel.SiteName.Split('|');
// for (int i = 0; i < (pathParts.Length - 1); i++)
// {
// sb.Append(pathParts[i]);
// //sb.Append(System.Web.HttpUtility.UrlDecode(pathParts[i]));
// sb.Append("\\");
// }
// viewModel.SiteName = System.Web.HttpUtility.UrlDecode(pathParts[(pathParts.Length - 1)] ?? string.Empty);
// viewModel.TreeviewPath = sb.ToString();
// }
// else
// {
// viewModel.SiteName = System.Web.HttpUtility.UrlDecode(viewModel.SiteName);
// viewModel.TreeviewPath = string.Format("\\{0}\\", System.Web.HttpUtility.UrlEncode(rootName));
// }
// rs.Add(viewModel);
// }
// break;
// }
// readStream.Flush();
// readStream.Close();
// readStream.Dispose();
// readStream = null;
// treeView1.AddItem(rs);
// sessionFilename = sessionPassword = null;
// usePassword = !string.IsNullOrWhiteSpace(password);
// if (this.InvokeRequired)
// {
// this.Invoke(new MethodInvoker(() =>
// {
// this.ApplicationMode = AppMode.New;
// }));
// }
// else
// {
// this.ApplicationMode = AppMode.New;
// }
// RyzStudio.Windows.Forms.ThreadControl.SetText(this, Path.GetFileNameWithoutExtension(filename) + " - " + Resources.app_name);
//}
// load bookmark items
ThreadControl.SetValue(progressBar1, 0, rs.Count);
for (int i = 0; i < rs.Count; i++)
{
ThreadControl.SetValue(progressBar1, (i + 1));
parentForm.TreeView.AddItem(rs[i]);
}
parentForm.ClearSession();
parentForm.ApplicationMode = AppMode.Open;
});
}
} }
} }

4
MainForm.Designer.cs generated
View File

@ -369,7 +369,7 @@ namespace bzit.bomg
// optionsToolMenuItem // optionsToolMenuItem
// //
this.optionsToolMenuItem.Name = "optionsToolMenuItem"; this.optionsToolMenuItem.Name = "optionsToolMenuItem";
this.optionsToolMenuItem.Size = new System.Drawing.Size(180, 22); this.optionsToolMenuItem.Size = new System.Drawing.Size(161, 22);
this.optionsToolMenuItem.Text = "&Update Favicons"; this.optionsToolMenuItem.Text = "&Update Favicons";
this.optionsToolMenuItem.Click += new System.EventHandler(this.toolsOptionsMenuItem_Click); this.optionsToolMenuItem.Click += new System.EventHandler(this.toolsOptionsMenuItem_Click);
// //
@ -699,7 +699,6 @@ namespace bzit.bomg
private System.Windows.Forms.ToolStripMenuItem closeFileMenuItem; private System.Windows.Forms.ToolStripMenuItem closeFileMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator4; private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
public BookmarkTreeView treeView1;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem4; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem4;
private System.Windows.Forms.OpenFileDialog openFileDialog; private System.Windows.Forms.OpenFileDialog openFileDialog;
private System.Windows.Forms.ContextMenuStrip folderTreeNodeMenu; private System.Windows.Forms.ContextMenuStrip folderTreeNodeMenu;
@ -733,6 +732,7 @@ namespace bzit.bomg
private System.Windows.Forms.ToolStripMenuItem findEditMenuItem; private System.Windows.Forms.ToolStripMenuItem findEditMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1; private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem alwaysOnTopToolStripMenuItem1; private System.Windows.Forms.ToolStripMenuItem alwaysOnTopToolStripMenuItem1;
private BookmarkTreeView treeView1;
} }
} }

View File

@ -198,6 +198,16 @@ namespace bzit.bomg
Application.Exit(); Application.Exit();
} }
public bool AllowSave
{
get => (saveMenuBarItem.Enabled || saveFileMenuItem.Enabled);
set
{
ThreadControl.SetEnable(toolStrip1, saveMenuBarItem, value);
ThreadControl.SetEnable(toolStrip1, saveFileMenuItem, value);
}
}
public AppMode ApplicationMode public AppMode ApplicationMode
{ {
get => appMode; get => appMode;
@ -245,16 +255,6 @@ namespace bzit.bomg
} }
} }
public bool AllowSave
{
get => (saveMenuBarItem.Enabled || saveFileMenuItem.Enabled);
set
{
ThreadControl.SetEnable(toolStrip1, saveMenuBarItem, value);
ThreadControl.SetEnable(toolStrip1, saveFileMenuItem, value);
}
}
public bool IsBusy public bool IsBusy
{ {
get => isBusy; get => isBusy;
@ -264,6 +264,8 @@ namespace bzit.bomg
} }
} }
public RyzStudio.Windows.Forms.BookmarkTreeView TreeView { get => treeView1; set => treeView1 = value; }
#region toolbar #region toolbar
private void fileNewMenuItem_Click(object sender, EventArgs e) private void fileNewMenuItem_Click(object sender, EventArgs e)
@ -663,285 +665,6 @@ namespace bzit.bomg
#endregion #endregion
//protected void loadBookmarkFile(string filename, int filterIndex)
//{
// sessionFilename = sessionPassword = null;
// usePassword = false;
// //sessionFilename = filename;
// //sessionPassword = null;
// //usePassword = false;
// if (RyzStudio.IO.SharpZipLib.IsZipEncrypted(filename))
// {
// TextBoxForm passwordForm = new TextBoxForm("Password", "Password", true);
// string password = string.Empty;
// while (true)
// {
// password = passwordForm.ShowDialog();
// if (string.IsNullOrWhiteSpace(password))
// {
// break;
// }
// if (RyzStudio.IO.SharpZipLib.TestZipEncrypted(filename, password))
// {
// sessionFilename = filename;
// sessionPassword = password;
// usePassword = true;
// loadFileType = LoadFileType.Jsnx;
// break;
// }
// }
// }
// switch (filterIndex)
// {
// case 1:
// loadFileType = LoadFileType.Jsnx;
// break;
// case 2:
// loadFileType = LoadFileType.Ryz;
// break;
// default:
// loadFileType = LoadFileType.None;
// break;
// }
// if (string.IsNullOrWhiteSpace(sessionFilename))
// {
// return;
// }
// this.IsBusy = true;
// loadFileThread.RunWorkerAsync();
//}
//protected void loadBookmarkFile_ForJSNX(string filename, string password = "")
//{
// int size = 2048;
// byte[] buffer = new byte[size];
// int bufferSize = 0;
// List<BookmarkItemViewModel> rs = null;
// ZipEntry readEntry = null;
// ZipInputStream readStream = new ZipInputStream(File.OpenRead(filename));
// readStream.Password = password;
// while (true)
// {
// readEntry = readStream.GetNextEntry();
// if (readEntry == null)
// {
// break;
// }
// if (string.IsNullOrWhiteSpace(readEntry.Name))
// {
// continue;
// }
// if (!readEntry.IsFile)
// {
// continue;
// }
// if (!readEntry.Name.Equals("bookmarks.json"))
// {
// continue;
// }
// MemoryStream ms = new MemoryStream();
// buffer = new byte[size];
// bufferSize = 0;
// do
// {
// bufferSize = readStream.Read(buffer, 0, buffer.Length);
// ms.Write(buffer, 0, bufferSize);
// }
// while (bufferSize > 0);
// ms.Position = 0;
// StreamReader sr = new StreamReader(ms);
// rs = JsonConvert.DeserializeObject<List<BookmarkItemViewModel>>(sr.ReadToEnd());
// break;
// }
// readStream.Flush();
// readStream.Close();
// readStream.Dispose();
// readStream = null;
// treeView1.AddItem(rs);
// if (this.InvokeRequired)
// {
// this.Invoke(new MethodInvoker(() =>
// {
// this.ApplicationMode = AppMode.Open;
// }));
// }
// else
// {
// this.ApplicationMode = AppMode.Open;
// }
// RyzStudio.Windows.Forms.ThreadControl.SetText(this, Path.GetFileNameWithoutExtension(filename) + " - " + Resources.app_name);
//}
//protected void loadBookmarkFile_ForRYZ(string filename, string password = "")
//{
// int size = 2048;
// byte[] buffer = new byte[size];
// int bufferSize = 0;
// List<BookmarkItemViewModel> rs = new List<BookmarkItemViewModel>();
// ZipEntry readEntry = null;
// ZipInputStream readStream = new ZipInputStream(File.OpenRead(filename));
// readStream.Password = password;
// while (true)
// {
// readEntry = readStream.GetNextEntry();
// if (readEntry == null)
// {
// break;
// }
// if (string.IsNullOrWhiteSpace(readEntry.Name))
// {
// continue;
// }
// if (!readEntry.IsFile)
// {
// continue;
// }
// if (!readEntry.Name.Equals("bookmarks.xml"))
// {
// continue;
// }
// MemoryStream ms = new MemoryStream();
// buffer = new byte[size];
// bufferSize = 0;
// do
// {
// bufferSize = readStream.Read(buffer, 0, buffer.Length);
// ms.Write(buffer, 0, bufferSize);
// }
// while (bufferSize > 0);
// ms.Position = 0;
// // read stream
// StreamReader sr = new StreamReader(ms);
// // load xml
// XmlDocument xmlDocument = new XmlDocument();
// xmlDocument.LoadXml(sr.ReadToEnd());
// // parse
// XmlNode xnl = xmlDocument.SelectSingleNode("bomg/b/g");
// if (xnl == null)
// {
// break;
// }
// string rootName = (xnl.Attributes["name"] == null) ? "Bookmarks" : (string.IsNullOrWhiteSpace(xnl.Attributes["name"].InnerText) ? "Bookmarks" : xnl.Attributes["name"].InnerText.Trim());
// foreach (XmlNode xn in xnl.ChildNodes)
// {
// BookmarkItemViewModel viewModel = new BookmarkItemViewModel();
// foreach (XmlNode xn2 in xn.ChildNodes)
// {
// switch (xn2.LocalName)
// {
// case "name":
// viewModel.SiteName = xn2.InnerText?.Trim();
// break;
// case "address":
// viewModel.SiteAddress = xn2.InnerText?.Trim();
// break;
// case "description":
// viewModel.SiteDescription = xn2.InnerText?.Trim();
// break;
// //case "created":
// // bi.Created = xn2.InnerText?.Trim();
// // break;
// default:
// break;
// }
// }
// // fix fullpath and name
// if (viewModel.SiteName.Contains("|"))
// {
// StringBuilder sb = new StringBuilder();
// sb.Append("\\");
// sb.Append(System.Web.HttpUtility.UrlEncode(rootName));
// sb.Append("\\");
// string[] pathParts = viewModel.SiteName.Split('|');
// for (int i = 0; i < (pathParts.Length - 1); i++)
// {
// sb.Append(pathParts[i]);
// //sb.Append(System.Web.HttpUtility.UrlDecode(pathParts[i]));
// sb.Append("\\");
// }
// viewModel.SiteName = System.Web.HttpUtility.UrlDecode(pathParts[(pathParts.Length - 1)] ?? string.Empty);
// viewModel.TreeviewPath = sb.ToString();
// }
// else
// {
// viewModel.SiteName = System.Web.HttpUtility.UrlDecode(viewModel.SiteName);
// viewModel.TreeviewPath = string.Format("\\{0}\\", System.Web.HttpUtility.UrlEncode(rootName));
// }
// rs.Add(viewModel);
// }
// break;
// }
// readStream.Flush();
// readStream.Close();
// readStream.Dispose();
// readStream = null;
// treeView1.AddItem(rs);
// sessionFilename = sessionPassword = null;
// usePassword = !string.IsNullOrWhiteSpace(password);
// if (this.InvokeRequired)
// {
// this.Invoke(new MethodInvoker(() =>
// {
// this.ApplicationMode = AppMode.New;
// }));
// }
// else
// {
// this.ApplicationMode = AppMode.New;
// }
// RyzStudio.Windows.Forms.ThreadControl.SetText(this, Path.GetFileNameWithoutExtension(filename) + " - " + Resources.app_name);
//}
protected void openBookmark(TreeNode node) protected void openBookmark(TreeNode node)
{ {
if (treeView1.GetNodeType(node) != RyzStudio.Windows.Forms.BookmarkTreeView.NodeType.Page) if (treeView1.GetNodeType(node) != RyzStudio.Windows.Forms.BookmarkTreeView.NodeType.Page)
@ -1079,6 +802,20 @@ namespace bzit.bomg
protected void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) => openBookmark(e.Node); protected void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) => openBookmark(e.Node);
protected void treeView1_OnNodeChanged(object sender, EventArgs e)
{
if (this.InvokeRequired)
{
this.Invoke(new MethodInvoker(() => {
this.AllowSave = treeView1.HasChanged;
}));
}
else
{
this.AllowSave = treeView1.HasChanged;
}
}
protected void treeView1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) protected void treeView1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{ {
TreeNode tn = treeView1.SelectedNode; TreeNode tn = treeView1.SelectedNode;
@ -1186,21 +923,6 @@ namespace bzit.bomg
#endregion #endregion
protected void treeView1_OnNodeChanged(object sender, EventArgs e)
{
if (this.InvokeRequired)
{
this.Invoke(new MethodInvoker(() => {
this.AllowSave = treeView1.HasChanged;
}));
}
else
{
this.AllowSave = treeView1.HasChanged;
}
}
public void ClearSession() public void ClearSession()
{ {
sessionFilename = sessionPassword = null; sessionFilename = sessionPassword = null;
@ -1230,30 +952,5 @@ namespace bzit.bomg
ThreadControl.SetText(this, Path.GetFileNameWithoutExtension(sessionFilename) + " - " + Resources.app_name); ThreadControl.SetText(this, Path.GetFileNameWithoutExtension(sessionFilename) + " - " + Resources.app_name);
} }
public void SetBookmarkItem(List<BookmarkItemViewModel> itmes)
{
treeView1.AddItem(itmes);
}
//private void loadFileThread_DoWork(object sender, DoWorkEventArgs e)
//{
// if (loadFileType == LoadFileType.Jsnx)
// {
// loadBookmarkFile_ForJSNX(sessionFilename, sessionPassword ?? string.Empty);
// }
// else if (loadFileType == LoadFileType.Ryz)
// {
// loadBookmarkFile_ForRYZ(sessionFilename, sessionPassword ?? string.Empty);
// }
//}
//private void loadFileThread_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
//{
// this.IsBusy = false;
// saveMenuBarItem.Enabled = saveFileMenuItem.Enabled = false;
//}
} }
} }

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.3.0.025")] [assembly: AssemblyVersion("0.3.0.030")]
[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.3.0.025 beta. /// Looks up a localized string similar to 0.3.0.030 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.3.0.025 beta</value> <value>0.3.0.030 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

@ -72,7 +72,7 @@ namespace bzit.bomg
return; return;
} }
List<TreeNode> nodeList = parentForm.treeView1.GetBookmarkNodeList(); List<TreeNode> nodeList = parentForm.TreeView.GetBookmarkNodeList();
ThreadControl.SetValue(progressBar1, 0, nodeList.Count); ThreadControl.SetValue(progressBar1, 0, nodeList.Count);
@ -95,16 +95,16 @@ namespace bzit.bomg
bool rv = model.UpdateFavicon(); bool rv = model.UpdateFavicon();
if (rv) if (rv)
{ {
if (parentForm.treeView1.InvokeRequired) if (parentForm.TreeView.InvokeRequired)
{ {
parentForm.treeView1.Invoke(new MethodInvoker(() => parentForm.TreeView.Invoke(new MethodInvoker(() =>
{ {
parentForm.treeView1.UpdateItem(nodeList[i], model.ToViewModel()); parentForm.TreeView.UpdateItem(nodeList[i], model.ToViewModel());
})); }));
} }
else else
{ {
parentForm.treeView1.UpdateItem(nodeList[i], model.ToViewModel()); parentForm.TreeView.UpdateItem(nodeList[i], model.ToViewModel());
} }
} }
} }

View File