public MyPage()
        {
            InitializeComponent();
            _tableView.Intent = TableIntent.Menu;

            var imageSection = new TableSection("One");
            var imageCell = new ImageCell();
            imageCell.ImageSource = ImageSource.FromResource("TestImageScrollBug.Images.contact_icon.png");
            imageSection.Add(imageCell);
            _tableRoot.Add(imageSection);

            var tableSection = new TableSection("Two");

            var textCell = new TextCell();
            textCell.Text = "blah1";
            tableSection.Add(textCell);

            var textCell1 = new TextCell();
            textCell1.Text = "blah1";
            tableSection.Add(textCell1);

            var textCell2 = new TextCell();
            textCell2.Text = "blah1";
            tableSection.Add(textCell2);

            var textCell3 = new TextCell();
            textCell3.Text = "blah1";
            tableSection.Add(textCell3);

            var textCell4 = new TextCell();
            textCell4.Text = "blah1";
            tableSection.Add(textCell4);

            var textCell5 = new TextCell();
            textCell5.Text = "blah1";
            tableSection.Add(textCell5);

            var textCell6 = new TextCell();
            textCell6.Text = "blah1";
            tableSection.Add(textCell6);

            var textCell7 = new TextCell();
            textCell7.Text = "blah1";
            tableSection.Add(textCell7);

            var textCell8 = new TextCell();
            textCell8.Text = "blah1";
            tableSection.Add(textCell8);

            var textCell9 = new TextCell();
            textCell9.Text = "blah1";
            tableSection.Add(textCell9);

            var textCell0 = new TextCell();
            textCell0.Text = "blah1";
            tableSection.Add(textCell0);

            _tableRoot.Add(tableSection);
        }
Пример #2
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;

	    }
Пример #3
0
        public CommitmentPage(Commitment commitment)
        {
            _commitment = commitment;
            BindingContext = commitment;

            var grid = new Grid() {
                RowDefinitions = new RowDefinitionCollection {
                    new RowDefinition(),
                    new RowDefinition(),
                },
                ColumnDefinitions = new ColumnDefinitionCollection {
                    new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) },
                    new ColumnDefinition { Width = new GridLength(2, GridUnitType.Star) },
                }
            };

            var plannedLabel = new Label {
                Text = "I am"
            };
            plannedLabel.SetValue(Grid.RowProperty, 0);

            var plannedTextCell = new TextCell {

            };
            plannedTextCell.SetBinding(TextCell.TextProperty, "Status");
            grid.Children.Add(plannedLabel);

            Content = grid;
        }
Пример #4
0
        public PublicRoomsPage(ViewModelBase viewModel)
            : base(viewModel)
        {
            var listView = new BindableListView
                {
                    ItemTemplate = new DataTemplate(() =>
                        {
                        var textCell = new TextCell();
                            textCell.SetBinding(TextCell.TextProperty, new Binding("Name"));
                            textCell.TextColor = Styling.BlackText;
                            //textCell.SetBinding(TextCell.DetailProperty, new Binding("Description"));
                            return textCell;
                        }),
                    SeparatorVisibility = SeparatorVisibility.None
                };

            listView.SetBinding(ListView.ItemsSourceProperty, new Binding("PublicRooms"));
            listView.SetBinding(BindableListView.ItemClickedCommandProperty, new Binding("SelectRoomCommand"));

            var loadingIndicator = new ActivityIndicator ();
            loadingIndicator.SetBinding(ActivityIndicator.IsRunningProperty, new Binding("IsBusy"));
            loadingIndicator.SetBinding(ActivityIndicator.IsVisibleProperty, new Binding("IsBusy"));

            Content = new StackLayout
            {
                Children =
                        {
                            loadingIndicator,
                            listView
                        }
            };
        }
