mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-06-22 05:47:28 +02:00
Version 3.0.337
This commit is contained in:
parent
fd0e63cf10
commit
573fe77e12
2336 changed files with 33688 additions and 86082 deletions
18
TINKLib/Services/ThemeNS/ITheme.cs
Normal file
18
TINKLib/Services/ThemeNS/ITheme.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
|
||||
namespace TINK.Services.ThemeNS
|
||||
{
|
||||
/// <summary>
|
||||
/// Set of available app themes
|
||||
/// </summary>
|
||||
public enum ThemeSet
|
||||
{
|
||||
ShareeBike,
|
||||
Konrad,
|
||||
LastenradBayern
|
||||
}
|
||||
|
||||
public interface ITheme
|
||||
{
|
||||
void SetActiveTheme(string themeName);
|
||||
}
|
||||
}
|
50
TINKLib/Services/ThemeNS/Theme.cs
Normal file
50
TINKLib/Services/ThemeNS/Theme.cs
Normal file
|
@ -0,0 +1,50 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace TINK.Services.ThemeNS
|
||||
{
|
||||
/// <summary>
|
||||
/// Manges themeing functionalty.
|
||||
/// Objects ResourceDictionary, Themes.Konrad, ... need Xamarin.Forms framework to be initialized which might break tests.
|
||||
/// </summary>
|
||||
public class Theme : ITheme
|
||||
{
|
||||
private ICollection<ResourceDictionary> _MergedDictionaries;
|
||||
|
||||
public Theme(ICollection<ResourceDictionary> mergedDictionaries)
|
||||
{
|
||||
_MergedDictionaries = mergedDictionaries ?? throw new ArgumentNullException(nameof(mergedDictionaries));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets active theme.
|
||||
/// </summary>
|
||||
/// <param name="themeName">Name of the new active theme.</param>
|
||||
public void SetActiveTheme(string themeName)
|
||||
{
|
||||
if (!Enum.TryParse(themeName, false, out ThemeSet theme))
|
||||
return;
|
||||
|
||||
if (_MergedDictionaries == null)
|
||||
return;
|
||||
|
||||
_MergedDictionaries.Clear();
|
||||
|
||||
switch (theme)
|
||||
{
|
||||
case ThemeSet.Konrad:
|
||||
_MergedDictionaries.Add(new Themes.Konrad());
|
||||
break;
|
||||
|
||||
case ThemeSet.LastenradBayern:
|
||||
_MergedDictionaries.Add(new Themes.LastenradBayern());
|
||||
break;
|
||||
|
||||
default:
|
||||
_MergedDictionaries.Add(new Themes.ShareeBike());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue