Changed: update icons with task

This commit is contained in:
Ray 2020-08-28 23:05:59 +01:00
parent 9043901c73
commit d97959f53c
11 changed files with 246 additions and 199 deletions

View File

@ -36,10 +36,10 @@ namespace bzit.bomg
this.label5 = new System.Windows.Forms.Label();
this.memoBox1 = new RyzStudio.Windows.ThemedForms.MemoBox();
this.textBox2 = new RyzStudio.Windows.ThemedForms.TextBox();
this.textBox1 = new RyzStudio.Windows.ThemedForms.TextBox();
this.horizontalSeparator1 = new RyzStudio.Windows.Forms.HorizontalSeparator();
this.button1 = new RyzStudio.Windows.ThemedForms.Button();
this.textBox1 = new RyzStudio.Windows.ThemedForms.TextBox();
this.button2 = new RyzStudio.Windows.ThemedForms.Button();
this.horizontalSeparator1 = new RyzStudio.Windows.Forms.HorizontalSeparator();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
@ -50,7 +50,7 @@ namespace bzit.bomg
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(28, 13);
this.label1.Size = new System.Drawing.Size(29, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Title";
//
@ -81,7 +81,7 @@ namespace bzit.bomg
this.pictureBox2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.pictureBox2.ErrorImage = null;
this.pictureBox2.InitialImage = null;
this.pictureBox2.Location = new System.Drawing.Point(368, 15);
this.pictureBox2.Location = new System.Drawing.Point(348, 15);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(32, 32);
this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
@ -95,7 +95,7 @@ namespace bzit.bomg
this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.pictureBox1.ErrorImage = null;
this.pictureBox1.InitialImage = null;
this.pictureBox1.Location = new System.Drawing.Point(286, 217);
this.pictureBox1.Location = new System.Drawing.Point(266, 217);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(32, 32);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
@ -110,7 +110,7 @@ namespace bzit.bomg
this.label5.Location = new System.Drawing.Point(9, 217);
this.label5.Margin = new System.Windows.Forms.Padding(3);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(271, 32);
this.label5.Size = new System.Drawing.Size(251, 32);
this.label5.TabIndex = 64;
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
@ -124,7 +124,7 @@ namespace bzit.bomg
this.memoBox1.Margin = new System.Windows.Forms.Padding(10, 6, 10, 6);
this.memoBox1.Name = "memoBox1";
this.memoBox1.Padding = new System.Windows.Forms.Padding(10, 10, 3, 9);
this.memoBox1.Size = new System.Drawing.Size(336, 83);
this.memoBox1.Size = new System.Drawing.Size(316, 83);
this.memoBox1.TabIndex = 3;
//
// textBox2
@ -136,11 +136,26 @@ namespace bzit.bomg
this.textBox2.Margin = new System.Windows.Forms.Padding(10, 6, 10, 6);
this.textBox2.Name = "textBox2";
this.textBox2.Padding = new System.Windows.Forms.Padding(10, 10, 9, 9);
this.textBox2.Size = new System.Drawing.Size(259, 32);
this.textBox2.Size = new System.Drawing.Size(239, 34);
this.textBox2.SubmitButton = this.button1;
this.textBox2.TabIndex = 0;
this.textBox2.UseSystemPasswordChar = false;
//
// 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 = "S&can";
this.button1.Location = new System.Drawing.Point(348, 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(64, 32);
this.button1.TabIndex = 1;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// textBox1
//
this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
@ -150,11 +165,26 @@ namespace bzit.bomg
this.textBox1.Margin = new System.Windows.Forms.Padding(10, 6, 10, 6);
this.textBox1.Name = "textBox1";
this.textBox1.Padding = new System.Windows.Forms.Padding(10, 10, 9, 9);
this.textBox1.Size = new System.Drawing.Size(259, 32);
this.textBox1.Size = new System.Drawing.Size(239, 34);
this.textBox1.SubmitButton = this.button2;
this.textBox1.TabIndex = 2;
this.textBox1.UseSystemPasswordChar = false;
//
// 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 = "&Save";
this.button2.Location = new System.Drawing.Point(304, 217);
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)
@ -163,44 +193,14 @@ namespace bzit.bomg
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(420, 2);
this.horizontalSeparator1.Size = new System.Drawing.Size(400, 2);
this.horizontalSeparator1.TabIndex = 65;
//
// 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 = "S&can";
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(64, 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 = "&Save";
this.button2.Location = new System.Drawing.Point(324, 217);
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);
//
// BookmarkEditForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(444, 261);
this.ClientSize = new System.Drawing.Size(424, 261);
this.Controls.Add(this.memoBox1);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.textBox1);