Пример #5
0
    protected async override void OnAppearing()
    {
      if (!_loaded)
      {
        _loaded = true;
        var projects = await Library.ProjectList.GetProjectListAsync();
        var list = new ListView();
        list.ItemTemplate = new DataTemplate(() =>
        {
          var cell = new TextCell();
          cell.SetBinding<Library.ProjectInfo>(TextCell.TextProperty, m => m.Name);
          return cell;
        });
        list.ItemsSource = projects;
        list.ItemTapped += async (a, b) => 
        {
          var info = (Library.ProjectInfo)((ListView)a).SelectedItem;
          var project = await Library.ProjectEdit.GetProjectAsync(info.Id);
          await Navigation.PushAsync(new ProjectEdit(project));
        };

        var stack = new StackLayout();
        stack.Children.Add(list);
        Content = stack;
      }
      base.OnAppearing();
    }
		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;
		}
Пример #7
0
        public static void updateEvents(String query)
        {
            if (query.Equals ("")) {
                //grab everything

                List<Event> events = Event.GrabLocalEvents(0,0,25);
                //display everything
                events.Clear();
                foreach (var i in events) {
                    TextCell current = new TextCell ();
                    current.Text = i.Name;
                    current.TextColor = Xamarin.Forms.Color.Blue;
                    current.Detail = i.StartTime + " to " + i.EndTime;
                    current.DetailColor = Xamarin.Forms.Color.White;
                }

            } else {
                //grab everything with title containing query
                List<Event> events = Event.GrabLocalEvents(0,0,25);
                //display everything from above
                events.Clear();
                foreach (var i in events) {

                    if (i.Name.Contains(query)){
                        TextCell current = new TextCell ();
                        current.Text = i.Name;
                        current.TextColor = Xamarin.Forms.Color.Blue;
                        current.Detail = i.StartTime + " to " + i.EndTime;
                        current.DetailColor = Xamarin.Forms.Color.White;
                    }
                }
            }
        }
Пример #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;

		}
Пример #9
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;
        }
Пример #10
0
		public Issue2794 ()
		{

			var tableView = new TableView ();
			_dataSection = new TableSection ();
			var cell1 = new TextCell { Text = "Cell1" };
			cell1.ContextActions.Add (new MenuItem {
				Text = "Delete me after",
				IsDestructive = true,
				Command = new Command (Delete),
				CommandParameter = 0
			});

			var cell2 = new TextCell { Text = "Cell2" };
			cell2.ContextActions.Add (new MenuItem {
				Text = "Delete me first",
				IsDestructive = true,
				Command = new Command (Delete),
				CommandParameter = 1
			});

			_dataSection.Add (cell1);
			_dataSection.Add (cell2);
			tableView.Root.Add (_dataSection);

			Content = tableView;
		}
		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;
		}
Пример #12
0
        public FriendSettingsPage()
        {
            ch = new ColorHandler();
            Title = "User Settings";
            BackgroundColor = ch.fromStringToColor("lightGray");
            TableView tableView = new TableView
            {
                Root = new TableRoot()
            };
            TableSection tSection = new TableSection();
            tableView.Root.Add(tSection);
            TextCell removeFriendCell = new TextCell
            {
                Text = "Remove Friend",
                TextColor = ch.fromStringToColor("gray"),

            };
            removeFriendCell.Tapped += RemoveFriendCell_Tapped;
            TextCell reportTextCell = new TextCell
            {
                Text = "Report",
                TextColor = ch.fromStringToColor("gray"),


            };
            reportTextCell.Tapped += ReportTextCell_Tapped;
            tSection.Add(removeFriendCell);
            tSection.Add(reportTextCell);
            Content = tableView;
        }
Пример #13
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
				}
			};
        }
Пример #14
0
 private void InitializeComponent()
 {
     this.LoadFromXaml(typeof(DoctorSearch));
     CELL1 = this.FindByName<TextCell>("CELL1");
     CELL2 = this.FindByName<TextCell>("CELL2");
     CELL3 = this.FindByName<TextCell>("CELL3");
     CELL4 = this.FindByName<TextCell>("CELL4");
     CELL5 = this.FindByName<TextCell>("CELL5");
     CELL6 = this.FindByName<TextCell>("CELL6");
     CELL7 = this.FindByName<TextCell>("CELL7");
     CELL8 = this.FindByName<TextCell>("CELL8");
 }
