示例#1
0
        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); };
        }
示例#2
0
        public void ChangingHorizontalTextAlignmentFiresXAlignChanged()
        {
            var entryCell = new EntryCell {
                HorizontalTextAlignment = TextAlignment.Center
            };

            var xAlignFired = false;
            var horizontalTextAlignmentFired = false;

            entryCell.PropertyChanged += (sender, args) => {
                if (args.PropertyName == "XAlign")
                {
                    xAlignFired = true;
                }
                else if (args.PropertyName == EntryCell.HorizontalTextAlignmentProperty.PropertyName)
                {
                    horizontalTextAlignmentFired = true;
                }
            };

            entryCell.HorizontalTextAlignment = TextAlignment.End;

            Assert.True(xAlignFired);
            Assert.True(horizontalTextAlignmentFired);
        }
示例#3
0
        public override NSTableCellView GetCell(Cell item, NSTableCellView reusableCell, NSTableView tv)
        {
            EntryCell entryCell = (EntryCell)item;

            EntryCellRenderer.EntryCellTableViewCell cell = reusableCell as EntryCellRenderer.EntryCellTableViewCell;
            if (cell == null)
            {
                cell = new EntryCellRenderer.EntryCellTableViewCell((item).GetType().FullName);
            }
            else
            {
                cell.Cell.PropertyChanged      -= OnCellPropertyChanged;
                cell.TextFieldTextChanged      -= new EventHandler(EntryCellRenderer.OnTextFieldTextChanged);
                cell.KeyboardDoneButtonPressed -= new EventHandler(EntryCellRenderer.OnKeyBoardDoneButtonPressed);
            }
            CellRenderer.SetRealCell((BindableObject)item, (NSTableCellView)cell);
            cell.Cell = item;
            cell.Cell.PropertyChanged      += OnCellPropertyChanged;
            cell.TextFieldTextChanged      += new EventHandler(EntryCellRenderer.OnTextFieldTextChanged);
            cell.KeyboardDoneButtonPressed += new EventHandler(EntryCellRenderer.OnKeyBoardDoneButtonPressed);
            this.UpdateBackground((NSTableCellView)cell, (Cell)entryCell);
            EntryCellRenderer.UpdateLabel(cell, entryCell);
            EntryCellRenderer.UpdateText(cell, entryCell);
            //EntryCellRenderer.UpdateKeyboard (cell, entryCell);
            EntryCellRenderer.UpdatePlaceholder(cell, entryCell);
            EntryCellRenderer.UpdateLabelColor(cell, entryCell);
            EntryCellRenderer.UpdateHorizontalTextAlignment(cell, entryCell);
            EntryCellRenderer.UpdateIsEnabled(cell, entryCell);
            return((NSTableCellView)cell);
        }
        public CalculatorPage()
        {
            InitializeComponent();

            resultLabel.Text = "0";

            testEntry = new Entry()
            {
                Text = "Test"
            };
            testEntryCell = new EntryCell {
                Text = "new"
            };

            formats = new FormatList();

            var      items    = Enumerable.Range(0, 2);
            ListView listView = new ListView();

            listView.HasUnevenRows = true;
            listView.RowHeight     = 5;
            listView.ItemTemplate  = new DataTemplate(typeof(FormatCell));
            listView.ItemsSource   = formats;

            CalculatorResult result = new CalculatorResult()
            {
                IsValid = true,
                Result  = 25
            };

            resultLabel.Text = new IntResult().GetFormatted(result.Result);

            mainLayout.Children.Add(listView);
        }
