Example #1
0
        private void _pay_Click(object sender, EventArgs e)
        {
            AlertDialog.Builder alert = new AlertDialog.Builder(Activity);
            alert.SetTitle("€" + _historyDb.GetBalance(MainActivity.UserName) + " " + GetString(Resource.String.AlertTitlePay));
            alert.SetMessage(GetString(Resource.String.AlertMessagePay));
            alert.SetPositiveButton(GetString(Resource.String.ButtonPositive), (senderAlert, args) => {
                Toast.MakeText(Activity, GetString(Resource.String.MessagePositivePay), ToastLength.Short).Show();
                _historyDb.PayCoffee(MainActivity.UserName);
                GetDatabaseEntires();
                _adapterL.NotifyDataSetChanged();
                _adapterL          = new MyArrayAdapter(Context, _activity, _coffeeNames, _time, _cost, _isPayed);
                _listViewL.Adapter = _adapterL;
                _currentSum.Text   = GetString(Resource.String.CurrentSum) + _historyDb.GetBalance(MainActivity.UserName);
            });

            alert.SetNegativeButton(GetString(Resource.String.ButtonNegative), (senderAlert, args) => {
                Toast.MakeText(Activity, GetString(Resource.String.MessageNegativePay), ToastLength.Short).Show();
            });
            alert.Show();
        }
Example #2
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);

            var view = inflater.Inflate(Resource.Layout.CostOverview, container, false);


            //Setup Actionbar
            _activity = (AppCompatActivity)Activity;
            _activity.SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            _activity.SupportActionBar.SetHomeButtonEnabled(true);
            _activity.SupportActionBar.Title = GetString(Resource.String.CostOverviewDialog);
            _activity.SupportActionBar.SetDisplayUseLogoEnabled(false);

            //Setup PayButton
            _pay        = view.FindViewById <TextView>(Resource.Id.textOptionPay);
            _pay.Text   = GetString(Resource.String.Pay);
            _pay.Click += _pay_Click;

            //Load DB
            _historyDb = new HistoryDb();
            _historyDb.CreateDataBase();

            //Get Account Balance
            _currentSum      = view.FindViewById <TextView>(Resource.Id.textCurrentSum);
            _currentSum.Text = GetString(Resource.String.CurrentSum) + _historyDb.GetBalance(MainActivity.UserName);

            //Get Name and Cost
            GetDatabaseEntires();

            //Setup ListViews With Adapter
            _adapterL          = new MyArrayAdapter(Context, _activity, _coffeeNames, _time, _cost, _isPayed);
            _listViewL         = view.FindViewById <ListView>(Resource.Id.listViewL);
            _listViewL.Adapter = _adapterL;

            return(view);
        }