Example #1
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;
        }
Example #2
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;
		}
Example #4
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;

	    }
Example #5
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));
        }
Example #6
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;
        }
Example #7
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
                }
            };
        }
Example #8
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;

		}
        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);
        }
Example #10
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;
        }
		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;
		}
Example #12
0
        private FieldGroup GetGroup(string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                name = ObjectEditor.Translate("Extra");
            }
            var ret = FieldGroups.FirstOrDefault(d => d.Name.Equals(name));

            if (ret == null)
            {
                ret = new FieldGroup()
                {
                    Name = name
                };

                ret.View = new TableSection()
                {
                    Title = name
                };

                ret.Fields = new ObservableCollection <EditableField>();
                table.Add(ret.View as TableSection);

                FieldGroups.Add(ret);
            }
            return(ret);
        }
Example #13
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;
        }
Example #14
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;
        }
Example #15
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;
        }
Example #16
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();
            }
Example #17
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 });
        }
Example #18
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;
        }
Example #19
0
        async Task RefreshVotesAsync()
        {
            // Get results
            var results = await api.Backend.GetVoteResultAsync(this.survey);

            if (results.Length == 0)
            {
                DisplayAlert("No Votes", "At the moment, there are no Votes/Results available", "OK");
            }

            // Get the sum of all votes
            int sum = 0;

            foreach (var r in results)
            {
                sum += r.Count;
            }

            root.Clear();
            // create internal representation
            foreach (var r in results)
            {
                double       quot = ((double)r.Count / (double)sum);
                TableSection ts   = new TableSection(" ")
                {
                    new TextCell {
                        Text = r.Answer.AnswerText + " (" + ((int)(quot * 100)) + " %)"
                    },
                    new ViewCell {
                        View = new ProgressBar {
                            Progress = quot, HeightRequest = 50, MinimumHeightRequest = 50
                        }
                    },
                };
                root.Add(ts);
            }
            TableSection tss = new TableSection(" Total Amount of Votes: ")
            {
                new TextCell {
                    Text = sum.ToString()
                }
            };

            root.Add(tss);

            IsBusy = false;
        }
        public ArcadeGameOptionsPage()
        {
            //Content = new StackLayout {
            //	Children = {
            //	   new tog
            //	}
            //};

            Title = "Arcade 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 text = new TextCell { Text = "TextCell", Detail = "TextCell Detail" };
            //var entry = new EntryCell { Text = "EntryCell Text", Label = "Entry Label" };
            var switchSound = new SwitchCell {
                Text = "Sound On"
            };

            switchSound.OnChanged += SwitchSound_OnChanged;
            //var image = new ImageCell { Text = "ImageCell Text", Detail = "ImageCell Detail", ImageSource = "XamarinLogo.png" };

            section1.Add(switchSound);
            //section1.Add(entry);
            //section1.Add(switchc);
            //section1.Add(image);
            //section2.Add(text);
            //section2.Add(entry);
            //section2.Add(switchc);
            //section2.Add(image);
            table.Root = root;
            root.Add(section1);
            root.Add(section2);

            Content = table;
        }
        public TableView()
        {
            InitializeComponent();
            this.Title = "LiftMore";
            var table = new Xamarin.Forms.TableView()
            {
                Intent = TableIntent.Data
            };
            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;
        }
Example #22
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;
        }
Example #23
0
        public MenuIntentCode()
        {
            this.Title = "Menu Intent";
            var table = new TableView()
            {
                Intent = TableIntent.Menu
            };
            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;
        }
Example #24
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);
		}
Example #25
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();
                }
            });
        }
Example #26
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();
                }
            });
        }
Example #27
0
        public NewNoteTableView()
        {
            this.Title = "Create";
            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 textCell = new TextCell()
            {
                Text = "Create a new reminder", Detail = "Enter info below to create a new notification"
            };
            var entryCell = new EntryCell()
            {
                Placeholder = "Enter your reminder text"
            };
            var switchCell = new SwitchCell()
            {
                Text = "Select reminder mode"
            };

            section1.Add(textCell);
            section1.Add(entryCell);

            section2.Add(switchCell);

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

            Content = table;
        }