示例#5
0
        public void EntryCellXAlignBindingMatchesHorizontalTextAlignmentBinding()
        {
            var vm = new ViewModel();

            vm.Alignment = TextAlignment.Center;

            var entryCellXAlign = new EntryCell()
            {
                BindingContext = vm
            };

            entryCellXAlign.SetBinding(EntryCell.XAlignProperty, new Binding("Alignment"));

            var entryCellHorizontalTextAlignment = new EntryCell()
            {
                BindingContext = vm
            };

            entryCellHorizontalTextAlignment.SetBinding(EntryCell.HorizontalTextAlignmentProperty, new Binding("Alignment"));

            Assert.AreEqual(TextAlignment.Center, entryCellXAlign.XAlign);
            Assert.AreEqual(TextAlignment.Center, entryCellHorizontalTextAlignment.HorizontalTextAlignment);

            vm.Alignment = TextAlignment.End;

            Assert.AreEqual(TextAlignment.End, entryCellXAlign.XAlign);
            Assert.AreEqual(TextAlignment.End, entryCellHorizontalTextAlignment.HorizontalTextAlignment);
        }
示例#6
0
 private static void UpdatePlaceholder(CellView cell, EntryCell entryCell)
 {
     if (cell.CustomView.FirstChild is TextInput textInput)
     {
         textInput.Placeholder = entryCell.Placeholder ?? string.Empty;
     }
 }
示例#7
0
        public async Task EntryCellDisposed()
        {
            var text1 = "Foo";
            var text2 = "Bar";
            var model = new _5560Model()
            {
                Text = text1
            };

            for (int m = 0; m < 3; m++)
            {
                var entryCell = new EntryCell();
                entryCell.SetBinding(EntryCell.TextProperty, new Binding("Text"));
                entryCell.SetBinding(EntryCell.BindingContextProperty, new Binding("BindingContext"));
                entryCell.BindingContext = model;
                CellFactory.GetCell(entryCell, null, null, Context, null);

                if (m == 1)
                {
                    GC.Collect();
                }

                model.Text = model.Text == text1 ? text2 : text1;
            }

            await model.WaitForTestToComplete().ConfigureAwait(false);
        }
        private void ConfigureEnv(bool flag, WebsiteEntry data_entry)
        {
            if (flag)
            {
                WebsiteTitleEntry = new EntryCell()
                {
                    Label       = "Enter Website Title: ",
                    Placeholder = "Enter Title"
                };

                UrlEntry = new EntryCell()
                {
                    Label       = "Enter URL: ",
                    Placeholder = "Enter URL"
                };
            }
            else
            {
                WebsiteTitleEntry = new EntryCell()
                {
                    Label       = "Enter Website Title: ",
                    Placeholder = data_entry.Title
                };

                UrlEntry = new EntryCell()
                {
                    Label       = "Enter URL: ",
                    Placeholder = data_entry.Url
                };
            }
        }
示例#9
0
 private static void UpdateText(CellView cell, EntryCell entryCell)
 {
     if (cell.CustomView.FirstChild is TextInput textInput)
     {
         textInput.Text = entryCell.Text ?? string.Empty;
     }
 }
示例#10
0
        async void Update_TaskName(object sender, EventArgs e)
        {
            //Capture the new task name from the EntryCell
            EntryCell entryCellVal = (EntryCell)sender;
            string    txt          = entryCellVal.Text;

            var myTsks = conn.Table <MyTask>().Where(x => x.MyTaskName == tskName);

            foreach (var ta in myTsks)
            {
                //ta.MyTaskName += "Task";

                ta.MyTaskName = txt; //set the new task name from EntryCell
                conn.Update(ta);     //update the task name
            }

            //Now we should UPDATE the Counts table with the updated Task name
            var myCounts = conn.Table <Counts>().Where(x => x.TaskName == tskName);

            foreach (var ta in myCounts)
            {
                ta.TaskName = txt; //set the new task name from EntryCell
                conn.Update(ta);   //update the task name in Counts table
            }

            await DisplayAlert("Message", "Task name successfully updated. All related data also updated.", "Ok");

            await Navigation.PushAsync(new ChangeTasks());

            //await Navigation.PopAsync();
        }
 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;
 }
