Ejemplo n.º 1
0
        public void TestGetSections()
        {
            var model = new TableRoot("Name")
            {
                new TableSection("Section 1")
                {
                    new TextCell {
                        Text = "Item 1.1", Detail = "Hint 1"
                    },
                    new TextCell {
                        Text = "Item 1.2", Detail = "Hint 2"
                    },
                    new TextCell {
                        Text = "Item 1.3", Detail = "Hint 3"
                    }
                },
                new TableSection("Section 2")
                {
                    new TextCell {
                        Text = "Item 2.1", Detail = "Hint 1"
                    },
                    new TextCell {
                        Text = "Item 2.2", Detail = "Hint 2"
                    },
                    new TextCell {
                        Text = "Item 2.3", Detail = "Hint 3"
                    }
                }
            };

            Assert.AreEqual(2, model.Count);
        }
Ejemplo n.º 2
0
		public MenuPage ()
		{
			Title = "LoginPattern";
			Icon = "slideout.png";

			var section = new TableSection () {
				new TextCell {Text = "Sessions"},
				new TextCell {Text = "Speakers"},
				new TextCell {Text = "Favorites"},
				new TextCell {Text = "Room Plan"},
				new TextCell {Text = "Map"},
			};

			var root = new TableRoot () {section} ;

			tableView = new TableView ()
			{ 
				Root = root,
				Intent = TableIntent.Menu,
			};

			var logoutButton = new Button { Text = "Logout" };
			logoutButton.Clicked += (sender, e) => {
				App.Current.Logout();
			};

			Content = new StackLayout {
				BackgroundColor = Color.Gray,
				VerticalOptions = LayoutOptions.FillAndExpand,
				Children = {
					tableView, 
					logoutButton
				}
			};
		}
Ejemplo n.º 3
0
        public StepPage(Steps step)
        {
            Title = string.Format("{0}: Pick an Activity", StepNames.LookUpStepNameGivenCode (step));
            Debug.WriteLine ("Screen for step: " + step);
            theStep = step;

            lblStepTotal = new Label () {
                FontSize = 14, FontAttributes = FontAttributes.Italic, HorizontalOptions = LayoutOptions.Center,
                TextColor = Color.Red,
            };

            tableRoot = new TableRoot ("TableRoot");
            ts = new TableSection ();

            tableView = new TableView {
                Intent = TableIntent.Form,
                Root = tableRoot,
            };

            // Define command for the items in the TableView.
            navigateCommand =
                new Command<Activity> (async (Activity a) => {
                Debug.WriteLine ("navigate to Activity =" + a.FullName);
                Page page = new ActivityPage (a);
                await this.Navigation.PushAsync (page);
            });

            ListSubTasks ();

            //Title = string.Format("{0} ({1} points earned)", StepNames.LookUpStepNameGivenCode (theStep), ListSubTasks ());
        }
Ejemplo n.º 4
0
		public SettingsScreen ()
		{
			Intent = TableIntent.Settings;
			var cell = new TextCell { Text = "Coverflow", Detail = "Value 1" };

			var boolCell = new SwitchCell { Text = "Off" };
			boolCell.OnChanged += (sender, arg) => boolCell.Text = boolCell.On ? "On" : "Off";

			var root = new TableRoot () {
				new TableSection () {
					cell,
					new TextCell { Text = "Cell 2", Detail = "Value 2" },
					new EntryCell {
						Label = "Label",
						Placeholder = "Placeholder 1",
						HorizontalTextAlignment = TextAlignment.Center,
						Keyboard = Keyboard.Numeric
					},
					new ImageCell { Text = "Hello", Detail = "World", ImageSource = "cover1.jpg" }
				},
				new TableSection ("Styles") {
					boolCell,
					new EntryCell {
						Label = "Label2",
						Placeholder = "Placeholder 2",
						HorizontalTextAlignment = TextAlignment.Center,
						Keyboard = Keyboard.Chat
					},
				},
				new TableSection ("Custom Cells") {
					new ViewCell { View = new Button (){ Text = "Hi" } },
				}
			};
			Root = root;
		}
Ejemplo n.º 5
0
        protected override void Init()
        {
            var ts = new TableSection();
            var tr = new TableRoot {
                ts
            };
            var tv = new TableView(tr);

            var sc = new SwitchCell
            {
                Text = "Toggle switch; nothing should crash"
            };

            var button = new Button();

            button.SetBinding(Button.TextProperty, new Binding("On", source: sc));

            var vc = new ViewCell
            {
                View = button
            };

            vc.SetBinding(Cell.IsEnabledProperty, new Binding("On", source: sc));

            ts.Add(sc);
            ts.Add(vc);

            Content = tv;
        }
Ejemplo n.º 6
0
        private void refreshTable()
        {
            TableView    table       = configuratorTable;
            TableRoot    tempRoot    = new TableRoot();
            TableSection tempSection = new TableSection();

            for (int i = 0; i < windowOfThisPage.conf.items.Count; i++)
            {
                if (!windowOfThisPage.conf.items[i].isDaughter)
                {
                    ViewCell tempCell = new ViewCell
                    {
                        View = new Label
                        {
                            Text              = windowOfThisPage.conf.items[i].getName(),
                            VerticalOptions   = LayoutOptions.Center,
                            HorizontalOptions = LayoutOptions.Center,
                            FontSize          = 20
                        }
                    };
                    tempSection.Add(tempCell);
                }
            }
            tempRoot.Add(tempSection);
            table.Root = tempRoot;
        }
Ejemplo n.º 7
0
        private void PopulateNews()
        {
            IEnumerable <News> catchNews = News.RetrieveFromJson("http://www.taiwanbus.tw/app_api/New_N.ashx");
            TableView          table     = new TableView();

            table.Intent = TableIntent.Form;
            TableRoot troot = new TableRoot();

            table.Root = troot;
            TableSection section = new TableSection();

            troot.Add(section);
            foreach (News catchNew in catchNews)
            {
                TextCell newsCell = new TextCell();
                newsCell.Text        = catchNew.Updatetime;
                newsCell.TextColor   = Color.Red;
                newsCell.Detail      = catchNew.title;
                newsCell.DetailColor = Color.Black;
                newsCell.Tapped     += (object sender, EventArgs e) =>
                {
                    this.Navigation.PushAsync(new NewsDetailPage(catchNew.id));
                };
                section.Add(newsCell);
            }
            Content = table;
        }
Ejemplo n.º 8
0
        public TableViewGallery()
        {
            var section = new TableSection("Section One")
            {
                new ViewCell {
                    View = new Label {
                        Text = "View Cell 1"
                    }
                },
                new ViewCell {
                    View = new Label {
                        Text = "View Cell 2"
                    }
                }
            };

            var root = new TableRoot("Table")
            {
                section
            };

            var tableLayout = new TableView
            {
                Root      = root,
                RowHeight = 100
            };

            Content = tableLayout;
        }
Ejemplo n.º 9
0
        private void ReadDatabase(TableRoot TableRoot)
        {
            List <DProduct> productsList = GetProducts();

            TableSection sectionServices = new TableSection("Services");
            TableSection sectionProducts = new TableSection("Products");

            foreach (DProduct product in productsList)
            {
                if (product.Category == "Service")
                {
                    sectionServices.Add(new ImageCell
                    {
                        ImageSource = product.ImageUrl,
                        Text        = product.Name,
                        TextColor   = Color.Black,
                        Detail      = product.Description,
                        DetailColor = Color.Navy
                    });
                }
                else
                {
                    sectionProducts.Add(new ImageCell
                    {
                        ImageSource = product.ImageUrl,
                        Text        = product.Name,
                        TextColor   = Color.Black,
                        Detail      = product.Description,
                        DetailColor = Color.Navy
                    });
                }
            }
            TableRoot.Add(new TableSection[] { sectionServices, sectionProducts });
        }
