예제 #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);

            var GoTocartPageFloatingActionButton = FindViewById <FloatingActionButton>(Resource.Id.GoToCartPageButton);

            GoTocartPageFloatingActionButton.Click += GoToCartPage_Click;


            this.SearchView = FindViewById <SearchView>(Resource.Id.searchView);
            this.SearchView.QueryTextChange += SearchView_QueryTextChange;
            this.Products                    = ProductAPIController.GetProducts().Result;
            this.Adapter                     = new ProductsAdapter(this, this.Products, Resource.Layout.ProductAdapterItem);
            this.ProductsGridView            = FindViewById <GridView>(Resource.Id.ProductListView);
            this.ProductsGridView.ItemClick += ProductsGridView_ItemClick;
            this.FilterImageView             = FindViewById <ImageView>(Resource.Id.FilterImageView);
            this.FilterImageView.Click      += FilterImageView_Click;


            this.SortBySpiner               = FindViewById <Spinner>(Resource.Id.SortBySpiner);
            this.SortBySpiner.Adapter       = new ArrayAdapter(this, Android.Resource.Layout.SimpleExpandableListItem1, SearchByItems);
            this.SortBySpiner.ItemSelected += SortBySpiner_ItemSelected;



            this.ProductDescriptionActivityGenericTask = new Task <Intent>(() => new Intent(this, typeof(ProductDescriptionActivity)));
            this.ProductDescriptionActivityGenericTask.Start();
            this.CartActivityGenericTask = new Task <Intent>(() => new Intent(this, typeof(CartActivity)));
            this.CartActivityGenericTask.Start();
        }