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;
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;
//threadWorker.RunWorkerAsync();
await Task.Run(() =>
{
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.Name = "findEditMenuItem";
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.Click += new System.EventHandler(this.editFindMenuItem_Click);
//
@ -370,7 +370,7 @@ namespace bzit.bomg
//
this.optionsToolMenuItem.Name = "optionsToolMenuItem";
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);
//
// toolStripDropDownButton5

View File

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

View File

@ -1,10 +1,13 @@
using System;
using System.ComponentModel;
using System.Windows.Forms;
namespace RyzStudio.Windows.ThemedForms
{
public partial class TextBoxForm : System.Windows.Forms.Form
{
protected bool returnValue = false;
public TextBoxForm(string title, string labelText, string defaultValue)
{
InitializeComponent();
@ -54,8 +57,20 @@ namespace RyzStudio.Windows.ThemedForms
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)
{
returnValue = true;
this.Close();
}
@ -73,9 +88,12 @@ namespace RyzStudio.Windows.ThemedForms
public new string ShowDialog()
{
returnValue = false;
base.ShowDialog();
return textBox1.Text;
}
}
}

View File

@ -134,7 +134,7 @@ namespace bzit.bomg
this.progressBar1.TabIndex = 66;
this.progressBar1.Value = 0;
//
// OptionForm
// UpdateIconsForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
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.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "OptionForm";
this.Name = "UpdateIconsForm";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Update Icons";
this.Text = "Update Favicons";
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();

View File

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