Example #28
0
            public void FilterIssues(string filter = null)
            {
                _filter = filter;

                PageToAction.Clear();

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

                root.Add(section);

                var issueCells = Enumerable.Empty <TextCell>();

                if (!_filterBugzilla)
                {
                    var bugzillaIssueCells =
                        from issueModel in _issues
                        where issueModel.IssueTracker == IssueTracker.Bugzilla && issueModel.Matches(filter)
                        orderby issueModel.IssueNumber descending
                        select MakeIssueCell(issueModel.Name, issueModel.Description, issueModel.Action);

                    issueCells = issueCells.Concat(bugzillaIssueCells);
                }

                if (!_filterGitHub)
                {
                    var githubIssueCells =
                        from issueModel in _issues
                        where issueModel.IssueTracker == IssueTracker.Github && issueModel.Matches(filter)
                        orderby issueModel.IssueNumber descending
                        select MakeIssueCell(issueModel.Name, issueModel.Description, issueModel.Action);

                    issueCells = issueCells.Concat(githubIssueCells);
                }

                if (!_filterNone)
                {
                    var untrackedIssueCells =
                        from issueModel in _issues
                        where issueModel.IssueTracker == IssueTracker.None && issueModel.Matches(filter)
                        orderby issueModel.IssueNumber descending, issueModel.Description
                    select MakeIssueCell(issueModel.Name, issueModel.Description, issueModel.Action);

                    issueCells = issueCells.Concat(untrackedIssueCells);
                }

                foreach (var issueCell in issueCells)
                {
                    section.Add(issueCell);
                }

                Root = root;
            }
Example #29
0
        static TableView GetTableView()
        {
            var tableSection = new TableSection("Picker");

            tableSection.Add(new PickerCell());
            var root = new TableRoot("Root");

            root.Add(tableSection);
            var table = new TableView(root);

            return(table);
        }
        private void DisplayTherapist()
        {
            var languageTableSection       = CreateLanguageTableSection();
            var qualificationTableSections = CreateQualificationTableSections();
            var contactTableSection        = CreateOverallContactTableSection();
            var officeTableSection         = CreateOfficeTableSection();

            TableRoot.Add(languageTableSection);
            TableRoot.Add(contactTableSection);
            TableRoot.Add(officeTableSection);
            TableRoot.Add(qualificationTableSections);
        }
Example #31
0
        public SettingsPage()
        {
            // create table view
            var view = new TableView()
            {
                Intent = TableIntent.Settings
            };
            var root = new TableRoot();

            var mapSection = new TableSection("Map Display");

            foreach (KeyValuePair <string, SettingsVarObj> variable in
                     SettingsVars.Variables.Where(v => v.Value.section.Equals(SettingsVars.Section.MAP)))
            {
                mapSection.Add(new PickerCell(variable.Value, OnSelectedIndexChanged));
            }
            root.Add(mapSection);
            var alertSection = new TableSection("Alerts");

            foreach (KeyValuePair <string, SettingsVarObj> variable in
                     SettingsVars.Variables.Where(v => v.Value.section.Equals(SettingsVars.Section.ALERTS)))
            {
                alertSection.Add(new PickerCell(variable.Value, OnSelectedIndexChanged));
            }
            root.Add(alertSection);
            view.Root = root;

            // create stack for all items
            var stack = new StackLayout {
                Spacing = 0, Margin = 0
            };

            stack.Children.Add(view);

            Icon    = "SettingsTabIcon.png";
            Title   = "Settings";
            Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0);
            Content = stack;
        }
Example #32
0
        public VioalationView()
        {
            TableView table = new TableView
            {
                Intent = TableIntent.Form
            };
            TableRoot tableroot = new TableRoot();

            TableSection section = new TableSection();

            section.Title = "Нарушение";

            var cell = new TextCell();

            cell.Text = "Регламентирующий докумен";
            cell.SetBinding(TextCell.DetailProperty, "ArticleReference");
            section.Add(cell);

            cell      = new TextCell();
            cell.Text = "Регламентирующий докумен";
            cell.SetBinding(TextCell.DetailProperty, "ArticleReference");
            section.Add(cell);

            cell      = new TextCell();
            cell.Text = "Дата и время начала нарушения";
            cell.SetBinding(TextCell.DetailProperty, "BeginTime");
            section.Add(cell);

            cell      = new TextCell();
            cell.Text = "Дата и время окончания нарушения";
            cell.SetBinding(TextCell.DetailProperty, "EndTime");
            section.Add(cell);

            cell      = new TextCell();
            cell.Text = "Описание нарушения";
            cell.SetBinding(TextCell.DetailProperty, "Description");
            section.Add(cell);

            cell      = new TextCell();
            cell.Text = "Регламентированное значение";
            cell.SetBinding(TextCell.DetailProperty, "RegimentedValue");
            section.Add(cell);

            cell      = new TextCell();
            cell.Text = "Фактическое значение";
            cell.SetBinding(TextCell.DetailProperty, "ActualValue");
            section.Add(cell);
            tableroot.Add(section);
            table.Root   = tableroot;
            this.Content = table;
        }