1
FindForm.Designer.cs generated
View File

@ -113,7 +113,6 @@ namespace bzit.bomg
this.Font = new System.Drawing.Font("Tahoma", 8.25F);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(400, 160);
this.Name = "FindForm";
this.ShowIcon = false;
this.ShowInTaskbar = false;

View File

@ -91,5 +91,6 @@ namespace bzit.bomg
findNextNew = true;
}
}
}
}

8
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(137, 22);
this.findEditMenuItem.Size = new System.Drawing.Size(180, 22);
this.findEditMenuItem.Text = "&Find";
this.findEditMenuItem.Click += new System.EventHandler(this.editFindMenuItem_Click);
//
@ -368,11 +368,9 @@ namespace bzit.bomg
//
// optionsToolMenuItem
//
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.Text = "&Options";
this.optionsToolMenuItem.Size = new System.Drawing.Size(180, 22);
this.optionsToolMenuItem.Text = "&Update Icons";
this.optionsToolMenuItem.Click += new System.EventHandler(this.toolsOptionsMenuItem_Click);
//
// toolStripDropDownButton5

View File

@ -627,7 +627,7 @@ namespace bzit.bomg
return;
}
OptionForm optionForm = new OptionForm(this);
UpdateIconsForm optionForm = new UpdateIconsForm(this);
optionForm.ShowDialog();
}

View File

@ -1,131 +0,0 @@
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();
ThreadControl.SetValue(progressBar1, 0, nodeList.Count);
for (int i=0; i<nodeList.Count; i++)
{
if (threadWorker.CancellationPending)
{
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());
}
}
}
}
protected void threadWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
this.IsBusy = false;
ThreadControl.SetText(button2, "&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)
{
ThreadControl.SetText(button2, "&Cancelling...");
threadWorker.CancelAsync();
}
else
{
this.IsBusy = true;
ThreadControl.SetText(button2, "&Updating...");
threadWorker.RunWorkerAsync();
}
}
private void button2_Click(object sender, EventArgs e)
{
if (this.IsBusy)
{
return;
}
this.Close();
}
}
}

View File

@ -13,10 +13,13 @@ namespace RyzStudio.Windows.ThemedForms
}
public int Minimum { get => userControl1.Minimum; set => userControl1.Minimum = value; }
public int Maximum { get => userControl1.Maximum; set => userControl1.Maximum = value; }
public int Value { get => userControl1.Value; set => userControl1.Value = value; }
public Color BarColour { get => userControl1.BarColour; set => userControl1.BarColour = value; }
public Color BarTextColour { get => userControl1.BarTextColour; set => userControl1.BarTextColour = value; }
protected override void OnSizeChanged(EventArgs e)
@ -25,5 +28,6 @@ namespace RyzStudio.Windows.ThemedForms
this.Invalidate();
}
}
}

View File