Ejemplo n.º 10
0
            public TestCaseScreen()
            {
                AutomationId = "TestCasesIssueList";

                Intent = TableIntent.Settings;

                var assembly = typeof(TestCases).GetTypeInfo().Assembly;

                _issues =
                    (from typeInfo in assembly.DefinedTypes.Select(o => o.AsType().GetTypeInfo())
                     where typeInfo.GetCustomAttribute <IssueAttribute> () != null
                     let attribute = typeInfo.GetCustomAttribute <IssueAttribute> ()
                                     select new IssueModel {
                    IssueTracker = attribute.IssueTracker,
                    IssueNumber = attribute.IssueNumber,
                    IssueTestNumber = attribute.IssueTestNumber,
                    Name = attribute.DisplayName,
                    Description = attribute.Description,
                    Action = ActivatePageAndNavigate(attribute, typeInfo.AsType())
                }).ToList();

                var root    = new TableRoot();
                var section = new TableSection("Bug Repro");

                root.Add(section);

                VerifyNoDuplicates();

                FilterIssues();
            }
Ejemplo n.º 11
0
        private void AddItem()
        {
            root      = new TableRoot();
            tableview = new TableView()
            {
                Root = root
            };

            if (TypeItem == CollectionPage.TypeItemsOfColl.Constellation)
            {
                AddConstellation();
            }
            else if (TypeItem == CollectionPage.TypeItemsOfColl.Star)
            {
                AddStar();
            }
            else if (TypeItem == CollectionPage.TypeItemsOfColl.Planet)
            {
                AddPlanet();
            }

            SaveButton = new Button()
            {
                Text = "Добавить"
            };
            SaveButton.Clicked += (s, e_) => SaveButton_Clicked(s, e_);

            OurStackLayout.Children.Add(tableview);
            OurStackLayout.Children.Add(SaveButton);
        }
        Cell GetCategoryCell(string cat)
        {
            var cell = new TextCell {
                Text = cat
            };

            cell.Tapped += (sender, ea) => {;
                                            var category = cat;

                                            var tableView = new TableView();
                                            var root      = new TableRoot(category);
                                            var section   = new TableSection();
                                            section.Add(exampleInfoList
                                                        .Where(e => e.Category == category)
                                                        .OrderBy(e => e.Title)
                                                        .Select(e => GetGraphCell(e.Title)));
                                            root.Add(section);
                                            tableView.Root = root;

                                            var contentPage = new ContentPage {
                                                Title   = category,
                                                Content = new StackLayout {
                                                    Children = { tableView }
                                                }
                                            };

                                            Navigation.PushAsync(contentPage); };
            return(cell);
        }
Ejemplo n.º 13
0
        private void ScanComplete(object sender, EventArgs e)
        {
            // Xam Forms requires us to redraw the table root to add new content
            var tr = new TableRoot();
            var fs = new TableSection("Test Assemblies");

            foreach (var ta in viewModel.TestAssemblies)
            {
                var ts = new TextCell {
                    BindingContext = ta
                };
                ts.SetBinding(TextCell.TextProperty, "DisplayName");
                ts.SetBinding(TextCell.DetailProperty, "DetailText");
                ts.SetBinding(TextCell.DetailColorProperty, "RunStatus", converter: AssemblyRunStatusConverter);

                ts.Command          = viewModel.NavigateToTestAssemblyCommand;
                ts.CommandParameter = ts.BindingContext;

                fs.Add(ts);
            }
            tr.Add(fs);     // add the first section

            var run = new TextCell
            {
                Text    = "Run Everything",
                Command = viewModel.RunEverythingCommand,
            };

            table.Root.Skip(1)
            .First()
            .Insert(0, run);
            tr.Add(table.Root.Skip(1));     // Skip the first section and add the others

            table.Root = tr;
        }
Ejemplo n.º 14
0
        protected override void Init()
        {
            var tableview = new TableView();

            var section = new TableSection("Settings");

            section.Add(new TextCell {
                Text = "TextCell"
            });
            section.Add(new TextCell {
                Text = "TextCell"
            });
            section.Add(new EntryCell {
                Text = "EntryCell", Keyboard = Keyboard.Numeric
            });
            section.Add(new EntryCell {
                Text = "EntryCell", Keyboard = Keyboard.Numeric
            });
            var root = new TableRoot("Main");

            root.Add(section);

            tableview.Root = root;

            Content = tableview;
        }
Ejemplo n.º 15
0
	    private void ScanComplete(object sender, EventArgs e)
	    {
            // Xam Forms requires us to redraw the table root to add new content
	        var tr = new TableRoot();
	        var fs = new TableSection("Test Assemblies");

	        foreach (var ta in viewModel.TestAssemblies)
	        {
	            var ts = new TextCell {BindingContext = ta};
	            ts.SetBinding(TextCell.TextProperty, "DisplayName");
	            ts.SetBinding(TextCell.DetailProperty, "DetailText");
	            ts.SetBinding(TextCell.DetailColorProperty, "DetailColor");

	            ts.Command = viewModel.NavigateToTestAssemblyCommand;
	            ts.CommandParameter = ts.BindingContext;
                
                fs.Add(ts);
	        }
	        tr.Add(fs); // add the first section

	        var run = new TextCell
	        {
	            Text = "Run Everything",
	            Command = viewModel.RunEverythingCommand,
	        };

	        table.Root.Skip(1)
                .First()
	             .Insert(0, run);
	        tr.Add(table.Root.Skip(1)); // Skip the first section and add the others

	        table.Root = tr;

	    }
Ejemplo n.º 16
0
        protected override void OnAppearing()
        {
            base.OnAppearing();

            mainField.Content = new TableView();
            TableRoot    tempRoot    = new TableRoot();
            TableSection tempSection = new TableSection();
            ViewCell     tempCell;

            for (int i = 0; i < DataBase.lamps.Count; i++)
            {
                string tempText   = DataBase.lamps[i].Name;
                string tempId     = DataBase.lamps[i].id.ToString();
                bool   tempIsAuto = DataBase.lamps[i].isAuto;
                bool   tempValue  = Convert.ToBoolean(DataBase.lamps[i].curValue);
                Grid   grid       = new Grid
                {
                    ColumnDefinitions =
                    {
                        new ColumnDefinition {
                            Width = GridLength.Star
                        },
                        new ColumnDefinition {
                            Width = GridLength.Auto
                        },
                        new ColumnDefinition {
                            Width = 40
                        },
                        new ColumnDefinition {
                            Width = 60
                        }
                    }
                };
                grid.Children.Add(new Label {
                    HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Center, Text = tempText, FontSize = 25
                }, 0, 0);
                grid.Children.Add(new Label {
                    HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, Text = "id:" + tempId, FontSize = 10, TextColor = Color.Gray
                }, 1, 0);
                ImageButton tempImgButton = new ImageButton {
                    HorizontalOptions = LayoutOptions.Center, BackgroundColor = Color.White, VerticalOptions = LayoutOptions.Center, Source = "mySettings_small.png"
                };
                tempImgButton.Clicked += ImageButton_Clicked;
                grid.Children.Add(tempImgButton, 2, 0);
                Switch tempSwitch = new Switch {
                    HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, IsEnabled = !tempIsAuto, IsToggled = tempValue
                };
                tempSwitch.Toggled += TempSwitch_Toggled;
                grid.Children.Add(tempSwitch, 3, 0);
                tempCell = new ViewCell
                {
                    View = grid
                };
                tempSection.Add(tempCell);
            }
            tempRoot.Add(tempSection);
            TableView tempView = mainField.Content as TableView;

            tempView.Root = tempRoot;
        }