Example #33
0
        private void ListSubTasks()
        {
            string detailLine;
            int    stepTotal = 0;

            ts.Clear();
            tableRoot.Clear();

            var activityList = ActivityTable.Activities [theStep];

            foreach (var act in activityList)
            {
                int subScore = StartPage.CalculateScore(App.Database.GetCurrentTasksBySubStep(act.SubStep));
                stepTotal += subScore;
                detailLine = string.Empty;
                if (subScore > 0)
                {
                    if (act.OneTimeOnly)
                    {
                        detailLine = string.Format("({0} points, 1-time only task)", subScore);
                    }
                    else
                    {
                        detailLine = string.Format("({0} points earned)", subScore);
                    }
                }
                ts.Add(new TextCell {
                    Text        = string.Format("{0} (worth {1} points)", act.FullName, act.Score),
                    Detail      = detailLine,
                    DetailColor = Color.Red,
                    Command     = navigateCommand, CommandParameter = act,
                });
            }
            ;
            tableRoot.Add(ts);
            tableView.Root = tableRoot;
            if (stepTotal > 0)
            {
                lblStepTotal.Text = string.Format("{0} points earned for this step", stepTotal);
            }

            // Build the page.
            this.Content = new StackLayout {
                Children =
                {
                    lblStepTotal,
                    tableView
                }
            };
        }
Example #34
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;
        }
Example #35
0
        protected override void OnAppearing()
        {
            base.OnAppearing();

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

            milesImageCell = new RightImageCell {
                Title   = "Miles",
                Source  = "check",
                Command = new Command(() => {
                    milesImageCell.ImageIsVisible = !milesImageCell.ImageIsVisible;
                    if (kmImageCell.ImageIsVisible)
                    {
                        kmImageCell.ImageIsVisible = false;
                    }

                    SimpleRun.Models.Settings.MeasurementType = DistanceUnit.Miles;
                }),
                ImageIsVisible = SimpleRun.Models.Settings.MeasurementType == DistanceUnit.Miles
            };

            kmImageCell = new RightImageCell {
                Title   = "Kilometers",
                Source  = "check",
                Command = new Command(() => {
                    kmImageCell.ImageIsVisible = !kmImageCell.ImageIsVisible;
                    if (milesImageCell.ImageIsVisible)
                    {
                        milesImageCell.ImageIsVisible = false;
                    }

                    SimpleRun.Models.Settings.MeasurementType = DistanceUnit.Kilometers;
                }),
                ImageIsVisible = SimpleRun.Models.Settings.MeasurementType == DistanceUnit.Kilometers
            };

            var root    = new TableRoot();
            var section = new TableSection("Distance Unit");

            section.Add(kmImageCell);
            section.Add(milesImageCell);
            root.Add(section);

            tableView.Root = root;
            Content        = tableView;
        }
Example #36
0
        /// <summary>
        /// Initialize this instance.
        /// </summary>
        void Initialize()
        {
            var layout = new StackLayout
            {
                VerticalOptions = LayoutOptions.Center
            };

            Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5);
            Content = layout;

            var loadingPage = new LoadingPage(async(page) =>
            {
                var vm       = ViewModelFactory.Get <RootViewModel>();
                var products = await vm.GetProducts();

                var kv = products.GroupBy(p => p.Category, p => p, (key, value) => new { Key = key, Value = value });

                var tableRoot = new TableRoot();

                foreach (var obj in kv)
                {
                    tableRoot.Add(GetTableSection(obj.Key, obj.Value));
                }

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

                page.OnLoaded(tableView);
            }, "Chargement du catalogue");


            loadingPage.Loaded += async(sender, e) => {
                var label = new Label
                {
                    Text              = "T-Shirt shop",
                    FontSize          = 36.0,
                    TextColor         = Color.FromRgb(52, 152, 219),
                    HorizontalOptions = LayoutOptions.Center
                };
                layout.Children.Add(label);
                layout.Children.Add((TableView)e);
                await Navigation.PopModalAsync();
            };
            Navigation.PushModalAsync(loadingPage);
        }
