Skip to content

Commit

Permalink
New Episode Summary Tab
Browse files Browse the repository at this point in the history
  • Loading branch information
SirSparkles committed May 13, 2020
1 parent 2efd9eb commit 23d2ca1
Show file tree
Hide file tree
Showing 8 changed files with 816 additions and 550 deletions.
7 changes: 0 additions & 7 deletions TVRename/Forms/ShowPreferences/AddModifyRule.cs
Expand Up @@ -275,11 +275,4 @@ private RuleAction Action()
throw new ArgumentOutOfRangeException();
}
}

internal class ValidationFailedException : Exception
{
public ValidationFailedException(string message):base(message)
{
}
}
}
11 changes: 11 additions & 0 deletions TVRename/Forms/ShowPreferences/ValidationFailedException.cs
@@ -0,0 +1,11 @@
using System;

namespace TVRename
{
internal class ValidationFailedException : Exception
{
public ValidationFailedException(string message):base(message)
{
}
}
}
291 changes: 168 additions & 123 deletions TVRename/Forms/UI.Designer.cs

Large diffs are not rendered by default.

57 changes: 53 additions & 4 deletions TVRename/Forms/UI.cs
Expand Up @@ -447,8 +447,9 @@ private static void UpdateSplashPercent([NotNull] TVRenameSplash splashScreen, i

private void ClearInfoWindows(string defaultText)
{
SetHtmlBody( webImages, ShowHtmlHelper.CreateOldPage(defaultText));
SetHtmlBody(webImages, ShowHtmlHelper.CreateOldPage(defaultText));
SetHtmlBody(webInformation, ShowHtmlHelper.CreateOldPage(defaultText));
SetHtmlBody(webSummary, ShowHtmlHelper.CreateOldPage(defaultText));
}

private void MoreBusy() => Interlocked.Increment(ref busy);
Expand Down Expand Up @@ -1040,6 +1041,7 @@ private void ShowQuickStartGuide()
tabControl1.SelectTab(tbMyShows);
webInformation.Navigate(QuickStartGuide());
webImages.Navigate(QuickStartGuide());
webSummary.Navigate(QuickStartGuide());
}

private void FillEpGuideHtml()
Expand Down Expand Up @@ -1145,23 +1147,25 @@ private void FillEpGuideHtml(ShowItem si, int snum)
ProcessedSeason s = si.AppropriateSeasons()[snum];
SetHtmlBody(webInformation, ShowHtmlHelper.CreateOldPage(si.GetSeasonHtmlOverviewOffline(s)));
SetHtmlBody(webImages, ShowHtmlHelper.CreateOldPage(si.GetSeasonImagesHtmlOverview(s)));
SetHtmlBody(webSummary, ShowHtmlHelper.CreateOldPage("Not available offline"));
}
else
{
// no epnum specified, just show an overview
SetHtmlBody(webInformation, ShowHtmlHelper.CreateOldPage(si.GetShowHtmlOverviewOffline()));
SetHtmlBody(webImages, ShowHtmlHelper.CreateOldPage(si.GetShowImagesHtmlOverview()));
SetHtmlBody(webSummary, ShowHtmlHelper.CreateOldPage("Not available offline"));
}

return;
return;
}

if (snum >= 0 && si.AppropriateSeasons().ContainsKey(snum))
{
ProcessedSeason s = si.AppropriateSeasons()[snum];
SetHtmlBody(webImages, ShowHtmlHelper.CreateOldPage(si.GetSeasonImagesHtmlOverview(s)));

SetHtmlBody(webInformation, si.GetSeasonHtmlOverview(s, false));
SetHtmlBody(webSummary, si.GetSeasonSummaryHtmlOverview(s, false));

if (bwSeasonHTMLGenerator.WorkerSupportsCancellation)
{
Expand All @@ -1173,13 +1177,24 @@ private void FillEpGuideHtml(ShowItem si, int snum)
{
bwSeasonHTMLGenerator.RunWorkerAsync(s);
}

if (bwSeasonSummaryHTMLGenerator.WorkerSupportsCancellation)
{
// Cancel the asynchronous operation.
bwSeasonSummaryHTMLGenerator.CancelAsync();
}

if (!bwSeasonSummaryHTMLGenerator.IsBusy)
{
bwSeasonSummaryHTMLGenerator.RunWorkerAsync(s);
}
}
else
{
// no epnum specified, just show an overview
SetHtmlBody(webImages, ShowHtmlHelper.CreateOldPage(si.GetShowImagesHtmlOverview()));

SetHtmlBody(webInformation, si.GetShowHtmlOverview(false));
SetHtmlBody(webInformation, si.GetShowSummaryHtmlOverview(false));

if (bwShowHTMLGenerator.WorkerSupportsCancellation)
{
Expand All @@ -1191,6 +1206,17 @@ private void FillEpGuideHtml(ShowItem si, int snum)
{
bwShowHTMLGenerator.RunWorkerAsync(si);
}

if (bwShowSummaryHTMLGenerator.WorkerSupportsCancellation)
{
// Cancel the asynchronous operation.
bwShowSummaryHTMLGenerator.CancelAsync();
}

if (!bwShowSummaryHTMLGenerator.IsBusy)
{
bwShowSummaryHTMLGenerator.RunWorkerAsync(si);
}
}
}

Expand Down Expand Up @@ -3769,6 +3795,15 @@ private void UpdateWebInformation(object sender, [NotNull] RunWorkerCompletedEve
}
}

private void UpdateWebSummary(object sender, [NotNull] RunWorkerCompletedEventArgs e)
{
string html = e.Result as string;
if (html.HasValue())
{
SetHtmlBody(webSummary, html);
}
}

private void BwShowHTMLGenerator_DoWork(object sender, [NotNull] DoWorkEventArgs e)
{
ShowItem si = e.Argument as ShowItem;
Expand Down Expand Up @@ -3932,5 +3967,19 @@ private void OlvAction_CanDrop(object sender, [NotNull] OlvDropEventArgs e)
}
}
}

private void BwShowSummaryHTMLGenerator_DoWork(object sender, [NotNull] DoWorkEventArgs e)
{
ShowItem si = e.Argument as ShowItem;
string html = si?.GetShowSummaryHtmlOverview(true);
e.Result = html ?? string.Empty;
}
private void BwSeasonSummaryHTMLGenerator_DoWork(object sender, [NotNull] DoWorkEventArgs e)
{
ProcessedSeason s = e.Argument as ProcessedSeason;
ShowItem si = s?.Show;
string html = si?.GetSeasonSummaryHtmlOverview(s, true);
e.Result = html ?? string.Empty;
}
}
}

0 comments on commit 23d2ca1

Please sign in to comment.