Ejemplo n.º 17
0
        public StepPage(Steps step)
        {
            Title = string.Format("{0}: Pick an Activity", StepNames.LookUpStepNameGivenCode(step));
            Debug.WriteLine("Screen for step: " + step);
            theStep = step;

            lblStepTotal = new Label()
            {
                FontSize  = 14, FontAttributes = FontAttributes.Italic, HorizontalOptions = LayoutOptions.Center,
                TextColor = Color.Red,
            };

            tableRoot = new TableRoot("TableRoot");
            ts        = new TableSection();

            tableView = new TableView {
                Intent = TableIntent.Form,
                Root   = tableRoot,
            };

            // Define command for the items in the TableView.
            navigateCommand =
                new Command <Activity> (async(Activity a) => {
                Debug.WriteLine("navigate to Activity =" + a.FullName);
                Page page = new ActivityPage(a);
                await this.Navigation.PushAsync(page);
            });

            ListSubTasks();

            //Title = string.Format("{0} ({1} points earned)", StepNames.LookUpStepNameGivenCode (theStep), ListSubTasks ());
        }
Ejemplo n.º 18
0
        public Issue214()
        {
            var instructions = new Label {
                Text = "The text of each item should be visually distinct from the " +
                       "detail of each item. If both typefaces are identical, this test has failed."
            };

            var items = Enumerable.Range(0, 50).Select(i => new TextCell {
                Text   = "Text" + i.ToString(),
                Detail = "Detail" + i.ToString()
            }).ToList();

            var tableSection = new TableSection("First Section");

            foreach (TextCell cell in items)
            {
                tableSection.Add(cell);
            }

            var tableRoot = new TableRoot()
            {
                tableSection
            };

            var tableLayout = new TableView {
                Root = tableRoot
            };

            tableLayout.Intent = TableIntent.Data;
            Content            = new StackLayout
            {
                Children = { instructions, tableLayout }
            };
        }
Ejemplo n.º 19
0
        public static int tableRetrieve(uint a, TableRoot table, out ACTCVertex refe)
        {
            int i1 = (int)a / (LEVEL2COUNT * LEVEL3COUNT);
            int i2 = ((int)a / LEVEL3COUNT) % LEVEL2COUNT;
            int i3 = (int)a % LEVEL3COUNT;

            refe = null;

            if (table.Table[i1] == null)
            {
                return(0);
            }

            if (table.Table[i1].Table[i2] == null)
            {
                return(0);
            }

            if (table.Table[i1].Table[i2].IsSet[i3] == false)
            {
                return(0);
            }

            refe = table.Table[i1].Table[i2].Table[i3];
            return(1);
        }
Ejemplo n.º 20
0
        public SvcInfoPage(string busSvcName)
        {
            Label header = new Label
            {
                Text              = busSvcName + "Route Information",
                FontSize          = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                HorizontalOptions = LayoutOptions.Center
            };

            var view = new TableView()
            {
                Intent = TableIntent.Settings
            };
            var root    = new TableRoot();
            var section = new TableSection();

            foreach (string busStopCode in BusHelper.BusSvcs[busSvcName].stops)
            {
                section.Add(new BusStopCell(busStopCode));
            }

            root.Add(section);
            view.Root = root;

            Content = new StackLayout
            {
                Children =
                {
                    header,
                    view
                }
            };
        }
		Cell GetCategoryCell (string cat) {
			var cell = new TextCell {Text = cat};
			cell.Tapped += (sender, ea) => {;
				var category = cat;

				var tableView = new TableView ();
				var root = new TableRoot (category);
				var section = new TableSection ();
				section.Add (exampleInfoList
					.Where (e => e.Category == category)
					.OrderBy (e => e.Title)
					.Select (e => GetGraphCell(e.Title) ));
				root.Add (section);
				tableView.Root = root;

				var contentPage = new ContentPage {
					Title = category,
					Content = new StackLayout {
						Children = {tableView}
					}
				};

				Navigation.PushAsync (contentPage);
			};
			return cell;
		}
Ejemplo n.º 22
0
        protected override void OnAppearing()
        {
            base.OnAppearing();

            mainField.Content = new TableView();
            TableRoot    tempRoot    = new TableRoot();
            TableSection tempSection = new TableSection();
            ViewCell     tempCell;

            for (int i = 0; i < DataBase.sensors.Count; i++)
            {
                string tempText  = DataBase.sensors[i].Name;
                string tempId    = DataBase.sensors[i].id.ToString();
                int    tempValue = DataBase.sensors[i].Value;
                Grid   grid      = new Grid
                {
                    ColumnDefinitions =
                    {
                        new ColumnDefinition {
                            Width = GridLength.Star
                        },
                        new ColumnDefinition {
                            Width = GridLength.Auto
                        },
                        new ColumnDefinition {
                            Width = 40
                        },
                        new ColumnDefinition {
                            Width = 60
                        }
                    }
                };
                grid.Children.Add(new Label {
                    HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Center, Text = tempText, FontSize = 25
                }, 0, 0);
                grid.Children.Add(new Label {
                    HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, Text = "id:" + tempId, FontSize = 10, TextColor = Color.Gray
                }, 1, 0);
                Label tempLabel = new Label()
                {
                    Text = Convert.ToString(tempValue), FontSize = 20, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center
                };
                grid.Children.Add(tempLabel, 3, 0);
                ImageButton tempButton = new ImageButton()
                {
                    Source = "mySettings_small.png", BackgroundColor = Color.White, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center
                };
                tempButton.Clicked += TempButton_Clicked;
                grid.Children.Add(tempButton, 2, 0);
                tempCell = new ViewCell
                {
                    View = grid
                };
                tempSection.Add(tempCell);
            }
            tempRoot.Add(tempSection);
            TableView tempView = mainField.Content as TableView;

            tempView.Root = tempRoot;
        }
Ejemplo n.º 23
0
        public Issue260()
        {
            var items = Enumerable.Range(0, 50).Select(i => new TextCell
            {
                Text   = i.ToString(),
                Detail = i.ToString()
            }).ToList();

            var tableSection = new TableSection("First Section");

            foreach (TextCell cell in items)
            {
                tableSection.Add(cell);
            }

            var tableRoot = new TableRoot()
            {
                tableSection
            };

            var tableLayout = new TableView
            {
                Root = tableRoot
            };

            tableLayout.Intent = TableIntent.Data;
            Content            = tableLayout;
        }
Ejemplo n.º 24
0
		public HelpPage ()
		{

			var helpOptions = new TableSection ("User Guide");
			foreach (string option in CONSTANTS.helpOptions) {
				var cell = new TextCell {
					Text = option, 
					TextColor = Color.White,
					Command = new Command (async o => await Application.Current.MainPage.Navigation.PushModalAsync (new HelpOptionPage(option[8]))),
				};

				helpOptions.Add (cell);
			}

			Title = "Help Page";
			Icon = "Help.png";

			TableRoot root = new TableRoot ();
			root.Add (helpOptions);
			TableView tableView = new TableView (root);

			var stackLayout = new StackLayout ();
			stackLayout.Children.Add (tableView);
			Content = stackLayout;

		}
Ejemplo n.º 25
0
        public void Ctor()
        {
            const string title = "FooBar";
            var          model = new TableRoot(title);

            Assert.AreEqual(title, model.Title);
        }
