Skip to content

Commit

Permalink
remove useless await async
Browse files Browse the repository at this point in the history
  • Loading branch information
SirSparkles committed Dec 10, 2018
1 parent dee0f9b commit b7dab61
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 24 deletions.
1 change: 1 addition & 0 deletions TVRename/Forms/ShowPreferences/FolderBrowserDialogEx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using System.Diagnostics;
// ReSharper disable InconsistentNaming
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable All

namespace DaveChambers.FolderBrowserDialogEx
{
Expand Down
42 changes: 21 additions & 21 deletions TVRename/Forms/UI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ private ListView ListViewByName(string name)
}
}

private async void flushCacheToolStripMenuItem_Click(object sender, EventArgs e)
private void flushCacheToolStripMenuItem_Click(object sender, EventArgs e)
{
if (busy != 0)
{
Expand All @@ -351,7 +351,7 @@ private async void flushCacheToolStripMenuItem_Click(object sender, EventArgs e)
{
TheTVDB.Instance.ForgetEverything();
FillMyShows();
await FillEpGuideHtml();
FillEpGuideHtml();
FillWhenToWatchList();
BGDownloadTimer_QuickFire();
}
Expand Down Expand Up @@ -630,14 +630,14 @@ private void ShowQuickStartGuide()
webImages.Navigate(QuickStartGuide());
}

private async Task FillEpGuideHtml()
private void FillEpGuideHtml()
{
if (MyShowTree.Nodes.Count == 0)
ShowQuickStartGuide();
else
{
TreeNode n = MyShowTree.SelectedNode;
await FillEpGuideHtml(n);
FillEpGuideHtml(n);
}
}

Expand Down Expand Up @@ -668,7 +668,7 @@ private static Season TreeNodeToSeason(TreeNode n)
return seas;
}

private async Task FillEpGuideHtml(TreeNode n)
private void FillEpGuideHtml(TreeNode n)
{
if (n == null)
{
Expand All @@ -678,7 +678,7 @@ private async Task FillEpGuideHtml(TreeNode n)

if (n.Tag is ProcessedEpisode pe)
{
await FillEpGuideHtml(pe.Show, pe.AppropriateSeasonNumber);
FillEpGuideHtml(pe.Show, pe.AppropriateSeasonNumber);
return;
}

Expand All @@ -691,7 +691,7 @@ private async Task FillEpGuideHtml(TreeNode n)
int tvdbcode = seas.TheSeries.TvdbCode;
foreach (ShowItem si in mDoc.Library.Values.Where(si=>si.TvdbCode == tvdbcode))
{
await FillEpGuideHtml(si, seas.SeasonNumber);
FillEpGuideHtml(si, seas.SeasonNumber);
return;
}
}
Expand All @@ -700,10 +700,10 @@ private async Task FillEpGuideHtml(TreeNode n)
return;
}

await FillEpGuideHtml(TreeNodeToShowItem(n), -1);
FillEpGuideHtml(TreeNodeToShowItem(n), -1);
}

