This repository has been archived on 2022-09-30. You can view files and clone it, but cannot push or open issues or pull requests.
bookmark-manager/UpdateIconForm.cs

121 lines
3.5 KiB
C#
Raw Normal View History

2017-07-30 11:59:34 +00:00
using System;
using System.ComponentModel;
using System.Windows.Forms;
namespace bzit.bomg
{
public partial class UpdateIconForm : Form
{
private MainForm parentForm = null;
private BackgroundWorker mainThread = null;
public UpdateIconForm(MainForm parent)
{
InitializeComponent();
parentForm = parent;
this.StartPosition = FormStartPosition.WindowsDefaultLocation;
mainThread = new BackgroundWorker();
mainThread.WorkerReportsProgress = mainThread.WorkerSupportsCancellation = true;
mainThread.DoWork += mainThread_DoWork;
mainThread.RunWorkerCompleted += mainThread_OnCompleted;
}
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
2019-04-19 02:51:55 +00:00
//##int nodeCount = (int)parentForm.treeView1.NodeCountCalc;
//progressBar1.Minimum = 0;
//progressBar1.Value = 0;
//progressBar1.Maximum = nodeCount;
2017-07-30 11:59:34 +00:00
2019-04-19 02:51:55 +00:00
//label2.Text = string.Concat("0", "/", nodeCount.ToString());
2017-07-30 11:59:34 +00:00
}
protected override void OnClosing(CancelEventArgs e)
{
base.OnClosing(e);
if (mainThread.IsBusy)
{
e.Cancel = true;
}
}
private void btnRun_Click(object sender, EventArgs e)
{
if (mainThread.IsBusy)
{
return;
}
btnRun.Enabled = false;
pictureBox1.Image = Properties.Resources.aniZomq2x32;
mainThread.RunWorkerAsync();
}
private void mainThread_DoWork(object sender, DoWorkEventArgs e)
{
2019-04-20 16:05:55 +00:00
//TreeNode[] nodeList = parentForm.treeView1.NodeList;
//for (int i=0; i< nodeList.Length; i++)
//{
// if (progressBar1.InvokeRequired)
// {
// progressBar1.Invoke(new Action(() => progressBar1.Value = (i + 1) ));
// }
// else
// {
// progressBar1.Value = (i + 1);
// }
// if (label2.InvokeRequired)
// {
// label2.Invoke(new Action(() => label2.Text = string.Concat((i + 1).ToString(), "/", progressBar1.Maximum.ToString())));
// }
// else
// {
// label2.Text = string.Concat((i + 1).ToString(), "/", progressBar1.Maximum.ToString());
// }
// TreeNode node = nodeList[i];
// if (node == null)
// {
// continue;
// }
// if (node.Tag == null)
// {
// continue;
// }
// if (!(node.Tag is BookmarkItem))
// {
// continue;
// }
// BookmarkItem bookmarkItem = (BookmarkItem)node.Tag;
// if (bookmarkItem == null)
// {
// continue;
// }
// bookmarkItem.GetFaviconAddress();
// if (bookmarkItem.IconData == null)
// {
// continue;
// }
2017-07-30 11:59:34 +00:00
//##parentForm.treeView1.AddIcon(bookmarkItem);
2019-04-20 16:05:55 +00:00
//}
2017-07-30 11:59:34 +00:00
}
private void mainThread_OnCompleted(object sender, RunWorkerCompletedEventArgs e)
{
pictureBox1.Image = null;
btnRun.Enabled = true;
}
}
}