Пример #15
0
        public ActivityPage(Activity act)
        {
            theAct = act;
            Title = act.FullName;
            fullDescription = string.Format ("{0}, worth {1} points", act.FullName, act.Score);
            Label subTitle = new Label () {
                FontAttributes = FontAttributes.Italic,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
            };
            if (act.OneTimeOnly) {
                subTitle.Text = string.Format ("Worth {0} points (one time only)", act.Score);
            } else {
                subTitle.Text = string.Format ("Worth {0} points (each)", act.Score);
            }

            var listTemplate = new DataTemplate (() => {
                var cell = new TextCell ();
                cell.SetBinding<Task> (TextCell.TextProperty, t => t.DT);
                cell.SetBinding<Task> (TextCell.DetailProperty, t => t.Notes);
                return cell;
            });

            // There might be multiple task-completions here, so use a scrolling ListView
            listCurrentTasks = new ListView ();
            listCurrentTasks.ItemTemplate = listTemplate;
            listCurrentTasks.ItemSelected += HandleSelect;

            // There might be multiple task-completions here, so use a scrolling ListView
            listTaskHistory = new ListView ();
            listTaskHistory.ItemTemplate = listTemplate;
            listTaskHistory.ItemSelected += HandleSelect;

            btnAdd = new Button () { Text = "Tap to Record Completion", BorderWidth = 2, };
            btnAdd.Clicked += HandleAdd;

            var layout = new StackLayout ();
            layout.Children.Add (subTitle);
            layout.Children.Add (btnAdd);
            tapToDeleteOrUpdate = new Label { Text = "Tap below to Delete or Add Notes", TextColor = Color.Teal, };
            tapToDeleteOrUpdate.IsVisible = false;
            layout.Children.Add (tapToDeleteOrUpdate);

            layout.Children.Add (listCurrentTasks);
            var lineSeparator = new BoxView () { Color = Color.Blue, WidthRequest = 100, HeightRequest = 8 };
            layout.Children.Add (lineSeparator);
            layout.Children.Add (new Label { Text = "History (not included in current score):", TextColor = Color.Teal, });
            layout.Children.Add (listTaskHistory);
            //layout.HorizontalOptions = LayoutOptions.Center;
            Content = layout;
        }
		Cell GetGraphCell (string title)
		{
			var cell = new TextCell { Text = title };
			cell.Tapped += (sender, ea) => {
				var ei = exampleInfoList
					.Where (e => e.Title == title)
					.FirstOrDefault ();

				var gp = new GraphViewPage (ei){Title = title};

				Navigation.PushAsync (gp);
			};
			return cell;
		}
Пример #17
0
        public SwitchPageCS()
        {
            SwitchPageViewModel vm = new SwitchPageViewModel();
            BindingContext = vm;

            var sw0 = new SwitchCell { Text = "Toggle sw1 & sw2" };
            sw0.SetBinding(SwitchCell.OnProperty, "SwAllValue", BindingMode.OneWayToSource);
            var sw1 = new SwitchCell { Text = "Toggle sw1" };
            sw1.SetBinding(SwitchCell.OnProperty, "Sw1Value", BindingMode.TwoWay);
            var sw2 = new SwitchCell { Text = "Toggle sw2" };
            sw2.SetBinding(SwitchCell.OnProperty, "Sw2Value", BindingMode.TwoWay);
            var tc1 = new TextCell { Text = "sw1 value" };
            tc1.SetBinding(TextCell.DetailProperty, "Sw1Value");
            var tc2 = new TextCell { Text = "sw2 value" };
            tc2.SetBinding(TextCell.DetailProperty, "Sw2Value");

            var tv = new TableView
            {
                Intent = TableIntent.Menu,
                Root = new TableRoot
                {
                    new TableSection("Toggle all")
                    {
                        sw0,
                    },

                    new TableSection("Toggle each")
                    {
                        sw1,
                        sw2,
                    },
                    new TableSection("Values of ViewModel")
                    {
                        tc1,
                        tc2,
                    }
                }
            };

            Content = new StackLayout
            {
                Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0),
                Children =
                {
                    tv,
                }
            };
        }
