private void GetDropdownList() { model = new List <StudentModel>(); try { BTProgressHUD.Show("Fetching List..."); Task.Factory.StartNew( // tasks allow you to use the lambda syntax to pass wor () => { model = WebService.GetStudentByParentId(); } /// ).ContinueWith( t => { if (model != null) { InvokeOnMainThread(() => { GetPickerUi.SetupPicker(txtDropdown, model); // manipulate UI controls }); //txtDropdown.Text = model[0].s_fname + " " + model[0].family_name.ToString(); //txtDropdown.UserInteractionEnabled = true; } else { } BTProgressHUD.Dismiss(); }, TaskScheduler.FromCurrentSynchronizationContext() ); } catch (Exception ex) { } finally { } }
public override void ViewDidLoad() { base.ViewDidLoad(); GetDropdownList(); // Keyboard popup NSNotificationCenter.DefaultCenter.AddObserver (UIKeyboard.DidShowNotification, KeyBoardUpNotification); // Keyboard Down NSNotificationCenter.DefaultCenter.AddObserver (UIKeyboard.WillHideNotification, KeyBoardDownNotification); //model = WebService.GetStudentByParentId(); GetPickerUi.SetupPicker(txtDropdown, model); PrepareUI(); //To add calendar calendar = new SlideCalendar(new CoreGraphics.CGPoint(0, 20), DateTime.Now, new DateTime(1984, 8, 15), new DateTime(2020, 8, 15)); calendar.OnDaySelected += Calendar_OnDaySelected; uiviewCalendar.AddSubview(calendar); calendar.NextMonth += Calendar_NextMonth; calendar.PreviousMonth += Calendar_PreviousMonth; imgBack.AddGestureRecognizer(new UITapGestureRecognizer(ro => { this.DismissModalViewController(false); })); txtReason.ShouldReturn += (textField) => { textField.ResignFirstResponder(); return(true); }; }