Initial version.

This commit is contained in:
Oliver Hauff 2021-05-13 20:03:07 +02:00
parent 193aaa1a56
commit b72c67a53e
228 changed files with 25924 additions and 0 deletions

View file

@ -0,0 +1,101 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using TINK.Model.Services.CopriApi.ServerUris;
namespace TINK.Model.Connector
{
/// <summary> View model managing active uri and sets of uris. </summary>
public class CopriServerUriListViewModel : INotifyPropertyChanged
{
/// <summary>
/// Object holding active uris.
/// </summary>
private CopriServerUriList m_oUris;
/// <summary>
/// Fired whenever a property changes.
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;
/// <summary>Maps uris to user fiendly descriptions.</summary>
private Dictionary<string, string> uriToServerText;
/// <summary>Maps user fiendly descriptions to uris.</summary>
private Dictionary<string, string> serverTextToUri;
public CopriServerUriListViewModel(CopriServerUriList p_oSource)
{
uriToServerText = new Dictionary<string, string> {
{ CopriServerUriList.TINK_DEVEL, "TINK-Konrad-devellopment" },
{ CopriServerUriList.TINK_LIVE, "TINK-Konrad-live" },
{ CopriServerUriList.SHAREE_DEVEL, "Sharee-fr01-devellopment" },
{ CopriServerUriList.SHAREE_LIVE, "Sharee-fr01-live" }
};
serverTextToUri = uriToServerText.ToDictionary(x => x.Value, x => x.Key);
m_oUris = new CopriServerUriList(p_oSource);
NextActiveUri = m_oUris.ActiveUri;
}
/// <summary>
/// Sets the active uri.
/// </summary>
private Uri ActiveUri
{
set
{
if (m_oUris.ActiveUri.AbsoluteUri == value.AbsoluteUri)
{
/// Nothing to do.
return;
}
m_oUris = new CopriServerUriList(m_oUris.Uris.ToArray(), value);
}
}
/// <summary> Gets the known uris. </summary>
public IList<string> ServerTextList
{
get
{
return m_oUris.Uris.Select(x => (uriToServerText.ContainsKey(x.AbsoluteUri) ? uriToServerText[x.AbsoluteUri] : x.AbsoluteUri)).OrderBy(x => x).ToList();
}
}
/// <summary> Holds the uri which will be applied after restart of app. </summary>
public Uri NextActiveUri { get; private set; }
/// <summary> Holds the uri which will be applied after restart. </summary>
public string NextActiveServerText
{
get
{
return uriToServerText.ContainsKey(NextActiveUri.AbsoluteUri) ? uriToServerText[NextActiveUri.AbsoluteUri] : NextActiveUri.AbsoluteUri;
}
set
{
NextActiveUri = new Uri(serverTextToUri.ContainsKey(value) ? serverTextToUri[value] : value);
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(CorpiServerUriDescription)));
}
}
/// <summary> Holds the description of the picker.</summary>
public string CorpiServerUriDescription
{
get
{
return m_oUris.ActiveUri.AbsoluteUri == NextActiveUri.AbsoluteUri
? "Aktiver Copri- Server"
: "Copri- Server.\r\nNeustart erforderlich für Wechsel!";
}
}
}
}

View file

@ -0,0 +1,62 @@
using TINK.Model;
namespace TINK.ViewModel.Settings
{
/// <summary>Holds filter item incluting full state (avaialble, activated, name, ...). </summary>
public class FilterItemMutable
{
/// <summary> Switch value</summary>
private bool m_bIsActivatedSwitch;
/// <summary> Constructs a filter object. </summary>
/// <param name="p_strKey">Key of the filter state.</param>
/// <param name="p_oFilterState">State of filter, on or off.</param>
/// <param name="p_bIsEnabled">If filter does not apply because user does not belong to group (TINK, Konrad, ...) filter is deactivated.</param>
/// <param name="p_strLabelText">Text of the switch describing the filter.</param>
public FilterItemMutable(
string p_strKey,
FilterState p_oFilterState,
bool p_bIsEnabled,
string p_strLabelText)
{
Text = p_strLabelText;
IsEnabled = p_bIsEnabled;
State = p_oFilterState;
Key = p_strKey;
m_bIsActivatedSwitch = p_bIsEnabled && p_oFilterState == FilterState.On;
}
/// <summary> Text describing the filter. </summary>
public string Text { get; }
/// <summary> True if switch can be toggeled.</summary>
public bool IsEnabled { get; }
/// <summary> True if switch is on.</summary>
public bool IsActivated
{
get
{
return m_bIsActivatedSwitch;
}
set
{
m_bIsActivatedSwitch = value;
if (!IsEnabled)
{
// Nothing to do if filter does not apply to user account.
return;
}
State = m_bIsActivatedSwitch ? FilterState.On : FilterState.Off;
}
}
/// <summary> Key of the filter.</summary>
public string Key { get; }
/// <summary> State of the filter.</summary>
public FilterState State { get; private set; }
}
}