Ejemplo n.º 26
0
		protected override void Init()
		{
			var ts = new TableSection();
			var tr = new TableRoot { ts };
			var tv = new TableView(tr);

			var sc = new SwitchCell
			{
				Text = "Toggle switch; nothing should crash"
			};

			var button = new Button();
			button.SetBinding(Button.TextProperty, new Binding("On", source: sc));

			var vc = new ViewCell
			{
				View = button
			};
			vc.SetBinding(IsEnabledProperty, new Binding("On", source: sc));

			ts.Add(sc);
			ts.Add(vc);

			Content = tv;
		}
Ejemplo n.º 27
0
        private void InitializeComponents()
        {
            // Primero: Creamos el Layout
            // *Cuando sólo hay un control en el Page no se usa Layout

            // Segundo: Agregamos los controles al Layout
            categoriesTable = new TableView();
            TableRoot tableRoot = new TableRoot ("Categorías");
            categoriesTable.Root = tableRoot;
            categoriesTable.HasUnevenRows = true;
            categoriesTable.Intent = TableIntent.Data;

            foreach( Category category in categories ) {
                TableSection section = new TableSection ( category.ToString() );
                foreach( Subcategory subcategory in subcategories ) {
                    TextCell cell = new TextCell ();
                    cell.Text = subcategory.ToString ();
                    cell.Detail = "Prueba";
                    cell.Tapped += (object sender, EventArgs e) => {
                        Navigation.PushAsync(
                            new ProductsPage( category, subcategory )
                        );
                    };
                    section.Add ( cell );
                }
                tableRoot.Add ( section );
            }

            // Tercero: Asignamos el Layout como contenido del Page
            Content = categoriesTable;
        }
Ejemplo n.º 28
0
		public MenuPage (MasterDetailPage m)
		{
			master = m;

			Title = "Evolve13";
			Icon = "slideout.png";

			var section = new TableSection () {
				new MenuCell {Text = "Sessions", Host = this},
				new MenuCell {Text = "Speakers", Host = this},
				new MenuCell {Text = "Favorites", Host = this},
				new MenuCell {Text = "Room Plan", Host = this},
				new MenuCell {Text = "Map", Host = this},
				new MenuCell {Text = "About", Host = this},
			};

			var root = new TableRoot () {section} ;
		
			tableView = new MenuTableView ()
			{ 
				Root = root,
//				HeaderTemplate = new DataTemplate (typeof(MenuHeader)),
				Intent = TableIntent.Menu,
			};


			Content = new StackLayout {
				BackgroundColor = Color.Gray,
				VerticalOptions = LayoutOptions.FillAndExpand,
				Children = {tableView}
			};
		}
Ejemplo n.º 29
0
        public GameOptionsPage()
        {
            Title = "Standard Game Options";

            var table = new TableView()
            {
                Intent = TableIntent.Settings
            };
            var root     = new TableRoot();
            var section1 = new TableSection()
            {
                Title = "Enable Sound"
            };
            var section2 = new TableSection()
            {
                Title = "Game Time"
            };

            var switchSound = new SwitchCell {
                Text = "Sound On"
            };

            //switchSound.OnChanged += SwitchSound_OnChanged;

            section1.Add(switchSound);
            table.Root = root;
            root.Add(section1);
            root.Add(section2);

            Content = table;
        }
		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;
		}
Ejemplo n.º 31
0
        public static void tableDelete(TableRoot table)
        {
            int i1, i2, i3;

            for (i1 = 0; i1 < LEVEL1COUNT; i1++)
            {
                if (table.Table[i1] != null)
                {
                    for (i2 = 0; i2 < LEVEL2COUNT; i2++)
                    {
                        if (table.Table[i1].Table[i2] != null)
                        {
                            for (i3 = 0; i3 < LEVEL3COUNT; i3++)
                            {
                                if (table.Table[i1].Table[i2].IsSet[i3] != false)
                                {
                                    table.Table[i1].Table[i2].IsSet[i3] = false;
                                    //table.Table[i1].Table[i2].Table[i3] = null;
                                }
                            }
                            //free(table.Table[i1].Table[i2]);
                        }
                    }
                    //free(table.Table[i1]);
                    table.Table[i1] = null;
                }
            }
            table.TotalEntryCount = 0;
            table.EmptyEntryCount = 0;
            //table.TotalAllocatedBytes = 0;

            table = new TableRoot();
        }
Ejemplo n.º 32
0
        private async void Init()
        {
            var samples = new[]
            {
                typeof (TcpSocketListenerPage),
                typeof (TcpSocketClientPage),
                typeof (UdpSocketReceiverPage),
                typeof (UdpSocketClientPage),
                typeof (UdpSocketMulticastClientPage),
            };

            var netCell = new TextCell() {Text = "View Network Interfaces "};
            netCell.Tapped += (sender, args) =>
            {
                var netPage = new NetworkInterfacesPage()
                {
                    Title = "Network Interfaces"
                };

                _parentTabPage.Children.Add(netPage);
            };

            var cells = await Task.Run(() => samples.Select(t =>
            {
                var title = t.Name.Substring(0, t.Name.IndexOf("Page", StringComparison.Ordinal));

                var cell = new TextCell()
                {
                    Text = String.Format("Add {0}", title)
                };

                cell.Tapped += (sender, args) =>
                {
                    var page = (ContentPage)Activator.CreateInstance(t);
                    page.Title = title;
                    _parentTabPage.Children.Add(page);
                };

                return cell;

            })
                .Concat(new[]
                {
                    netCell
                    // more cells here, one day . . . 
                })            
                .ToList());

            var tableRoot = new TableRoot() {new TableSection("Classes") { cells } };
            var tableView = new TableView(tableRoot);

			this.Content = new StackLayout {
				Padding = new Thickness (0, Device.OnPlatform (20, 0, 0), 0, 0),
				Children = { 
					tableView
				}
			};
        }
Ejemplo n.º 33
0
		public SelectionPage(MultiCell cell, string title, string[] items, string key, int defaultValue)
		{
			this.cell = cell;
			this.items = items;
			this.key = key;
			this.defaultValue = defaultValue;

			Title = Catalog.GetString(title);

			NavigationPage.SetTitleIcon(this, "HomeIcon.png");
			NavigationPage.SetBackButtonTitle(this, string.Empty);

			section = new TableSection();

			var active = 0;

			if (cell.Values == null)
			{
				active = Settings.Current.GetValueOrDefault<int>(key, defaultValue);
			}
			else
			{
				active = Array.IndexOf(cell.Values, Settings.Current.GetValueOrDefault<string>(key, cell.Values[defaultValue]));
				active = active < 0 ? 0 : active;
			}

			cells = new CheckCell[items.Length];

			for(int i = 0; i < items.Length; i++)
			{
				cells[i] = new CheckCell
					{
						Text = items[i],
						TextColor = App.Colors.Text,
					};

				cells[i].Index = i;
				cells[i].Checkmark = i == active;
				cells[i].Tapped += HandleTapped;

				section.Add(cells[i]);
			}

			var tableRoot = new TableRoot() 
				{
					section,
				};

			var tableView = new TableView() 
				{
					BackgroundColor = App.Colors.Background,
					Intent = TableIntent.Settings,
					Root = tableRoot,
					HasUnevenRows = true,
				};

			Content = tableView;
		}
