static Entry CreateEntry <T>(bool shouldUseEffects, ReturnType returnType, string placeholder, string automationId, Expression <Func <T, object> > textPropertyBindingSource) where T : BaseViewModel { Entry entry; switch (shouldUseEffects) { case true: entry = new Entry(); ReturnTypeEffect.SetReturnType(entry, returnType); break; case false: entry = new CustomReturnEntry { ReturnType = returnType, }; break; default: throw new Exception("Invalid Type"); } entry.Placeholder = placeholder; entry.AutomationId = automationId; entry.SetBinding <T>(Entry.TextProperty, textPropertyBindingSource); return(entry); }
public static View CreatePickEntryReturnTypePaageLayout(bool shouldUseEffects) { Entry customizableEntry; switch (shouldUseEffects) { case true: customizableEntry = new Entry(); ReturnTypeEffect.SetReturnType(customizableEntry, ReturnType.Go); customizableEntry.SetBinding <PickEntryReturnTypeViewModel>(ReturnTypeEffect.ReturnTypeProperty, vm => vm.EntryReturnType); break; case false: customizableEntry = new CustomReturnEntry(); customizableEntry.SetBinding <PickEntryReturnTypeViewModel>(CustomReturnEntry.ReturnTypeProperty, vm => vm.EntryReturnType); break; default: throw new Exception("Invalid Type"); } customizableEntry.AutomationId = AutomationIdConstants.CustomizableEntryAutomationId; customizableEntry.SetBinding <PickEntryReturnTypeViewModel>(Entry.PlaceholderProperty, vm => vm.EntryPlaceHolderText); var entryReturnTypePicker = new Picker { AutomationId = AutomationIdConstants.EntryReturnTypePickerAutomationId }; entryReturnTypePicker.SetBinding <PickEntryReturnTypeViewModel>(Picker.ItemsSourceProperty, vm => vm.EntryReturnTypePickerSource); entryReturnTypePicker.SetBinding <PickEntryReturnTypeViewModel>(Picker.SelectedItemProperty, vm => vm.PickerSelection); return(new StackLayout { Children = { customizableEntry, entryReturnTypePicker } }); }