Skip to content

Instantly share code, notes, and snippets.

View dsibinski's full-sized avatar

Dawid Sibiński dsibinski

View GitHub Profile
public class PeopleRepository
{
private SQLiteConnection db = null;
protected static PeopleRepository me;
static PeopleRepository()
{
me = new PeopleRepository();
}
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
});
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
// This will load all tests within the current project
var nunit = new NUnit.Runner.App();
[Test]
public void one_new_person_inserted_adds_one_new_row()
{
// given
var person = new Person()
{
Name = "A",
LastName = "B"
};
public SQLiteAsyncConnection InMemorySqliteConnection;
[OneTimeSetUp]
public void Init()
{
InMemorySqliteConnection = new SQLiteAsyncConnection(":memory:");
}
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);
StartActivity(intent);
}
private void _btnPeople_Click(object sender, EventArgs e)
{
var intent = new Intent(this, typeof(PeopleActivity));
StartActivity(intent);
}
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);
StartActivity(intent);
}
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;
<?xml version="1.0" encoding="utf-8"?>
<resources>
<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>