Skip to content

Instantly share code, notes, and snippets.


Dawid Sibiński dsibinski

View GitHub Profile
View PeopleRepository.cs
public class PeopleRepository
private SQLiteConnection db = null;
protected static PeopleRepository me;
static PeopleRepository()
me = new PeopleRepository();
View addPersonButtonClick.cs
private void _btnAddPerson_Click(object sender, EventArgs e)
var name = _inputName.Text;
var lastName = _inputLastName.Text;
var id = PeopleRepository.SavePerson(new Person
Name = name,
LastName = lastName
View MainActivity_Tests.cs
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
protected override void OnCreate(Bundle savedInstanceState)
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
// This will load all tests within the current project
var nunit = new NUnit.Runner.App();
View RepositoryTests_methods.cs
public void one_new_person_inserted_adds_one_new_row()
// given
var person = new Person()
Name = "A",
LastName = "B"
View RepositoryTests_sqlite.cs
public SQLiteAsyncConnection InMemorySqliteConnection;
public void Init()
InMemorySqliteConnection = new SQLiteAsyncConnection(":memory:");
View PeopleListActivity_clicking.cs
private void ListView_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
var person = _peopleList[e.Position];
var uri = Android.Net.Uri.Parse("tel:" + person.PhoneNumber);
var intent = new Intent(Intent.ActionDial, uri);
View MainActivity_peopleManagementClick.cs
private void _btnPeople_Click(object sender, EventArgs e)
var intent = new Intent(this, typeof(PeopleActivity));
View MainActivity_peopleManagementClick_msg.cs
private void _btnPeople_Click(object sender, EventArgs e)
var intent = new Intent(this, typeof(PeopleActivity));
var msgContent = "Hello! This is a secret sent from MainActivity! Don't tell anyone!";
intent.PutExtra("secret_message", msgContent);
View PeopleListActivity.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
View Strings.xml
<?xml version="1.0" encoding="utf-8"?>
<string name="ApplicationName">MoneyBack</string>
<string name="titleMenu">Menu:</string>
<string name="btnPeople">People management</string>
<string name="titleName">Name</string>
<string name="titleLastName">Last name</string>
<string name="titlePhoneNumber">Phone number</string>
<string name="btnSavePerson">Save person</string>
<string name="btnPeopleList">List of people</string>