Ejemplo n.º 34
0
        protected override void Init()
        {
            StackLayout stackLayout = new StackLayout();

            Content = stackLayout;

            var instructions = new Label
            {
                Text = $@"Tap the ""{_btnText}"" button. Then click on the picker inside the Table. The picker should display ""test 0"". If not, the test failed."
            };

            stackLayout.Children.Add(instructions);

            TableView tableView = new TableView();

            stackLayout.Children.Add(tableView);

            TableRoot tableRoot = new TableRoot();

            tableView.Root = tableRoot;

            TableSection tableSection = new TableSection("Table");

            tableRoot.Add(tableSection);

            ViewCell viewCell = new ViewCell();

            tableSection.Add(viewCell);

            ContentView contentView = new ContentView();

            contentView.HorizontalOptions = LayoutOptions.FillAndExpand;
            viewCell.View = contentView;

            _pickerTable = new Picker();
            _pickerTable.AutomationId      = _pickerTableId;
            _pickerTable.HorizontalOptions = LayoutOptions.FillAndExpand;
            contentView.Content            = _pickerTable;

            Label label = new Label();

            label.Text = "Normal";
            stackLayout.Children.Add(label);

            _pickerNormal = new Picker();
            stackLayout.Children.Add(_pickerNormal);

            Button button = new Button();

            button.Clicked += button_Clicked;
            button.Text     = _btnText;
            stackLayout.Children.Add(button);

            //button_Clicked(button, EventArgs.Empty);
            _pickerTable.SelectedIndex  = 0;
            _pickerNormal.SelectedIndex = 0;
        }
Ejemplo n.º 35
0
        public HomePage(string title)
        {
            BackgroundColor = Color.Gray.WithLuminosity(.9);
            Title = title;
            Padding = 0;
            PopupButton = new ToolbarItem
            {
                Text = "Show Popup",
                Priority = 0
            };

            ToolbarItems.Add(PopupButton);
            PopupButton.Clicked += ((object sender, EventArgs e) =>
            {
                if (!PopupContent.PopupVisible)
                {
                    #region popup content

                    //optional remove popup toolbaritem from navigation bar
                    ToolbarItems.Remove(PopupButton);

                    TableRoot = new TableRoot();
                    TableView = new TableView(TableRoot)
                    {
                        Intent = TableIntent.Data,
                        HasUnevenRows = false
                    };
                    TableSection = new TableSection("");
                    TableRoot.Add(TableSection);
                    for (var i = 0; i < 20; i++)
                    {
                        TableSection.Add(new SwitchCell { Text = "Switch Cell #" + i });
                    }

                    //scale the size of the modal popup min=.25 max=1 default=.80 optional title
                    //if the size=1 the dialog will fill the content area like a sheet window

                    PopupContent.ShowPopup(TableView, 1, modal: true, title: "Perfect Popup ");
                    foreach (var cell1 in TableSection)
                    {
                        var cell = (SwitchCell)cell1;
                        cell.OnChanged += ((cellsender, cellevent) =>
                        {
                            PopupContent.PopupChanged = true;
                            
                        });
                    }

                    #endregion
                }
                else
                {
                    PopupContent.DismisPopup();
                }
            });
        }
Ejemplo n.º 36
0
        public HomePage(string title)
        {
            BackgroundColor = Color.Gray.WithLuminosity(.9);
            Title = title;
            Padding = 0;
            PopupButton = new ToolbarItem
            {
                Text = "Show Popup",
                Priority = 0
            };

            ToolbarItems.Add(PopupButton);
            PopupButton.Clicked += ((object sender, EventArgs e) =>
            {
                if (!PopupContent.PopupVisible)
                {
                    #region popup content

                    //optional remove popup toolbaritem from navigation bar
                    ToolbarItems.Remove(PopupButton);

                    TableRoot = new TableRoot();
                    TableView = new TableView(TableRoot)
                    {
                        Intent = TableIntent.Data,
                        HasUnevenRows = false
                    };
                    TableSection = new TableSection("");
                    TableRoot.Add(TableSection);
                    for (var i = 0; i < 20; i++)
                    {
                        TableSection.Add(new SwitchCell { Text = "Switch Cell #" + i });
                    }

                    //scale the size of the modal popup min=.25 max=1 default=.80 optional title
                    //if the size=1 the dialog will fill the content area like a sheet window

                    PopupContent.ShowPopup(TableView, 1, modal: true, title: "Perfect Popup ");
                    foreach (var cell1 in TableSection)
                    {
                        var cell = (SwitchCell)cell1;
                        cell.OnChanged += ((cellsender, cellevent) =>
                        {
                            PopupContent.PopupChanged = true;

                        });
                    }

                    #endregion
                }
                else
                {
                    PopupContent.DismisPopup();
                }
            });
        }
Ejemplo n.º 37
0
        /// <summary>
        /// Actual drawing operations are performed in this method
        /// </summary>
        internal void Draw()
        {
            /// Sets title bar
            TitleBar titleBar = new TitleBar();

            /// Sets left button text
            titleBar.LeftButton.Text = "Cancel";
            /// Sets right button text
            titleBar.RightButton.Text = "OK";
            /// Sets title label
            titleBar.TitleLabel.Text = "Select";

            /// Sets event callback when right button is called (update the tone info)
            titleBar.RightButton.Clicked += (s, e) =>
            {
                AlarmModel.BindableAlarmRecord.AlarmToneType = AlarmToneRow.newValue;
                Navigation.PopAsync();
            };

            // Sets default tone table cell
            defaultTone = new AlarmToneTableCell(AlarmToneTypes.Default, this);

            // Sets alarm mp3 tone table cell
            alarmMP3Tone = new AlarmToneTableCell(AlarmToneTypes.AlarmMp3, this);

            // Sets ringtone tone table cell
            ringtoneMP3Tone = new AlarmToneTableCell(AlarmToneTypes.RingtoneSdk, this);

            /// Sets table root to hold all three table cells
            TableRoot root = new TableRoot()
            {
                new TableSection()
                {
                    defaultTone,
                    alarmMP3Tone,
                    ringtoneMP3Tone,
                }
            };

            // TableView to show each tone type
            TableView alarmToneTable = new TableView(root);

            // Main StackLayout
            // titlebar and alarmToneTable are added
            StackLayout mainLayout = new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          =
                {
                    titleBar,
                    alarmToneTable
                }
            };

            Content = mainLayout;
        }
Ejemplo n.º 38
0
        private void InitialiseInfo()
        {
            TableRoot tableRoot = tableInfo.Root;

            tableRoot.Clear();

            tableRoot.Add(CreateDeviceInfoSection(environmentInfo.Device));
            tableRoot.Add(CreatePlatformInfoSection(environmentInfo.Platform));
            tableRoot.Add(CreateApplicationInfoSection(environmentInfo.Application));
        }
Ejemplo n.º 39
0
        public MenuPage(MasterDetailPage m)
        {
            master          = m;
            BackgroundColor = App.NavTint;
            Title           = "menu";
            Icon            = "slideout.png";

            var section = new TableSection()
            {
                new MenuCell {
                    Text = "Home", MenuOption = MenuOption.Home, Host = this
                },
                new MenuCell {
                    Text = "Sessions", MenuOption = MenuOption.Sessions, Host = this
                },
                new MenuCell {
                    Text = "Tracks", MenuOption = MenuOption.Tracks, Host = this
                },
                new MenuCell {
                    Text = "Speakers", MenuOption = MenuOption.Speakers, Host = this
                },
                new MenuCell {
                    Text = "Sponsors", MenuOption = MenuOption.Sponsors, Host = this
                },
                new MenuCell {
                    Text = "Twitter", MenuOption = MenuOption.Twitter, Host = this
                },
                new MenuCell {
                    Text = "Location", MenuOption = MenuOption.Location, Host = this
                },
                new MenuCell {
                    Text = "About", MenuOption = MenuOption.About, Host = this
                },
            };

            var root = new TableRoot()
            {
                section
            };


            tableView = new MenuTableView()
            {
                Root = root,
//				HeaderTemplate = new DataTemplate (typeof(MenuHeader)),
                Intent = TableIntent.Menu,
            };


            Content = new StackLayout {
                BackgroundColor = App.NavTint,
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children        = { tableView }
            };
        }