Пример #18
0
        public TestPage()
        {
            this.BindingContext = new TestPageViewModel();

            var ed = new Editor { Text = "BindingTo TextValue" };
            ed.SetBinding(Editor.TextProperty, "TextValue", mode: BindingMode.OneWayToSource);
            var lb = new Label { Text = "" };
            lb.SetBinding(Label.TextProperty, "TextValue");

            var sw = new Switch();
            sw.SetBinding(Switch.IsToggledProperty, "BoolValue", mode: BindingMode.TwoWay);

            var sc = new SwitchCell { Text = "BindingTo BoolValue" };
            sc.SetBinding(SwitchCell.OnProperty, "BoolValue", mode: BindingMode.TwoWay);

            var tc = new TextCell { Text = "" };
            tc.SetBinding(TextCell.TextProperty, "BoolValue", stringFormat:"Value: {0}");

            var tv = new TableView
            {
                Intent = TableIntent.Settings,
                Root = new TableRoot
                {
                    new TableSection("TableView")
                    {
                        sc,
                        tc,
                    },
                }
            };

            Content = new StackLayout
            {
                Padding = 20,
                Children = {
                    new Label {
                        Text = "INotifyPropertyChanged Test",
                        FontSize = 30,
                    },
                    ed,
                    lb,
                    sw,
                    tv,
                }
            };
        }
Пример #19
0
    protected async override void OnAppearing()
    {
      var projects = await Library.ProjectList.GetProjectListAsync();
      var list = new ListView();
      list.ItemTemplate = new DataTemplate(() =>
      {
        var cell = new TextCell();
        cell.SetBinding<Library.ProjectInfo>(TextCell.TextProperty, m => m.Name);
        return cell;
      });
      list.ItemsSource = projects;

      var stack = (StackLayout)Content;
      stack.Children.Add(list);

      base.OnAppearing();
    }
		private Cell GetCustomCell()
		{
			var cell = new TextCell ();
			var editItem = new MenuItem () {
				Text = "Edit"
			};
			editItem.Clicked += EditItem_Clicked;
			editItem.SetBinding (MenuItem.CommandParameterProperty, ".");
			cell.ContextActions.Add(editItem);

			var deleteItem = new MenuItem () {
				Text = "Delete",
				IsDestructive = true
			};
			deleteItem.SetBinding (MenuItem.CommandParameterProperty, ".");
			deleteItem.Clicked += DeleteItem_Clicked;
			cell.ContextActions.Add(deleteItem);
			return cell;
		}
Пример #21
0
    protected async override void OnAppearing()
    {
      if (!_loaded)
      {
        _loaded = true;
        var resources = await Library.ResourceList.GetResourceListAsync();
        var list = new ListView();
        list.ItemTemplate = new DataTemplate(() =>
        {
          var cell = new TextCell();
          cell.SetBinding<Library.ResourceInfo>(TextCell.TextProperty, m => m.Name);
          return cell;
        });
        list.ItemsSource = resources;

        var stack = new StackLayout();
        stack.Children.Add(list);
        Content = stack;
      }
      base.OnAppearing();
    }
        public BlogPostSelectorPage(ApplicationViewModel applicationViewModel)
        {
            if (applicationViewModel == null) throw new ArgumentNullException(nameof(applicationViewModel));

            Title = "Blog posts";
            BindingContext = applicationViewModel;
            listView = new ListView
            {
                ItemsSource = applicationViewModel.BlogPosts,
                ItemTemplate = new DataTemplate(() =>
                {
                    var textCell = new TextCell();
                    textCell.SetBinding(TextCell.TextProperty, nameof(BlogPostViewModel.Title));
                    return textCell;
                })
            };

            listView.SetBinding(ListView.SelectedItemProperty, nameof(ApplicationViewModel.SelectedBlogPost));

            Content = listView;
        }