示例#12
0
        Cell CreateTintColorCell(string colorName, Color colorValue, CellGlossAccessoryType accessoryType)
        {
            Cell result;

            if (accessoryType == CellGlossAccessoryType.EditIndicator)
            {
                result = new EntryCell();
                (result as EntryCell).Label                   = colorName;
                (result as EntryCell).Placeholder             = "Optional";
                (result as EntryCell).HorizontalTextAlignment = TextAlignment.End;
            }
            else
            {
                result = new TextCell();
                (result as TextCell).Text = colorName;
            }

            // Instantiate an instance of the Gloss properties you want to assign values to
            var gloss = new CellGloss(result);

            gloss.TintColor     = colorValue;
            gloss.AccessoryType = accessoryType;

            return(result);
        }
        public UnitDetailsPage(UnitTypeItem unitTypeItem)
        {
            InitializeComponent();

            UnitTypeItem = unitTypeItem;

            Title = unitTypeItem.UnitTypeFriendlyName;

            var units = _getSortedUnits(unitTypeItem.UnitType);

            //var units = App.UnitsManager.GetUnits(unitTypeItem.UnitType).ToList();

            foreach (IUnit unit in units)
            {
                var cell = new EntryCell()
                {
                    Label                   = unit.Name,
                    Placeholder             = _withSuperscriptChars(unit.Symbol),
                    HorizontalTextAlignment = TextAlignment.End,
                    BindingContext          = unit,
                    Keyboard                = Keyboard.Plain
                };

                cell.Completed += Cell_Completed;
                cell.Tapped    += Cell_Tapped;

                tablesectionUnits.Add(cell);
            }
        }
示例#14
0
        private void AddElements()
        {
            EntryCell newCustomer = new EntryCell();

            newCustomer.Placeholder = "Ім'я користувача";

            TableView table = new TableView
            {
                Intent = TableIntent.Form,
                Root   = new TableRoot("Добавлення нового користувача")
                {
                    new TableSection("Введіть дані користувача")
                    {
                        newCustomer
                    }
                }
            };

            Button createCustomerButton = new Button();

            createCustomerButton.Text            = "Створити";
            createCustomerButton.BackgroundColor = Color.Aqua;
            createCustomerButton.Clicked        += async(sender, e) => await CreateNewCustomer(newCustomer.Text);

            StackLayout sl = new StackLayout();

            sl.Children.Add(table);
            sl.Children.Add(createCustomerButton);

            Content = sl;
        }
        public static IEnumerable <Cell> GenerateSettingsFormCells(object instance)
        {
            if (instance == null)
            {
                throw new ArgumentNullException(nameof(instance));
            }

            foreach (var property in instance.GetType().GetProperties(
                         BindingFlags.Public | BindingFlags.Instance))
            {
                var entryCell = new EntryCell();
                if (property.PropertyType == typeof(sbyte) ||
                    property.PropertyType == typeof(byte) ||
                    property.PropertyType == typeof(short) ||
                    property.PropertyType == typeof(ushort) ||
                    property.PropertyType == typeof(int) ||
                    property.PropertyType == typeof(uint) ||
                    property.PropertyType == typeof(long) ||
                    property.PropertyType == typeof(ulong) ||
                    property.PropertyType == typeof(decimal) ||
                    property.PropertyType == typeof(float) ||
                    property.PropertyType == typeof(double))
                {
                    entryCell.Keyboard = Keyboard.Numeric;
                }

                entryCell.Label = property.GetCustomAttribute <DisplayAttribute>()?.Name ?? property.Name.Humanize(LetterCasing.Title);
                entryCell.HorizontalTextAlignment = TextAlignment.End;
                entryCell.SetBinding(EntryCell.TextProperty, new Binding {
                    Source = instance, Path = property.Name
                });
                yield return(entryCell);
            }
        }
        /// <summary>
        /// Initialize main page.
        /// Add components and events.
        /// </summary>
        private void InitializeComponent()
        {
            Title     = "Download";
            IsVisible = true;

            BackgroundColor = Color.White;

            urlEntryCell   = CreateEntryCell();
            urlEntryView   = CreateEntryView();
            downloadButton = CreateDownloadButton();
            progressBar    = CreateProgressbar();
            progressLabel  = CreateProgressLabel();

            AddEvent();

            Content = new StackLayout
            {
                Spacing  = 0,
                Children =
                {
                    urlEntryView,
                    downloadButton,
                    progressBar,
                    progressLabel,
                }
            };
        }
        public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
        {
            EntryCell entryCell = (EntryCell)item;
            EntryCellTableViewCell entryCellTableViewCell = reusableCell as EntryCellTableViewCell;

            if (entryCellTableViewCell != null)
            {
                entryCellTableViewCell.Cell.PropertyChanged      -= OnCellPropertyChanged;
                entryCellTableViewCell.TextFieldTextChanged      -= OnTextFieldTextChanged;
                entryCellTableViewCell.KeyboardDoneButtonPressed -= OnKeyBoardDoneButtonPressed;
            }
            else
            {
                entryCellTableViewCell = new EntryCellTableViewCell(item.GetType().FullName);
            }
            SetMyRealCell(item, entryCellTableViewCell);
            entryCellTableViewCell.Cell = item;
            entryCellTableViewCell.Cell.PropertyChanged      += OnCellPropertyChanged;
            entryCellTableViewCell.TextFieldTextChanged      += OnTextFieldTextChanged;
            entryCellTableViewCell.KeyboardDoneButtonPressed += OnKeyBoardDoneButtonPressed;
            base.WireUpForceUpdateSizeRequested(item, entryCellTableViewCell, tv);
            base.UpdateBackground(entryCellTableViewCell, entryCell);
            UpdateLabel(entryCellTableViewCell, entryCell);
            UpdateText(entryCellTableViewCell, entryCell);
            UpdateKeyboard(entryCellTableViewCell, entryCell);
            UpdatePlaceholder(entryCellTableViewCell, entryCell);
            UpdateLabelColor(entryCellTableViewCell, entryCell);
            UpdateHorizontalTextAlignment(entryCellTableViewCell, entryCell);
            UpdateIsEnabled(entryCellTableViewCell, entryCell);
            return(entryCellTableViewCell);
        }