Ejemplo n.º 40
0
        protected override void Init()
        {
            _viewModel = new _37841ViewModel();

            var instructions = new Label {
                FontSize = 16, Text = @"Click on the Generate button. 
The EntryCell should display '12345' and the TextCell should display '6789'. 
Click on the Generate button a second time. 
The EntryCell should display '112358' and the TextCell should display '48151623'."
            };

            var button = new Button {
                Text = "Generate"
            };

            button.SetBinding(Button.CommandProperty, nameof(_37841ViewModel.GetNextNumbersCommand));

            var random1 = new EntryCell {
                IsEnabled = false, Label = "Entry Cell"
            };

            random1.SetBinding(EntryCell.TextProperty, nameof(_37841ViewModel.Value1));

            var textCell = new TextCell {
                IsEnabled = false, Detail = "TextCell"
            };

            textCell.SetBinding(TextCell.TextProperty, nameof(_37841ViewModel.Value2));

            var buttonViewCell = new ViewCell {
                View = button
            };

            var section = new TableSection("")
            {
                random1,
                textCell,
                buttonViewCell
            };

            var root = new TableRoot {
                section
            };
            var tv = new TableView {
                Root = root
            };

            Content = new StackLayout
            {
                Children = { instructions, tv }
            };

            BindingContext = _viewModel;
        }
Ejemplo n.º 41
0
        public SettingsScreen()
        {
            Intent = TableIntent.Settings;
            var cell = new TextCell {
                Text = "Coverflow", Detail = "Value 1"
            };

            var boolCell = new SwitchCell {
                Text = "Off"
            };

            boolCell.OnChanged += (sender, arg) => boolCell.Text = boolCell.On ? "On" : "Off";

            var root = new TableRoot()
            {
                new TableSection()
                {
                    cell,
                    new TextCell {
                        Text = "Cell 2", Detail = "Value 2"
                    },
                    new EntryCell {
                        Label                   = "Label",
                        Placeholder             = "Placeholder 1",
                        HorizontalTextAlignment = TextAlignment.Center,
                        Keyboard                = Keyboard.Numeric
                    },
                    new ImageCell {
                        Text = "Hello", Detail = "World", ImageSource = "cover1.jpg"
                    }
                },
                new TableSection("Styles")
                {
                    boolCell,
                    new EntryCell {
                        Label                   = "Label2",
                        Placeholder             = "Placeholder 2",
                        HorizontalTextAlignment = TextAlignment.Center,
                        Keyboard                = Keyboard.Chat
                    },
                },
                new TableSection("Custom Cells")
                {
                    new ViewCell {
                        View = new Button()
                        {
                            Text = "Hi"
                        }
                    },
                }
            };

            Root = root;
        }
Ejemplo n.º 42
0
 /// <summary>
 /// Sets the root of the table.
 /// </summary>
 /// <param name="root">TableRoot, which is parent to one or more TableSections.</param>
 public void ApplyTableRoot(TableRoot root)
 {
     Clear();
     foreach (TableSection ts in root)
     {
         if (!string.IsNullOrEmpty(ts.Title))
         {
             AddSectionTitle(ts.Title, ts.TextColor);
         }
         AddSource(ts);
     }
 }
Ejemplo n.º 43
0
        public MenuPage()
        {
            Title = "LoginPattern";
            Icon  = "slideout.png";

            var section = new TableSection()
            {
                new TextCell {
                    Text = "Sessions"
                },
                new TextCell {
                    Text = "Speakers"
                },
                new TextCell {
                    Text = "Favorites"
                },
                new TextCell {
                    Text = "Room Plan"
                },
                new TextCell {
                    Text = "Map"
                },
            };

            var root = new TableRoot()
            {
                section
            };

            tableView = new TableView()
            {
                Root   = root,
                Intent = TableIntent.Menu,
            };

            var logoutButton = new Button {
                Text = "Logout"
            };

            logoutButton.Clicked += (sender, e) => {
                TodoREST.App.Current.Logout();
            };

            Content = new StackLayout {
                BackgroundColor = Color.Gray,
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children        =
                {
                    tableView,
                    logoutButton
                }
            };
        }
Ejemplo n.º 44
0
		public TextCellTablePage ()
		{
			Title = "TextCell Table Gallery - Legacy";

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

			var tableSection = new TableSection ("Section One") {
				new TextCell { Text = "Text 1" },
				new TextCell { Text = "Text 2", Detail = "Detail 1" },
				new TextCell { Text = "Text 3" },
				new TextCell { Text = "Text 4", Detail = "Detail 2" },
				new TextCell { Text = "Text 5" },
				new TextCell { Text = "Text 6", Detail = "Detail 3" },
				new TextCell { Text = "Text 7" },
				new TextCell { Text = "Text 8", Detail = "Detail 4" },
				new TextCell { Text = "Text 9" },
				new TextCell { Text = "Text 10", Detail = "Detail 5" },
				new TextCell { Text = "Text 11" },
				new TextCell { Text = "Text 12", Detail = "Detail 6" }
			};

			var tableSectionTwo = new TableSection ("Section Two") {
				new TextCell { Text = "Text 13" },
				new TextCell { Text = "Text 14", Detail = "Detail 7" },
				new TextCell { Text = "Text 15" },
				new TextCell { Text = "Text 16", Detail = "Detail 8" },
				new TextCell { Text = "Text 17" },
				new TextCell { Text = "Text 18", Detail = "Detail 9" },
				new TextCell { Text = "Text 19" },
				new TextCell { Text = "Text 20", Detail = "Detail 10" },
				new TextCell { Text = "Text 21" },
				new TextCell { Text = "Text 22", Detail = "Detail 11" },
				new TextCell { Text = "Text 23" },
				new TextCell { Text = "Text 24", Detail = "Detail 12" }
			};

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

			var table = new TableView {
				Root = root,
			};

			Content = table;
		}
		public SwitchCellDemoCode ()
		{
			this.Title = "SwitchCell";
			var table = new TableView ();
			var root = new TableRoot ();
			var section1 = new TableSection ();

			var switchOn = new SwitchCell { Text = "On", On = true };
			var switchOff = new SwitchCell { Text = "Off", On = false };

			section1.Add (switchOn); 
			section1.Add (switchOff);

			Content = table;
		}
Ejemplo n.º 46
0
		public void TestGetSections ()
		{
			var model = new TableRoot ("Name") {
				new TableSection ("Section 1") {
					new TextCell { Text = "Item 1.1", Detail = "Hint 1"},
					new TextCell { Text = "Item 1.2", Detail = "Hint 2"},
					new TextCell { Text = "Item 1.3", Detail = "Hint 3"}
				},
				new TableSection ("Section 2") {
					new TextCell { Text = "Item 2.1", Detail = "Hint 1"},
					new TextCell { Text = "Item 2.2", Detail = "Hint 2"},
					new TextCell { Text = "Item 2.3", Detail = "Hint 3"}
				}
			};

			Assert.AreEqual (2, model.Count);
		}
