Skip to content

Instantly share code, notes, and snippets.

View axemastabloggists's full-sized avatar

axemastabloggists

View GitHub Profile
@axemastabloggists
axemastabloggists / DatabaseAccess.cs
Created November 4, 2018 16:59
Data Persistence Part 2 - Gist 2
using System;
using System.IO;
using SQLite;
namespace DataPersistence.Sqlite.Database.Private
{
/// <summary>
/// DatabaseAccess - Accesses the SQLite Database
/// </summary>
@axemastabloggists
axemastabloggists / IDatabaseAccess.cs
Created November 4, 2018 16:58
Data Persistence Part 2 - Gist 1
using SQLite;
namespace DataPersistence.Sqlite.Database.Private
{
public interface IDatabaseAccess
{
/// <summary>
/// Returns a connection to the sqlite database
/// </summary>
/// <returns></returns>
@axemastabloggists
axemastabloggists / xamlwithbinding.xaml
Created August 14, 2018 21:38
Data Persistence Properties Blog - Gist 17
<StackLayout VerticalOptions="Center" Padding="20,0">
<Label Text="{Binding RedirectUrl}" HorizontalOptions="Center"/>
<Button Text="Get Redirect Url" Command="{Binding GetValueCommand}"/>
<BoxView HeightRequest="20" Color="Transparent"/>
<Entry Placeholder="Update Redirect Url" Text="{Binding UpdatedValue}"/>
<Button Text="Update" Command="{Binding UpdateValueCommand}"/>
</StackLayout>
@axemastabloggists
axemastabloggists / viewmodelctor.cs
Created August 14, 2018 21:37
Data Persistence Properties Blog - Gist 16
public MainPageViewModel()
{
_appSettings = new AppSettings();
GetValueCommand = new Command(OnGetValue);
UpdateValueCommand = new Command(OnUpdateValue);
_redirectUrl = "Press to get redirect url";
}
@axemastabloggists
axemastabloggists / viewmodelmoreproperties.cs
Created August 14, 2018 21:37
Data Persistence Properties Blog - Gist 15
#region Properties
public ICommand GetValueCommand { get; private set; }
public ICommand UpdateValueCommand { get; private set; }
#endregion Properties
#region OnCommand Methods
private void OnGetValue()
@axemastabloggists
axemastabloggists / viewmodelproperties.cs
Created August 14, 2018 21:36
Data Persistence Properties Blog - Gist 14
#region Properties
private string _redirectUrl;
public string RedirectUrl
{
get => _redirectUrl;
}
private string _updatedValue;
public string UpdatedValue
@axemastabloggists
axemastabloggists / appsettingsview.cs
Created August 14, 2018 21:34
Data Persistence Properties Blog - Gist 13
#region Properties
private IAppSettings _appSettings;
#endregion Properties
@axemastabloggists
axemastabloggists / viewmodelbindingcontext.xaml
Created August 14, 2018 21:33
Data Persistence Properties Blog - Gist 12
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:DataPersistence.Properties.Views"
xmlns:viewModels="clr-namespace:DataPersistence.Properties.ViewModels"
x:Class="DataPersistence.Properties.Views.MainPage">
<ContentPage.BindingContext>
<viewModels:MainPageViewModel/>
</ContentPage.BindingContext>
...
@axemastabloggists
axemastabloggists / viewmodelnotify.cs
Created August 14, 2018 21:31
Data Persistence Properties Blog - Gist 11
#endregion OnCommand Methods
#region PropertyChanged Methods
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
@axemastabloggists
axemastabloggists / viewmodelcreation.cs
Created August 14, 2018 21:30
Data Persistence Properties Blog - Gist 10
public class MainPageViewModel : INotifyPropertyChanged
{
...
}