示例#18
0
        private void AddComponents()
        {
            ToolbarItem tb = new ToolbarItem
            {
                Text     = "Реєстрація",
                Order    = ToolbarItemOrder.Secondary,
                Priority = 0
            };

            tb.Clicked += async(sender, e) =>
            {
                var registrationPage = new NavigationPage(new RegistrationPage());
                await Navigation.PushModalAsync(registrationPage);
            };

            ToolbarItems.Add(tb);

            SwitchCell saveConfig = new SwitchCell();

            saveConfig.Text = "Зберегти дані";
            saveConfig.On   = true;

            EntryCell loginField = new EntryCell();

            loginField.Placeholder = "Логін";

            PasswordEntryCell passwordField = new PasswordEntryCell();

            passwordField.Placeholder = "Пароль";

            TableView table = new TableView
            {
                Intent = TableIntent.Form,
                Root   = new TableRoot("Авторизація в системі")
                {
                    new TableSection("Авторизація в системі")
                    {
                        loginField,
                        passwordField
                    },
                    new TableSection("Додаткові налаштування")
                    {
                        saveConfig
                    }
                }
            };

            Button enterButton = new Button();

            enterButton.Text            = "Ввійти";
            enterButton.BackgroundColor = Color.Accent;
            enterButton.Clicked        += async(sender, e) => await AuthorizeAsync(loginField.Text, passwordField.Value);

            StackLayout sl = new StackLayout();

            sl.Children.Add(table);
            sl.Children.Add(enterButton);
            Content = sl;
        }
 public static EntryCell Text(this EntryCell cell, string text, string label = "", string placeholder = "", Color color = default(Color))
 {
     cell.Label       = label;
     cell.Placeholder = placeholder;
     cell.LabelColor  = color;
     cell.Text        = text;
     return(cell);
 }
 private static void UpdateText(EntryCellTableViewCell cell, EntryCell entryCell)
 {
     if (cell.TextField.Text == entryCell.Text)
     {
         return;
     }
     cell.TextField.Text = entryCell.Text;
 }
