Skip to content

Commit

Permalink
Use wait cursor when loading cards/plugins/zipmods (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
ManlyMarco authored Apr 13, 2024
1 parent aaa4dcb commit 0ed3036
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/KKManager/Windows/Content/CardWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ public void RefreshList()
{
CancelRefreshing();

UseWaitCursor = true;

listView.ClearObjects();
listView.SmallImageList.Images.Clear();
listView.LargeImageList.Images.Clear();
Expand Down Expand Up @@ -278,6 +280,8 @@ public void RefreshList()
listView.FastAutoResizeColumns();
RefreshThumbnails(true);

UseWaitCursor = false;

MainWindow.SetStatusText("Done loading cards");
listView.EmptyListMsg = prevEmptyListMsg;
},
Expand Down Expand Up @@ -417,10 +421,11 @@ private void SetupImageLists()
};
}

private static void ShowFailedToLoadDirError(Exception exception)
private void ShowFailedToLoadDirError(Exception exception)
{
Console.WriteLine(exception);
MessageBox.Show(exception.Message, "Failed to open folder", MessageBoxButtons.OK, MessageBoxIcon.Error);
UseWaitCursor = false;
}

private void ShowOpenFolderDialog(object sender, EventArgs e)
Expand Down
4 changes: 4 additions & 0 deletions src/KKManager/Windows/Content/PluginsWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ private void SideloaderModsWindow_Shown(object sender, EventArgs e)

public void RefreshList()
{
UseWaitCursor = true;

objectListView1.ClearObjects();

_cancellationTokenSource = new CancellationTokenSource();
Expand All @@ -86,13 +88,15 @@ public void RefreshList()
() =>
{
objectListView1.FastAutoResizeColumns();
UseWaitCursor = false;
MainWindow.SetStatusText("Done loading plugins");
}, token);
}

public void CancelRefreshing()
{
_cancellationTokenSource?.Cancel();
UseWaitCursor = false;
}

private void SideloaderModsWindow_FormClosed(object sender, FormClosedEventArgs e)
Expand Down
4 changes: 4 additions & 0 deletions src/KKManager/Windows/Content/SideloaderModsWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ private void SideloaderModsWindow_Shown(object sender, EventArgs e)

public void RefreshList()
{
UseWaitCursor = true;

objectListView1.ClearObjects();

_cancellationTokenSource = new CancellationTokenSource();
Expand All @@ -88,6 +90,7 @@ public void RefreshList()
() =>
{
objectListView1.FastAutoResizeColumns();
UseWaitCursor = false;
MainWindow.SetStatusText("Done loading zipmods");
}, token);
}
Expand Down Expand Up @@ -168,6 +171,7 @@ private void toolStripButtonOpenModsDir_Click(object sender, EventArgs e)
public void CancelRefreshing()
{
_cancellationTokenSource?.Cancel();
UseWaitCursor = false;
}

private void toolStripButtonSameGuid_Click(object sender, EventArgs e)
Expand Down

0 comments on commit 0ed3036

Please sign in to comment.