示例#1
0
        public void DoStartup()
        {
            SetContentView(Resource.Layout.activity_main);

            db = new DataBaseClass();

            Product newProduct = new Product();

            Magazin newMagazin = new Magazin();

            mRecyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView);
            mProducts     = db.getAllProducts();
            mProductsCopy = new List <Product>(); //lista copie pt filtrare
            mProductsCopy.AddRange(mProducts);

            mProductsCD = new List <Product>(); //lista copie pt stergere multipla
            mProductsCD.AddRange(mProducts);
            mMagazin = db.getAllMagazin();

            //create our layout manager
            mLayoutManager = new LinearLayoutManager(this);
            mRecyclerView.SetLayoutManager(mLayoutManager);
            mAdapter = new RecyclerAdapter(mProducts, mRecyclerView, db, this);
            mAdapter.CellClick_ButtonDelete += MAdapter_CellClick_ButtonDelete;
            mAdapter.CellClick_ButtonEdit   += MAdapter_CellClick_ButtonEdit;
            //  mAdapter = new RecyclerAdapter(mMagazin);
            mRecyclerView.SetAdapter(mAdapter);

            // MenuInflater.Inflate(Resource.Menu.menu_pop, menu);
            // base.OnCreateOptionsMenu(menu);
            Button btnInsertData = FindViewById <Button>(Resource.Id.btnInsertData);

            btnInsertData.Click += BtnInsertData_Click;

            database = new DataBaseClass();

            spinnerMagazine = FindViewById <Spinner>(Resource.Id.spinnerMagazine);
            arrayAdapter    = new ArrayAdapter <Magazin>(this, Resource.Layout.support_simple_spinner_dropdown_item);
            List <Magazin> magazine = MainActivity.database.GetMagazins();
            Magazin        magazin  = new Magazin();

            magazin.Name = "Magazine";
            arrayAdapter.Add(magazin);
            arrayAdapter.AddAll(magazine);
            arrayAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);

            spinnerMagazine.Adapter = arrayAdapter;

            spinnerMagazine.ItemSelected += SpinnerMagazine_ItemSelected;

            Button mMultipleDelete = FindViewById <Button>(Resource.Id.btnMultipleDelete);

            mMultipleDelete.Click += MMultipleDelete_Click;


            //Galerie-buton
            Button btnGallery = FindViewById <Button>(Resource.Id.btnGallery);

            btnGallery.Click += BtnGallery_Click;

            //Map-button
            Button btnMap = FindViewById <Button>(Resource.Id.btnMap);

            btnMap.Click += BtnMap_Click;


            Depozit newDepozit = new Depozit();

            mDepozit = db.getAllDepozite();

            Button btnDepozit = FindViewById <Button>(Resource.Id.btnDepozit);

            btnDepozit.Click += BtnDepozit_Click;

            Button btnValutaEur = FindViewById <Button>(Resource.Id.btnValutaEur);
            Button btnValutaUsd = FindViewById <Button>(Resource.Id.btnValutaUsd);

            try
            {
                ro.infovalutar.www.Curs curs = new ro.infovalutar.www.Curs();
                double valE = curs.GetValue(DateTime.Now, "EUR");
                double valU = curs.GetValue(DateTime.Now, "USD");
                btnValutaEur.Text   = "1 Euro=" + valE.ToString() + "Lei";
                btnValutaUsd.Text   = "1 USD=" + valU.ToString() + "Lei";
                btnValutaEur.Click += BtnValutaEur_Click;
                btnValutaUsd.Click += BtnValutaUsd_Click;
            }
            catch (System.Net.WebException)
            {
                btnValutaEur.Text = "Please ensure you are connected to the internet";
                btnValutaUsd.Text = "Please ensure you are connected to the internet";
            }
            catch (Exception ex)
            {
                btnValutaEur.Text = ex.Message;
                btnValutaUsd.Text = ex.Message;
            }


            Button btnMail = FindViewById <Button>(Resource.Id.btnMail);

            btnMail.Click += BtnMail_Click;

            Button btnMail2 = FindViewById <Button>(Resource.Id.btnMail2);

            btnMail2.Click += BtnMail2_Click;
        }
示例#2
0
 public static ProductFilter newInstance(JavaList <Product> currentList, RecyclerAdapter adapter)
 {
     ProductFilter.adapter           = adapter;
     ProductFilter.productFilterList = currentList;
     return(new ProductFilter());
 }