示例#21
0
            public View LoadSettings()
            {
                eCell = new EntryCell {
                    Label = "Some label here", Text = "Some text here", IsEnabled = false, HorizontalTextAlignment = TextAlignment.End
                };

                Button myButton = new Button()
                {
                    Text = "do something", HorizontalOptions = LayoutOptions.CenterAndExpand, HeightRequest = 40
                };
                StackLayout myStack = new StackLayout()
                {
                    HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand
                };

                myStack.Children.Add(myButton);

                myCell = new ViewCell {
                    View = myStack
                };

                showThis = new SwitchCell {
                    Text = "turn this on/off?", On = true
                };
                showThat = new SwitchCell {
                    Text = "turn this on/off?", On = false
                };

                tv = new TableView()
                {
                    Root = new TableRoot
                    {
                        new TableSection("Some settings")
                        {
                            eCell,
                            myCell
                        }
                    },
                    Intent = TableIntent.Settings
                };

                tv.Root.Add(new TableSection("Other Settings")
                {
                });
                tv.Root.Last().Add(showThis);
                tv.Root.Last().Add(showThat);

                StackLayout pageItems = new StackLayout()
                {
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    BackgroundColor   = Color.White
                };

                pageItems.Children.Add(tv);

                return(pageItems);
            }
示例#22
0
        private void AddPlanet()
        {
            newPlanet = new Planet("");
            Title     = "Добавление планеты";

            //данные о планете
            nameEntry = new EntryCell {
                Label = "Название:", Placeholder = "Введите название", Keyboard = Keyboard.Default
            };
            weightEntry = new EntryCell {
                Label = "Масса:", Placeholder = "Введите массу в килограммах", Keyboard = Keyboard.Numeric,
            };
            radiusEntry = new EntryCell {
                Label = "Радиус:", Placeholder = "Введите радиус в метрах", Keyboard = Keyboard.Numeric
            };
            root.Add(new TableSection("Общие данные")
            {
                nameEntry, weightEntry, radiusEntry
            });

            //звезда
            var searchStarButton = new Button {
                Text = "Звезда", TextColor = Color.Black, BackgroundColor = Color.FromHex("9E9E9E"), HorizontalOptions = LayoutOptions.Start
            };
            var searchStarEntry = new Entry {
                Placeholder = "Звезда", Keyboard = Keyboard.Default
            };

            searchParentListView = new ListView()
            {
                ItemsSource = Stars
            };
            searchStarButton.Clicked += (s, e) =>
            {
                NavigationPage.SetHasBackButton(this, false);
                OurStackLayout.Children.Clear();
                searchStarEntry.TextChanged += (_s, _e) =>
                {
                    searchParentListView.ItemsSource = Stars.Search(searchStarEntry.Text);
                };
                OurStackLayout.Children.Add(searchStarEntry);
                OurStackLayout.Children.Add(searchParentListView);
                OurStackLayout.Children.Add(cancelButton);
            };
            searchParentListView.ItemTapped += (s, e) =>
            {
                searchStarButton.Text = searchParentListView.SelectedItem.ToString();
                OurStackLayout.Children.Clear();
                OurStackLayout.Children.Add(tableview);
                OurStackLayout.Children.Add(SaveButton);
            };
            root.Add(new TableSection("Звезда")
            {
                new ViewCell {
                    View = searchStarButton
                }
            });
        }
示例#23
0
        private void AddPlayers(object sender, EventArgs e)
        {
            EntryCell cell = new EntryCell {
                Placeholder = "Enter Players Name"
            };
            TableSection tablesec = (TableSection)FindByName("tablesection");

            tablesec.Add(cell);
        }
