Fixed: interrupt open with password with exit

This commit is contained in:
Ray 2020-08-29 09:56:25 +01:00
parent d6d4fd024d
commit ad9c1242cf
6 changed files with 71 additions and 77 deletions

View File

@ -61,7 +61,7 @@ namespace bzit.bomg
isBusy = value; isBusy = value;
textBox1.Enabled = textBox2.Enabled = memoBox1.Enabled = !value; textBox1.Enabled = textBox2.Enabled = memoBox1.Enabled = !value;
pictureBox1.Image = (value) ? Resources.aniZomq2x32 : null; ThreadControl.SetImage(pictureBox1, (value) ? Resources.aniZomq2x32 : null);
} }
} }
@ -92,7 +92,6 @@ namespace bzit.bomg
this.IsBusy = true; this.IsBusy = true;
//threadWorker.RunWorkerAsync();
await Task.Run(() => await Task.Run(() =>
{ {
if (itemModel == null) itemModel = new BookmarkItemModel(); if (itemModel == null) itemModel = new BookmarkItemModel();

4
MainForm.Designer.cs generated
View File

@ -310,7 +310,7 @@ namespace bzit.bomg
this.findEditMenuItem.Image = global::bzit.bomg.Properties.Resources.search; this.findEditMenuItem.Image = global::bzit.bomg.Properties.Resources.search;
this.findEditMenuItem.Name = "findEditMenuItem"; this.findEditMenuItem.Name = "findEditMenuItem";
this.findEditMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F))); this.findEditMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F)));
this.findEditMenuItem.Size = new System.Drawing.Size(180, 22); this.findEditMenuItem.Size = new System.Drawing.Size(137, 22);
this.findEditMenuItem.Text = "&Find"; this.findEditMenuItem.Text = "&Find";
this.findEditMenuItem.Click += new System.EventHandler(this.editFindMenuItem_Click); this.findEditMenuItem.Click += new System.EventHandler(this.editFindMenuItem_Click);
// //
@ -370,7 +370,7 @@ namespace bzit.bomg
// //
this.optionsToolMenuItem.Name = "optionsToolMenuItem"; this.optionsToolMenuItem.Name = "optionsToolMenuItem";
this.optionsToolMenuItem.Size = new System.Drawing.Size(180, 22); this.optionsToolMenuItem.Size = new System.Drawing.Size(180, 22);
this.optionsToolMenuItem.Text = "&Update Icons"; this.optionsToolMenuItem.Text = "&Update Favicons";
this.optionsToolMenuItem.Click += new System.EventHandler(this.toolsOptionsMenuItem_Click); this.optionsToolMenuItem.Click += new System.EventHandler(this.toolsOptionsMenuItem_Click);
// //
// toolStripDropDownButton5 // toolStripDropDownButton5

View File

@ -659,83 +659,49 @@ namespace bzit.bomg
protected void loadBookmarkFile(string filename, int filterIndex) 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) switch (filterIndex)
{ {
case 1: case 1:
if (RyzStudio.IO.SharpZipLib.IsZipEncrypted(filename)) loadFileType = LoadFileType.Jsnx;
{
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;
}
}
}
else
{
sessionFilename = filename;
sessionPassword = null;
usePassword = false;
loadFileType = LoadFileType.Jsnx;
}
break; break;
case 2: case 2:
if (RyzStudio.IO.SharpZipLib.IsZipEncrypted(filename)) loadFileType = LoadFileType.Ryz;
{
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.Ryz;
break;
}
}
}
else
{
sessionFilename = filename;
sessionPassword = null;
usePassword = false;
loadFileType = LoadFileType.Ryz;
}
break; break;
default: default:
sessionFilename = sessionPassword = null; loadFileType = LoadFileType.None;
usePassword = false;
break; break;
} }
@ -1228,6 +1194,8 @@ namespace bzit.bomg
} }
} }
private void loadFileThread_DoWork(object sender, DoWorkEventArgs e) private void loadFileThread_DoWork(object sender, DoWorkEventArgs e)
{ {
if (loadFileType == LoadFileType.Jsnx) if (loadFileType == LoadFileType.Jsnx)

View File

@ -1,10 +1,13 @@
using System; using System;
using System.ComponentModel;
using System.Windows.Forms; using System.Windows.Forms;
namespace RyzStudio.Windows.ThemedForms namespace RyzStudio.Windows.ThemedForms
{ {
public partial class TextBoxForm : System.Windows.Forms.Form public partial class TextBoxForm : System.Windows.Forms.Form
{ {
protected bool returnValue = false;
public TextBoxForm(string title, string labelText, string defaultValue) public TextBoxForm(string title, string labelText, string defaultValue)
{ {
InitializeComponent(); InitializeComponent();
@ -54,8 +57,20 @@ namespace RyzStudio.Windows.ThemedForms
textBox1.UseSystemPasswordChar = password; textBox1.UseSystemPasswordChar = password;
} }
protected override void OnClosing(CancelEventArgs e)
{
base.OnClosing(e);
if (!returnValue)
{
textBox1.Text = string.Empty;
}
}
private void button2_Click(object sender, EventArgs e) private void button2_Click(object sender, EventArgs e)
{ {
returnValue = true;
this.Close(); this.Close();
} }
@ -73,9 +88,12 @@ namespace RyzStudio.Windows.ThemedForms
public new string ShowDialog() public new string ShowDialog()
{ {
returnValue = false;
base.ShowDialog(); base.ShowDialog();
return textBox1.Text; return textBox1.Text;
} }
} }
} }

View File

@ -134,7 +134,7 @@ namespace bzit.bomg
this.progressBar1.TabIndex = 66; this.progressBar1.TabIndex = 66;
this.progressBar1.Value = 0; this.progressBar1.Value = 0;
// //
// OptionForm // UpdateIconsForm
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.White; this.BackColor = System.Drawing.Color.White;
@ -149,12 +149,12 @@ namespace bzit.bomg
this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.MaximizeBox = false; this.MaximizeBox = false;
this.MinimizeBox = false; this.MinimizeBox = false;
this.Name = "OptionForm"; this.Name = "UpdateIconsForm";
this.ShowIcon = false; this.ShowIcon = false;
this.ShowInTaskbar = false; this.ShowInTaskbar = false;
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Update Icons"; this.Text = "Update Favicons";
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();

View File

@ -102,6 +102,12 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="LoadFileForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="LoadFileForm.Designer.cs">
<DependentUpon>LoadFileForm.cs</DependentUpon>
</Compile>
<Compile Include="UpdateIconsForm.cs"> <Compile Include="UpdateIconsForm.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@ -199,6 +205,9 @@
<Compile Include="Windows\Forms\BookmarkTreeView.cs"> <Compile Include="Windows\Forms\BookmarkTreeView.cs">
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>
<EmbeddedResource Include="LoadFileForm.resx">
<DependentUpon>LoadFileForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UpdateIconsForm.resx"> <EmbeddedResource Include="UpdateIconsForm.resx">
<DependentUpon>UpdateIconsForm.cs</DependentUpon> <DependentUpon>UpdateIconsForm.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>