Exemple #1
0
        public void  BtnNewClick()
        {
            try
            {
                // Test if the controls are filled 
                if (GetControlReferences () == false)
                    return ;

                var dlg = new TransactionDialog(this._mainActivity,this._stateClass._person,BusinessLayer.Bestellung.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 Bestellungen to reflect the changes (project and sum of the transactions)                    
                        this._bestellungen = await BusinessLayer.Bestellung.GetBestellungenAsync(_stateClass._person.ID, Utilities.GetCurrentLanguage(this._mainActivity),MainActivity.User);
                        _list = _mainActivity.FindViewById<ListView> (Resource.Id.AuftraegeListview);
                        _adapter = new BestellungViewAdapter (_mainActivity, _bestellungen);
                        _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.Enabled = false;
            _list.Clickable = false;

            // show the transaction with all the positions 
            var dlg = new TransactionDialog(_activity,_stateFragment._stateClass._person,_stateFragment._bestellungen[args.Position], permission.Update);
            dlg.Show();
            dlg.DismissEvent+= async  (object sen, EventArgs e) => {
                try
                {
                    // look if in transaction Dialog any changes has been made
                    if (dlg.bChanged)
                    {
                        // update the main listview of Bestellung to reflect the changes (project and sum of the transactions)                    
                        this._stateFragment._bestellungen = await BusinessLayer.Bestellung.GetBestellungenAsync(_stateFragment._stateClass._person.ID, Utilities.GetCurrentLanguage(_activity),MainActivity.User);
                        _list = _activity.FindViewById<ListView> (Resource.Id.AuftraegeListview);
                        _adapter = new BestellungViewAdapter (_activity, this._stateFragment._bestellungen);
                        _list.Adapter = _adapter;
                    }
                    // enable again the list
                    _list.Clickable = true;
                    _list.Enabled = true;
                }
                catch(Exception ex)
                {
                    DataAccessLayer.ExceptionWriter.WriteLogFile(ex);
                }
            };


        }
Exemple #3
0
        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
            _bestellungen = await BusinessLayer.Bestellung.GetBestellungenAsync ( _stateClass._person.ID,Utilities.GetCurrentLanguage(_mainActivity ),MainActivity.User );
            _list = _mainActivity.FindViewById<ListView> (Resource.Id.AuftraegeListview);
            _adapter = new BestellungViewAdapter (_mainActivity, _bestellungen);
            _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.AuftraegeListview);
            _activity.FindViewById<TextView>(Resource.Id.tvAuftrag).Text = _activity.Resources.GetString(Resource.String.Bestellungen_);

            _adapter = new BestellungViewAdapter (_activity, _stateFragment._bestellungen);
            _list.Adapter = _adapter;

            _list.ItemClick += ListItemClick;
        }