示例#24
0
 static void UpdateText(EntryCellTableViewCell cell, EntryCell entryCell)
 {
     if (cell.TextField.Text == entryCell.Text)
     {
         return;
     }
     // double sets side effect on iOS, YAY
     cell.TextField.Text = entryCell.Text;
 }
        static void UpdatePlaceholder(CellNSView cell, EntryCell entryCell)
        {
            var nsTextField = cell.AccessoryView.Subviews[0] as NSTextField;

            if (nsTextField != null)
            {
                nsTextField.PlaceholderString = entryCell.Placeholder ?? "";
            }
        }
        static void UpdateHorizontalTextAlignment(CellNSView cell, EntryCell entryCell)
        {
            var nsTextField = cell.AccessoryView.Subviews[0] as NSTextField;

            if (nsTextField != null)
            {
                nsTextField.Alignment = entryCell.HorizontalTextAlignment.ToNativeTextAlignment();
            }
        }
示例#27
0
        public AccountPage()
        {
            Title = "My Account";

            ToolbarItem save = new ToolbarItem()
            {
                Text    = "Save",
                Command = new Command((obj) =>
                {
                    if (api.APIHandler.updateAccount(DISPLAY_NAME.Text, BIO.Text))
                    {
                        api.APIHandler.myAccount.BIO          = BIO.Text;
                        api.APIHandler.myAccount.DISPLAY_NAME = DISPLAY_NAME.Text;

                        DisplayAlert("Information Updated", "Your information has been updated", "Nice!");
                    }
                    else
                    {
                        DisplayAlert("Information Updated Error", "Your information was not updated for some reason", "Not Nice :(");
                    }
                })
            };

            ToolbarItems.Add(save);

            Content = new TableView
            {
                Root = new TableRoot()
                {
                    new TableSection("Information")
                    {
                        (DISPLAY_NAME = new EntryCell {
                            Label = "Display Name", Text = api.APIHandler.myAccount.DISPLAY_NAME
                        }),
                        (BIO = new EntryCell {
                            Label = "Bio", Text = api.APIHandler.myAccount.BIO
                        })
                    },
                    new TableSection("Email")
                    {
                        (EMAIL = new EntryCell {
                            Label = "Email", Text = api.APIHandler.myAccount.EMAIL
                        }),
                    },
                    new TableSection("Password")
                    {
                        (PASSWORD = new EntryCellPassword("Password", "Password")),
                        (CONFIRM = new EntryCellPassword("Confirm Password", "Password")),
                        (CURRENT = new EntryCellPassword("Current Password", "Password"))
                    }
                },

                HasUnevenRows = true,
                Intent        = TableIntent.Form
            };
        }
示例#28
0
        public WalkEntryPage()
        {
            var walkTitle = new EntryCell
            {
                Label       = "Title",
                Placeholder = "Trail Title"
            };

            InitializeComponent();
        }
        static void UpdateIsEnabled(CellNSView cell, EntryCell entryCell)
        {
            cell.TextLabel.Enabled = entryCell.IsEnabled;
            var nsTextField = cell.AccessoryView.Subviews[0] as NSTextField;

            if (nsTextField != null)
            {
                nsTextField.Enabled = entryCell.IsEnabled;
            }
        }