Пример #23
0
        public HistoryPage()
        {
            Title = "Score History";

            var periodList = new ListView ();
            var lblDesc = new Label ();
            lblDesc.Text = "Score / For Period Beginning";

            periodList.ItemTemplate = new DataTemplate (() => {
                var cell = new TextCell ();
                cell.SetBinding<Period> (TextCell.TextProperty, p => p.Score);
                cell.SetBinding<Period> (TextCell.DetailProperty, p => p.StartDT);
                return cell;
            });

            var periodHistory = App.Database.ListPeriods ();
            periodList.ItemsSource = periodHistory;

            var layout = new StackLayout ();
            layout.Children.Add (lblDesc);
            layout.Children.Add (periodList);
            Content = layout;
        }
Пример #24
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;

		}
 public static FluentTextCell TextCell(TextCell instance = null)
 {
     return new FluentTextCell (instance);
 }
Пример #26
0
		protected override Cell CreateDefault(object item)
		{
			TextCell textCell = new TextCell();
			textCell.SetBinding(TextCell.TextProperty, ".", converter: _toStringValueConverter);
			return textCell;
		}
Пример #27
0
		public StorePage (Store store)
		{
			
			dataStore = DependencyService.Get<IDataStore> ();
			Store = store;
			if (Store == null) {
				Store = new Store ();
				Store.MondayOpen = "9am";
				Store.TuesdayOpen = "9am";
				Store.WednesdayOpen = "9am";
				Store.ThursdayOpen = "9am";
				Store.FridayOpen = "9am";
				Store.SaturdayOpen = "9am";
				Store.SundayOpen = "12pm";
				Store.MondayClose = "8pm";
				Store.TuesdayClose = "8pm";
				Store.WednesdayClose = "8pm";
				Store.ThursdayClose = "8pm";
				Store.FridayClose = "8pm";
				Store.SaturdayClose = "8pm";
				Store.SundayClose = "6pm";
				isNew = true;
			}

			Title = isNew ? "New Store" : "Edit Store";
			
			ToolbarItems.Add (new ToolbarItem {
				Text="Save",
				Command = new Command(async (obj)=>
					{
						Store.Name = name.Text.Trim();
						Store.LocationHint = locationHint.Text.Trim();
						Store.City = city.Text.Trim();
						Store.PhoneNumber = phoneNumber.Text.Trim();
						Store.Image = imageUrl.Text.Trim();
						Store.StreetAddress = streetAddress.Text.Trim();
						Store.State = state.Text.Trim();
						Store.ZipCode = zipCode.Text.Trim();
						Store.LocationCode = locationCode.Text.Trim();
						Store.Country = country.Text.Trim();
						double lat;
						double lng;

						var parse1 = double.TryParse(latitude.Text.Trim(), out lat);
						var parse2 = double.TryParse(longitude.Text.Trim(), out lng);
						Store.Longitude = lng;
						Store.Latitude = lat;
						Store.MondayOpen = mondayOpen.Text.Trim();
						Store.MondayClose = mondayClose.Text.Trim();
						Store.TuesdayOpen = tuesdayOpen.Text.Trim();
						Store.TuesdayClose = tuesdayClose.Text.Trim();
						Store.WednesdayOpen = wednesdayOpen.Text.Trim();
						Store.WednesdayClose = wednesdayClose.Text.Trim();
						Store.ThursdayOpen = thursdayOpen.Text.Trim();
						Store.ThursdayClose = thursdayClose.Text.Trim();
						Store.FridayOpen = fridayOpen.Text.Trim();
						Store.FridayClose = fridayClose.Text.Trim();
						Store.SaturdayOpen = saturdayOpen.Text.Trim();
						Store.SaturdayClose = saturdayClose.Text.Trim();
						Store.SundayOpen = sundayOpen.Text.Trim();
						Store.SundayClose = sundayClose.Text.Trim();




						bool isAnyPropEmpty = Store.GetType().GetTypeInfo().DeclaredProperties
							.Where(p => p.GetValue(Store) is string && p.CanRead && p.CanWrite && p.Name != "State") // selecting only string props
							.Any(p => string.IsNullOrWhiteSpace((p.GetValue(Store) as string)));

						if(isAnyPropEmpty || !parse1 || !parse2)
						{
							await DisplayAlert("Not Valid", "Some fields are not valid, please check", "OK");
							return;
						}
						Title = "SAVING...";
						if(isNew)
						{
							await dataStore.AddStoreAsync(Store);
						}
						else
						{
							await dataStore.UpdateStoreAsync(Store);
						}

						await DisplayAlert("Saved", "Please refresh store list", "OK");
						await Navigation.PopAsync();
					})
			});


			Content = new TableView {
				HasUnevenRows = true,
				Intent = TableIntent.Form,
				Root = new TableRoot {
					new TableSection ("Information") {
						(name = new EntryCell {Label = "Name", Text = Store.Name}),
						(locationHint = new EntryCell {Label = "Location Hint", Text = Store.LocationHint}),
						(phoneNumber = new EntryCell {Label = "Phone Number", Text = Store.PhoneNumber, Placeholder ="555-555-5555"}),
						(locationCode = new EntryCell {Label = "Location Code", Text = Store.LocationCode}),

					},
					new TableSection ("Image") {
						(imageUrl = new EntryCell { Label="Image URL", Text = Store.Image, Placeholder = ".png or .jpg image link" }),
						(refreshImage = new TextCell()
							{
								Text="Refresh Image"
							}),
						new ViewCell { View = (image = new Image
							{
								HeightRequest = 400,
								VerticalOptions = LayoutOptions.FillAndExpand
							})
						}
					},
					new TableSection ("Address") {
						(streetAddress = new EntryCell {Label = "Street Address", Text = Store.StreetAddress }),
						(city = new EntryCell {Label = "City", Text = Store.City }),
						(state = new EntryCell {Label = "State", Text = Store.State }),
						(zipCode = new EntryCell {Label = "Zipcode", Text = Store.ZipCode }),
						(country = new EntryCell{Label="Country", Text = Store.Country}),
						(detectLatLong = new TextCell()
							{
								Text="Detect Lat/Long"
							}),
						(latitude = new TextCell {Text = Store.Latitude.ToString() }),
						(longitude = new TextCell {Text = Store.Longitude.ToString() }),
					},


					new TableSection ("Hours") {
						(mondayOpen = new EntryCell {Label = "Monday Open", Text = Store.MondayOpen}),
						(mondayClose = new EntryCell {Label = "Monday Close", Text = Store.MondayClose}),
						(tuesdayOpen = new EntryCell {Label = "Tuesday Open", Text = Store.TuesdayOpen}),
						(tuesdayClose = new EntryCell {Label = "Tuesday Close", Text = Store.TuesdayClose}),
						(wednesdayOpen = new EntryCell {Label = "Wedneday Open", Text = Store.WednesdayOpen}),
						(wednesdayClose = new EntryCell {Label = "Wedneday Close", Text = Store.WednesdayClose}),
						(thursdayOpen = new EntryCell {Label = "Thursday Open", Text = Store.ThursdayOpen}),
						(thursdayClose = new EntryCell {Label = "Thursday Close", Text = Store.ThursdayClose}),
						(fridayOpen = new EntryCell {Label = "Friday Open", Text = Store.FridayOpen}),
						(fridayClose = new EntryCell {Label = "Friday Close", Text = Store.FridayClose}),
						(saturdayOpen = new EntryCell {Label = "Saturday Open", Text = Store.SaturdayOpen}),
						(saturdayClose =new EntryCell {Label = "Saturday Close", Text = Store.SaturdayClose}),
						(sundayOpen = new EntryCell {Label = "Sunday Open", Text = Store.SundayOpen}),
						(sundayClose = new EntryCell {Label = "Sunday Close", Text = Store.SundayClose}),
					},
				},
			};

			refreshImage.Tapped += (sender, e) => 
			{
				image.Source = ImageSource.FromUri(new Uri(imageUrl.Text));
			};

			detectLatLong.Tapped += async (sender, e) => 
			{
				var coder = new Xamarin.Forms.Maps.Geocoder();
				var oldTitle = Title;
				Title = "Please wait...";
				var locations =  await coder.GetPositionsForAddressAsync(streetAddress.Text + " " + city.Text + ", " + state.Text + " " + zipCode.Text + " " + country.Text);
				Title = oldTitle;
				foreach(var location in locations)
				{
					latitude.Text = location.Latitude.ToString();
					longitude.Text = location.Longitude.ToString();
					break;
				}
			};

			SetBinding (Page.IsBusyProperty, new Binding("IsBusy"));
		}