@ -1,6 +1,6 @@
namespace bzit.bomg
{
partial class OptionForm
partial class UpdateIconsForm
{
/// <summary>
/// Required designer variable.
@ -57,7 +57,7 @@ namespace bzit.bomg
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.Location = new System.Drawing.Point(112, 77);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(32, 32);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
@ -69,25 +69,25 @@ namespace bzit.bomg
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.Location = new System.Drawing.Point(9, 77);
this.label5.Margin = new System.Windows.Forms.Padding(3);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(291, 32);
this.label5.Size = new System.Drawing.Size(97, 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.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | 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.Location = new System.Drawing.Point(150, 77);
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.Size = new System.Drawing.Size(108, 32);
this.button1.TabIndex = 1;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
@ -98,7 +98,7 @@ namespace bzit.bomg
this.button2.DefaultImage = null;
this.button2.DownImage = null;
this.button2.LabelText = "&Close";
this.button2.Location = new System.Drawing.Point(344, 237);
this.button2.Location = new System.Drawing.Point(264, 77);
this.button2.Name = "button2";
this.button2.OverImage = null;
this.button2.Padding = new System.Windows.Forms.Padding(4, 4, 3, 3);
@ -110,11 +110,11 @@ namespace bzit.bomg
//
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.Location = new System.Drawing.Point(12, 62);
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.Size = new System.Drawing.Size(360, 2);
this.horizontalSeparator1.TabIndex = 65;
//
// progressBar1
@ -124,13 +124,13 @@ namespace bzit.bomg
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.Location = new System.Drawing.Point(96, 15);
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.Size = new System.Drawing.Size(276, 32);
this.progressBar1.TabIndex = 66;
this.progressBar1.Value = 0;
//
@ -138,7 +138,7 @@ namespace bzit.bomg
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(464, 281);
this.ClientSize = new System.Drawing.Size(384, 121);
this.Controls.Add(this.progressBar1);
this.Controls.Add(this.horizontalSeparator1);
this.Controls.Add(this.label5);
@ -149,13 +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.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";
this.Text = "Update Icons";
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();

177
UpdateIconsForm.cs Normal file
View File

@ -0,0 +1,177 @@
using bzit.bomg.Models;
using RyzStudio.Windows.Forms;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Threading.Tasks;
using System.Windows.Forms;
using Form = System.Windows.Forms.Form;
using Resources = bzit.bomg.Properties.Resources;
namespace bzit.bomg
{
public partial class UpdateIconsForm : Form
{
protected bool isBusy = false;
protected bool requestCancel = false;
protected BookmarkItemModel itemModel = null;
protected MainForm parentForm = null;
public UpdateIconsForm(MainForm mainForm) : base()
{
InitializeComponent();
parentForm = mainForm;
this.StartPosition = FormStartPosition.WindowsDefaultLocation;
}
//protected void threadWorker1_DoWork(object sender, DoWorkEventArgs e)
//{
// if (threadWorker.CancellationPending)
// {
// return;
// }
// List<TreeNode> nodeList = parentForm.treeView1.GetBookmarkNodeList();
// ThreadControl.SetValue(progressBar1, 0, nodeList.Count);
// for (int i=0; i<nodeList.Count; i++)
// {
// if (threadWorker.CancellationPending)
// {
// 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());
// }
// }
// }
//}
//protected void threadWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
//{
// this.IsBusy = false;
// ThreadControl.SetText(button1, "&Update");
//}
protected override void OnClosing(CancelEventArgs e)
{
base.OnClosing(e);
if (this.IsBusy)
{
e.Cancel = true;
}
}
protected bool IsBusy
{
get => isBusy;
set
{
isBusy = value;
ThreadControl.SetImage(pictureBox1, (value) ? Resources.aniZomq2x32 : null);
ThreadControl.SetEnable(button2, !value);
}
}
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)
{
if (this.IsBusy)
{
return;
}
this.Close();
}
}
}

View File

@ -102,11 +102,11 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="OptionForm.cs">
<Compile Include="UpdateIconsForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="OptionForm.Designer.cs">
<DependentUpon>OptionForm.cs</DependentUpon>
<Compile Include="UpdateIconsForm.Designer.cs">
<DependentUpon>UpdateIconsForm.cs</DependentUpon>
</Compile>
<Compile Include="Models\BookmarkItemModel.cs" />
<Compile Include="RyzStudio\Net\HttpWeb.cs" />
@ -199,8 +199,8 @@
<Compile Include="Windows\Forms\BookmarkTreeView.cs">
<SubType>Component</SubType>
</Compile>
<EmbeddedResource Include="OptionForm.resx">
<DependentUpon>OptionForm.cs</DependentUpon>
<EmbeddedResource Include="UpdateIconsForm.resx">
<DependentUpon>UpdateIconsForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="RyzStudio\Windows\ThemedForms\MemoBox.resx">
<DependentUpon>MemoBox.cs</DependentUpon>