public FormIntentCode () { this.Title = "Form Intent"; var table = new TableView () { Intent = TableIntent.Form }; var root = new TableRoot (); var section1 = new TableSection () {Title = "First Section"}; var section2 = new TableSection () {Title = "Second Section"}; var text = new TextCell { Text = "TextCell", Detail = "TextCell Detail" }; var entry = new EntryCell { Text = "EntryCell Text", Label = "Entry Label" }; var switchc = new SwitchCell { Text = "SwitchCell Text" }; var image = new ImageCell { Text = "ImageCell Text", Detail = "ImageCell Detail", ImageSource = "XamarinLogo.png" }; section1.Add (text); section1.Add (entry); section1.Add (switchc); section1.Add (image); section2.Add (text); section2.Add (entry); section2.Add (switchc); section2.Add (image); table.Root = root; root.Add (section1); root.Add (section2); Content = table; }
public SettingsPage(IFileRepository fileRepository, IExternalBrowserService externalBrowserService, ApplicationEvents applicationEvents) { Title = "Settings"; _fileRepository = fileRepository; _applicationEvents = applicationEvents; InitializeStorageSettings(fileRepository); InitializeDropboxSettings(externalBrowserService, applicationEvents); var autoSyncValue = new EntryCell { Label = "Interval in minutes", IsEnabled = PersistedState.SyncInterval > 0, Text = PersistedState.SyncInterval > 0 ? PersistedState.SyncInterval.ToString() : string.Empty }; var autoSyncSwitch = new SwitchCell { Text = "Auto sync", On = PersistedState.SyncInterval > 0 }; autoSyncSwitch.OnChanged += (sender, args) => { if (args.Value) { autoSyncValue.Text = "10"; autoSyncValue.IsEnabled = true; SetSyncInterval(10); } else { autoSyncValue.Text = string.Empty; autoSyncValue.IsEnabled = false; SetSyncInterval(0); } }; autoSyncValue.Completed += (sender, args) => { int value; SetSyncInterval(int.TryParse(autoSyncValue.Text, out value) ? value : 0); }; Content = new TableView { Intent = TableIntent.Settings, Root = new TableRoot { new TableSection("Storage") { _customStorageSwitch, _customStorageDirectoryEntry }, new TableSection("Cloud sync") { autoSyncSwitch, autoSyncValue, _dropboxSwitch } } }; }
public CreatePage() { var btnCreate = new Button { Text = "Create" }; var imgCode = new Image(); var txtBarcode = new EntryCell { Label = "Bar Code" }; btnCreate.Clicked += (sender, e) => imgCode.Source = ImageSource.FromStream(() => BarCodes.Instance.Create(new BarCodeCreateConfiguration { Format = BarCodeFormat.QR_CODE, BarCode = txtBarcode.Text.Trim(), Width = 200, Height = 200 } )); this.Content = new StackLayout { Children = { btnCreate, imgCode, new TableView(new TableRoot { new TableSection { txtBarcode } }) } }; }
internal static Cell IntCell(PropertyInfo property, IContact context, Page parent = null) { var label = CreateLabel(property); var entryCell = new EntryCell(); entryCell.SetValue(EntryCell.LabelProperty, label); entryCell.LabelColor = Color.FromHex("999999"); entryCell.SetBinding(EntryCell.TextProperty, new Binding(property.Name, mode: BindingMode.TwoWay, converter: DefaultConverter)); entryCell.BindingContext = context; return entryCell; }
public NewEntryPage () { Title = "New Entry"; // Form fields var title = new EntryCell { Label = "Titel" }; title.SetBinding (EntryCell.TextProperty, "Title", BindingMode.TwoWay); var latitude = new EntryCell { Label = "Latitude", Keyboard = Keyboard.Numeric }; latitude.SetBinding (EntryCell.TextProperty, "Latitude", BindingMode.TwoWay); var longitude = new EntryCell {Label = "Longitude", Keyboard = Keyboard.Numeric }; longitude.SetBinding (EntryCell.TextProperty, "Longitude", BindingMode.TwoWay); var date = new DatePickerEntryCell {Label = "Date"}; date.SetBinding (DatePickerEntryCell.DateProperty, "Date",BindingMode.TwoWay); var rating = new EntryCell { Label = "Rating", Keyboard = Keyboard.Numeric }; rating.SetBinding (EntryCell.TextProperty, "Rating", BindingMode.TwoWay); var notes = new EntryCell { Label = "Notes" }; notes.SetBinding (EntryCell.TextProperty, "Notes", BindingMode.TwoWay); // Form var entryForm = new TableView { Intent = TableIntent.Form, Root = new TableRoot { new TableSection () { title, latitude, longitude, date, rating, notes } } }; Content = entryForm; var save = new ToolbarItem { Text = "Save" }; save.SetBinding (ToolbarItem.CommandProperty, "SaveCommand"); ToolbarItems.Add (save); }
protected override Cell CreateDefault(object item) { var pi = (PropertyInfo)item; if (pi.PropertyType == typeof(double)) { Binding b = new Binding() { Source = Target, Path = pi.Name }; var cell = new EntryCell() { Label = pi.Name }; cell.SetBinding(EntryCell.TextProperty, b); return cell; //return CreateSpinnerCell(pi); } return base.CreateDefault(item); }
public CheckDetailsPage(Check check) { EntryCell payee, amount; SwitchCell cleared; Title = "Details"; this.Content = new TableView { Intent = TableIntent.Form, Root = new TableRoot() { new TableSection("Check #" + check.Id) { new TextCell { Text = "Date", Detail = check.Date.ToString("D"), }, (payee = new EntryCell { Label = "Payee", Placeholder = "Enter Payee", Text = check.Payee, Keyboard = Keyboard.Default, }), (amount = new EntryCell { Label = "Amount", Placeholder = "Enter Dollar Amount", Text = check.Amount.ToString("N2"), Keyboard = Keyboard.Numeric, }), (cleared = new SwitchCell { Text = "Cleared?", On = check.Cleared, }), }, } }; // Push updates back to models. payee.Completed += (sender, e) => check.Payee = payee.Text; amount.Completed += (sender, e) => check.Amount = double.Parse(amount.Text, NumberStyles.Currency); cleared.OnChanged += (sender, e) => check.Cleared = cleared.On; }
public EntryCellDemoCode () { this.Title = "EntryCell"; var table = new TableView (); var root = new TableRoot (); var section1 = new TableSection () {Title="Keyboards" }; var section2 = new TableSection () { Title = "States & Colors" }; var entryDefault = new EntryCell { Text = "Default", Placeholder="default" }; var entryChat = new EntryCell { Text = "Chat", Placeholder="omg brb ttyl gtg lol", Keyboard=Keyboard.Chat }; var entryEmail = new EntryCell { Text = "Email", Placeholder="*****@*****.**", Keyboard=Keyboard.Email }; var entryNumeric = new EntryCell { Text = "Numeric", Placeholder="55", Keyboard=Keyboard.Numeric }; var entryTelephone = new EntryCell { Text = "Telephone", Placeholder="+1 012 345 6789", Keyboard=Keyboard.Telephone }; var entryText = new EntryCell { Text = "Text", Placeholder="text", Keyboard=Keyboard.Text }; var entryUrl = new EntryCell { Text = "Url", Placeholder="http://developer.xamarin.com", Keyboard=Keyboard.Url }; var entryColorful = new EntryCell { Text = "Colorful", Placeholder = "text", LabelColor = Color.Red }; var entryColorfulDisabled = new EntryCell { Text = "Colorful + Disabled", Placeholder = "text", IsEnabled = false, LabelColor = Color.Red }; var entryDisabled = new EntryCell{ Text = "Disabled", Placeholder = "text", IsEnabled = false }; section1.Add (entryDefault); section1.Add (entryChat); section1.Add (entryEmail); section1.Add (entryNumeric); section1.Add (entryTelephone); section1.Add (entryText); section1.Add (entryUrl); section2.Add (entryColorful); section2.Add (entryDisabled); section2.Add (entryColorfulDisabled); Content = table; }
private void AddStringParam(OrderParameterType paramType, OrderParameter param) { EntryCell entry = new EntryCell { Label = paramType.Name, Text = param.Value }; entry.PropertyChanged += (object sender, System.ComponentModel.PropertyChangedEventArgs e) => { if(e.PropertyName == "Text"){ param.Value = entry.Text; } }; LastSection.Add (entry); }
public SettingsPage() { Title = Catalog.GetString("Settings"); BackgroundColor = App.Colors.Background; // Save for later use // Do this, because color could change while handling with settings :) textColor = App.Colors.Text; backgroundColor = App.Colors.Background; NavigationPage.SetTitleIcon(this, "HomeIcon.png"); NavigationPage.SetBackButtonTitle(this, string.Empty); var cellTheme = new MultiCell { Text = Catalog.GetString("Theme"), // Detail = Catalog.GetString("Theme of display"), Items = new string[] { Catalog.GetString("Light"), Catalog.GetString("Dark"), }, Key = Settings.DisplayThemeKey, DefaultValue = (int)0, }; var sectionTheme = new TableSection(Catalog.GetString("Appearance")) { cellTheme, }; var cellTextAlignment = new MultiCell { Text = Catalog.GetString("Alignment"), // Detail = Catalog.GetString("Alignment of text"), Items = new string[] { Catalog.GetString("Left"), Catalog.GetString("Center"), Catalog.GetString("Right"), }, Key = Settings.TextAlignmentKey, DefaultValue = (int)Settings.DefaultTextAlignment, }; var cellTextSize = new EntryCell { Label = Catalog.GetString("Size"), LabelColor = App.Colors.Text, Keyboard = Keyboard.Numeric, Text = Settings.Current.GetValueOrDefault<int>(Settings.TextSizeKey, Settings.DefaultFontSize).ToString(), XAlign = TextAlignment.End, }; cellTextSize.Completed += (object sender, EventArgs e) => { int value; if (int.TryParse(((EntryCell)sender).Text, out value)) { Settings.Current.AddOrUpdateValue<int>(Settings.TextSizeKey, value); } }; cellTextSize.PropertyChanged += (object sender, System.ComponentModel.PropertyChangedEventArgs e) => { if (e.PropertyName == "Text") { int value; if (int.TryParse(((EntryCell)sender).Text, out value)) { Settings.Current.AddOrUpdateValue<int>(Settings.TextSizeKey, value); } } }; var sectionText = new TableSection(Catalog.GetString("Text")) { cellTextAlignment, cellTextSize, }; var cellImageAlignment = new MultiCell { Text = Catalog.GetString("Alignment"), // Detail = Catalog.GetString("Alignment of images"), Items = new string[] { Catalog.GetString("Left"), Catalog.GetString("Center"), Catalog.GetString("Right"), }, Key = Settings.ImageAlignmentKey, DefaultValue = (int)Settings.DefaultImageAlignment, }; var cellImageResize = new MultiCell { Text = Catalog.GetString("Resizing"), // Detail = Catalog.GetString("Resizing of images"), Items = new string[] { Catalog.GetString("Don't resize"), Catalog.GetString("Shrink only"), Catalog.GetString("Resize to screen width"), Catalog.GetString("Resize to max. half height"), }, ShortItems = new string[] { Catalog.GetString("Don't resize"), Catalog.GetString("Shrink only"), Catalog.GetString("Screen width"), Catalog.GetString("Max. half height"), }, Key = Settings.ImageResizeKey, DefaultValue = (int)Settings.DefaultImageResize, }; var sectionImages = new TableSection(Catalog.GetString("Images")) { cellImageAlignment, cellImageResize, }; var cellFeedbackSound = new SwitchCell { Text = Catalog.GetString("Sound"), On = Settings.Current.GetValueOrDefault<bool>(Settings.FeedbackSoundKey, false), }; cellFeedbackSound.OnChanged += (object sender, ToggledEventArgs e) => Settings.Current.AddOrUpdateValue<bool>(Settings.FeedbackSoundKey, e.Value); var cellFeedbackVibration = new SwitchCell { Text = Catalog.GetString("Vibration"), On = Settings.Current.GetValueOrDefault<bool>(Settings.FeedbackVibrationKey, false), }; cellFeedbackVibration.OnChanged += (object sender, ToggledEventArgs e) => Settings.Current.AddOrUpdateValue<bool>(Settings.FeedbackVibrationKey, e.Value); var sectionFeedback = new TableSection(Catalog.GetString("Feedback")) { cellFeedbackSound, cellFeedbackVibration, }; var cellUnitDegrees = new MultiCell { Text = Catalog.GetString("Degrees"), // Detail = Catalog.GetString("Resizing of images"), Items = new string[] { Catalog.GetString("Decimal degrees (9.07538°)"), Catalog.GetString("Decimal minutes (9° 04.523')"), Catalog.GetString("Decimal seconds (9° 04' 31.38\")"), }, ShortItems = new string[] { Catalog.GetString("Decimal degrees"), Catalog.GetString("Decimal minutes"), Catalog.GetString("Decimal seconds"), }, Key = Settings.FormatCoordinatesKey, DefaultValue = (int)Settings.DefaultFormatCoordinates, }; var cellUnitAltitude = new MultiCell { Text = Catalog.GetString("Altitude"), // Detail = Catalog.GetString("Resizing of images"), Items = new string[] { Catalog.GetString("Meter"), Catalog.GetString("Feet"), }, Key = Settings.UnitAltitudeKey, DefaultValue = (int)Settings.DefaultUnitAltitude, }; var cellUnitLength = new MultiCell { Text = Catalog.GetString("Length"), // Detail = Catalog.GetString("Resizing of images"), Items = new string[] { Catalog.GetString("Meter"), Catalog.GetString("Feet"), }, Key = Settings.UnitLengthKey, DefaultValue = (int)Settings.DefaultUnitLength, }; var sectionUnits = new TableSection(Catalog.GetString("Units")) { cellUnitDegrees, cellUnitAltitude, cellUnitLength, }; var languages = new string[] { string.Empty, "en", "fi", "fr", "de" }; var cellLanguage = new MultiCell { Text = Catalog.GetString("Language"), // Detail = Catalog.GetString("Resizing of images"), Items = new string[] { Catalog.GetString("Default"), Catalog.GetString("English"), Catalog.GetString("Finnish"), Catalog.GetString("French"), Catalog.GetString("German"), }, Values = languages, Key = Settings.LanguageKey, DefaultValue = Array.IndexOf(languages, Settings.LanguageKey) < 0 ? 0 : Array.IndexOf(languages, Settings.LanguageKey), }; var sectionLanguage = new TableSection(Catalog.GetString("Language")) { cellLanguage, }; #if __ANDROID__ cellPath = new TextCell { Text = Catalog.GetString("Path for cartridges"), TextColor = App.Colors.Text, Detail = Settings.Current.GetValueOrDefault<string>(Settings.CartridgePathKey, null), DetailColor = Color.Gray, }; cellPath.Command = new Command((sender) => App.Navigation.Navigation.PushAsync(new FolderSelectionPage(Settings.Current.GetValueOrDefault<string>(Settings.CartridgePathKey, null), () => { cellPath.Detail = Settings.Current.GetValueOrDefault<string>(Settings.CartridgePathKey, null); }, textColor, backgroundColor))); var sectionPath = new TableSection(Catalog.GetString("Path")) { cellPath, }; #endif var tableRoot = new TableRoot(Catalog.GetString("Settings")) { sectionTheme, sectionText, sectionImages, sectionFeedback, sectionUnits, sectionLanguage, #if __ANDROID__ sectionPath, #endif }; var tableView = new TableView() { BackgroundColor = App.Colors.Background, Intent = TableIntent.Settings, Root = tableRoot, HasUnevenRows = true, }; Content = tableView; }
private void SetupActionCells(){ // Set up switch cells autoSessionManagementCell = new SwitchCell { Text = "Auto session management", On = true , }; autoSessionManagementCell.OnChanged += (sender, ea) => { ApplicationInsights.SetAutoSessionManagementDisabled(!autoSessionManagementCell.On); }; autoPageViewsCell = new SwitchCell { Text = "Auto page view tracking", On = true , }; autoPageViewsCell.OnChanged += (sender, ea) => { ApplicationInsights.SetAutoPageViewTrackingDisabled(!autoPageViewsCell.On); }; // TODO: also update ApplicationInsights config if input field lost focus serverURLCell = new EntryCell(){ Label = "Server URL", Placeholder = "Custom server URL" }; serverURLCell.Completed += (sender, ea) => { ApplicationInsights.SetServerUrl(serverURLCell.Text); }; userIDCell = new EntryCell(){ Label = "User ID", Placeholder = "Custom user ID" }; userIDCell.Completed += (sender, ea) => { ApplicationInsights.SetUserId(userIDCell.Text); }; }
public static FluentEntryCell EntryCell(EntryCell instance = null) { return new FluentEntryCell (instance); }
public static EntryCellEvents Events(this EntryCell This) { return(new EntryCellEvents(This)); }
private void AddInfoParam(OrderParameterType paramType, OrderParameter param) { if (paramType.InfoType == 0) { AddIntegerParam (paramType, param); return; } string displayValue = string.IsNullOrWhiteSpace (param.DisplayValue) ? "Select " + paramType.Name : param.DisplayValue; Picker infoPicker = new Picker { Title = displayValue, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, BackgroundColor = Color.Silver }; EntryCell entry = new EntryCell { Text = param.Value, Label = paramType.Name }; if (string.IsNullOrWhiteSpace (param.Value)) { entry.Placeholder = paramType.DataType.ToString(); } if (paramType.DataType != OrderType.DataTypes.String) { entry.Keyboard = Keyboard.Numeric; } // entry.Completed += (sender, e) => { // InfoEntryTextChanged(entry,paramType,param,infoPicker); // }; entry.PropertyChanged += (object sender, System.ComponentModel.PropertyChangedEventArgs e) => { if(e.PropertyName == "Text"){ InfoEntryTextChanged(entry,paramType,param,infoPicker); } }; LastSection.Add (entry); LastSection.Add (new ViewCell { View = infoPicker }); if (infoData.ContainsKey (paramType.InfoType)) { Task.Factory.StartNew (() => { Dictionary<string,InfoData> data = infoData [paramType.InfoType]; if (data.Count > 0) { int i = 0; foreach (string value in data.Keys) { infoPicker.Items.Add (value.ToString()); if (param.Value != null && param.Value == data[value].ToString()) { Device.BeginInvokeOnMainThread(() => { infoPicker.SelectedIndex = i; }); } i += 1; } } }); } else { Phoenix.Application.InfoManager.GetInfoDataByGroupId (paramType.InfoType, (results) => { Dictionary<string,InfoData> data = new Dictionary<string,InfoData>(); int i = 0; foreach(InfoData info in results){ if(!data.ContainsKey(info.ToString())){ data.Add(info.ToString(),info); Device.BeginInvokeOnMainThread(() => { infoPicker.Items.Add(info.ToString()); if (param.Value != null && param.Value == info.NexusId.ToString()) { infoPicker.SelectedIndex = i; } }); i += 1; } } infoData.Add(paramType.InfoType,data); if(data.Count < 1){ Device.BeginInvokeOnMainThread(() => { infoPicker.IsEnabled = false; infoPicker.IsVisible = false; }); } }); } infoPicker.Unfocused += (sender, e) => { if(infoPicker.SelectedIndex > 0){ if (infoData.ContainsKey (paramType.InfoType)) { Dictionary<string,InfoData> data = infoData [paramType.InfoType]; string value = infoPicker.Items[infoPicker.SelectedIndex]; if(data.ContainsKey(value)){ param.Value = data[value].NexusId.ToString(); param.DisplayValue = data[value].ToString(); Device.BeginInvokeOnMainThread(() => { entry.Text = data[value].NexusId.ToString(); }); } } } }; }
//View public ContactEditPage(ContactRepository database) { //Initialize _database = database; //Create EntryCells var firstNameCell = new EntryCell {Label = "First Name:"}; var lastNameCell = new EntryCell {Label = "Last Name:"}; var typeCell = new EntryCell {Label = "Contact Type:"}; var dateCell = new EntryCell { Label = "Date of Birth:"}; //Set DataBinding firstNameCell.SetBinding(EntryCell.TextProperty, "FirstName"); lastNameCell.SetBinding(EntryCell.TextProperty, "LastName"); typeCell.SetBinding(EntryCell.TextProperty, "Type"); dateCell.SetBinding(EntryCell.TextProperty, "DateOfBirth"); //Save Btn var saveBtn = new Button { Text = " Save Contact ", FontSize = Device.GetNamedSize(NamedSize.Medium, typeof (Button)), HorizontalOptions = LayoutOptions.CenterAndExpand }; saveBtn.Clicked += async (sender, args) => { //Validate Text Fields if (firstNameCell.Text == string.Empty || lastNameCell.Text == string.Empty || typeCell.Text == string.Empty || dateCell.Text == string.Empty) { await DisplayAlert ("Warning", "Please Fill In All Fields", "OK"); } else { //Saves Changes to Database var contactItem = (Contact) BindingContext; _database.SaveContact(contactItem); await Navigation.PopAsync(); SortContacts(); } }; //Delete Btn var deleteBtn = new Button { Text = " Delete Contact ", FontSize = Device.GetNamedSize(NamedSize.Medium, typeof (Button)), HorizontalOptions = LayoutOptions.CenterAndExpand }; deleteBtn.Clicked += async (sender, e) => { //Deletes Contact from Database var contactItem = (Contact) BindingContext; _database.DeleteContact(contactItem); await Navigation.PopAsync(); SortContacts(); }; //Cancel Btn var cancelBtn = new Button { Text = " Cancel ", FontSize = Device.GetNamedSize(NamedSize.Medium, typeof (Button)), HorizontalOptions = LayoutOptions.CenterAndExpand }; cancelBtn.Clicked += async (sender, args) => { await Navigation.PopAsync(); }; //Create TableView var tableView = new TableView { HeightRequest = 275, Intent = TableIntent.Form, Root = new TableRoot { new TableSection("Edit/Delete a Contact") { firstNameCell, lastNameCell, dateCell, typeCell } } }; //Build Button Layout var btnLayout = new StackLayout { Orientation = StackOrientation.Horizontal, Children = {saveBtn, deleteBtn, cancelBtn} }; //Build Main Page var main = new StackLayout { VerticalOptions = LayoutOptions.Start, Children = {tableView, btnLayout} }; Content = main; }
private static void UpdateKeyboard(EntryCellTableViewCell cell, EntryCell entryCell) { cell.TextField.ApplyKeyboard(entryCell.Keyboard); }
private void InitializeStorageSettings(IFileRepository fileRepository) { bool hasCustomStorageDir = fileRepository.StorageDirectory != fileRepository.DefaultStorageDirectory; _customStorageSwitch = new SwitchCell { Text = "Custom storage directory", On = hasCustomStorageDir }; _customStorageDirectoryEntry = new EntryCell { Label = "Path", Text = fileRepository.StorageDirectory, IsEnabled = hasCustomStorageDir }; _customStorageSwitch.OnChanged += (sender, args) => { _customStorageDirectoryEntry.IsEnabled = args.Value; if (args.Value) { //reset to default _customStorageDirectoryEntry.Text = fileRepository.DefaultStorageDirectory; SetStorageDir(fileRepository.DefaultStorageDirectory); } }; _customStorageDirectoryEntry.Completed += (sender, args) => { SetStorageDir(_customStorageDirectoryEntry.Text); }; }
protected EntryCell CreateEntryCell(string label, Action action, string initialText) { var entryCell = new EntryCell { Label = label, Text = initialText, XAlign = TextAlignment.End, }; if (action != null) { entryCell.Tapped += (sender, e) => action(); } return entryCell; }
private static void UpdateIsEnabled(EntryCellTableViewCell cell, EntryCell entryCell) { cell.UserInteractionEnabled = entryCell.IsEnabled; cell.TextLabel.Enabled = entryCell.IsEnabled; cell.DetailTextLabel.Enabled = entryCell.IsEnabled; cell.TextField.Enabled = entryCell.IsEnabled; }
public void PopEntryEditor(string title, string label, string initalText, Action<string> changedText, bool allowEmpty = false) { TableView table = new TableView { Intent = TableIntent.Menu }; TableSection mainSection = new TableSection (); EntryCell cell = new EntryCell { Text = initalText, Label = label, XAlign = TextAlignment.Start, }; mainSection.Add (cell); (table.Root = new TableRoot ()).Add (mainSection); ContentPage popPage = new ContentPage { Title = title, Content = table, BackgroundColor = new Color(1, 1, 1, 0.2) }; popPage.ToolbarItems.Add (new ToolbarItem ("Save", null, () => { if (allowEmpty || !cell.Text.Equals ("")) { changedText (cell.Text); } Navigation.PopAsync (); })); Navigation.PushAsync (popPage); }
public LoginPage() { InitializeComponent(); Title = "Login to Your Account"; _viewModel = new LoginPageViewModel(); this.BindingContext = _viewModel; var tableView = new TableView { Intent = TableIntent.Menu, }; this.Content = tableView; var usernameSection = new TableSection(); tableView.Root.Add(usernameSection); var usernameCell = new EntryCell { Label = "Login", Placeholder = "username", Keyboard = Keyboard.Email, }; usernameSection.Add(usernameCell); usernameCell.SetBinding(EntryCell.TextProperty, "Username"); // var passwordCell = new EntryCell // { // Label = "Password", // Placeholder = "password", // Keyboard = Keyboard.Text, // }; var passwordCell = new ExtendedEntryCell { Label = "Password", Placeholder = "password", Keyboard = Keyboard.Text, IsPassword = true, }; usernameSection.Add(passwordCell); passwordCell.SetBinding(EntryCell.TextProperty, "Password"); var forgotPasswordViewCell = new ViewCell(); usernameSection.Add(forgotPasswordViewCell); var forgotPasswordLayout = new StackLayout { Padding = new Thickness(5, 0, 5, 0), }; forgotPasswordViewCell.View = forgotPasswordLayout; var forgotPasswordButton = new Button { Text = "Forgot your Password?", HorizontalOptions = LayoutOptions.End, }; forgotPasswordLayout.Children.Add(forgotPasswordButton); forgotPasswordButton.Clicked += async (sender, e) => { ResetPassword(usernameCell.Text); }; var loginSection = new TableSection(); tableView.Root.Add(loginSection); var loginButtonViewCell = new ViewCell(); loginSection.Add(loginButtonViewCell); loginButtonViewCell.Tapped += async (sender, e) => { await Login(usernameCell.Text, passwordCell.Text); }; var loginButtonLayout = new StackLayout { Padding = new Thickness(5, 0, 5, 0), BackgroundColor = Color.Accent, }; loginButtonViewCell.View = loginButtonLayout; var loginButton = new Button { Text = "Login", HorizontalOptions = LayoutOptions.CenterAndExpand, TextColor = Color.White, }; loginButtonLayout.Children.Add(loginButton); loginButton.Clicked += async (sender, e) => { // Maybe just make the call to be Login() and determine the parameters in the VM is better!! await Login(usernameCell.Text, passwordCell.Text); }; var signUpSection = new TableSection(); tableView.Root.Add(signUpSection); var signUpCell = new ViewCell(); signUpSection.Add(signUpCell); var signUpLayout = new StackLayout { Padding = new Thickness(5, 0, 5, 0), }; signUpCell.View = signUpLayout; var signUpButton = new Button { Text = "Don't have an account yet? Sign up", }; signUpLayout.Children.Add(signUpButton); signUpButton.Clicked += (sender, e) => { this.Navigation.PushAsync(new RegistrationPage(false, this)); }; }
public EntryCellEvents(EntryCell This) : base(This) { this.This = This; }
public void createTable() { var entryCellBillType = new EntryCell { Label = "Bill Type:", Placeholder = "default keyboard", Keyboard = Keyboard.Default }; var entryCellFirstName = new EntryCell { Label = "First Name", Placeholder = "default keyboard", Keyboard = Keyboard.Default }; var entryCellMiddleName = new EntryCell { Label = "Middle", Placeholder = "default keyboard", Keyboard = Keyboard.Default }; var entryCellLastName = new EntryCell { Label = "Last Name", Placeholder = "default keyboard", Keyboard = Keyboard.Default }; var entryCellAddress = new EntryCell { Label = "Address", Placeholder = "default keyboard", Keyboard = Keyboard.Default }; var entryCellCity = new EntryCell { Label = "City", Placeholder = "default keyboard", Keyboard = Keyboard.Default }; var entryCellState = new EntryCell { Label = "State", Placeholder = "default keyboard", Keyboard = Keyboard.Default }; var entryCellZip = new EntryCell { Label = "Zip", Placeholder = "default keyboard", Keyboard = Keyboard.Default }; var entryCellPhone = new EntryCell { Label = "Phone", Placeholder = "default keyboard", Keyboard = Keyboard.Default }; var entryCellEmail = new EntryCell { Label = "Email", Placeholder = "default keyboard", Keyboard = Keyboard.Default }; var entryCellParcelNo = new EntryCell { Label = "ParcelNumber", Placeholder = "default keyboard", Keyboard = Keyboard.Default }; var entryCellTaxYear = new EntryCell { Label = "Tax Year", Placeholder = "default keyboard", Keyboard = Keyboard.Default }; var entryCellAmtToPay = new EntryCell { Label = "Amount to Pay", Placeholder = "default keyboard", Keyboard = Keyboard.Default }; Content = new TableView { Intent = TableIntent.Form, Root = new TableRoot ("Accept Payments") { new TableSection ("Section 1 Title") { entryCellBillType, entryCellFirstName, entryCellMiddleName, entryCellLastName, entryCellAddress, entryCellCity, entryCellState, entryCellZip, entryCellPhone, entryCellEmail, entryCellParcelNo, entryCellTaxYear, entryCellAmtToPay } } }; }
private static void UpdateLabelColor(EntryCellTableViewCell cell, EntryCell entryCell) { cell.TextLabel.TextColor = entryCell.LabelColor.ToUIColor(DefaultTextColor); }
public SettingsPage(LanesViewModel viewModel) { BindingContext = viewModel; #region create the IsOpen Switch var isOpenSwitch = new SwitchCell { Text = "Is Open" }; isOpenSwitch.SetBinding(SwitchCell.OnProperty,"LaneTappedIsOpen"); #endregion #region Create the Needs Maintenance Switch var needsMaintenanceSwitch = new SwitchCell { Text = "Needs Maintenance" }; needsMaintenanceSwitch.SetBinding(SwitchCell.OnProperty,"LaneTappedNeedsMaintenance"); #endregion #region create the IP Address Entry var ipAddressText = new EntryCell { Label = "IP Address", HorizontalTextAlignment = TextAlignment.End }; ipAddressText.SetBinding(EntryCell.TextProperty, "LaneTappedIPAddress"); #endregion #region Create Image Cell var imageCell = new ImageCell(); imageCell.SetBinding(ImageCell.ImageSourceProperty, "ImageCellIcon"); #endregion #region Create the Icon Toggle Button var iconToggleButton = new Button(); iconToggleButton.SetBinding(Button.CommandProperty, "IconToggleButton"); iconToggleButton.SetBinding(Button.TextProperty, "ToggleButtonText"); #endregion #region create the TableView var tableView = new TableView { Intent = TableIntent.Settings, Root = new TableRoot { new TableSection{ isOpenSwitch, needsMaintenanceSwitch, ipAddressText, imageCell } } }; #endregion #region Create StackLayout to Include a Button var settingsStack = new StackLayout { Children ={ tableView, iconToggleButton } }; #endregion NavigationPage.SetTitleIcon(this,"cogwheel_navigation"); Title = $"Lane {viewModel.LanesList.IndexOf(viewModel.LaneTapped)+1} Settings"; Content = settingsStack; }
private static void UpdatePlaceholder(EntryCellTableViewCell cell, EntryCell entryCell) { cell.TextField.Placeholder = entryCell.Placeholder; }
internal static Cell DecimalCell(PropertyInfo property, IContact context, Page parent = null) { var label = CreateLabel(property); var currencyAttrib = property.GetCustomAttribute<CurrencyAttribute>(); var entryCell = new EntryCell(); entryCell.SetValue(EntryCell.LabelProperty, label); entryCell.LabelColor = Color.FromHex("999999"); entryCell.SetBinding(EntryCell.TextProperty, new Binding(property.Name, mode: BindingMode.TwoWay, converter: DefaultConverter, converterParameter: currencyAttrib)); entryCell.BindingContext = context; return entryCell; }
private static void UpdateText(EntryCellTableViewCell cell, EntryCell entryCell) { if (cell.TextField.Text == entryCell.Text) { return; } cell.TextField.Text = entryCell.Text; }
public StorePage (Store store) { dataStore = DependencyService.Get<IDataStore> (); Store = store; if (Store == null) { Store = new Store (); Store.MondayOpen = "9am"; Store.TuesdayOpen = "9am"; Store.WednesdayOpen = "9am"; Store.ThursdayOpen = "9am"; Store.FridayOpen = "9am"; Store.SaturdayOpen = "9am"; Store.SundayOpen = "12pm"; Store.MondayClose = "8pm"; Store.TuesdayClose = "8pm"; Store.WednesdayClose = "8pm"; Store.ThursdayClose = "8pm"; Store.FridayClose = "8pm"; Store.SaturdayClose = "8pm"; Store.SundayClose = "6pm"; isNew = true; } Title = isNew ? "New Store" : "Edit Store"; ToolbarItems.Add (new ToolbarItem { Text="Save", Command = new Command(async (obj)=> { Store.Name = name.Text.Trim(); Store.LocationHint = locationHint.Text.Trim(); Store.City = city.Text.Trim(); Store.PhoneNumber = phoneNumber.Text.Trim(); Store.Image = imageUrl.Text.Trim(); Store.StreetAddress = streetAddress.Text.Trim(); Store.State = state.Text.Trim(); Store.ZipCode = zipCode.Text.Trim(); Store.LocationCode = locationCode.Text.Trim(); Store.Country = country.Text.Trim(); double lat; double lng; var parse1 = double.TryParse(latitude.Text.Trim(), out lat); var parse2 = double.TryParse(longitude.Text.Trim(), out lng); Store.Longitude = lng; Store.Latitude = lat; Store.MondayOpen = mondayOpen.Text.Trim(); Store.MondayClose = mondayClose.Text.Trim(); Store.TuesdayOpen = tuesdayOpen.Text.Trim(); Store.TuesdayClose = tuesdayClose.Text.Trim(); Store.WednesdayOpen = wednesdayOpen.Text.Trim(); Store.WednesdayClose = wednesdayClose.Text.Trim(); Store.ThursdayOpen = thursdayOpen.Text.Trim(); Store.ThursdayClose = thursdayClose.Text.Trim(); Store.FridayOpen = fridayOpen.Text.Trim(); Store.FridayClose = fridayClose.Text.Trim(); Store.SaturdayOpen = saturdayOpen.Text.Trim(); Store.SaturdayClose = saturdayClose.Text.Trim(); Store.SundayOpen = sundayOpen.Text.Trim(); Store.SundayClose = sundayClose.Text.Trim(); bool isAnyPropEmpty = Store.GetType().GetTypeInfo().DeclaredProperties .Where(p => p.GetValue(Store) is string && p.CanRead && p.CanWrite && p.Name != "State") // selecting only string props .Any(p => string.IsNullOrWhiteSpace((p.GetValue(Store) as string))); if(isAnyPropEmpty || !parse1 || !parse2) { await DisplayAlert("Not Valid", "Some fields are not valid, please check", "OK"); return; } Title = "SAVING..."; if(isNew) { await dataStore.AddStoreAsync(Store); } else { await dataStore.UpdateStoreAsync(Store); } await DisplayAlert("Saved", "Please refresh store list", "OK"); await Navigation.PopAsync(); }) }); Content = new TableView { HasUnevenRows = true, Intent = TableIntent.Form, Root = new TableRoot { new TableSection ("Information") { (name = new EntryCell {Label = "Name", Text = Store.Name}), (locationHint = new EntryCell {Label = "Location Hint", Text = Store.LocationHint}), (phoneNumber = new EntryCell {Label = "Phone Number", Text = Store.PhoneNumber, Placeholder ="555-555-5555"}), (locationCode = new EntryCell {Label = "Location Code", Text = Store.LocationCode}), }, new TableSection ("Image") { (imageUrl = new EntryCell { Label="Image URL", Text = Store.Image, Placeholder = ".png or .jpg image link" }), (refreshImage = new TextCell() { Text="Refresh Image" }), new ViewCell { View = (image = new Image { HeightRequest = 400, VerticalOptions = LayoutOptions.FillAndExpand }) } }, new TableSection ("Address") { (streetAddress = new EntryCell {Label = "Street Address", Text = Store.StreetAddress }), (city = new EntryCell {Label = "City", Text = Store.City }), (state = new EntryCell {Label = "State", Text = Store.State }), (zipCode = new EntryCell {Label = "Zipcode", Text = Store.ZipCode }), (country = new EntryCell{Label="Country", Text = Store.Country}), (detectLatLong = new TextCell() { Text="Detect Lat/Long" }), (latitude = new TextCell {Text = Store.Latitude.ToString() }), (longitude = new TextCell {Text = Store.Longitude.ToString() }), }, new TableSection ("Hours") { (mondayOpen = new EntryCell {Label = "Monday Open", Text = Store.MondayOpen}), (mondayClose = new EntryCell {Label = "Monday Close", Text = Store.MondayClose}), (tuesdayOpen = new EntryCell {Label = "Tuesday Open", Text = Store.TuesdayOpen}), (tuesdayClose = new EntryCell {Label = "Tuesday Close", Text = Store.TuesdayClose}), (wednesdayOpen = new EntryCell {Label = "Wedneday Open", Text = Store.WednesdayOpen}), (wednesdayClose = new EntryCell {Label = "Wedneday Close", Text = Store.WednesdayClose}), (thursdayOpen = new EntryCell {Label = "Thursday Open", Text = Store.ThursdayOpen}), (thursdayClose = new EntryCell {Label = "Thursday Close", Text = Store.ThursdayClose}), (fridayOpen = new EntryCell {Label = "Friday Open", Text = Store.FridayOpen}), (fridayClose = new EntryCell {Label = "Friday Close", Text = Store.FridayClose}), (saturdayOpen = new EntryCell {Label = "Saturday Open", Text = Store.SaturdayOpen}), (saturdayClose =new EntryCell {Label = "Saturday Close", Text = Store.SaturdayClose}), (sundayOpen = new EntryCell {Label = "Sunday Open", Text = Store.SundayOpen}), (sundayClose = new EntryCell {Label = "Sunday Close", Text = Store.SundayClose}), }, }, }; refreshImage.Tapped += (sender, e) => { image.Source = ImageSource.FromUri(new Uri(imageUrl.Text)); }; detectLatLong.Tapped += async (sender, e) => { var coder = new Xamarin.Forms.Maps.Geocoder(); var oldTitle = Title; Title = "Please wait..."; var locations = await coder.GetPositionsForAddressAsync(streetAddress.Text + " " + city.Text + ", " + state.Text + " " + zipCode.Text + " " + country.Text); Title = oldTitle; foreach(var location in locations) { latitude.Text = location.Latitude.ToString(); longitude.Text = location.Longitude.ToString(); break; } }; SetBinding (Page.IsBusyProperty, new Binding("IsBusy")); }
private static void UpdateXAlign(EntryCellTableViewCell cell, EntryCell entryCell) { cell.TextField.TextAlignment = entryCell.XAlign.ToUITextAlignment(); }
private static void UpdateLabel(EntryCellTableViewCell cell, EntryCell entryCell) { cell.TextLabel.Text = entryCell.Label; }
private void InfoEntryTextChanged(EntryCell entry, OrderParameterType paramType, OrderParameter param, Picker infoPicker) { param.Value = entry.Text; if (infoData.ContainsKey (paramType.InfoType)) { Dictionary<string,InfoData> data = infoData [paramType.InfoType]; if(data.Count > 0) { Task.Factory.StartNew(() => { int i = 0; foreach(string value in data.Keys){ if(entry.Text == data[value].NexusId.ToString()){ if(infoPicker.Items.Count > i){ Device.BeginInvokeOnMainThread(() => { infoPicker.SelectedIndex = i; infoPicker.Title = data[value].ToString(); }); } break; } i += 1; } }); } else { Device.BeginInvokeOnMainThread(() => { infoPicker.Title = param.Value; }); } } else { Device.BeginInvokeOnMainThread(() => { infoPicker.Title = param.Value; }); } }