Пример #28
0
        private void Init()
        {

            OsmNominatim.Instance.CountryCodes.Add("de");

            this._autoCompleteListView = new ListView
            {
                IsVisible = false,
                RowHeight = 40,
                HeightRequest = 0,
                BackgroundColor = Color.White
            };
            this._autoCompleteListView.ItemTemplate = new DataTemplate(() =>
            {
                var cell = new TextCell();
                cell.SetBinding(ImageCell.TextProperty, "Description");

                return cell;
            });

            View searchView;
            if (this._useSearchBar)
            {
                this._searchBar = new SearchBar
                {
                    Placeholder = "Search for address..."
                };
                this._searchBar.TextChanged += SearchTextChanged;
                this._searchBar.SearchButtonPressed += SearchButtonPressed;

                searchView = this._searchBar;

            }
            else
            {
                this._entry = new Entry
                {
                    Placeholder = "Sarch for address"
                };
                this._entry.TextChanged += SearchTextChanged;

                searchView = this._entry;
            }
            this.Children.Add(searchView,
                Constraint.Constant(0),
                Constraint.Constant(0),
                widthConstraint: Constraint.RelativeToParent(l => l.Width));

            this.Children.Add(
                this._autoCompleteListView,
                Constraint.Constant(0),
                Constraint.RelativeToView(searchView, (r, v) => v.Y + v.Height));

            this._autoCompleteListView.ItemSelected += ItemSelected;

            this._textChangeItemSelected = false;
        }
        internal static Cell UserCell(PropertyInfo property, IContact context, Page parent = null)
        {
            var label = CreateLabel(property);
            var cell = new TextCell();
            cell.BindingContext = parent.BindingContext;
            cell.SetValue(TextCell.DetailProperty, label);
            cell.SetBinding(
                TextCell.TextProperty, 
                new Binding(
                    path: "SelectedModel." + property.Name,
                    mode: BindingMode.OneWay,
                    converter: OwnerConverter, 
                    converterParameter: parent.BindingContext
                )
            );
            cell.SetValue(TextCell.CommandProperty, new Command(async (a)=>{
                var cellTemplate = new DataTemplate(typeof(TextCell));
                cellTemplate.SetBinding(TextCell.TextProperty, new Binding(".", converter: OwnerConverter));
                var list = new ListView {
                    ItemTemplate = cellTemplate,
                };
                list.SetBinding(ItemsView<Cell>.ItemsSourceProperty, "Users");
                list.SetBinding(ListView.SelectedItemProperty, "SelectedModel." + property.Name);
                list.ItemSelected += async (sender, e)=>
                {
                    await parent.Navigation.PopAsync();
                };
                var page = new ContentPage {
                    Title = "Change Owner",
                    Content = list
                };
                page.BindingContext = parent.BindingContext;

                await parent.Navigation.PushAsync(page);
            }));
            return cell;
        }
