public void BtnNewClick() { try { // Test if the controls are filled if (GetControlReferences () == false) return ; var dlg = new TransactionDialog(this._mainActivity,this._stateClass._person,BusinessLayer.Angebot.Create(), permission.Create); dlg.Show(); dlg.DismissEvent+= async (object sen, EventArgs e) => { // look if in transaction Dialog any changes has been made if (dlg.bChanged) { // update the main listview of Angebote to reflect the changes (project and sum of the transactions) this._angebote = await BusinessLayer.Angebot.GetAngeboteAsync(_stateClass._person.ID, Utilities.GetCurrentLanguage(this._mainActivity),MainActivity.User); _list = _mainActivity.FindViewById<ListView> (Resource.Id.AngeboteListview); _adapter = new AngebotViewAdapter (_mainActivity, _angebote); _list.Adapter = _adapter; } }; // Configure the buttons if (MainActivity.User.NetworkStatus == DataAccessLayer.NetworkState.Disconnected) ConfigureButtons(false, false, false, false, false); else ConfigureButtons(permission.Create, false, false, false, permission.UpDownload); return ; } catch(Exception ex) { DataAccessLayer.ExceptionWriter.WriteLogFile(ex); } }
void ListItemClick (object sender, AdapterView.ItemClickEventArgs args) { // disable the list outside, so that not another dlg is opend _list.Clickable = false; _list.Enabled = false; // show the transaction with all the positions var dlg = new TransactionDialog(_activity,_stateFragment._stateClass._person,_stateFragment._angebote[args.Position], permission.Update); dlg.Show(); dlg.DismissEvent+= async (object sen, EventArgs e) => { // look if in transaction Dialog any changes has been made if (dlg.bChanged) { // update the main listview of Angebote to reflect the changes (project and sum of the transactions) this._stateFragment._angebote = await BusinessLayer.Angebot.GetAngeboteAsync(_stateFragment._stateClass._person.ID, Utilities.GetCurrentLanguage(_activity),MainActivity.User); _list = _activity.FindViewById<ListView> (Resource.Id.AngeboteListview); _adapter = new AngebotViewAdapter (_activity, this._stateFragment._angebote); _list.Adapter = _adapter; } // enable again the list _list.Clickable = true; _list.Enabled = true; }; }
async public Task ListViewClickAsync() { // Test if the controls are filled if (GetControlReferences () == false) return ; // Disable the controls DisableControls (); // Specific Controls // Test if the controls are filled if (GetControlReferences () == false) return ; // Refill the List // Build an adapter // Connect it to the lovely Listview _angebote = await BusinessLayer.Angebot.GetAngeboteAsync ( _stateClass._person.ID,Utilities.GetCurrentLanguage(_mainActivity ),MainActivity.User ); _list = _mainActivity.FindViewById<ListView> (Resource.Id.AngeboteListview); _adapter = new AngebotViewAdapter (_mainActivity, _angebote); _list.Adapter = _adapter; // Configure the buttons if (MainActivity.User.NetworkStatus == DataAccessLayer.NetworkState.Disconnected) ConfigureButtons(false, false, false, false, false); else ConfigureButtons(permission.Create, false, false, false, permission.UpDownload); return ; }
public override void OnStart () { base.OnStart (); _list = _activity.FindViewById<ListView> (Resource.Id.AngeboteListview); _activity.FindViewById<TextView>(Resource.Id.tvAngebot).Text = _activity.Resources.GetString(Resource.String.Angebote); _adapter = new AngebotViewAdapter (_activity, _stateFragment._angebote); _list.Adapter = _adapter; _list.ItemClick += ListItemClick; }