Пример #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            _pd =	ProgressDialog.Show (this, "Please wait...", "Querying Azure!");

            ThreadPool.QueueUserWorkItem (delegate {

                var root = BuildRoot (kGetAllUrl);

                RunOnUiThread (delegate {
                    var da = new DialogAdapter(this, root);
                    var lv = new ListView(this) {Adapter = da};

                    SetContentView(lv);
                    _pd.Dismiss ();
                    _pd.Dispose ();
                });

            });
        }
Пример #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 ();
			}
		}