Пример #30
0
        public MenuPage()
        {
            InitializeComponent();

            _chosenItemCmd = new Command(obj =>
            {
                var mic = MenuItemChanged;
                if (mic != null)
                {
                    mic.Invoke(this, new MenuItemChangedEventArg()
                    {
                        SelectedMenuItem = obj as MenuItem,
                    });
                }
            });

            _calcMenuItems = new List<MenuItem>()
            {
                new MenuItem("Introduction", () => new IntroPage()),
                new MenuItem("Step 1", () => new Step1Page()),
                new MenuItem("Step 2", () => new Step2Page()),
                new MenuItem("Step 3", () => new Step3Page()),
                new MenuItem("Step 4", () => new Step4Page()),
                new MenuItem("Step 5", () => new ContentPage()),
            };

            _appMenuItems = new List<MenuItem>()
            {
                new MenuItem("About", () => new ContentPage()),
                new MenuItem("Settings", () => new ContentPage()),
                new MenuItem("Help", () => new ContentPage()),
            };

            _subMenu.ItemsSource = _calcMenuItems;

            _subMenu.ItemSelected += (object sender, SelectedItemChangedEventArgs e) =>
            {
                if (e.SelectedItem != null)
                {
                    var mi = (MenuItem)e.SelectedItem;
                    _subMenu.SelectedItem = null;
                    _chosenItemCmd.Execute(mi);
                }
            };

            _subMenu.ItemTemplate = new DataTemplate(() =>
            {
                var tc = new TextCell();
                tc.SetBinding(TextCell.TextProperty, "MenuTitle");

                return tc;
            });
        }
