Choose when to end the thread

This commit is contained in:
KillzXGaming 2019-08-01 21:16:48 -04:00
parent 72cce64583
commit 894e53ea07
4 changed files with 6 additions and 6 deletions

View file

@ -104,9 +104,9 @@ namespace Toolbox.Library
}
private Thread Thread;
public void ReloadTextureIcons()
public void ReloadTextureIcons(bool CanAbortThread)
{
if (Thread != null && Thread.IsAlive)
if (Thread != null && Thread.IsAlive && CanAbortThread)
Thread.Abort();
Thread = new Thread((ThreadStart)(() =>
@ -166,9 +166,9 @@ namespace Toolbox.Library
this.Refresh();
}
public void ReloadTextureIcons(ISingleTextureIconLoader textureIcon)
public void ReloadTextureIcons(ISingleTextureIconLoader textureIcon, bool CanAbortThread)
{
if (Thread != null && Thread.IsAlive)
if (Thread != null && Thread.IsAlive && CanAbortThread)
Thread.Abort();
Thread = new Thread((ThreadStart)(() =>

View file

@ -670,7 +670,7 @@ namespace Toolbox.Library.Forms
public void LoadGenericTextureIcons(ISingleTextureIconLoader iconTex) {
treeViewCustom1.SingleTextureIcons.Add(iconTex);
treeViewCustom1.ReloadTextureIcons(iconTex);
treeViewCustom1.ReloadTextureIcons(iconTex, false);
}
private void nodeSizeCB_SelectedIndexChanged(object sender, EventArgs e)
@ -694,7 +694,7 @@ namespace Toolbox.Library.Forms
treeViewCustom1.ItemHeight = Size;
treeViewCustom1.ReloadImages(Size, Size);
treeViewCustom1.ReloadTextureIcons();
treeViewCustom1.ReloadTextureIcons(true);
}
}