This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Activity(Label = "MoneyBack", MainLauncher = true, Icon = "@drawable/icon")] | |
public class MainActivity : Activity | |
{ | |
protected override void OnCreate(Bundle bundle) | |
{ | |
base.OnCreate(bundle); | |
// Set our view from the "main" layout resource | |
SetContentView (Resource.Layout.Main); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override void OnCreate(Bundle bundle) | |
{ | |
base.OnCreate(bundle); | |
// Set our view from the "main" layout resource | |
SetContentView(Resource.Layout.Main); | |
_amount = 0.00m; | |
_result = 0.00m; | |
_numberOfPeople = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override void OnStart() | |
{ | |
base.OnStart(); | |
RefreshUserInputsFromVariables(); | |
} | |
// ... | |
private void RefreshUserInputsFromVariables() | |
{ | |
_inputAmount.SetText(_amount.ToString(CultureInfo.InvariantCulture), TextView.BufferType.Editable); | |
_txtResultDecimal.SetText(_result.ToString(CultureInfo.InvariantCulture), TextView.BufferType.Editable); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override void OnResume() | |
{ | |
base.OnResume(); | |
InitializeUserControlsEvents(); | |
// TODO: retrieving variables (amount, number of people) from persistent storage (file, database) | |
} | |
// ... | |
private void InitializeUserControlsEvents() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override void OnPause() | |
{ | |
base.OnPause(); | |
DetatchUserControlsEvents(); | |
// TODO: saving variables (amount, number of people) to persistent storage (file, database) | |
} | |
// ... | |
private void DetatchUserControlsEvents() | |
{ | |
_btnCalculate.Click -= _btnCalculate_Click; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private bool AddNewCity(string cityName, string countryIso) | |
{ | |
var city = CountriesCitiesDbService.GetNewCity(); | |
var europeanCountries = CountriesCitiesDbService.GetAllEuropeanCountries(); | |
var country = europeanCountries.FirstOrDefault(ec => ec.IsoCode.Equals(countryIso)); | |
if (country == null) | |
throw new ArgumentException($"Country with ISO Code {countryIso} does not exist!"); | |
city.Name = cityName; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private List<Country> _europeanCountries; | |
public List<Country> EuropeanCountries => | |
_europeanCountries ?? (_europeanCountries = CountriesCitiesDbService.GetAllEuropeanCountries()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private bool AddNewCity(string cityName, string countryIso) | |
{ | |
var city = CountriesCitiesDbService.GetNewCity(); | |
var country = EuropeanCountries.FirstOrDefault(ec => ec.IsoCode.Equals(countryIso)); | |
// the rest of method's code... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace MoneyBack.Entities | |
{ | |
[Table("People")] | |
public class Person | |
{ | |
[PrimaryKey, AutoIncrement] | |
public int Id { get; set; } | |
public string Name { get; set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Constants | |
{ | |
public static readonly string DbFilePath = | |
Path.Combine( | |
Environment.GetFolderPath(Environment.SpecialFolder.Personal), | |
"moneyback.db" | |
); | |
} |
OlderNewer