Пример #31
0
        public SettingsPage()
        {
            Title = "Settings";
            ch = new ColorHandler();

            var cloudsTCell = new TextCell
            {
                Text = "Clouds",
                TextColor = ch.fromStringToColor("black")
            };
            cloudsTCell.Tapped += async (sender, e) =>
            {
                var location = await App.dbWrapper.GetLocation();
                var cloudsList = await App.dbWrapper.GetAvailableClouds(location[0],location[1]);
                this.getSavedClouds();
                await Navigation.PushAsync(new CloudsPage(cloudsList,savedCloudList));

            };

            var notificationsTCell = new TextCell
            {
                Text = "Notifications",
                TextColor = ch.fromStringToColor("black")
            };
            notificationsTCell.Tapped += (sender, e) =>
            {
                Navigation.PushAsync(new SettingsNotificationspage());
            };

            var tutorialTCell = new TextCell
            {
                Text = "Tutorial",
                TextColor = ch.fromStringToColor("black")
            };
            tutorialTCell.Tapped += (sender, e) =>
            {

                Navigation.PushAsync(new CarouselTutorialPageRedo());
            };
            var contactUsTCell = new TextCell
            {
                Text = "Contact Us",
                TextColor = ch.fromStringToColor("black")
            };
            contactUsTCell.Tapped += (sender, e) =>
            {
                Navigation.PushAsync(new ContactUsPage());
            };

            var signOutTCell = new TextCell
            {

                Text = "Sign Out",
                TextColor = ch.fromStringToColor("black"),
            };
            signOutTCell.Tapped += async (sender, args) =>
            {

                var response = await DisplayAlert("Logout", "Are you sure you want to logout?", "Yes", "No");
                if (response)
                {
                    var fileSystem = FileSystem.Current.LocalStorage;
                    var exists = await fileSystem.CheckExistsAsync("PhoneData.txt");
                    if (exists.Equals(ExistenceCheckResult.FileExists))
                    {
                        IFile file = await fileSystem.CreateFileAsync("PhoneData.txt", CreationCollisionOption.ReplaceExisting);
                        string baseString = "a\nUVA,\n";
                        await file.WriteAllTextAsync(baseString);
                        var navPage = new NavigationPage(new CarouselTutorialPage());
                        Application.Current.MainPage = navPage;
                    }
                    else
                    {
                        throw new System.IO.FileNotFoundException("PhoneData.txt");
                    }
                }


            };
            // Navigation.PushModalAsync(new SignUpPage());

            TableView tableView = new TableView
            {
                Intent = TableIntent.Settings,
                Root = new TableRoot
                {
                    new TableSection
                    {
                        cloudsTCell,
                        notificationsTCell,
                        tutorialTCell,
                        contactUsTCell,
                        signOutTCell
                    }
                },
                BackgroundColor = ch.fromStringToColor("white"),
                
            };
            Content = tableView;


        }