Example #37
0
        internal void ResetChecklists()
        {
            ActivityIndicator indicator = new ActivityIndicator()
            {
                IsEnabled = true,
                IsRunning = true,
                IsVisible = true,
                Color     = Color.Red,
            };
            TableView    checklistsView       = new TableView();
            TableRoot    root                 = new TableRoot("Select a Checklist");
            TableSection tempChecklistSection = new TableSection();

            checklistsView.Intent = TableIntent.Menu;
            //TableSection inspectorSection = new TableSection();
            List <ViewCell> cells = new List <ViewCell>();

            foreach (ChecklistModel checklist in checklists)
            {
                ChecklistButton button = new ChecklistButton();
                button.Clicked          += ChecklistHelper.ChecklistButtonClicked;
                button.Text              = checklist.Title;
                button.checklist         = checklist;
                button.HorizontalOptions = LayoutOptions.Start;

                ViewCell cell = new ViewCell
                {
                    View = button,
                };

                BoundMenuItem <ChecklistModel> Delete = new BoundMenuItem <ChecklistModel> {
                    Text = "Delete", BoundObject = checklist, IsDestructive = true
                };
                Delete.Clicked += DeleteChecklist;
                cell.ContextActions.Add(Delete);

                cells.Add(cell);
            }
            tempChecklistSection.Add(cells);
            tempChecklistSection.Add(ResetCell);
            root.Add(tempChecklistSection);
            checklistSection    = tempChecklistSection;
            checklistsView.Root = root;

            Content = checklistsView;
        }
		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}
			};
		}
Example #39
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);
		}
Example #40
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;
		}
Example #41
0
		public AlertsPage ()
		{

			var data = DataManager.getInstance ();

			List<EIMAAlert> testAlertData = data.getAlerts ();



			//			List<EIMAAlert> alertData = data.getAlerts ();


			Title = "Alerts";
			Icon = "Alerts.png";

			var alerts = new TableSection ("Alerts");
			foreach (EIMAAlert alert in testAlertData) {
				var cell = new TextCell {
					Text = alert.message, 
					TextColor = Color.White,
					Command = new Command (async o => await Application.Current.MainPage.Navigation.PushModalAsync (new AlertInfoPage (alert))),
				};

				alerts.Add (cell);
			}
			TableRoot root = new TableRoot ();
			root.Add (alerts);
			TableView tableView = new TableView (root);

			// content page for sending messages
			ContentPage contentpage = new ContentPage ();
			var command1 = new Command (async o => await Application.Current.MainPage.Navigation.PushModalAsync (contentpage));
			var button = new Button
			{
				Text = "Send Message",
				BorderWidth = 1,
				HorizontalOptions = LayoutOptions.End,
				VerticalOptions = LayoutOptions.Start,
				Command = command1
			};
			var stackLayout = new StackLayout ();
			stackLayout.Children.Add (tableView);
			stackLayout.Children.Add (button);
			Content = stackLayout;


			// stack layout for the send message window
			var label = new Label {
				Text = "Enter your message:",
				FontSize = 20
			};
			var entry = new Entry {
				Placeholder = "Message"
			};

			var sendCommands = new Command (async o => {
				var postData = new JObject ();

				postData ["token"] = data.getSecret();
				postData ["message"] = entry.Text;

				if(data.isAdmin()){
					postData ["username"] = "******";
				} else{
					postData ["username"] = "******";
				}

				Console.WriteLine(RestCall.POST (URLs.SENDMESSAGE, postData));
				await Application.Current.MainPage.Navigation.PopModalAsync ();
			});

			var sendButton = new Button {
				Text = "Send",
				// insert code to send message

				Command = sendCommands
			};
			var cancelButton = new Button {
				Text = "Cancel",
				Command = new Command (async o => await Application.Current.MainPage.Navigation.PopModalAsync ()),
			};

			var stackLayout1 = new StackLayout ();
			stackLayout1.Children.Add (label);
			stackLayout1.Children.Add (entry);
			var stackLayout2 = new StackLayout ();
			stackLayout2.Children.Add (sendButton);
			stackLayout2.Children.Add (cancelButton);
			stackLayout2.HorizontalOptions = LayoutOptions.Center;
			stackLayout2.Orientation = StackOrientation.Horizontal;
			stackLayout1.Children.Add (stackLayout2);
			stackLayout1.VerticalOptions = LayoutOptions.Center;

			contentpage.Content = stackLayout1;

		}
