/// <summary> /// Returns the ONLY instance of the class, if null. we initate the ONLY instance. /// </summary> /// <returns>The instance.</returns> public static BookkeeperManager GetInstance() { if (null == bookkeeperManager) { bookkeeperManager = new BookkeeperManager(); } return bookkeeperManager; }
protected override void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); SetContentView (Resource.Layout.AllEntries); bkManager = BookkeeperManager.GetInstance (); listViewAllEntries = FindViewById<ListView> (Resource.Id.listViewAllEntries); myAdapter = new MyAdapter (this, bkManager.getEntries ()); listViewAllEntries.Adapter = myAdapter; }
protected override void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); SetContentView (Resource.Layout.NewEntry); bkManager = BookkeeperManager.GetInstance (); buttonAddEntry = FindViewById<Button> (Resource.Id.buttonAddEntry); radioButtonIncome = FindViewById<RadioButton> (Resource.Id.radioButtonIncome); radioButtonExpences = FindViewById<RadioButton> (Resource.Id.radioButtonExpences); spinnerType = FindViewById<Spinner> (Resource.Id.spinnerType); spinnerTax = FindViewById<Spinner> (Resource.Id.spinnerTax); spinnerAccount = FindViewById<Spinner> (Resource.Id.spinnerAccount); editTextDate = FindViewById<EditText> (Resource.Id.editTextDate); editTextDesc = FindViewById<EditText> (Resource.Id.editTextDesc); editTextTotal = FindViewById<EditText> (Resource.Id.editTextTotal); adapterSpinnerTypeIncome = new ArrayAdapter (this, Android.Resource.Layout.SimpleSpinnerItem, bkManager.getIncomeAccounts()); adapterSpinnerTypeExpense = new ArrayAdapter (this, Android.Resource.Layout.SimpleSpinnerItem, bkManager.getExpenseAccounts ()); adapterSpinnerTypeMoney = new ArrayAdapter (this, Android.Resource.Layout.SimpleSpinnerItem, bkManager.getMoneyAccounts ()); adapterSpinnerTaxRates = new ArrayAdapter (this, Android.Resource.Layout.SimpleSpinnerItem, bkManager.getTaxRates()); spinnerWillNotShowToastWhenEnteringPage = 0; spinnerType.Adapter = adapterSpinnerTypeIncome; spinnerAccount.Adapter = adapterSpinnerTypeMoney; spinnerTax.Adapter = adapterSpinnerTaxRates; buttonAddEntry.Click += delegate { CreateEntry (); }; radioButtonIncome.Click += delegate { spinnerWillNotShowToastWhenEnteringPage = 2; PushedRadioGroup(); }; radioButtonExpences.Click += delegate { spinnerWillNotShowToastWhenEnteringPage = 2; PushedRadioGroup(); }; spinnerTax.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs> (SpinnerSelected); spinnerType.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs> (SpinnerSelected); spinnerAccount.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs> (SpinnerSelected); }