public UIView GetView(OutputFieldMetadata outputField, object value, MyFormHandler myFormHandler, FormMetadata formMetadata, List <FormInputManager> inputsManager, int yAxis) { var formLink = value.CastTObject <FormLink>(); var size = new CGSize(UIScreen.MainScreen.Bounds.Width - 40, 30); this.OutputView = new UITextView { Text = outputField.Label + ": " + formLink.Label, Frame = new CGRect(new CGPoint(20, yAxis), size), TextColor = UIColor.Blue }; var gesture = new UITapGestureRecognizer(); gesture.AddTarget(() => { var metadata = myFormHandler.GetFormMetadataAsync(formLink.Form); myFormHandler.FormWrapper.UpdateView(myFormHandler, new FormParameter(metadata, formLink.InputFieldValues)); }); this.OutputView.AddGestureRecognizer(gesture); return(this.OutputView); }
public UIView GetView(OutputFieldMetadata outputField, object value, MyFormHandler myFormHandler, FormMetadata formMetadata, List <FormInputManager> inputsManager, int yAxis) { this.OutputView = new UIView(); var labelSize = new CGSize(UIScreen.MainScreen.Bounds.Width - 40, 30); this.OutputView.Frame = new CGRect(new CGPoint(20, yAxis), labelSize); var tabstrip = value.CastTObject <Tabstrip>(); var currentTab = tabstrip.Tabs.SingleOrDefault(a => a.Form == tabstrip.CurrentTab); var x = 0; var width = UIScreen.MainScreen.Bounds.Width - 60; foreach (var tab in tabstrip.Tabs) { var size = new CGSize(width / tabstrip.Tabs.Count, 30); if (tab != null) { var tv = new UITextView { Text = tab.Label, Frame = new CGRect(new CGPoint(x, 0), size), TextColor = UIColor.LightGray }; nfloat borderWidth = 2; var border = new CALayer { BorderColor = UIColor.LightGray.CGColor, Frame = new CGRect(0, tv.Frame.Size.Height - borderWidth, tv.Frame.Size.Width - 20, tv.Frame.Size.Height), BorderWidth = width }; x += (int)tv.Frame.Width; UITapGestureRecognizer gesture = new UITapGestureRecognizer(); gesture.AddTarget(() => { var metadata = myFormHandler.GetFormMetadataAsync(tab.Form); myFormHandler.FormWrapper.UpdateView(myFormHandler, new FormParameter(metadata, tab.InputFieldValues)); }); tv.AddGestureRecognizer(gesture); if (tab == currentTab) { tv.TextColor = UIColor.Black; border.BorderColor = UIColor.Black.CGColor; } tv.Layer.AddSublayer(border); tv.Layer.MasksToBounds = true; this.OutputView.AddSubview(tv); } } return(this.OutputView); }
public UIButton InitializeActionButton(FormLink formLink, MyFormHandler myFormHandler, int yAxis) { var button = new UIButton(); button.SetTitle(formLink.Label, UIControlState.Normal); button.BackgroundColor = UIColor.LightGray; var btnSize = new CGSize(UIScreen.MainScreen.Bounds.Width - 60, 40); button.Frame = new CGRect(new CGPoint(0, yAxis), btnSize); button.TouchUpInside += (sender, args) => { var formMetadata = myFormHandler.GetFormMetadataAsync(formLink.Form); var action = formLink.Action ?? FormLinkActions.OpenModal; myFormHandler.FormWrapper.UpdateView(myFormHandler, new FormParameter(formMetadata, formLink.InputFieldValues), action); }; return(button); }