Example #42
0
		public UserInfoPage (EIMAUser user)
		{
			var data = DataManager.getInstance ();
			var name = new TableSection ("Name");
			var cell1 = new TextCell {
				Text = user.name,
				TextColor = Color.White,
			};
			name.Add (cell1);

			var username = new TableSection ("Username");
			var cell2 = new TextCell {
				Text = user.username,
				TextColor = Color.White,
			};
			username.Add (cell2);

			var unit = new TableSection ("Unit");
			var cell3 = new TextCell {
				Text = user.unit,
				TextColor = Color.White,
			};
			unit.Add (cell3);

			var unitType = new TableSection ("Unit Type");
			var cell4 = new TextCell {
				Text = user.unitType,
				TextColor = Color.White,
			};
			unitType.Add (cell4);

			var organization = new TableSection ("Organization");
			var cell5 = new TextCell {
				Text = user.organization,
				TextColor = Color.White,
			};
			organization.Add (cell5);

			var status = new TableSection ("Status");
			var cell6 = new TextCell {
				Text = user.status,
				TextColor = Color.White,
			};
			status.Add (cell6);

			var level = new TableSection ("Privilege Level");
			var cell7 = new TextCell {
				Text = user.level,
				TextColor = Color.White,
			};
			level.Add (cell7);


			TableRoot root = new TableRoot ();
			root.Add (name);
			root.Add (username);
			root.Add (unit);
			root.Add (unitType);
			root.Add (organization);
			root.Add (status);
			root.Add (level);
			TableView tableView = new TableView (root);

			var command1 = new Command (async o => await Application.Current.MainPage.Navigation.PopModalAsync ());
			var command2 = new Command (async o => {
				var action = await Application.Current.MainPage.DisplayActionSheet (
					"Enter New Privilege Level",
					"Cancel",
					null,
					"No Access",
					"Standard User",
					"Map Editor",
					"Admin"
				);

				if (action == "No Access") { 
					user.level = "noAccess";
					Users.userList.Add (user);
					await Application.Current.MainPage.DisplayAlert ("", "The user is now a No Access User", "OK");
				} else if (action == "Standard User") { 
					user.level = "user";
					Users.userList.Add (user);
					await Application.Current.MainPage.DisplayAlert ("", "The user is now a Standard User", "OK");
				}	else if (action == "Map Editor") { 
					user.level = "mapEditor";
					Users.userList.Add (user);
					await Application.Current.MainPage.DisplayAlert ("", "The user is now a Map Editor", "OK");
				} else if (action == "Admin") { 
					user.level = "admin";
					Users.userList.Add (user);
					await Application.Current.MainPage.DisplayAlert ("", "The user is now an Admin", "OK");
				}

				var postData = new JObject ();

				postData ["token"] = data.getSecret();
				postData ["privLevel"] = user.level;
				postData ["username"] = user.username;
				Console.WriteLine(postData);
				Console.WriteLine(RestCall.POST (URLs.EDITPRIV, postData));
			});


			var changePrivilege = new Button {
				Text = "Change Privilege",
				VerticalOptions = LayoutOptions.Start,
				Command = command2,
			};

			var backButton = new Button {
				Text = "Back",
				VerticalOptions = LayoutOptions.Start,
				Command = command1,
			};

			var label = new Label {
				Text = "Enter your message:",
				FontSize = 20
			};

			var entry = new Entry {
				Placeholder = "Message"
			};

			var sendCommands = new Command (async o => {
				var postData = new JObject ();

				postData ["token"] = data.getSecret();
				postData ["message"] = entry.Text;
				postData ["username"] = user.username;

				Console.WriteLine(RestCall.POST (URLs.SENDMESSAGE, postData));
				await Application.Current.MainPage.Navigation.PopModalAsync ();
			});

			var sendButton = new Button {
				Text = "Send",

				// insert code to send message

				Command = sendCommands
			};

				
			var cancelButton = new Button {
				Text = "Cancel",
				Command = new Command (async o => await Application.Current.MainPage.Navigation.PopModalAsync ()),
			};

			var stackLayout1 = new StackLayout ();
			stackLayout1.Children.Add (label);
			stackLayout1.Children.Add (entry);
			var stackLayout2 = new StackLayout ();
			stackLayout2.Children.Add (sendButton);
			stackLayout2.Children.Add (cancelButton);
			stackLayout2.HorizontalOptions = LayoutOptions.Center;
			stackLayout2.Orientation = StackOrientation.Horizontal;
			stackLayout1.Children.Add (stackLayout2);
			stackLayout1.VerticalOptions = LayoutOptions.Center;

			ContentPage contentpage = new ContentPage ();
			contentpage.Content = stackLayout1;

			var command3 = new Command (async o => await Application.Current.MainPage.Navigation.PushModalAsync (contentpage));
			var messageButton = new Button {
				Text = "Send Message",
				VerticalOptions = LayoutOptions.Start,
				Command = command3,
			};

			var stackLayout3 = new StackLayout ();
			stackLayout3.Children.Add (tableView);
			var stackLayout4 = new StackLayout ();
			stackLayout4.Children.Add (changePrivilege);
			stackLayout4.Children.Add (messageButton);
			stackLayout4.Children.Add (backButton);
			stackLayout4.HorizontalOptions = LayoutOptions.Center;
			stackLayout4.Orientation = StackOrientation.Horizontal;
			stackLayout3.Children.Add (stackLayout4);
			Content = stackLayout3;

		}