示例#30
0
        private async void RefreshBoard()
        {
            //Refresh the board
            BoardSection.Clear();
            BoardSection.Add(new ViewCell()
            {
                View = common.Common.GetLoadingGridView("Loading The Board™")
            });
            Settings.Players = await BasicRequest <List <Player> >("Players/List", "POST");

            var boardStatus = await BasicRequest <Dictionary <string, decimal> >("Status/All", "POST");

            Settings.Players.Sort((x, y) => y.CurrentMargin.CompareTo(x.CurrentMargin));
            BoardSection.Clear();
            foreach (Player Play in Settings.Players)
            {
                var LabelColor = Color.Red;
                if (Play.Active)
                {
                    LabelColor = Color.White;
                }
                var Cell = new EntryCell()
                {
                    IsEnabled = false, Text = boardStatus[Play.Name].ToString("F2"), Label = Play.Name, LabelColor = LabelColor
                };
                BoardSection.Add(Cell);
            }

            //refresh the games
            CurrentGames.Clear();
            CurrentGames.Add(new ViewCell()
            {
                View = common.Common.GetLoadingGridView("Loading Current Games")
            });
            var Games = await BasicRequest <List <GameInfo> >("GamesPlayed/Unfinished", "POST");

            CurrentGameEntries = new Dictionary <TextCell, GameInfo>();
            Games.Sort((x, y) => y.GameUniqueId.CompareTo(x.GameUniqueId));
            CurrentGames.Clear();
            foreach (GameInfo game in Games)
            {
                var playernames = new List <string>();
                foreach (Player player in game.Players)
                {
                    playernames.Add(player.Name);
                }
                var Cell = new TextCell()
                {
                    Text = game.GameType.Name + " - £" + game.Entry.ToString("F2"), Detail = $"ID: {game.GameUniqueId} Players: {string.Join(", ",playernames)}"
                };
                Cell.Tapped += CurrentGamePress;
                CurrentGameEntries.Add(Cell, game);
                CurrentGames.Add(Cell);
            }
        }
示例#31
0
		public void EntryCellXAlignBindingMatchesHorizontalTextAlignmentBinding ()
		{
			var vm = new ViewModel ();
			vm.Alignment = TextAlignment.Center;

			var entryCellXAlign = new EntryCell () { BindingContext = vm };
			entryCellXAlign.SetBinding (EntryCell.XAlignProperty, new Binding ("Alignment"));

			var entryCellHorizontalTextAlignment = new EntryCell () { BindingContext = vm };
			entryCellHorizontalTextAlignment.SetBinding (EntryCell.HorizontalTextAlignmentProperty, new Binding ("Alignment"));

			Assert.AreEqual (TextAlignment.Center, entryCellXAlign.XAlign);
			Assert.AreEqual (TextAlignment.Center, entryCellHorizontalTextAlignment.HorizontalTextAlignment);

			vm.Alignment = TextAlignment.End;

			Assert.AreEqual (TextAlignment.End, entryCellXAlign.XAlign);
			Assert.AreEqual (TextAlignment.End, entryCellHorizontalTextAlignment.HorizontalTextAlignment);
		}
示例#32
0
		public void ChangingHorizontalTextAlignmentFiresXAlignChanged ()
		{
			var entryCell = new EntryCell { HorizontalTextAlignment = TextAlignment.Center };

			var xAlignFired = false;
			var horizontalTextAlignmentFired = false;

			entryCell.PropertyChanged += (sender, args) => {
				if (args.PropertyName == "XAlign") {
					xAlignFired	= true;
				} else if (args.PropertyName == EntryCell.HorizontalTextAlignmentProperty.PropertyName) {
					horizontalTextAlignmentFired = true;
				}
			};

			entryCell.HorizontalTextAlignment = TextAlignment.End;

			Assert.True(xAlignFired);
			Assert.True(horizontalTextAlignmentFired);
		}
示例#33
0
		static void UpdateHorizontalTextAlignment(EntryCellTableViewCell cell, EntryCell entryCell)
		{
			cell.TextField.TextAlignment = entryCell.HorizontalTextAlignment.ToNativeTextAlignment();
		}
示例#34
0
		static void UpdateText(EntryCellTableViewCell cell, EntryCell entryCell)
		{
			if (cell.TextField.Text == entryCell.Text)
				return;
			// double sets side effect on iOS, YAY
			cell.TextField.Text = entryCell.Text;
		}
示例#35
0
		static void UpdatePlaceholder(EntryCellTableViewCell cell, EntryCell entryCell)
		{
			cell.TextField.Placeholder = entryCell.Placeholder;
		}
示例#36
0
		static void UpdateLabelColor(EntryCellTableViewCell cell, EntryCell entryCell)
		{
			cell.TextLabel.TextColor = entryCell.LabelColor.ToUIColor(DefaultTextColor);
		}
示例#37
0
		static void UpdateLabel(EntryCellTableViewCell cell, EntryCell entryCell)
		{
			cell.TextLabel.Text = entryCell.Label;
		}
