Skip to content

Commit

Permalink
#10 Implemented "Shutdown if all finished" checkbox
Browse files Browse the repository at this point in the history
  • Loading branch information
akorb committed Feb 22, 2017
1 parent 77cd026 commit 6b93ec4
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 12 deletions.
52 changes: 41 additions & 11 deletions SteamShutdown/Main.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 18 additions & 1 deletion SteamShutdown/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ private void SwitchItems(object[] items, ListBox from, ListBox to)
to.Items.AddRange(items);
}

private void SwitchAllToWatching()
{
lbWatching.Items.AddRange(lbUnwatched.Items);
lbUnwatched.Items.Clear();
}



private void Steam_AppInfoDeleted(AppInfoEventArgs e)
Expand Down Expand Up @@ -89,7 +95,10 @@ private void Steam_AppInfoChanged(AppInfoChangedEventArgs e)

if (e.AppInfo.IsDownloading && !lbUnwatched.Items.Contains(e.AppInfo) && !lbWatching.Items.Contains(e.AppInfo))
{
lbUnwatched.Items.Add(e.AppInfo);
if (cbAll.Checked)
lbWatching.Items.Add(e.AppInfo);
else
lbUnwatched.Items.Add(e.AppInfo);
}
else if (AppInfo.CheckDownloading(e.PreviousState) && !e.AppInfo.IsDownloading)
{
Expand All @@ -105,6 +114,14 @@ private void btnSwitch_Click(object sender, EventArgs e)
SwitchItems(focused.SelectedItems.Cast<object>().ToArray(), focused, unfocused);
}

private void cbAll_CheckedChanged(object sender, EventArgs e)
{
panelMain.Enabled = !cbAll.Checked;

if (cbAll.Checked)
SwitchAllToWatching();
}

private void Shutdown()
{
#if DEBUG
Expand Down

0 comments on commit 6b93ec4

Please sign in to comment.