Example #43
0
			public TestCaseScreen ()
			{
				AutomationId = "TestCasesIssueList";

				Intent = TableIntent.Settings;

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

				var issueModels = 
					from typeInfo in assembly.DefinedTypes.Select (o => o.AsType ().GetTypeInfo ())
					where typeInfo.GetCustomAttribute<IssueAttribute> () != null
					let attribute = (IssueAttribute)typeInfo.GetCustomAttribute<IssueAttribute> ()
					select new {
						IssueTracker = attribute.IssueTracker,
						IssueNumber = attribute.IssueNumber,
						Name = attribute.IssueTracker.ToString ().Substring(0, 1) + attribute.IssueNumber.ToString (),
						Description = attribute.Description,
						Action = ActivatePageAndNavigate (attribute, typeInfo.AsType ())
					};

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

				var duplicates = new HashSet<string> ();
				issueModels.ForEach (im => {
					if (duplicates.Contains (im.Name) && !IsExempt (im.Name)) {
						throw new NotSupportedException ("Please provide unique tracker + issue number combo: " + im.IssueTracker.ToString () + im.IssueNumber.ToString ());
					} else {
						duplicates.Add (im.Name);
					}
				});

				var githubIssueCells = 
					from issueModel in issueModels
					where issueModel.IssueTracker == IssueTracker.Github
					orderby issueModel.IssueNumber descending
					select MakeIssueCell (issueModel.Name, issueModel.Description, issueModel.Action);

				var bugzillaIssueCells = 
					from issueModel in issueModels
					where issueModel.IssueTracker == IssueTracker.Bugzilla
					orderby issueModel.IssueNumber descending
					select MakeIssueCell (issueModel.Name, issueModel.Description, issueModel.Action);

				var untrackedIssueCells = 
					from issueModel in issueModels
					where issueModel.IssueTracker == IssueTracker.None
					orderby issueModel.Description 
					select MakeIssueCell (issueModel.Name, issueModel.Description, issueModel.Action);

				var issueCells = bugzillaIssueCells.Concat (githubIssueCells).Concat (untrackedIssueCells);

				foreach (var issueCell in issueCells) {
					section.Add (issueCell);
				} 

				Root = root;
			}
Example #44
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;

		}