Esempio n. 1
0
        public void ActualizarListView()
        {
            _ListaAvisos = new List <AvisoRender>();

            if (Conectividad.IsConnected)
            {
                progressBar = new ProgressDialog(this);
                progressBar.SetCancelable(true);
                progressBar.SetMessage("Actualizando Datos ...");
                progressBar.SetProgressStyle(ProgressDialogStyle.Spinner);
                progressBar.Progress = 0;
                progressBar.Max      = 100;
                progressBar.Show();
                new Thread(new ThreadStart(delegate {
                    _ListaAvisos = new Database().ListaAvisosSQL();
                    mAdapter     = new AvisoAdapter(this, Resource.Layout.ListaAviso, _ListaAvisos);
                    RunOnUiThread(() =>
                    {
                        mListView.Adapter = mAdapter;
                        progressBar.Dismiss();
                    });
                })).Start();
            }
            else
            {
                Utilidades.MostrarMensaje(this, "No tiene conexión a internet.");
            }
        }
Esempio n. 2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Lista);

            mListView            = FindViewById <ListView>(Resource.Id.listView);
            mListView.ItemClick += MListView_ItemClick;
            //Cabeceras listado
            _txtAvisoCabecera       = FindViewById <TextView>(Resource.Id.txtAvisoCabecera);
            _txtEspecieCabecera     = FindViewById <TextView>(Resource.Id.txtEspecieCabecera);
            _txtAGCabecera          = FindViewById <TextView>(Resource.Id.txtAGCabecera);
            _txtFAvisoCabecera      = FindViewById <TextView>(Resource.Id.txtFAvisoCabecera);
            _txtPoblacionCabecera   = FindViewById <TextView>(Resource.Id.txtPoblacionCabecera);
            _txtNombreCabecera      = FindViewById <TextView>(Resource.Id.txtNombreCabecera);
            _txtExplotacionCabecera = FindViewById <TextView>(Resource.Id.txtExplotacionCabecera);
            _txtTfno1Cabecera       = FindViewById <TextView>(Resource.Id.txtTfno1Cabecera);
            //_txtTfno2Cabecera = FindViewById<TextView>(Resource.Id.txtTfno2Cabecera);
            //Metodos Cabeceras Listado
            _txtAvisoCabecera.Click       += _txtAvisoCabecera_Click;
            _txtEspecieCabecera.Click     += _txtEspecieCabecera_Click;
            _txtAGCabecera.Click          += _txtAGCabecera_Click;
            _txtFAvisoCabecera.Click      += _txtFAvisoCabecera_Click;
            _txtPoblacionCabecera.Click   += _txtPoblacionCabecera_Click;
            _txtNombreCabecera.Click      += _txtNombreCabecera_Click;
            _txtExplotacionCabecera.Click += _txtExplotacionCabecera_Click;
            _txtTfno1Cabecera.Click       += _txtTfno1Cabecera_Click;
            _ListaAvisos = new List <AvisoRender>();

            //if (Conectividad.IsConnected)
            //{
            progressBar = new ProgressDialog(this);
            progressBar.SetCancelable(true);
            progressBar.SetMessage("Actualizando Datos ...");
            progressBar.SetProgressStyle(ProgressDialogStyle.Spinner);
            progressBar.Progress = 0;
            progressBar.Max      = 100;
            progressBar.Show();
            new Thread(new ThreadStart(delegate
            {
                _ListaAvisos = new Database().ListaAvisosRecogidosSQL();
                mAdapter     = new AvisoAdapter(this, Resource.Layout.ListaAviso, _ListaAvisos);
                RunOnUiThread(() =>
                {
                    mListView.Adapter = mAdapter;
                    progressBar.Dismiss();
                });
            })).Start();
            //}
            //else
            //{
            //    AlertDialog.Builder d = new AlertDialog.Builder(this);
            //    d.SetMessage("No hay conexión con internet.");
            //    d.Show();

            //}
        }
Esempio n. 3
0
 protected override void OnRestart()
 {
     base.OnRestart();
     progressBar = new ProgressDialog(this);
     progressBar.SetCancelable(true);
     progressBar.SetMessage("Actualizando Datos ...");
     progressBar.SetProgressStyle(ProgressDialogStyle.Spinner);
     progressBar.Progress = 0;
     progressBar.Max      = 100;
     progressBar.Show();
     new Thread(new ThreadStart(delegate
     {
         _ListaAvisos = new Database().ListaAvisosSQL();
         mAdapter     = new AvisoAdapter(this, Resource.Layout.ListaAviso, _ListaAvisos);
         RunOnUiThread(() =>
         {
             mListView.Adapter = mAdapter;
             progressBar.Dismiss();
         });
     })).Start();
 }
Esempio n. 4
0
        private void _txtAvisoCabecera_Click(object sender, EventArgs e)
        {
            List <AvisoRender> AvisosFiltrados;

            if (!OrdenadoAviso)
            {
                AvisosFiltrados = (from Aviso in _ListaAvisos
                                   orderby Aviso.No
                                   select Aviso).ToList <AvisoRender>();
                mAdapter          = new AvisoAdapter(this, Resource.Layout.ListaAviso, AvisosFiltrados);
                mListView.Adapter = mAdapter;
            }
            else
            {
                AvisosFiltrados = (from Aviso in _ListaAvisos
                                   orderby Aviso.No descending
                                   select Aviso).ToList <AvisoRender>();
                mAdapter          = new AvisoAdapter(this, Resource.Layout.ListaAviso, AvisosFiltrados);
                mListView.Adapter = mAdapter;
            }
            OrdenadoAviso = !OrdenadoAviso;
        }