Ejemplo n.º 47
0
		public TableViewGallery () {

			var section = new TableSection ("Section One") {
				new ViewCell { View = new Label { Text = "View Cell 1" } },
				new ViewCell { View = new Label { Text = "View Cell 2" } }
			};

			var root = new TableRoot ("Table") {
				section
			};

			var tableLayout = new TableView {
				Root = root,
				RowHeight = 100
			};

			Content = tableLayout;
		}
Ejemplo n.º 48
0
		public void TestCollectionChanged ()
		{
			var model = new TableRoot ();

			bool changed = false;
			model.CollectionChanged += (sender, e) => changed = true;

			model.Add (new TableSection ("Foo"));

			Assert.True (changed);

			changed = false;

			model [0].Add (new TextCell { Text = "Foobar" });

			// Our tree is not supposed to track up like this
			Assert.False (changed);
		}
		public ExampleList ()
		{
			exampleInfoList = ExampleLibrary.Examples.GetList();

			var tableView = new TableView ();
			var root = new TableRoot ("OxyPlot Example Browser");
			var section = new TableSection ();
			section.Add (exampleInfoList
				.GroupBy (e => e.Category)
				.OrderBy (g => g.Key)
				.Select (g => GetCategoryCell (g.Key)));
			root.Add (section);
			tableView.Root = root;

			Content = new StackLayout {
				Children = {tableView}
			};
		}
Ejemplo n.º 50
0
		public void buildUI(){
			var section = new TableSection ("Assets");
			foreach(FilterObject element in assetFilterData){
				var cell = new SwitchCell {
					Text = element.Name, 
					On = element.IsSelected,
				};
				cell.OnChanged += switchedCellAsset;
				cell.Tapped += tappedCellAsset;

				section.Add (cell);
				switchList.Add (cell);
			}

			var dzSection = new TableSection ("Danger Zones");
			foreach(FilterObject element in dzFilterData){
				var cell = new SwitchCell {
					Text = element.Name, 
					On = element.IsSelected,
				};
				cell.OnChanged += switchedCellDZ;
				cell.Tapped += tappedCellDZ;

				dzSection.Add (cell);
				dzSwitchList.Add (cell);
			}

			TableRoot root = new TableRoot ();
			root.Add (section);
			root.Add (dzSection);
			TableView tableView = new TableView (root);

			Content = tableView;

			ToolbarItem allOnTBI;
			ToolbarItem allOffTBI;

			allOnTBI = new ToolbarItem ("All", "", allOn, 0, 0);
			allOffTBI = new ToolbarItem ("None", "", allOff, 0, 0);

			//Change map type
			ToolbarItems.Add (allOnTBI);
			ToolbarItems.Add (allOffTBI);
		}
Ejemplo n.º 51
0
		public Issue1777 ()
		{
			StackLayout stackLayout = new StackLayout();
			Content = stackLayout;

			TableView tableView = new TableView();
			stackLayout.Children.Add( tableView);

			TableRoot tableRoot = new TableRoot();
			tableView.Root = tableRoot;

			TableSection tableSection = new TableSection("Table");
			tableRoot.Add(tableSection);

			ViewCell viewCell = new ViewCell ();
			tableSection.Add (viewCell);

			ContentView contentView = new ContentView ();
			contentView.HorizontalOptions = LayoutOptions.FillAndExpand;
			viewCell.View = contentView;

			_pickerTable = new Picker ();
			_pickerTable.HorizontalOptions = LayoutOptions.FillAndExpand;
			contentView.Content = _pickerTable;

			Label label = new Label ();
			label.Text = "Normal";
			stackLayout.Children.Add (label);

			_pickerNormal = new Picker ();
			stackLayout.Children.Add (_pickerNormal);

			Button button = new Button ();
			button.Clicked += button_Clicked;
			button.Text = "do magic";
			stackLayout.Children.Add (button);

			//button_Clicked(button, EventArgs.Empty);
			_pickerTable.SelectedIndex = 0;
			_pickerNormal.SelectedIndex = 0;
		}
Ejemplo n.º 52
0
		public void TestTree ()
		{
			var model = new TableRoot ("Name") {
				new TableSection ("Section 1") {
					new TextCell { Text = "Item 1.1", Detail = "Hint 1"},
					new TextCell { Text = "Item 1.2", Detail = "Hint 2"},
					new TextCell { Text = "Item 1.3", Detail = "Hint 3"}
				},
				new TableSection {
					new TextCell { Text = "Item 2.1", Detail = "Hint 1"},
					new TextCell { Text = "Item 2.2", Detail = "Hint 2"},
					new TextCell { Text = "Item 2.3", Detail = "Hint 3"}
				}
			};
			
			Assert.AreEqual ("Item 1.1", (model[0][0] as TextCell).Text);
			Assert.AreEqual ("Item 1.2", (model[0][1] as TextCell).Text);
			Assert.AreEqual ("Item 1.3", (model[0][2] as TextCell).Text);
			Assert.AreEqual ("Item 2.1", (model[1][0] as TextCell).Text);
			Assert.AreEqual ("Item 2.2", (model[1][1] as TextCell).Text);
			Assert.AreEqual ("Item 2.3", (model[1][2] as TextCell).Text);
		}
		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;
		}
Ejemplo n.º 54
0
		public Issue214 ()
		{
			var items = Enumerable.Range (0, 50).Select (i => new TextCell {
				Text = i.ToString (),
				Detail = i.ToString ()
			}).ToList ();

			var tableSection = new TableSection("First Section");
			foreach (TextCell cell in items) {
				tableSection.Add (cell);
			}

			var tableRoot = new TableRoot () {
				tableSection
			};

			var tableLayout = new TableView {
				Root = tableRoot
			};

			tableLayout.Intent = TableIntent.Data;
			Content = tableLayout;
		}
Ejemplo n.º 55
0
		public TableViewPage ()
		{
			Title = "TableView";

			// sample code from http://developer.xamarin.com/api/type/Xamarin.Forms.TableView/
			var root = new TableRoot ("Table Title") {
				new TableSection ("Section 1 Title") {
					new TextCell {
						Text = "TextCell Text",
						Detail = "TextCell Detail"
					},
					new EntryCell {
						Label = "EntryCell:",
						Placeholder = "default keyboard",
						Keyboard = Keyboard.Default
					}
				},
				new TableSection ("Section 2 Title") {
					new EntryCell {
						Label = "Another EntryCell:",
						Placeholder = "phone keyboard",
						Keyboard = Keyboard.Telephone
					},
					new SwitchCell {
						Text = "SwitchCell:"
					}
				}
			};

			var tv = new TableView {
				Intent = TableIntent.Form,
				Root = root
			};

			Content = tv;
		}
Ejemplo n.º 56
0
			void RemoveEvents(TableRoot tableRoot)
			{
				if (tableRoot == null)
					return;

				tableRoot.CollectionChanged -= _parent.CollectionChanged;
				tableRoot.SectionCollectionChanged -= _parent.OnSectionCollectionChanged;
			}
