Skip to content

Instantly share code, notes, and snippets.

View axemastabloggists's full-sized avatar

axemastabloggists

View GitHub Profile
@axemastabloggists
axemastabloggists / usingstatements.cs
Created August 14, 2018 21:30
Data Persistence Properties Blog - Gist 9
using System;
using System.ComponentModel;
using System.Windows.Input;
using Xamarin.Forms;
using DataPersistence.Properties.Settings;
@axemastabloggists
axemastabloggists / initialxaml.xaml
Created August 14, 2018 21:29
Data Persistence Properties Blog - Gist 8
<StackLayout VerticalOptions="Center" Padding="20,0">
<Label Text="Redirect Url Here" HorizontalOptions="Center"/>
<Button Text="Get Redirect Url"/>
<BoxView HeightRequest="20" Color="Transparent"/>
<Entry Placeholder="Update Redirect Url"/>
<Button Text="Update"/>
</StackLayout>
@axemastabloggists
axemastabloggists / appsettingsinterface.cs
Created August 14, 2018 21:27
Data Persistence Properties Blog - Gist 7
interface IAppSettings
{
/// <summary>
/// Gets or Sets the Server Redirect URL
/// </summary>
string RedirectUrl { get; set; }
}
@axemastabloggists
axemastabloggists / appsettingsinherit.cs
Created August 14, 2018 21:25
Data Persistence Properties Blog - Gist 6
class AppSettings : IAppSettings
{
...
}
@axemastabloggists
axemastabloggists / redirecturlcomplete.cs
Created August 14, 2018 21:24
Data Persistence Properties Blog - Gist 5
#region Redirect URL
private static readonly string RedirectUrlKey = SettingsConstants.RedirectUrlKey;
private static readonly string RedirectUrlDefault = SettingsConstants.RedirectUrlDefault;
/// <summary>
/// Gets or Sets the Server Redirect URL
/// </summary>
public string RedirectUrl
{
@axemastabloggists
axemastabloggists / settingsconstants.cs
Created August 14, 2018 21:22
Data Persistence Properties Blog - Gist 4
public class SettingsConstants
{
public const string RedirectUrlKey = "redirecturl";
public const string RedirectUrlDefault = "www.alexduffell.wordpress.com/api";
}
@axemastabloggists
axemastabloggists / redirecturl2.cs
Last active August 14, 2018 21:22
Data Persistence Properties Blog - Gist 3
/// <summary>
/// Gets or Sets the Server Redirect URL
/// </summary>
public string RedirectUrl
{
get
{
return _appSettings.GetValueOrDefault("redirecturl", "www.alexduffell.wordpress.com/api");
}
set
@axemastabloggists
axemastabloggists / redirecturl.cs
Created August 14, 2018 21:18
Data Persistence Properties Blog - Gist 2
/// <summary>
/// Gets or Sets the Server Redirect URL
/// </summary>
public string RedirectUrl { get; set; }
@axemastabloggists
axemastabloggists / appsettingconnection.cs
Created August 14, 2018 21:15
Data Persistence Properties Blog - Gist 1
/// <summary>
/// App Settings Connection.
/// </summary>
private static ISettings _appSettings => CrossSettings.Current;