protected async override void OnCreate(Bundle bundle)
        {
            try
            {
                base.OnCreate(bundle);
                SetContentView(Resource.Layout.MakeBookingSesh);

                ActionBar.SetHomeButtonEnabled(true);
                ActionBar.SetDisplayHomeAsUpEnabled(true);

                //progressDialog = ProgressDialog.Show(this, "", "Loading...");

                string WorkshopSetId = Intent.GetStringExtra("WorkshopSetId");
                _WorkshopSessions = await RESTClass.GetWorkshopSessions("?workshopSetId=" + WorkshopSetId);

                CreateExpendableListData();

                ExpandableListView elvExListBox = FindViewById <ExpandableListView> (Resource.Id.elvExListBox);
                elvExListBox.SetAdapter(new ExpandListSessionAdapter(this, dictGroup));

                elvExListBox.ChildClick += delegate(object sender, ExpandableListView.ChildClickEventArgs e) {
                    string           itmGroup = lstKeys [e.GroupPosition];
                    WorkshopSessions itmChild = dictGroup [itmGroup];
                };

                elvExListBox.GroupExpand += delegate(object sender, ExpandableListView.GroupExpandEventArgs e) {
                    if (lastExpandedPosition != -1 && e.GroupPosition != lastExpandedPosition)
                    {
                        elvExListBox.CollapseGroup(lastExpandedPosition);
                    }

                    lastExpandedPosition = e.GroupPosition;
                };

                //				Button btnViewDetails = FindViewById<Button>(Resource.Id.btnViewDetails);
                //				btnViewDetails.Click += delegate {
                //					StartActivity(new Intent(this, typeof(MakeBookingListActivity)));
                //				};
            }
            catch (Exception e)
            {
                ErrorHandling.LogError(e, this);
            }
            finally
            {
                //				progressDialog.Dismiss();
                //				progressDialog.Dispose ();
            }
        }
Exemple #2
0
        protected async override void OnCreate(Bundle bundle)
        {
            try
            {
                base.OnCreate(bundle);
                SetContentView(Resource.Layout.Search);
                List <string>       WorkshopList;
                List <WorkshopSets> WrkSets;
                EditText            txtsearch      = FindViewById <EditText>(Resource.Id.txtsearch);
                Spinner             searchWorkshop = FindViewById <Spinner>(Resource.Id.ddpworkshop);
                ExpandableListView  ddpSearchList  = FindViewById <ExpandableListView> (Resource.Id.ddpSearch);
                ImageButton         btnsearch      = FindViewById <ImageButton>(Resource.Id.imgsearch);
                ListView            workshoplist   = FindViewById <ListView>(Resource.Id.lvlWorkShops);
                string search;


                WorkshopList = new List <string>();
                WorkshopList.Add("Session");
                WorkshopList.Add("Workshop");
                WorkshopList.Add("Programs");
                ArrayAdapter <String> adapter = new ArrayAdapter <String>(this, Android.Resource.Layout.SimpleDropDownItem1Line, WorkshopList);
                searchWorkshop.Adapter = adapter;

                btnsearch.Click += async delegate
                {
                    try
                    {
                        search = txtsearch.Text;
                        string searchBy;
                        searchBy = searchWorkshop.SelectedItem.ToString();

                        progressDialog = ProgressDialog.Show(this, "", "Searching...");

                        if (searchBy == "Session")
                        {
                            //string WorkshopSetId = Intent.GetStringExtra(search);
                            _WorkshopSessions = await RESTClass.GetWorkshopSessions("?workshopSetId=" + search);

                            //_WorkshopSessions = await RESTClass.GetWorkshopSessions("?topic=" + WorkshopSetId + "&active=true&etc.");
                        }
                        else if (searchBy == "Workshop")
                        {
                            WrkSets = await RESTClass.GetWorkshopList("?active=true");

                            taskList             = new Adapters.SearchAdapter(this, WrkSets);
                            workshoplist.Adapter = taskList;
                            //	lvWorkShops.Adapter = taskList;


                            //			new AlertDialog.Builder (this)
                            //				.SetMessage(taskList.GetId(0))
                            //				.SetTitle("Application Error")
                            //				.Show();
                        }
                        else if (searchBy == "Programs")
                        {
                            //await Ge
                        }
                        dictGroup.Clear();
                        CreateExpendableListData();

                        ddpSearchList.SetAdapter(new ExpandListSessionAdapter(this, dictGroup));
                    }
                    catch (Exception e)
                    {
                        ErrorHandling.LogError(e, this);
                    }
                    finally
                    {
                        progressDialog.Dismiss();
                        progressDialog.Dispose();
                    }
                };

                ddpSearchList.ChildClick += delegate(object sender, ExpandableListView.ChildClickEventArgs e)
                {
                    try
                    {
                        string           itmGroup = lstKeys [e.GroupPosition];
                        WorkshopSessions itmChild = dictGroup [itmGroup];
                    }
                    catch (Exception Ex)
                    {
                        ErrorHandling.LogError(Ex, this);
                    }
                };

                ddpSearchList.GroupExpand += delegate(object sender, ExpandableListView.GroupExpandEventArgs e)
                {
                    if (lastExpandedPosition != -1 && e.GroupPosition != lastExpandedPosition)
                    {
                        ddpSearchList.CollapseGroup(lastExpandedPosition);
                    }

                    lastExpandedPosition = e.GroupPosition;
                };

                //				Button btnViewDetails = FindViewById<Button>(Resource.Id.btnViewDetails);
                //				btnViewDetails.Click += delegate {
                //					StartActivity(new Intent(this, typeof(MakeBookingListActivity)));
                //				} ;
            }
            catch (Exception e)
            {
                ErrorHandling.LogError(e, this);
            }
            finally
            {
                //				progressDialog.Dismiss();
                //				progressDialog.Dispose ();
            }
        }