Ejemplo n.º 57
0
        public MenuPage(RootPage rootPage)
        {
            Icon = "menu.png";
            Title = "menu"; // The Title property must be set.

            this.rootPage = rootPage;

            var logoutButton = new Button { Text = "Logout" };
            logoutButton.Clicked += (sender, e) =>
            {
                App.Current.LogOut();
            };
            var layout = new StackLayout
            {
                Spacing = 0,
                VerticalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor = Color.FromHex("2C3E50"),
            };
            var section = new TableSection()
            {
                new MenuCell {Text = "Home",Host= this,ImageSrc="home.png"},
                new MenuCell {Text = "Favorites",Host= this,ImageSrc="favorite.png"},
                new MenuCell {Text = "About",Host= this,ImageSrc="about.png"},
            };
            var root = new TableRoot() { section };

            tableView = new MenuTableView()
            {
                Root = root,
                Intent = TableIntent.Data,
                BackgroundColor = Color.FromHex("2C3E50"),
            };

            var settingView = new SettingsUserView();

            //settingView.tapped += (object sender, TapViewEventHandler e) =>
            //{

            //    Navigation.PushAsync(new Profile());
            //    // var home = new NavigationPage(new Profile());
            //    // rootPage.Detail = home;
            //};

            layout.Children.Add(settingView);
            //layout.Children.Add(new BoxView()
            //{
            //    HeightRequest = 1,
            //    BackgroundColor = AppStyle.DarkLabelColor,
            //});
            layout.Children.Add(tableView);
            layout.Children.Add(logoutButton);

            Content = layout;

            var tapGestureRecognizer = new TapGestureRecognizer();
            tapGestureRecognizer.Tapped +=
                (sender, e) =>
                {
                    NavigationPage profile = new NavigationPage(new Profile(settingView.profileViewModel.myProfile)) { BarBackgroundColor = App.BrandColor };
                    rootPage.Detail = profile;
                    rootPage.IsPresented = false;
                };
            settingView.GestureRecognizers.Add(tapGestureRecognizer);
 
        }
Ejemplo n.º 58
0
		public AdminPage ()
		{
			Title = "Administration";

			//User Data
			var data = DataManager.getInstance ();

			List<EIMAUser> list = data.getUsers ();


	
			//List<EIMAUser> userData = data.getUsers ();

			// Sort the users by privilege level
			List<EIMAUser> noAccessUsers = new List<EIMAUser> ();
			foreach (EIMAUser user in list) {
				if (user.level == "noAccess") {
					noAccessUsers.Add (user);
				}
			}

			List<EIMAUser> standardUsers = new List<EIMAUser> ();
			foreach (EIMAUser user in list) {
				if (user.level == "user") {
					standardUsers.Add (user);
				}
			}

			List<EIMAUser> mapEditors = new List<EIMAUser> ();
			foreach (EIMAUser user in list) {
				if (user.level == "mapEditor") {
					mapEditors.Add (user);
				}
			}

			List<EIMAUser> admins = new List<EIMAUser> ();
			foreach (EIMAUser user in list) {
				if (user.level == "admin") {
					admins.Add (user);
				}
			}
			admins.ForEach (Console.WriteLine);
			TableRoot root = new TableRoot ();
			var noAccess = new TableSection ("No Access");
			foreach (EIMAUser user in noAccessUsers) {
				var cell = new TextCell {
					Text = user.username, 
					TextColor = Color.White,
					Command = new Command (async o => await Application.Current.MainPage.Navigation.PushModalAsync (new UserInfoPage (user)))
				};
				noAccess.Add (cell);
			}

			var standardUser = new TableSection ("Standard Users");
			foreach (EIMAUser user in standardUsers) {
				var cell = new TextCell {
					Text = user.username, 
					TextColor = Color.White,
					Command = new Command (async o => await Application.Current.MainPage.Navigation.PushModalAsync (new UserInfoPage (user))),
				};

				standardUser.Add (cell);
			}

			var mapEditor = new TableSection ("Map Editors");
			foreach (EIMAUser user in mapEditors) {
				var cell = new TextCell {
					Text = user.username, 
					TextColor = Color.White,
					Command = new Command (async o => await Application.Current.MainPage.Navigation.PushModalAsync (new UserInfoPage (user))),
				};

				mapEditor.Add (cell);
			}

			var admin = new TableSection ("Admins");
			foreach (EIMAUser user in admins) {
				var cell = new TextCell {
					Text = user.username, 
					TextColor = Color.White,
					Command = new Command (async o => await Application.Current.MainPage.Navigation.PushModalAsync (new UserInfoPage (user))),
				};

				admin.Add (cell);
			}

			var refreshButton = new Button();

			// big command to refresh the page with updated privilege levels
			Command command1 = new Command (c => {

				root.Remove (noAccess);
				root.Remove (standardUser);
				root.Remove (mapEditor);
				root.Remove (admin);


				foreach (EIMAUser user in Users.userList) {
					if (noAccessUsers.Contains(user)) {
						noAccessUsers.Remove (user);
					}
					else if (standardUsers.Contains(user)) {
						standardUsers.Remove (user);
					}
					else if (mapEditors.Contains(user)) {
						mapEditors.Remove (user);
					}
					else if (admins.Contains(user)) {
						admins.Remove (user);
					}
				}

				foreach (EIMAUser user in Users.userList){
					if (user.level == "noAccess") { 
						noAccessUsers.Add(user);
					} else if (user.level == "user") { 
						standardUsers.Add(user);
					}	else if (user.level == "mapEditor") { 
						mapEditors.Add(user);
					} else if (user.level == "admin") {
						admins.Add(user);
					}
				}
				Users.userList.Clear();

				noAccess = new TableSection ("No Access");
				foreach (EIMAUser user in noAccessUsers) {
					var cell = new TextCell {
						Text = user.username, 
						TextColor = Color.White,
						Command = new Command (async o => await Application.Current.MainPage.Navigation.PushModalAsync (new UserInfoPage (user)))
					};
					noAccess.Add (cell);
				}

				standardUser = new TableSection ("Standard Users");
				foreach (EIMAUser user in standardUsers) {
					var cell = new TextCell {
						Text = user.username, 
						TextColor = Color.White,
						Command = new Command (async o => await Application.Current.MainPage.Navigation.PushModalAsync (new UserInfoPage (user))),
					};

					standardUser.Add (cell);
				}

				mapEditor = new TableSection ("Map Editors");
				foreach (EIMAUser user in mapEditors) {
					var cell = new TextCell {
						Text = user.username, 
						TextColor = Color.White,
						Command = new Command (async o => await Application.Current.MainPage.Navigation.PushModalAsync (new UserInfoPage (user))),
					};

					mapEditor.Add (cell);
				}

				admin = new TableSection ("Admins");
				foreach (EIMAUser user in admins) {
					var cell = new TextCell {
						Text = user.username, 
						TextColor = Color.White,
						Command = new Command (async o => await Application.Current.MainPage.Navigation.PushModalAsync (new UserInfoPage (user))),
					};

					admin.Add (cell);
				}
					
				root.Add(noAccess);
				root.Add(standardUser);
				root.Add(mapEditor);
				root.Add(admin);

				var stackLayout2 = new StackLayout ();
				TableView tableView2 = new TableView (root);
				stackLayout2.Children.Add (tableView2);
				stackLayout2.Children.Add (refreshButton);
				Content = stackLayout2;
			});

			refreshButton = new Button {
				Text = "Refresh",
				HorizontalOptions = LayoutOptions.Center,
				Command = command1,
			};

			root.Add (noAccess);
			root.Add (standardUser);
			root.Add (mapEditor);
			root.Add (admin);
			TableView tableView = new TableView (root);
			var stackLayout = new StackLayout ();
			stackLayout.Children.Add (tableView);
			stackLayout.Children.Add (refreshButton);
			Content = stackLayout;

		}
Ejemplo n.º 59
0
		public void Ctor()
		{
			const string title = "FooBar";
			var model = new TableRoot (title);
			Assert.AreEqual (title, model.Title);
		}
Ejemplo n.º 60
0
		public TableView(TableRoot root)
		{
			VerticalOptions = HorizontalOptions = LayoutOptions.FillAndExpand;
			Model = _tableModel = new TableSectionModel(this, root);
		}