private async Task FillEpGuideHtml(ShowItem si, int snum)
private void FillEpGuideHtml(ShowItem si, int snum)
{
if (tabControl1.SelectedTab != tbMyShows)
return;
Expand All @@ -728,26 +728,26 @@ private async Task FillEpGuideHtml(ShowItem si, int snum)
if (si.DvdOrder && snum >= 0 && ser.DvdSeasons.ContainsKey(snum))
{
Season s = ser.DvdSeasons[snum];
SetHtmlBody(webInformation, await si.GetSeasonHtmlOverview(s, false));
SetHtmlBody(webInformation, si.GetSeasonHtmlOverview(s, false));
SetHtmlBody(webImages, ShowHtmlHelper.CreateOldPage(si.GetSeasonImagesHtmlOverview(s)));

SetHtmlBody(webInformation, await si.GetSeasonHtmlOverview(s, true));
SetHtmlBody(webInformation, si.GetSeasonHtmlOverview(s, true));
}
else if (!si.DvdOrder && snum >= 0 && ser.AiredSeasons.ContainsKey(snum))
{
Season s = ser.AiredSeasons[snum];
SetHtmlBody(webInformation, await si.GetSeasonHtmlOverview(s, false));
SetHtmlBody(webInformation, si.GetSeasonHtmlOverview(s, false));
SetHtmlBody(webImages, ShowHtmlHelper.CreateOldPage(si.GetSeasonImagesHtmlOverview(s)));

SetHtmlBody(webInformation, await si.GetSeasonHtmlOverview(s, true));
SetHtmlBody(webInformation, si.GetSeasonHtmlOverview(s, true));
}
else
{
// no epnum specified, just show an overview
SetHtmlBody(webInformation, await si.GetShowHtmlOverview(false));
SetHtmlBody(webInformation, si.GetShowHtmlOverview(false));
SetHtmlBody(webImages, ShowHtmlHelper.CreateOldPage(si.GetShowImagesHtmlOverview()));

SetHtmlBody(webInformation, await si.GetShowHtmlOverview(true));
SetHtmlBody(webInformation, si.GetShowHtmlOverview(true));
}

TheTVDB.Instance.Unlock("FillEpGuideHTML");
Expand Down Expand Up @@ -2026,7 +2026,7 @@ private void UpdateWtw(DirFilesCache dfc, ProcessedEpisode pe, ListViewItem lvi)
}
}

private async Task SelectSeason(Season seas)
private void SelectSeason(Season seas)
{
foreach (TreeNode n in MyShowTree.Nodes)
{
Expand All @@ -2041,10 +2041,10 @@ private async Task SelectSeason(Season seas)
}
}

await FillEpGuideHtml(null);
FillEpGuideHtml(null);
}

private async Task SelectShow(ShowItem si)
private void SelectShow(ShowItem si)
{
foreach (TreeNode n in MyShowTree.Nodes)
{
Expand All @@ -2057,7 +2057,7 @@ private async Task SelectShow(ShowItem si)
}
}

await FillEpGuideHtml(null);
FillEpGuideHtml(null);
}

private void bnMyShowsAdd_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -2246,9 +2246,9 @@ private void bnMyShowsRefresh_Click(object sender, EventArgs e)
}
}

private async void MyShowTree_AfterSelect(object sender, TreeViewEventArgs e)
private void MyShowTree_AfterSelect(object sender, TreeViewEventArgs e)
{
await FillEpGuideHtml(e.Node);
FillEpGuideHtml(e.Node);
bool showSelected = MyShowTree.SelectedNode != null;
bnMyShowsEdit.Enabled = showSelected;
bnMyShowsDelete.Enabled = showSelected;
Expand Down
6 changes: 3 additions & 3 deletions TVRename/Utility/Helper/ShowHtmlHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static string CreateOldPage(string body)
return html;
}

public static async Task<string> GetShowHtmlOverview(this ShowItem si,bool includeDirectoryLinks)
public static string GetShowHtmlOverview(this ShowItem si,bool includeDirectoryLinks)
{
Color col = Color.FromName("ButtonFace");
StringBuilder sb = new StringBuilder();
Expand All @@ -40,7 +40,7 @@ public static async Task<string> GetShowHtmlOverview(this ShowItem si,bool inclu
return sb.ToString();
}

private static void AppendShow(this StringBuilder sb,ShowItem si, Color backgroundColour, bool includeDirectoryLinks)
private static async Task AppendShow(this StringBuilder sb,ShowItem si, Color backgroundColour, bool includeDirectoryLinks)
{
if (si == null) return;

Expand Down Expand Up @@ -164,7 +164,7 @@ private static string ScreenShotHtml(this ProcessedEpisode ei)
return $"<img class=\"rounded w-100\" src=\"{TheTVDB.GetImageURL(ei.Filename)}\" alt=\"{ei.Name} Screenshot\">";
}

public static async Task<string> GetSeasonHtmlOverview(this ShowItem si, Season s, bool includeDirectoryLinks)
public static string GetSeasonHtmlOverview(this ShowItem si, Season s, bool includeDirectoryLinks)
{
StringBuilder sb = new StringBuilder();
DirFilesCache dfc = new DirFilesCache();
Expand Down

0 comments on commit b7dab61

Please sign in to comment.