Changed: total rebuild
This commit is contained in:
parent
d6775aa5ad
commit
95e332941e
445
MainForm.cs
445
MainForm.cs
@ -23,12 +23,33 @@ namespace bzit.bomg
|
|||||||
New
|
New
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum LoadFileType
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
Jsnx,
|
||||||
|
Ryz
|
||||||
|
}
|
||||||
|
|
||||||
|
protected BackgroundWorker loadFileThread = null;
|
||||||
|
protected LoadFileType loadFileType = LoadFileType.None;
|
||||||
|
|
||||||
protected AppMode appMode = AppMode.Clear;
|
protected AppMode appMode = AppMode.Clear;
|
||||||
protected string sessionFilename = null;
|
protected string sessionFilename = null;
|
||||||
|
protected string sessionPassword = null;
|
||||||
|
protected bool usePassword = false;
|
||||||
|
|
||||||
public MainForm()
|
public MainForm()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
if (loadFileThread == null)
|
||||||
|
{
|
||||||
|
loadFileThread = new BackgroundWorker();
|
||||||
|
loadFileThread.WorkerReportsProgress = loadFileThread.WorkerSupportsCancellation = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
loadFileThread.DoWork += loadFileThread_DoWork;
|
||||||
|
loadFileThread.RunWorkerCompleted += loadFileThread_RunWorkerCompleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnLoad(EventArgs e)
|
protected override void OnLoad(EventArgs e)
|
||||||
@ -47,7 +68,8 @@ namespace bzit.bomg
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.ApplicationMode = AppMode.Clear;
|
this.ApplicationMode = AppMode.Clear;
|
||||||
sessionFilename = null;
|
sessionFilename = sessionPassword = null;
|
||||||
|
usePassword = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnShown(EventArgs e)
|
protected override void OnShown(EventArgs e)
|
||||||
@ -102,6 +124,12 @@ namespace bzit.bomg
|
|||||||
|
|
||||||
protected override void OnFormClosing(FormClosingEventArgs e)
|
protected override void OnFormClosing(FormClosingEventArgs e)
|
||||||
{
|
{
|
||||||
|
if (this.IsBusy)
|
||||||
|
{
|
||||||
|
e.Cancel = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.ApplicationMode == AppMode.Clear)
|
if (this.ApplicationMode == AppMode.Clear)
|
||||||
{
|
{
|
||||||
// do later
|
// do later
|
||||||
@ -137,7 +165,16 @@ namespace bzit.bomg
|
|||||||
DialogResult response = MessageBox.Show("Save changes to open bookmarks", "Save?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
|
DialogResult response = MessageBox.Show("Save changes to open bookmarks", "Save?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
|
||||||
if (response == DialogResult.Yes)
|
if (response == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
saveBookmarkFile_ForJSNX(sessionFilename);
|
if (usePassword)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(sessionPassword))
|
||||||
|
{
|
||||||
|
TextBoxForm passwordForm = new TextBoxForm("Password", "Password", true);
|
||||||
|
sessionPassword = passwordForm.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
saveBookmarkFile_ForJSNX(sessionFilename, sessionPassword ?? string.Empty);
|
||||||
}
|
}
|
||||||
else if (response == DialogResult.No)
|
else if (response == DialogResult.No)
|
||||||
{
|
{
|
||||||
@ -160,12 +197,12 @@ namespace bzit.bomg
|
|||||||
|
|
||||||
treeView1.Clear();
|
treeView1.Clear();
|
||||||
this.ApplicationMode = AppMode.Clear;
|
this.ApplicationMode = AppMode.Clear;
|
||||||
sessionFilename = null;
|
sessionFilename = sessionPassword = null;
|
||||||
|
|
||||||
Application.Exit();
|
Application.Exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public AppMode ApplicationMode
|
protected AppMode ApplicationMode
|
||||||
{
|
{
|
||||||
get => appMode;
|
get => appMode;
|
||||||
set
|
set
|
||||||
@ -206,10 +243,27 @@ namespace bzit.bomg
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Toolbar #1
|
protected bool IsBusy
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return loadFileThread.IsBusy;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
treeView1.Enabled = !value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region toolbar
|
||||||
|
|
||||||
private void fileNewMenuItem_Click(object sender, EventArgs e)
|
private void fileNewMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (this.IsBusy)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.ApplicationMode == AppMode.Clear)
|
if (this.ApplicationMode == AppMode.Clear)
|
||||||
{
|
{
|
||||||
// do later
|
// do later
|
||||||
@ -243,7 +297,16 @@ namespace bzit.bomg
|
|||||||
DialogResult response = MessageBox.Show("Save changes to open bookmarks", "Save?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
|
DialogResult response = MessageBox.Show("Save changes to open bookmarks", "Save?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
|
||||||
if (response == DialogResult.Yes)
|
if (response == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
saveBookmarkFile_ForJSNX(sessionFilename);
|
if (usePassword)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(sessionPassword))
|
||||||
|
{
|
||||||
|
TextBoxForm passwordForm = new TextBoxForm("Password", "Password", true);
|
||||||
|
sessionPassword = passwordForm.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
saveBookmarkFile_ForJSNX(sessionFilename, sessionPassword ?? string.Empty);
|
||||||
}
|
}
|
||||||
else if (response == DialogResult.No)
|
else if (response == DialogResult.No)
|
||||||
{
|
{
|
||||||
@ -271,11 +334,16 @@ namespace bzit.bomg
|
|||||||
treeView1.Clear(rv);
|
treeView1.Clear(rv);
|
||||||
|
|
||||||
this.ApplicationMode = AppMode.New;
|
this.ApplicationMode = AppMode.New;
|
||||||
sessionFilename = null;
|
sessionFilename = sessionPassword = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fileOpenMenuItem_Click(object sender, EventArgs e)
|
private void fileOpenMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (this.IsBusy)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.ApplicationMode == AppMode.Clear)
|
if (this.ApplicationMode == AppMode.Clear)
|
||||||
{
|
{
|
||||||
// do later
|
// do later
|
||||||
@ -309,7 +377,16 @@ namespace bzit.bomg
|
|||||||
DialogResult response = MessageBox.Show("Save changes to open bookmarks", "Save?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
|
DialogResult response = MessageBox.Show("Save changes to open bookmarks", "Save?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
|
||||||
if (response == DialogResult.Yes)
|
if (response == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
saveBookmarkFile_ForJSNX(sessionFilename);
|
if (usePassword)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(sessionPassword))
|
||||||
|
{
|
||||||
|
TextBoxForm passwordForm = new TextBoxForm("Password", "Password", true);
|
||||||
|
sessionPassword = passwordForm.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
saveBookmarkFile_ForJSNX(sessionFilename, sessionPassword ?? string.Empty);
|
||||||
}
|
}
|
||||||
else if (response == DialogResult.No)
|
else if (response == DialogResult.No)
|
||||||
{
|
{
|
||||||
@ -335,6 +412,11 @@ namespace bzit.bomg
|
|||||||
|
|
||||||
private void fileCloseMenuItem_Click(object sender, EventArgs e)
|
private void fileCloseMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (this.IsBusy)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.ApplicationMode == AppMode.Clear)
|
if (this.ApplicationMode == AppMode.Clear)
|
||||||
{
|
{
|
||||||
// do later
|
// do later
|
||||||
@ -368,7 +450,16 @@ namespace bzit.bomg
|
|||||||
DialogResult response = MessageBox.Show("Save changes to open bookmarks", "Save?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
|
DialogResult response = MessageBox.Show("Save changes to open bookmarks", "Save?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
|
||||||
if (response == DialogResult.Yes)
|
if (response == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
saveBookmarkFile_ForJSNX(sessionFilename);
|
if (usePassword)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(sessionPassword))
|
||||||
|
{
|
||||||
|
TextBoxForm passwordForm = new TextBoxForm("Password", "Password", true);
|
||||||
|
sessionPassword = passwordForm.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
saveBookmarkFile_ForJSNX(sessionFilename, sessionPassword ?? string.Empty);
|
||||||
}
|
}
|
||||||
else if (response == DialogResult.No)
|
else if (response == DialogResult.No)
|
||||||
{
|
{
|
||||||
@ -388,11 +479,16 @@ namespace bzit.bomg
|
|||||||
|
|
||||||
treeView1.Clear();
|
treeView1.Clear();
|
||||||
this.ApplicationMode = AppMode.Clear;
|
this.ApplicationMode = AppMode.Clear;
|
||||||
sessionFilename = null;
|
sessionFilename = sessionPassword = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fileSaveMenuItem_Click(object sender, EventArgs e)
|
private void fileSaveMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (this.IsBusy)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.ApplicationMode == AppMode.New)
|
if (this.ApplicationMode == AppMode.New)
|
||||||
{
|
{
|
||||||
DialogResult response = MessageBox.Show("Save bookmarks", "Save?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
|
DialogResult response = MessageBox.Show("Save bookmarks", "Save?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
|
||||||
@ -415,12 +511,26 @@ namespace bzit.bomg
|
|||||||
}
|
}
|
||||||
else if (this.ApplicationMode == AppMode.Open)
|
else if (this.ApplicationMode == AppMode.Open)
|
||||||
{
|
{
|
||||||
saveBookmarkFile_ForJSNX(sessionFilename);
|
if (usePassword)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(sessionPassword))
|
||||||
|
{
|
||||||
|
TextBoxForm passwordForm = new TextBoxForm("Password", "Password", true);
|
||||||
|
sessionPassword = passwordForm.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
saveBookmarkFile_ForJSNX(sessionFilename, sessionPassword ?? string.Empty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fileSaveAsMenuItem_Click(object sender, EventArgs e)
|
private void fileSaveAsMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (this.IsBusy)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.ApplicationMode == AppMode.Clear)
|
if (this.ApplicationMode == AppMode.Clear)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -435,17 +545,32 @@ namespace bzit.bomg
|
|||||||
|
|
||||||
private void fileExitMenuItem_Click(object sender, EventArgs e)
|
private void fileExitMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (this.IsBusy)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void editFindMenuItem_Click(object sender, EventArgs e)
|
private void editFindMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (this.IsBusy)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
FindForm findForm = new FindForm(this);
|
FindForm findForm = new FindForm(this);
|
||||||
findForm.Show();
|
findForm.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void viewExpandAllMenuItem_Click(object sender, EventArgs e)
|
private void viewExpandAllMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (this.IsBusy)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.ApplicationMode == AppMode.Clear)
|
if (this.ApplicationMode == AppMode.Clear)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -463,6 +588,11 @@ namespace bzit.bomg
|
|||||||
|
|
||||||
private void viewCollapseAllMenuItem_Click(object sender, EventArgs e)
|
private void viewCollapseAllMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (this.IsBusy)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.ApplicationMode == AppMode.Clear)
|
if (this.ApplicationMode == AppMode.Clear)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -485,27 +615,13 @@ namespace bzit.bomg
|
|||||||
alwaysOnTopToolStripMenuItem1.Checked = this.TopMost;
|
alwaysOnTopToolStripMenuItem1.Checked = this.TopMost;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Tools -> Refresh Icons
|
|
||||||
*/
|
|
||||||
//private void toolStripMenuItem1_Click(object sender, EventArgs e)
|
|
||||||
//{
|
|
||||||
// if (string.IsNullOrEmpty(sessionFilename))
|
|
||||||
// {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (this.ApplicationMode == AppMode.Clear)
|
|
||||||
// {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// UpdateIconForm frm = new UpdateIconForm(this);
|
|
||||||
// frm.ShowDialog();
|
|
||||||
//}
|
|
||||||
|
|
||||||
private void toolsOptionsMenuItem_Click(object sender, EventArgs e)
|
private void toolsOptionsMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (this.IsBusy)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//OptionsForm frm = new OptionsForm(this);
|
//OptionsForm frm = new OptionsForm(this);
|
||||||
//frm.ShowDialog();
|
//frm.ShowDialog();
|
||||||
}
|
}
|
||||||
@ -536,11 +652,6 @@ namespace bzit.bomg
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected void loadBookmarkFile(string filename, int filterIndex)
|
protected void loadBookmarkFile(string filename, int filterIndex)
|
||||||
{
|
{
|
||||||
switch (filterIndex)
|
switch (filterIndex)
|
||||||
@ -562,8 +673,12 @@ namespace bzit.bomg
|
|||||||
if (RyzStudio.IO.SharpZipLib.TestZipEncrypted(filename, password))
|
if (RyzStudio.IO.SharpZipLib.TestZipEncrypted(filename, password))
|
||||||
{
|
{
|
||||||
sessionFilename = filename;
|
sessionFilename = filename;
|
||||||
//this.ApplicationMode = AppMode.Open;
|
sessionPassword = password;
|
||||||
loadBookmarkFile_ForJSNX(filename, password);
|
usePassword = true;
|
||||||
|
|
||||||
|
loadFileType = LoadFileType.Jsnx;
|
||||||
|
|
||||||
|
loadFileThread.RunWorkerAsync();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -571,8 +686,12 @@ namespace bzit.bomg
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
sessionFilename = filename;
|
sessionFilename = filename;
|
||||||
//this.ApplicationMode = AppMode.Open;
|
sessionPassword = null;
|
||||||
loadBookmarkFile_ForJSNX(filename);
|
usePassword = false;
|
||||||
|
|
||||||
|
loadFileType = LoadFileType.Jsnx;
|
||||||
|
|
||||||
|
loadFileThread.RunWorkerAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -592,20 +711,26 @@ namespace bzit.bomg
|
|||||||
|
|
||||||
if (RyzStudio.IO.SharpZipLib.TestZipEncrypted(filename, password))
|
if (RyzStudio.IO.SharpZipLib.TestZipEncrypted(filename, password))
|
||||||
{
|
{
|
||||||
loadBookmarkFile_ForRYZ(filename, password);
|
sessionFilename = filename;
|
||||||
|
sessionPassword = password;
|
||||||
|
usePassword = true;
|
||||||
|
|
||||||
sessionFilename = null;
|
loadFileType = LoadFileType.Ryz;
|
||||||
this.ApplicationMode = AppMode.New;
|
|
||||||
|
loadFileThread.RunWorkerAsync();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
loadBookmarkFile_ForRYZ(filename);
|
sessionFilename = filename;
|
||||||
|
sessionPassword = null;
|
||||||
|
usePassword = false;
|
||||||
|
|
||||||
sessionFilename = null;
|
loadFileType = LoadFileType.Ryz;
|
||||||
this.ApplicationMode = AppMode.New;
|
|
||||||
|
loadFileThread.RunWorkerAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -673,9 +798,27 @@ namespace bzit.bomg
|
|||||||
readStream.Dispose();
|
readStream.Dispose();
|
||||||
readStream = null;
|
readStream = null;
|
||||||
|
|
||||||
|
if (treeView1.InvokeRequired)
|
||||||
|
{
|
||||||
|
treeView1.Invoke(new MethodInvoker(() => {
|
||||||
treeView1.AddItem(rs);
|
treeView1.AddItem(rs);
|
||||||
treeView1.HasChanged = false;
|
}));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
treeView1.AddItem(rs);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.InvokeRequired)
|
||||||
|
{
|
||||||
|
this.Invoke(new MethodInvoker(() => {
|
||||||
this.ApplicationMode = AppMode.Open;
|
this.ApplicationMode = AppMode.Open;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.ApplicationMode = AppMode.Open;
|
||||||
|
}
|
||||||
|
|
||||||
setAppTitle(Path.GetFileNameWithoutExtension(filename));
|
setAppTitle(Path.GetFileNameWithoutExtension(filename));
|
||||||
}
|
}
|
||||||
@ -805,13 +948,62 @@ namespace bzit.bomg
|
|||||||
readStream.Dispose();
|
readStream.Dispose();
|
||||||
readStream = null;
|
readStream = null;
|
||||||
|
|
||||||
|
if (treeView1.InvokeRequired)
|
||||||
|
{
|
||||||
|
treeView1.Invoke(new MethodInvoker(() => {
|
||||||
treeView1.AddItem(rs);
|
treeView1.AddItem(rs);
|
||||||
treeView1.HasChanged = false;
|
}));
|
||||||
//this.ApplicationMode = AppMode.New;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
setAppTitle(Path.GetFileNameWithoutExtension(filename));
|
setAppTitle(Path.GetFileNameWithoutExtension(filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void openBookmark(TreeNode node)
|
||||||
|
{
|
||||||
|
if (treeView1.GetNodeType(node) != RyzStudio.Windows.Forms.BookmarkTreeView.NodeType.Page)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BookmarkItemViewModel viewModel = (BookmarkItemViewModel)node.Tag;
|
||||||
|
if (viewModel == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(viewModel.SiteAddress))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
System.Diagnostics.Process.Start(viewModel.SiteAddress);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected bool saveAsBookmarkFile()
|
protected bool saveAsBookmarkFile()
|
||||||
{
|
{
|
||||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||||
@ -824,6 +1016,7 @@ namespace bzit.bomg
|
|||||||
setAppTitle(Path.GetFileNameWithoutExtension(saveFileDialog.FileName));
|
setAppTitle(Path.GetFileNameWithoutExtension(saveFileDialog.FileName));
|
||||||
|
|
||||||
sessionFilename = saveFileDialog.FileName;
|
sessionFilename = saveFileDialog.FileName;
|
||||||
|
usePassword = false;
|
||||||
this.ApplicationMode = AppMode.Open;
|
this.ApplicationMode = AppMode.Open;
|
||||||
treeView1.HasChanged = false;
|
treeView1.HasChanged = false;
|
||||||
break;
|
break;
|
||||||
@ -836,6 +1029,8 @@ namespace bzit.bomg
|
|||||||
setAppTitle(Path.GetFileNameWithoutExtension(saveFileDialog.FileName));
|
setAppTitle(Path.GetFileNameWithoutExtension(saveFileDialog.FileName));
|
||||||
|
|
||||||
sessionFilename = saveFileDialog.FileName;
|
sessionFilename = saveFileDialog.FileName;
|
||||||
|
sessionPassword = password;
|
||||||
|
usePassword = true;
|
||||||
this.ApplicationMode = AppMode.Open;
|
this.ApplicationMode = AppMode.Open;
|
||||||
treeView1.HasChanged = false;
|
treeView1.HasChanged = false;
|
||||||
break;
|
break;
|
||||||
@ -895,7 +1090,16 @@ namespace bzit.bomg
|
|||||||
|
|
||||||
protected void setAppTitle(string title)
|
protected void setAppTitle(string title)
|
||||||
{
|
{
|
||||||
|
if (this.InvokeRequired)
|
||||||
|
{
|
||||||
|
this.Invoke(new MethodInvoker(() => {
|
||||||
this.Text = title + " - " + Properties.Resources.app_name;
|
this.Text = title + " - " + Properties.Resources.app_name;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.Text = title + " - " + Properties.Resources.app_name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
|
protected void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
|
||||||
@ -961,113 +1165,15 @@ namespace bzit.bomg
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void openBookmark(TreeNode node)
|
|
||||||
{
|
|
||||||
if (treeView1.GetNodeType(node) != RyzStudio.Windows.Forms.BookmarkTreeView.NodeType.Page)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
BookmarkItemViewModel viewModel = (BookmarkItemViewModel)node.Tag;
|
|
||||||
if (viewModel == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(viewModel.SiteAddress))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
System.Diagnostics.Process.Start(viewModel.SiteAddress);
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//if (node == null)
|
|
||||||
//{
|
|
||||||
// return;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//if (node.Tag == null)
|
|
||||||
//{
|
|
||||||
// return;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//if (!(node.Tag is BookmarkItem))
|
|
||||||
//{
|
|
||||||
// return;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//BookmarkItem item = (BookmarkItem)node.Tag;
|
|
||||||
//if (item == null)
|
|
||||||
//{
|
|
||||||
// return;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//if (string.IsNullOrEmpty(item.SiteAddress))
|
|
||||||
//{
|
|
||||||
// return;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//int bookmarkAction;
|
|
||||||
//if (!int.TryParse(this.IconDatabase.GetConfig("core.bookmark.action", string.Empty), out bookmarkAction))
|
|
||||||
//{
|
|
||||||
// bookmarkAction = 0;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//string bookmarkCustom1 = this.IconDatabase.GetConfig("core.bookmark.customcommand1", string.Empty).Trim();
|
|
||||||
//string bookmarkCustom2 = this.IconDatabase.GetConfig("core.bookmark.customcommand2", string.Empty).Trim();
|
|
||||||
|
|
||||||
//switch (bookmarkAction)
|
|
||||||
//{
|
|
||||||
// case 1:
|
|
||||||
// if (string.IsNullOrEmpty(bookmarkCustom1))
|
|
||||||
// {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// bookmarkCustom1 = bookmarkCustom1.Replace("%1", item.SiteAddress);
|
|
||||||
// bookmarkCustom2 = bookmarkCustom2.Replace("%1", item.SiteAddress);
|
|
||||||
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// System.Diagnostics.Process.Start(bookmarkCustom1, bookmarkCustom2);
|
|
||||||
// }
|
|
||||||
// catch
|
|
||||||
// {
|
|
||||||
// // do nothing
|
|
||||||
// }
|
|
||||||
|
|
||||||
// break;
|
|
||||||
// default:
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// System.Diagnostics.Process.Start(item.SiteAddress);
|
|
||||||
// }
|
|
||||||
// catch
|
|
||||||
// {
|
|
||||||
// // do nothing
|
|
||||||
// }
|
|
||||||
|
|
||||||
// break;
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
|
|
||||||
#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();
|
||||||
|
|
||||||
private void addFolderContextMenu_Click(object sender, EventArgs e) => treeView1.SelectedNode = treeView1.SNode.AddFolder();
|
private void addFolderContextMenu_Click(object sender, EventArgs e) => treeView1.SelectedNode = treeView1.SNode.AddFolder();
|
||||||
|
|
||||||
private void editContextMenu_Click(object sender, EventArgs e) => treeView1.SNode.Edit();
|
private void editContextMenu_Click(object sender, EventArgs e) => treeView1.SNode.Edit();
|
||||||
|
|
||||||
private void sortContextMenu_Click(object sender, EventArgs e) => treeView1.SNode.Sort();
|
private void sortContextMenu_Click(object sender, EventArgs e) => treeView1.SNode.Sort();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -1075,6 +1181,7 @@ namespace bzit.bomg
|
|||||||
#region folder context menu
|
#region folder context menu
|
||||||
|
|
||||||
private void addPageContextMenu2_Click(object sender, EventArgs e) => (new BookmarkEditForm(treeView1)).ShowDialog();
|
private void addPageContextMenu2_Click(object sender, EventArgs e) => (new BookmarkEditForm(treeView1)).ShowDialog();
|
||||||
|
|
||||||
private void addFolderContextMenu2_Click(object sender, EventArgs e) => treeView1.SelectedNode = treeView1.SNode.AddFolder();
|
private void addFolderContextMenu2_Click(object sender, EventArgs e) => treeView1.SelectedNode = treeView1.SNode.AddFolder();
|
||||||
|
|
||||||
private void openAllContextMenu_Click(object sender, EventArgs e)
|
private void openAllContextMenu_Click(object sender, EventArgs e)
|
||||||
@ -1096,9 +1203,13 @@ namespace bzit.bomg
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void editContextMenu2_Click(object sender, EventArgs e) => treeView1.SNode.Edit();
|
private void editContextMenu2_Click(object sender, EventArgs e) => treeView1.SNode.Edit();
|
||||||
|
|
||||||
private void deleteContextMenu_Click(object sender, EventArgs e) => treeView1.SNode.Delete();
|
private void deleteContextMenu_Click(object sender, EventArgs e) => treeView1.SNode.Delete();
|
||||||
|
|
||||||
private void sortContextMenu2_Click(object sender, EventArgs e) => treeView1.SNode.Sort();
|
private void sortContextMenu2_Click(object sender, EventArgs e) => treeView1.SNode.Sort();
|
||||||
|
|
||||||
private void moveUpContextMenu_Click(object sender, EventArgs e) => treeView1.SNode.MoveUp();
|
private void moveUpContextMenu_Click(object sender, EventArgs e) => treeView1.SNode.MoveUp();
|
||||||
|
|
||||||
private void moveDownContextMenu_Click(object sender, EventArgs e) => treeView1.SNode.MoveDown();
|
private void moveDownContextMenu_Click(object sender, EventArgs e) => treeView1.SNode.MoveDown();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -1106,12 +1217,48 @@ namespace bzit.bomg
|
|||||||
#region page context menu
|
#region page context menu
|
||||||
|
|
||||||
private void openContextMenu_Click(object sender, EventArgs e) => openBookmark(treeView1.SelectedNode);
|
private void openContextMenu_Click(object sender, EventArgs e) => openBookmark(treeView1.SelectedNode);
|
||||||
|
|
||||||
private void editContextMenu3_Click(object sender, EventArgs e) => (new BookmarkEditForm(treeView1)).ShowDialog();
|
private void editContextMenu3_Click(object sender, EventArgs e) => (new BookmarkEditForm(treeView1)).ShowDialog();
|
||||||
|
|
||||||
private void deleteContextMenu2_Click(object sender, EventArgs e) => treeView1.SNode.Delete();
|
private void deleteContextMenu2_Click(object sender, EventArgs e) => treeView1.SNode.Delete();
|
||||||
|
|
||||||
private void moveUpContextMenu2_Click(object sender, EventArgs e) => treeView1.SNode.MoveUp();
|
private void moveUpContextMenu2_Click(object sender, EventArgs e) => treeView1.SNode.MoveUp();
|
||||||
|
|
||||||
private void moveDownContextMenu2_Click(object sender, EventArgs e) => treeView1.SNode.MoveDown();
|
private void moveDownContextMenu2_Click(object sender, EventArgs e) => treeView1.SNode.MoveDown();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
private void loadFileThread_DoWork(object sender, DoWorkEventArgs e)
|
||||||
|
{
|
||||||
|
if (loadFileType == LoadFileType.Jsnx)
|
||||||
|
{
|
||||||
|
if (usePassword)
|
||||||
|
{
|
||||||
|
loadBookmarkFile_ForJSNX(sessionFilename, sessionPassword);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
loadBookmarkFile_ForJSNX(sessionFilename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (loadFileType == LoadFileType.Ryz)
|
||||||
|
{
|
||||||
|
if (usePassword)
|
||||||
|
{
|
||||||
|
loadBookmarkFile_ForRYZ(sessionFilename, sessionPassword);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
loadBookmarkFile_ForRYZ(sessionFilename);
|
||||||
|
}
|
||||||
|
|
||||||
|
sessionFilename = sessionPassword = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadFileThread_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
|
||||||
|
{
|
||||||
|
this.IsBusy = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ using System.Runtime.InteropServices;
|
|||||||
[assembly: AssemblyTitle("Bookmark Manager")]
|
[assembly: AssemblyTitle("Bookmark Manager")]
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("")]
|
[assembly: AssemblyCompany("Hi, I'm Ray")]
|
||||||
[assembly: AssemblyProduct("Bookmark Manager")]
|
[assembly: AssemblyProduct("Bookmark Manager")]
|
||||||
[assembly: AssemblyCopyright("Copyright © Ray Lam 2012")]
|
[assembly: AssemblyCopyright("Copyright © Ray Lam 2012")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
|
@ -64,6 +64,7 @@ namespace RyzStudio.Windows.ThemedForms
|
|||||||
switch (e.KeyCode)
|
switch (e.KeyCode)
|
||||||
{
|
{
|
||||||
case Keys.Escape:
|
case Keys.Escape:
|
||||||
|
textBox1.Text = string.Empty;
|
||||||
this.Close();
|
this.Close();
|
||||||
break;
|
break;
|
||||||
default: break;
|
default: break;
|
||||||
|
@ -153,6 +153,8 @@ namespace RyzStudio.Windows.Forms
|
|||||||
{
|
{
|
||||||
AddItem(item);
|
AddItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.HasChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddItem(BookmarkItemViewModel viewModel)
|
public void AddItem(BookmarkItemViewModel viewModel)
|
||||||
|
24
bomg.csproj
24
bomg.csproj
@ -155,12 +155,6 @@
|
|||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="ViewModels\BookmarkItemViewModel.cs" />
|
<Compile Include="ViewModels\BookmarkItemViewModel.cs" />
|
||||||
<Compile Include="RyzStudio\Data\SQLite\SQLiteDatabase2.cs" />
|
<Compile Include="RyzStudio\Data\SQLite\SQLiteDatabase2.cs" />
|
||||||
<Compile Include="UpdateIconForm.cs">
|
|
||||||
<SubType>Form</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="UpdateIconForm.Designer.cs">
|
|
||||||
<DependentUpon>UpdateIconForm.cs</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Data\IconDatabase.cs" />
|
<Compile Include="Data\IconDatabase.cs" />
|
||||||
<Compile Include="BookmarkEditForm.cs">
|
<Compile Include="BookmarkEditForm.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
@ -192,18 +186,6 @@
|
|||||||
<Compile Include="RyzStudio\IO\FileType.cs" />
|
<Compile Include="RyzStudio\IO\FileType.cs" />
|
||||||
<Compile Include="RyzStudio\IO\SessionFileFormatBase.cs" />
|
<Compile Include="RyzStudio\IO\SessionFileFormatBase.cs" />
|
||||||
<Compile Include="RyzStudio\IO\SharpZipLib.cs" />
|
<Compile Include="RyzStudio\IO\SharpZipLib.cs" />
|
||||||
<Compile Include="RyzStudio\Windows\Forms\BigButton.cs">
|
|
||||||
<SubType>UserControl</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="RyzStudio\Windows\Forms\BigButton.Designer.cs">
|
|
||||||
<DependentUpon>BigButton.cs</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="RyzStudio\Windows\Forms\BigUserControl.cs">
|
|
||||||
<SubType>UserControl</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="RyzStudio\Windows\Forms\BigUserControl.Designer.cs">
|
|
||||||
<DependentUpon>BigUserControl.cs</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Windows\Forms\BookmarkTreeView.cs">
|
<Compile Include="Windows\Forms\BookmarkTreeView.cs">
|
||||||
<SubType>Component</SubType>
|
<SubType>Component</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@ -225,9 +207,6 @@
|
|||||||
<EmbeddedResource Include="RyzStudio\Windows\ThemedForms\ProgressBarInner.resx">
|
<EmbeddedResource Include="RyzStudio\Windows\ThemedForms\ProgressBarInner.resx">
|
||||||
<DependentUpon>ProgressBarInner.cs</DependentUpon>
|
<DependentUpon>ProgressBarInner.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="UpdateIconForm.resx">
|
|
||||||
<DependentUpon>UpdateIconForm.cs</DependentUpon>
|
|
||||||
</EmbeddedResource>
|
|
||||||
<EmbeddedResource Include="BookmarkEditForm.resx">
|
<EmbeddedResource Include="BookmarkEditForm.resx">
|
||||||
<DependentUpon>BookmarkEditForm.cs</DependentUpon>
|
<DependentUpon>BookmarkEditForm.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
@ -250,9 +229,6 @@
|
|||||||
<EmbeddedResource Include="MainForm.resx">
|
<EmbeddedResource Include="MainForm.resx">
|
||||||
<DependentUpon>MainForm.cs</DependentUpon>
|
<DependentUpon>MainForm.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="RyzStudio\Windows\Forms\BigButton.resx">
|
|
||||||
<DependentUpon>BigButton.cs</DependentUpon>
|
|
||||||
</EmbeddedResource>
|
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
<None Include="Properties\Settings.settings">
|
<None Include="Properties\Settings.settings">
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
|
Reference in New Issue
Block a user