View file

@ -0,0 +1,36 @@
using System;
using System.ComponentModel;
namespace TINK.ViewModel.Settings
{
/// <summary> Manages locks services and related parameters. </summary>
public class LocksServicesViewModel : INotifyPropertyChanged
{
private TimeSpan ConnectTimeout { get; set; }
public LocksServicesViewModel(
TimeSpan connectTimeout,
ServicesViewModel servicesViewModel)
{
ConnectTimeout = connectTimeout;
Services = servicesViewModel;
}
public ServicesViewModel Services { get; }
public string ConnectTimeoutSecText { get => ConnectTimeout.TotalSeconds.ToString(); }
public double ConnectTimeoutSec
{
get => ConnectTimeout.TotalSeconds;
set
{
ConnectTimeout = TimeSpan.FromSeconds(value);
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(ConnectTimeoutSecText)));
}
}
public event PropertyChangedEventHandler PropertyChanged;
}
}

View file

@ -0,0 +1,110 @@
using System;
using System.ComponentModel;
using TINK.Settings;
namespace TINK.ViewModel.Settings
{
/// <summary> Polling relagted parameters</summary>
public class PollingViewModel : INotifyPropertyChanged
{
/// <summary>Holds the views polling parameters.</summary>
private PollingParameters m_oPolling = PollingParameters.Default;
/// <summary> Current polling periode. Used to check whether values were modified or not.</summary>
private readonly PollingParameters m_oPollingActive;
/// <summary> Constructs polling object. </summary>
/// <param name="p_oSource">Object to construct from</param>
public PollingViewModel(PollingParameters p_oSource)
{
m_oPollingActive = p_oSource
?? throw new ArgumentException("Can not instantiate polling parameters view model- object. Polling parameter object is null.");
m_oPolling = p_oSource;
}
/// <summary> Gets the immutable version of polling parameters.</summary>
/// <returns>Polling parameters object.</returns>
public PollingParameters ToImmutable() { return m_oPolling; }
/// <summary> Holds value whether polling is activated or not.</summary>
public bool IsActivated
{
get
{
return m_oPolling.IsActivated;
}
set
{
if (value == m_oPolling.IsActivated)
{
// Nothing to do.
return;
}
m_oPolling = new PollingParameters(m_oPolling.Periode, value);
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsActivated)));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(PeriodeTotalSeconds)));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(PeriodeTotalSecondsText)));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(PollingText)));
}
}
/// <summary> Gests or sets the polling periode [sec]. </summary>
public int PeriodeTotalSeconds
{
get
{
return (int)m_oPolling.Periode.TotalSeconds;
}
set
{
if (value == (int)m_oPolling.Periode.TotalSeconds)
{
// Nothing to do.
return;
}
m_oPolling = new PollingParameters(new TimeSpan(0, 0, value), IsActivated);
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(PeriodeTotalSeconds)));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(PeriodeTotalSecondsText)));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(PollingText)));
}
}
/// <summary> Gets info about polling periode.</summary>
public string PeriodeTotalSecondsText
{
get
{
if (IsActivated)
{
return $"Polling Periode: {PeriodeTotalSeconds} [Sek.]";
}
return $"Polling abgeschalten.";
}
}
/// <summary> Gets the text of the polling related controls.</summary>
public string PollingText
{
get
{
if (m_oPolling == m_oPollingActive)
{
return "Polling";
}
return "Polling\r\nAnsicht verlassen um Änderungen anzuwenden.";
}
}
/// <summary> Notifies GUI about modified values.</summary>
public event PropertyChangedEventHandler PropertyChanged;
}
}

View file

