private void OnFormChanged(View v) { ThreadPool.QueueUserWorkItem(delegate { Console.WriteLine("Thread working in formchanged event!"); try { FormChanged?.Invoke(null, new XFormChangedEventArgs() { }); //handle group show/hide foreach (Groups g in FormGroups) { View groupView = MainFormLayout.FindViewWithTag(g.id); if (groupView != null) { Bindings binding = DLL.GetBindingByReference(g.reference); if (binding != null && binding.relevant != null) { var eval = XForm.Evaluate(binding.relevant); if (eval != null) { RunOnUiThread(() => { groupView.Visibility = (bool)eval ? ViewStates.Visible : ViewStates.Gone; }); } } } } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }); }
//this is public override View GetView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = LayoutInflater.From(parent.Context); View view = convertView; Bindings binding = DLL.GetBindingByReference(FormControls[position].reference); //what form of control it is switch ((ControlType)FormControls[position].type) { case ControlType.input: //the user puts something in //view = WidgetHelper.CreateInput(FormControls[position], binding, inflater, fActivity, this); break; case ControlType.output: Console.WriteLine("not yet"); view = new LinearLayout(parent.Context); view.SetBackgroundColor(Color.Red); view.SetMinimumHeight(25); break; case ControlType.select: //view = WidgetHelper.CreateSelect(FormControls[position], binding, inflater, fActivity, this); break; case ControlType.select1: //view = WidgetHelper.CreateSelectOne(FormControls[position], binding, inflater, fActivity, this); break; case ControlType.upload: Console.WriteLine("not yet"); view = new LinearLayout(parent.Context); view.SetBackgroundColor(Color.Blue); view.SetMinimumHeight(25); break; } ControlViews.Add(view); return(view); }