示例#38
0
		static void UpdateKeyboard(EntryCellTableViewCell cell, EntryCell entryCell)
		{
			cell.TextField.ApplyKeyboard(entryCell.Keyboard);
		}
示例#39
0
		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;
		}
示例#40
0
		public EntryCellTablePage ()
		{
			Title = "EntryCell Table Gallery - Legacy";

			Device.OnPlatform (iOS: () => {
				if (Device.Idiom == TargetIdiom.Tablet) {
					Padding = new Thickness (0, 0, 0, 60);
				}
			});

			int timesEntered = 1;

			var entryCell = new EntryCell { Label = "Enter text", Placeholder = "I am a placeholder" };
			entryCell.Completed += (sender, args) => {
				((EntryCell)sender).Label = "Entered: " + timesEntered;
				timesEntered++;
			};

			var tableSection = new TableSection ("Section One") {
				new EntryCell { Label = "disabled", Placeholder = "disabled", IsEnabled = false },
				new EntryCell { Label = "Text 2" },
				new EntryCell { Label = "Text 3", Placeholder = "Placeholder 2" },
				new EntryCell { Label = "Text 4" },
				new EntryCell { Label = "Text 5", Placeholder = "Placeholder 3" },
				new EntryCell { Label = "Text 6" },
				new EntryCell { Label = "Text 7", Placeholder = "Placeholder 4" },
				new EntryCell { Label = "Text 8" },
				new EntryCell { Label = "Text 9", Placeholder = "Placeholder 5" },
				new EntryCell { Label = "Text 10" },
				new EntryCell { Label = "Text 11", Placeholder = "Placeholder 6" },
				new EntryCell { Label = "Text 12" },
				new EntryCell { Label = "Text 13", Placeholder = "Placeholder 7" },
				new EntryCell { Label = "Text 14" },
				new EntryCell { Label = "Text 15", Placeholder = "Placeholder 8" },
				new EntryCell { Label = "Text 16" },
				entryCell
			};

			var tableSectionTwo = new TableSection ("Section Two") {
				new EntryCell { Label = "Text 17", Placeholder = "Placeholder 9" },
				new EntryCell { Label = "Text 18" },
				new EntryCell { Label = "Text 19", Placeholder = "Placeholder 10" },
				new EntryCell { Label = "Text 20" },
				new EntryCell { Label = "Text 21", Placeholder = "Placeholder 11" },
				new EntryCell { Label = "Text 22" },
				new EntryCell { Label = "Text 23", Placeholder = "Placeholder 12" },
				new EntryCell { Label = "Text 24" },
				new EntryCell { Label = "Text 25", Placeholder = "Placeholder 13" },
				new EntryCell { Label = "Text 26" },
				new EntryCell { Label = "Text 27", Placeholder = "Placeholder 14" },
				new EntryCell { Label = "Text 28" },
				new EntryCell { Label = "Text 29", Placeholder = "Placeholder 15" },
				new EntryCell { Label = "Text 30" },
				new EntryCell { Label = "Text 31", Placeholder = "Placeholder 16" },
				new EntryCell { Label = "Text 32" },
			};

			var keyboards = new TableSection ("Keyboards") {
				new EntryCell { Label = "Chat", Keyboard = Keyboard.Chat },
				new EntryCell { Label = "Default", Keyboard = Keyboard.Default },
				new EntryCell { Label = "Email", Keyboard = Keyboard.Email },
				new EntryCell { Label = "Numeric", Keyboard = Keyboard.Numeric },
				new EntryCell { Label = "Telephone", Keyboard = Keyboard.Telephone },
				new EntryCell { Label = "Text", Keyboard = Keyboard.Text },
				new EntryCell { Label = "Url", Keyboard = Keyboard.Url }
			};

			var root = new TableRoot ("Text Cell table") {
				tableSection,
				tableSectionTwo,
				keyboards
			};

			var table = new TableView {
				Root = root
			};

			Content = table;
		}