@ -0,0 +1,80 @@
using Serilog;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
namespace TINK.ViewModel.Settings
{
/// <summary> ViewModel for an active service plus a list of services which are not active.</summary>
/// <remarks>
/// Example for services are lock services, geolocation services, ...,
/// </remarks>
public class ServicesViewModel : INotifyPropertyChanged
{
/// <summary> Active service. </summary>
private string active;
/// <summary> Holds the dictionary which maps services to service display texts.</summary>
private IDictionary<string, string> ServiceToText { get; }
/// <summary> Holds the dictionary which maps service display texts to services.</summary>
private IDictionary<string, string> TextToService { get; }
/// <summary>Constructs view model ensuring consistency. </summary>
/// <param name="services">List of available services.</param>
/// <param name="serviceToText"> Dictionary holding display text for services as values.</param>
/// <param name="active">Active service.</param>
public ServicesViewModel(
IEnumerable<string> services,
IDictionary<string, string> serviceToText,
string active)
{
if (!services.Contains(active))
throw new ArgumentException($"Can not instantiate {typeof(ServicesViewModel).Name}- object. Active lock service {active} must be contained in [{String.Join(",", services)}].");
ServiceToText = services.Distinct().ToDictionary(
x => x,
x => serviceToText.ContainsKey(x) ? serviceToText[x] : x);
TextToService = ServiceToText.ToDictionary(x => x.Value, x => x.Key);
Active = active;
}
/// <summary> Fired whenever active service changes.</summary>
public event PropertyChangedEventHandler PropertyChanged;
/// <summary> Holds active service.</summary>
public string Active
{
get => active;
set
{
if (active == value)
return;
active = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Active)));
}
}
/// <summary> List of display texts of services.</summary>
public IList<string> ServicesTextList => ServiceToText.Select(x => x.Value).OrderBy(x => x).ToList();
/// <summary> Active locks service.</summary>
public string ActiveText
{
get => ServiceToText[Active];
set
{
if (!TextToService.ContainsKey(value))
{
Log.ForContext<ServicesViewModel>().Error($"Can not set service {value} to services view model. List of services {{{string.Join(";", TextToService)}}} does not hold machting element.");
throw new ArgumentException($"Can not set service {value} to services view model. List of services {{{string.Join(";", TextToService)}}} does not hold machting element.");
}
Active = TextToService[value];
}
}
}
}

View file

@ -0,0 +1,64 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using TINK.Model;
using TINK.Model.Connector;
namespace TINK.ViewModel.Settings
{
/// <summary> Holds the filters to display..</summary>
/// <remarks> Former name: FilterCollectionMutable.</remarks>
public class SettingsBikeFilterViewModel : ObservableCollection<FilterItemMutable>
{
/// <summary> Constructs a filter collection object.</summary>
/// <param name="p_oFilterSettings">All available filters.</param>
/// <param name="p_oFilterGroupUser">Filters which apply to logged in user.</param>
public SettingsBikeFilterViewModel(
IGroupFilterSettings p_oFilterSettings,
IEnumerable<string> p_oFilterGroupUser)
{
foreach (var l_oFilter in p_oFilterSettings)
{
if (l_oFilter.Key == FilterHelper.FILTERTINKGENERAL)
{
Add(new FilterItemMutable(
l_oFilter.Key,
l_oFilter.Value,
p_oFilterGroupUser != null ? p_oFilterGroupUser.Contains(l_oFilter.Key) : true,
"TINK Lastenräder"));
continue;
}
if (l_oFilter.Key == FilterHelper.FILTERKONRAD)
{
Add(new FilterItemMutable(
l_oFilter.Key,
l_oFilter.Value,
p_oFilterGroupUser != null ? p_oFilterGroupUser.Contains(l_oFilter.Key) : true,
"Konrad Stadträder"));
continue;
}
Add(new FilterItemMutable(
l_oFilter.Key,
l_oFilter.Value,
p_oFilterGroupUser != null ? p_oFilterGroupUser.Contains(l_oFilter.Key) : true,
l_oFilter.Key));
}
}
/// <summary> Get filter collection which might have been modified for serialization purposes.</summary>
public Dictionary<string, FilterState> FilterCollection
{
get
{
var l_Dictionary = new Dictionary<string, FilterState>();
foreach (var l_oEntry in this)
{
l_Dictionary.Add(l_oEntry.Key, l_oEntry.State);
}
return l_Dictionary;
}
}
}
}

View file

