Implimented a theme changer, waiting for the Plex theme

This commit is contained in:
tidusjar 2016-05-24 12:58:01 +01:00
commit c41944c933
7 changed files with 7078 additions and 7008 deletions

View file

@ -52,8 +52,13 @@ namespace PlexRequests.UI.Helpers
var assetLocation = GetBaseUrl();
var content = GetContentUrl(assetLocation);
var settings = GetSettings();
if (string.IsNullOrEmpty(settings.ThemeName))
{
settings.ThemeName = Themes.OriginalTheme;
}
sb.AppendLine($"<link rel=\"stylesheet\" href=\"{content}/Content/bootstrap.css\" type=\"text/css\"/>");
sb.AppendLine($"<link rel=\"stylesheet\" href=\"{content}/Content/Themes/{settings.ThemeName}\" type=\"text/css\"/>");
sb.AppendLine($"<link rel=\"stylesheet\" href=\"{content}/Content/custom.min.css\" type=\"text/css\" />");
sb.AppendLine($"<link rel=\"stylesheet\" href=\"{content}/Content/font-awesome.css\" type=\"text/css\"/>");
sb.AppendLine($"<link rel=\"stylesheet\" href=\"{content}/Content/pace.min.css\" type=\"text/css\"/>");
@ -156,11 +161,15 @@ namespace PlexRequests.UI.Helpers
private static string GetBaseUrl()
{
var returnValue = Cache.GetOrSet(CacheKeys.GetBaseUrl, () =>
return GetSettings().BaseUrl;
}
private static PlexRequestSettings GetSettings()
{
var returnValue = Cache.GetOrSet(CacheKeys.GetPlexRequestSettings, () =>
{
var settings = Locator.Resolve<ISettingsService<PlexRequestSettings>>().GetSettings();
var assetLocation = settings.BaseUrl;
return assetLocation;
var settings = Locator.Resolve<ISettingsService<PlexRequestSettings>>().GetSettings();
return settings;
});
return returnValue;
}

View file

@ -0,0 +1,34 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: Themes.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
namespace PlexRequests.UI.Helpers
{
public static class Themes
{
public const string OriginalTheme = "OriginalBootstrap.css";
public const string PlexTheme = "PlexBootstrap.css";
}
}