@ -0,0 +1,384 @@
using Serilog;
using Serilog.Events;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Threading.Tasks;
using TINK.Model;
using TINK.Model.Connector;
using TINK.Model.Repository.Exception;
using TINK.Model.Services.Geolocation;
using TINK.Settings;
using TINK.View;
using TINK.ViewModel.Map;
using TINK.ViewModel.Settings;
using System.Linq;
using TINK.Model.User.Account;
using TINK.Services.BluetoothLock;
using Xamarin.Forms;
namespace TINK.ViewModel
{
/// <summary>
/// View model for settings.
/// </summary>
public class SettingsPageViewModel : INotifyPropertyChanged
{
/// <summary>
/// Reference on view servcie to show modal notifications and to perform navigation.
/// </summary>
private IViewService m_oViewService;
/// <summary>
/// Fired if a property changes.
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;
/// <summary> Object to manage update of view model objects from Copri.</summary>
private IPollingUpdateTaskManager m_oViewUpdateManager;
/// <summary> List of copri server uris.</summary>
public CopriServerUriListViewModel CopriServerUriList { get; }
/// <summary> Manages selection of locks services.</summary>
public LocksServicesViewModel LocksServices { get; }
/// <summary> Manages selection of geolocation services.</summary>
public ServicesViewModel GeolocationServices { get; }
/// <summary>
/// Object to switch logging level.
/// </summary>
private LogEventLevel m_oMinimumLogEventLevel;
/// <summary> List of copri server uris.</summary>
public ServicesViewModel Themes { get; }
/// <summary> Reference on the tink app instance. </summary>
private ITinkApp TinkApp { get; }
/// <summary> Constructs a settings page view model object.</summary>
/// <param name="tinkApp"> Reference to tink app model.</param>
/// <param name="p_oUser"></param>
/// <param name="p_oDevice"></param>
/// <param name="p_oFilterGroup">Filter to apply on stations and bikes.</param>
/// <param name="p_oUris">Available copri server host uris including uri to use for next start.</param>
/// <param name="p_oPolling"> Holds whether to poll or not and the periode leght is polling is on. </param>
/// <param name="p_oDefaultPollingPeriode">Default polling periode lenght.</param>
/// <param name="p_oMinimumLogEventLevel">Controls logging level.</param>
/// <param name="p_oViewService">Interface to view</param>
public SettingsPageViewModel(
ITinkApp tinkApp,
IViewService p_oViewService)
{
TinkApp = tinkApp
?? throw new ArgumentException("Can not instantiate settings page view model- object. No tink app object available.");
m_oViewService = p_oViewService
?? throw new ArgumentException("Can not instantiate settings page view model- object. No user view service available.");
m_oMinimumLogEventLevel = TinkApp.MinimumLogEventLevel;
CenterMapToCurrentLocation = TinkApp.CenterMapToCurrentLocation;
ExternalFolder = TinkApp.ExternalFolder;
IsLogToExternalFolderVisible = !string.IsNullOrEmpty(ExternalFolder);
LogToExternalFolderDisplayValue = IsLogToExternalFolderVisible ? TinkApp.LogToExternalFolder : false;
IsSiteCachingOnDisplayValue = TinkApp.IsSiteCachingOn;
if (TinkApp.Uris == null
|| TinkApp.Uris.Uris.Count <= 0)
{
throw new ArgumentException("Can not instantiate settings page view model- object. No uri- list available.");
}
if (string.IsNullOrEmpty(TinkApp.NextActiveUri.AbsoluteUri))
{
throw new ArgumentException("Can not instantiate settings page view model- object. Next active uri must not be null or empty.");
}
GroupFilter = new SettingsBikeFilterViewModel(
TinkApp.FilterGroupSetting,
TinkApp.ActiveUser.IsLoggedIn ? TinkApp.ActiveUser.Group : null);
m_oViewUpdateManager = new IdlePollingUpdateTaskManager();
Polling = new PollingViewModel(TinkApp.Polling);
ExpiresAfterTotalSeconds = Convert.ToInt32(TinkApp.ExpiresAfter.TotalSeconds);
CopriServerUriList = new CopriServerUriListViewModel(TinkApp.Uris);
Themes = new ServicesViewModel(
TinkApp.Themes.Select(x => x.GetType().FullName),
new Dictionary<string, string> {
{ typeof(Themes.Konrad).FullName, "Konrad" },
{ typeof(Themes.ShareeBike).FullName, "sharee.bike" }
},
TinkApp.Themes.Active.GetType().FullName);
Themes.PropertyChanged += OnThemesChanged;
LocksServices = new LocksServicesViewModel(
TinkApp.LocksServices.Active.TimeOut.MultiConnect,
new ServicesViewModel(
TinkApp.LocksServices,
new Dictionary<string, string> {
{ typeof(LocksServiceInReach).FullName, "Simulation - AllLocksInReach" },
{ typeof(LocksServiceOutOfReach).FullName, "Simulation - AllLocksOutOfReach" },
{ typeof(Services.BluetoothLock.BLE.LockItByScanServiceEventBased).FullName, "Live - Scan" },
{ typeof(Services.BluetoothLock.BLE.LockItByScanServicePolling).FullName, "Live - Scan (Polling)" },
{ typeof(Services.BluetoothLock.BLE.LockItByGuidService).FullName, "Live - Guid" },
/* { typeof(Services.BluetoothLock.Arendi.LockItByGuidService).FullName, "Live - Guid (Arendi)" },
{ typeof(Services.BluetoothLock.Arendi.LockItByScanService).FullName, "Live - Scan (Arendi)" },
{ typeof(Services.BluetoothLock.Bluetoothle.LockItByGuidService).FullName, "Live - Guid (Ritchie)" }, */
},
TinkApp.LocksServices.Active.GetType().FullName));
GeolocationServices = new ServicesViewModel(
TinkApp.GeolocationServices.Select(x => x.GetType().FullName),
new Dictionary<string, string> {
{ typeof(LastKnownGeolocationService).FullName, "Smartdevice-LastKnowGeolocation" },
{ typeof(GeolocationService).FullName, "Smartdevice-MediumAccuracy" },
{ typeof(SimulatedGeolocationService).FullName, "Simulation-AlwaysSamePosition" } },
TinkApp.GeolocationServices.Active.GetType().FullName);
}
/// <summary>
/// User switches scheme.
/// </summary>
private void OnThemesChanged(object sender, PropertyChangedEventArgs e)
{
// Set active theme (leads to switch of title)
TinkApp.Themes.SetActive(Themes.Active);
// Switch theme.
ICollection<ResourceDictionary> mergedDictionaries = Application.Current.Resources.MergedDictionaries;
if (mergedDictionaries == null)
{
Log.ForContext<SettingsPageViewModel>().Error("No merged dictionary available.");
return;
}
mergedDictionaries.Clear();
if (Themes.Active == typeof(Themes.Konrad).FullName)
{
mergedDictionaries.Add(new Themes.Konrad());
}
else if (Themes.Active == typeof(Themes.ShareeBike).FullName)
{
mergedDictionaries.Add(new Themes.ShareeBike());
}
else
{
Log.ForContext<SettingsPageViewModel>().Debug($"No theme {Themes.Active} found.");
}
}
/// <summary> Holds information whether app is connected to web or not. </summary>
private bool? isConnected = null;
/// <summary>Exposes the is connected state. </summary>
private bool IsConnected
{
get => isConnected ?? false;
set
{
isConnected = value;
}
}
/// <summary> Holds a value indicating whether group filters GUI are visible or not</summary>
public bool IsGroupFilterVisible => GroupFilter.Count > 0;
/// <summary> Holds the bike types to fade out or show</summary>
public SettingsBikeFilterViewModel GroupFilter { get; }
/// <summary> Gets the value to path were copri mock files are located (for debugging purposes).</summary>
public string ExternalFolder { get; }
/// <summary>
/// Gets the value to path were copri mock files are located (for debugging purposes).
/// </summary>
public string InternalPath => TinkApp.SettingsFileFolder;
/// <summary>
/// Gets the value of device identifier (for debugging purposes).
/// </summary>
public string DeviceIdentifier
{
get { return TinkApp.Device.GetIdentifier(); }
}
/// <summary>
/// Invoked when page is shutdown.
/// Currently invoked by code behind, would be nice if called by XAML in future versions.
/// </summary>
public async Task OnDisappearing()
{
try
{
Log.ForContext<SettingsPageViewModel>().Information($"Entering {nameof(OnDisappearing)}...");
// Update model values.
TinkApp.NextActiveUri = CopriServerUriList.NextActiveUri;
TinkApp.Polling = new PollingParameters(
new TimeSpan(0, 0, Polling.PeriodeTotalSeconds),
Polling.IsActivated);
TinkApp.ExpiresAfter = TimeSpan.FromSeconds(ExpiresAfterTotalSeconds);
var filterGroup = GroupFilter.ToDictionary(x => x.Key, x => x.State);
TinkApp.FilterGroupSetting = new GroupFilterSettings(filterGroup.Count > 0 ? filterGroup : null);
// Update map page filter.
// Reasons for which map page filter has to be updated:
// - user activated/ deactivated a group (TINKCorpi/ TINKSms/ Konrad)
// - user logged off
TinkApp.GroupFilterMapPage =
GroupFilterMapPageHelper.CreateUpdated(
TinkApp.GroupFilterMapPage,
TinkApp.ActiveUser.DoFilter(TinkApp.FilterGroupSetting.DoFilter()));
TinkApp.CenterMapToCurrentLocation = CenterMapToCurrentLocation;
if (IsLogToExternalFolderVisible)
{
// If no external folder is available do not update model value.
TinkApp.LogToExternalFolder = LogToExternalFolderDisplayValue;
}
TinkApp.IsSiteCachingOn = IsSiteCachingOnDisplayValue;
TinkApp.MinimumLogEventLevel = m_oMinimumLogEventLevel; // Update value to be serialized.
TinkApp.UpdateLoggingLevel(m_oMinimumLogEventLevel); // Update logging server.
TinkApp.LocksServices.SetActive(LocksServices.Services.Active);
TinkApp.GeolocationServices.SetActive(GeolocationServices.Active);
TinkApp.LocksServices.SetTimeOut(TimeSpan.FromSeconds(LocksServices.ConnectTimeoutSec));
// Persist settings in case app is closed directly.
TinkApp.Save();
TinkApp.UpdateConnector();
await m_oViewUpdateManager.StopUpdatePeridically();
Log.ForContext<SettingsPageViewModel>().Information($"{nameof(OnDisappearing)} done.");
}
catch (Exception l_oException)
{
await m_oViewService.DisplayAlert(
"Fehler",
$"Ein unerwarteter Fehler ist aufgetreten. \r\n{l_oException.Message}",
"OK");
}
}
/// <summary> True if there is an error message to display.</summary>
/// <summary>
/// Exception which occurred getting bike information.
/// </summary>
protected Exception Exception { get; set; }
/// <summary>
/// If true debug controls are visible, false if not.
/// </summary>
public Permissions DebugLevel
{
get
{
return (Exception == null || Exception is WebConnectFailureException)
? TinkApp.ActiveUser.DebugLevel
: Permissions.None;
}
}
/// <summary>Polling periode.</summary>
public PollingViewModel Polling { get; }
/// <summary> Active logging level</summary>
public string SelectedLoggingLevel
{
get
{
return m_oMinimumLogEventLevel.ToString();
}
set
{
if (!Enum.TryParse(value, out LogEventLevel l_oNewLevel))
{
return;
}
m_oMinimumLogEventLevel = l_oNewLevel;
}
}
public bool CenterMapToCurrentLocation { get; set; }
/// <summary> Holds either
/// - a value indicating whether to use external folder (e.g. SD card)/ or internal folder for storing log-files or
/// - is false if external folder is not available
/// </summary>
public bool LogToExternalFolderDisplayValue { get; set; }
public bool IsSiteCachingOnDisplayValue { get; set; }
/// <summary> Holds a value indicating whether user can use external folder (e.g. SD card) for storing log-files.</summary>
public bool IsLogToExternalFolderVisible { get; }
/// <summary>
/// Holds the logging level serilog provides.
/// </summary>
public List<string> LoggingLevels
{
get
{
return new List<string>
{
LogEventLevel.Verbose.ToString(),
LogEventLevel.Debug.ToString(),
LogEventLevel.Information.ToString(),
LogEventLevel.Warning.ToString(),
LogEventLevel.Error.ToString(),
LogEventLevel.Fatal.ToString(),
};
}
}
double expiresAfterTotalSeconds;
public double ExpiresAfterTotalSeconds
{
get => expiresAfterTotalSeconds;
set
{
if (value == expiresAfterTotalSeconds)
{
return;
}
expiresAfterTotalSeconds = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(ExpiresAfterTotalSecondsText)));
}
}
public string ExpiresAfterTotalSecondsText
{
get => expiresAfterTotalSeconds.ToString("0");
}
}
}