示例#1
8
        /// <summary>
        /// Gets the table section.
        /// </summary>
        /// <returns>The table section.</returns>
        /// <param name="title">Title.</param>
        /// <param name="tshirts">Tshirts.</param>
        TableSection GetTableSection(string title, List<TShirt> tshirts)
        {
            var fsharpSection = new TableSection();
            fsharpSection.Title = title;
            foreach(var tshirt in tshirts)
            {
                var imageCell = new ImageCell { ImageSource = tshirt.Image, Text = tshirt.Name, Detail = tshirt.Detail, CommandParameter = tshirt };
                imageCell.Tapped += async (sender, e) => await Navigation.PushModalAsync(new OrderPage((TShirt)imageCell.CommandParameter));
                fsharpSection.Add(imageCell);
            }

            return fsharpSection;
        }
        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);
        }
示例#3
0
		public ScheduleMenu (int mode=0)
		{
			schedules=new List<CustomCell>();
			NavigationPage.SetBackButtonTitle (this, "Back");
			Title = "Study Schedules";
			schedules.Add (new CustomCell(){Text="Table of study schedules"});
			schedules.Add (new CustomCell(){Text="勉強スケジュールの比較"});
			schedules.Add (new CustomCell(){Text="100-minute lessons"});
			schedules.Add (new CustomCell(){Text="90-minute lessons"});
			schedules.Add (new CustomCell(){Text="80-minute lessons"});
			schedules.Add (new CustomCell(){Text="60-minute lessons"});

			mainSection = new TableSection ();

			tableView = new TableView ();
			foreach(var schedule in schedules)
			{
				mainSection.Add (schedule);
				schedule.Tapped+= Schedule_Tapped;
			}

			tableView.Intent = TableIntent.Menu;
			tableView.Root = new TableRoot{ 
				mainSection,
			};

			Content = tableView;
		}
		public MenuPage ()
		{
			Title = "LoginPattern";
			Icon = "slideout.png";

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

			var root = new TableRoot () {section} ;

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

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

			Content = new StackLayout {
				BackgroundColor = Color.Gray,
				VerticalOptions = LayoutOptions.FillAndExpand,
				Children = {
					tableView, 
					logoutButton
				}
			};
		}
示例#5
0
文件: HelpPage.cs 项目: r0345/EIMA
		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;

		}
示例#6
0
		protected override void Init()
		{
			var ts = new TableSection();
			var tr = new TableRoot { ts };
			var tv = new TableView(tr);

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

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

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

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

			Content = tv;
		}
示例#7
0
		public AboutMenu ()
		{
			this.Title="About Kana Keys";

			NavigationPage.SetBackButtonTitle (this, "Back");
			versionCell = new CustomCell{  Text= "Version #"};
			copyrightCell = new CustomCell{  Text = "Copyright notice"};
			termsCell = new CustomCell{  Text = "Terms of use"};

			mainSection = new TableSection ();

			tableView = new TableView ();
			mainSection.Add (versionCell);
			mainSection.Add(copyrightCell);	
			mainSection.Add(termsCell);	
			versionCell.Tapped += VersionCell_Tapped;
			copyrightCell.Tapped+= CopyrightCell_Tapped;
			termsCell.Tapped+= TermsCell_Tapped;
			tableView.Intent = TableIntent.Menu;

			tableView.Root = new TableRoot{ 
				mainSection,
			};
			Content = tableView;
		}
		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;
		}
示例#9
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;
		}
示例#10
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;

	    }
示例#11
0
        private void AddDescriptionSection(TableView table)
        {
            const int HEIGHT = 150;

            var descriptionSection = new TableSection ("Description");

            var descriptionGrid = new Grid {
                Padding = new Thickness(10),
                HeightRequest = HEIGHT,
                VerticalOptions = LayoutOptions.FillAndExpand,
                ColumnDefinitions = {
                    new ColumnDefinition { Width = new GridLength (1, GridUnitType.Star) }
                }
            };

            var descriptionEntry = new Editor {
                HeightRequest = HEIGHT
            };

            descriptionEntry.SetBinding (Editor.TextProperty, "Description");

            descriptionGrid.Children.Add (descriptionEntry, 0, 0);

            descriptionSection.Add (new ViewCell {
                View = descriptionGrid,
                Height = HEIGHT
            });

            table.Root.Add (descriptionSection);
        }
示例#12
0
        public StepPage(Steps step)
        {
            Title = string.Format("{0}: Pick an Activity", StepNames.LookUpStepNameGivenCode (step));
            Debug.WriteLine ("Screen for step: " + step);
            theStep = step;

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

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

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

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

            ListSubTasks ();

            //Title = string.Format("{0} ({1} points earned)", StepNames.LookUpStepNameGivenCode (theStep), ListSubTasks ());
        }
示例#13
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;
        }
示例#14
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;
        }
		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;
		}
示例#16
0
		public async void OnTextChanged(string text)
		{
			((SearchView)View).SuggestionListView.IsVisible = !text.Equals ("");
			((SearchView)View).TitleLabel.IsVisible = text.Equals ("");

			source.Cancel ();

			try
			{

				List <Workshop> workshops = await SearchKeywordsInModel (text, source.Token);

				TableSection section = new TableSection ();

				foreach (Workshop shop in workshops) {

					TextCell cell = new TextCell {
						Text = shop.topic,
					};

					cell.Tapped += (object sender, EventArgs e) => ShowSectionsInSessions (shop);
					section.Add (cell);
				}

				(((SearchView)View).SuggestionListView.Root = new TableRoot()).Add (section);
			}
			catch(Exception) {

			}
		}
示例#17
0
        public void PopTablePage(string title, string []texts)
        {
            TableView table = new TableView {
                Root = new TableRoot (),
                BackgroundColor = new Color(1, 1, 1, 0),
            };

            TableSection section = new TableSection ();

            foreach (string text in texts) {

                section.Add (new TextLabelCell {
                    Label = text
                });
            }

            table.Root.Add (section);

            var page = new ContentPage {
                Title = title,
                Content = table,
                BackgroundColor = new Color(1, 1, 1, 0.2)
            };

            View.Navigation.PushAsync (page);
        }
示例#18
0
		protected override void Init ()
		{
			var layout = new StackLayout ();
			var button = new Button { Text = "Click" };
			var tablesection = new TableSection { Title = "Switches" };
			var tableview = new TableView { Intent = TableIntent.Form, Root = new TableRoot { tablesection } };
			var viewcell1 = new ViewCell {
				View = new StackLayout {
					HorizontalOptions = LayoutOptions.FillAndExpand,
					Orientation = StackOrientation.Horizontal,
					Children = {
						new Label { Text = "Switch 1", HorizontalOptions = LayoutOptions.StartAndExpand },
						new Switch { AutomationId = "switch1", HorizontalOptions = LayoutOptions.End, IsToggled = true }
					}
				}
			};
			var viewcell2 = new ViewCell {
				View = new StackLayout {
					HorizontalOptions = LayoutOptions.FillAndExpand,
					Orientation = StackOrientation.Horizontal,
					Children = {
						new Label { Text = "Switch 2", HorizontalOptions = LayoutOptions.StartAndExpand },
						new Switch { AutomationId = "switch2", HorizontalOptions = LayoutOptions.End, IsToggled = true }
					}
				}
			};
			Label label = new Label { Text = "Switch 3", HorizontalOptions = LayoutOptions.StartAndExpand };
			Switch switchie = new Switch { AutomationId = "switch3", HorizontalOptions = LayoutOptions.End, IsToggled = true, IsEnabled = false };
			switchie.Toggled += (sender, e) => {
				label.Text = "FAIL";
			};
			var viewcell3 = new ViewCell {
				View = new StackLayout {
					HorizontalOptions = LayoutOptions.FillAndExpand,
					Orientation = StackOrientation.Horizontal,
					Children = {
						label,
						switchie,
					}
				}
			};

			tablesection.Add (viewcell1);
			tablesection.Add (viewcell2);
			tablesection.Add (viewcell3);

			button.Clicked += (sender, e) => {
				if (_removed)
					tablesection.Insert (1, viewcell2);
				else
					tablesection.Remove (viewcell2);

				_removed = !_removed;
			};

			layout.Children.Add (button);
			layout.Children.Add (tableview);

			Content = layout;
		}
		public MenuPage (MasterDetailPage m)
		{
			master = m;

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

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

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


			Content = new StackLayout {
				BackgroundColor = Color.Gray,
				VerticalOptions = LayoutOptions.FillAndExpand,
				Children = {tableView}
			};
		}
示例#20
0
		public override void UpdateView ()
		{
			base.UpdateView ();

			Bookings bookings = (Bookings)Model;
			BookingsPage page = (BookingsPage)View;

			TableSection section = new TableSection ();

			foreach (Booking booking in bookings.bookings) {

				TextLabelCell cell = new TextLabelCell {
					Label = booking.workshopID + " " + booking.topic,
					LabelColor = Color.Black,
					HasLabelShadow = false,
				};

				cell.Tapped += (object sender, EventArgs e) => ShowSelectedWorkshop (booking);
				section.Add (cell);
			}

			page.RecordAttendanceButton.Tapped += (sender, e) => ScanQRCode();

			(page.BookingsListView.Root = new TableRoot ()).Add (new TableSection {page.RecordAttendanceButton});
			page.BookingsListView.Root.Add (section);
		}
示例#21
0
		public SelectionPage(MultiCell cell, string title, string[] items, string key, int defaultValue)
		{
			this.cell = cell;
			this.items = items;
			this.key = key;
			this.defaultValue = defaultValue;

			Title = Catalog.GetString(title);

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

			section = new TableSection();

			var active = 0;

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

			cells = new CheckCell[items.Length];

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

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

				section.Add(cells[i]);
			}

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

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

			Content = tableView;
		}
示例#22
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();
                }
            });
        }
示例#23
0
		public void IndexOf ()
		{
			var section = new TableSection ();
			TextCell first, second;
			section.Add (first = new TextCell { Text = "Text" });
			section.Add (second = new TextCell { Text = "Text" });

			Assert.AreEqual (0, section.IndexOf (first));
			Assert.AreEqual (1, section.IndexOf (second));
		}
示例#24
0
		public void Contains ()
		{
			var section = new TableSection ();
			TextCell first, second;
			section.Add (first = new TextCell { Text = "Text" });
			section.Add (second = new TextCell { Text = "Text" });

			Assert.True (section.Contains (first));
			Assert.True (section.Contains (second));
		}
示例#25
0
		public void Add ()
		{
			var section = new TableSection ();
			TextCell first, second;
			section.Add (first = new TextCell { Text = "Text" });
			section.Add (second = new TextCell { Text = "Text" });

			Assert.That (section, NContains.Item (first));
			Assert.That (section, NContains.Item (second));
		}
示例#26
0
		public void Remove ()
		{
			var section = new TableSection ();
			TextCell first;
			section.Add (first = new TextCell { Text = "Text" });
			section.Add (new TextCell { Text = "Text" });

			var result = section.Remove (first);
			Assert.True (result);
			Assert.That (section, Has.No.Contains (first));
		}
        public override void UpdateView()
        {
            base.UpdateView ();

            Workshops sessions = (Workshops)Model;
            WorkshopsPage page = (WorkshopsPage)View;

            page.Title = sessions.RelatedWorkshopSet.Name;

            TableSection section = new TableSection ();

            foreach (Workshop session in sessions.workshops) {

                TextLabelCell cell = new TextLabelCell {
                    Label = session.topic,
                    HasArrow = true
                };

                //Simple theme
                if (((WorkshopsPage)View).BackgroundColor.A == 1) {

                    var cellAction = new MenuItem ();

                    if (session.BookingStatus == BookingStatuses.Booked) {

                        cellAction.Text = "Cancel";
                        cellAction.IsDestructive = true;
                        cellAction.Clicked += (sender, e) => CancelWorkShop (session);

                    } else if (session.BookingStatus == BookingStatuses.NotBooked) {

                        cellAction.Text = "Book";
                        cellAction.IsDestructive = false;
                        cellAction.Clicked += (sender, e) => BookWorkShop (session);
                    } else if (session.BookingStatus == BookingStatuses.Booking) {

                        cellAction.Text = "Booking";
                        cellAction.IsDestructive = false;
                    } else {

                        cellAction.Text = "Canceling";
                        cellAction.IsDestructive = false;
                    }

                    cell.ContextActions.Add (cellAction);
                }

                cell.Tapped += (object sender, EventArgs e) => ShowSelectedWorkshop (session);
                section.Add (cell);
            }

            (page.WorkshopsListView.Root = new TableRoot ()).Add (section);
        }
示例#28
0
		public TextCellTablePage ()
		{
			Title = "TextCell Table Gallery - Legacy";

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

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

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

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

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

			Content = table;
		}
        private async void OnSublayersClicked(object sender, EventArgs e)
        {
            // Make sure that layer and it's sublayers are loaded
            // If layer is already loaded, this returns directly
            await _imageLayer.LoadAsync();

            // Create layout for sublayers page
            // Create root layout
            var layout = new StackLayout();

            // Create list for layers
            var sublayersTableView = new TableView();

            // Create section for basemaps sublayers
            var sublayersSection = new TableSection(_imageLayer.Name);

            // Create cells for each of the sublayers
            foreach (ArcGISSublayer sublayer in _imageLayer.Sublayers)
            {
                // Using switch cells that provides on/off functionality
                SwitchCell cell = new SwitchCell()
                {
                    Text = sublayer.Name,
                    On = sublayer.IsVisible
                };

                // Hook into the On/Off changed event
                cell.OnChanged += OnCellOnOffChanged;
                
                // Add cell into the table view
                sublayersSection.Add(cell);
            }

            // Add section to the table view
            sublayersTableView.Root.Add(sublayersSection);

            // Add table to the root layout
            layout.Children.Add(sublayersTableView);

            // Create internal page for the navigation page
            var sublayersPage = new ContentPage()
            {
                Content = layout,
                Title = "Sublayers"
            };
                        
            // Navigate to the sublayers page
            await Navigation.PushAsync(sublayersPage);
        }
		public SwitchCellDemoCode ()
		{
			this.Title = "SwitchCell";
			var table = new TableView ();
			var root = new TableRoot ();
			var section1 = new TableSection ();

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

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

			Content = table;
		}
示例#31
0
        private void Init()
        {
            EditItem = new EditLoginToolBarItem(this, _loginId);
            ToolbarItems.Add(EditItem);
            if (Device.OS == TargetPlatform.iOS)
            {
                ToolbarItems.Add(new DismissModalToolBarItem(this));
            }

            // Name
            var nameCell = new LabeledValueCell(AppResources.Name);

            nameCell.Value.SetBinding <VaultViewLoginPageModel>(Label.TextProperty, s => s.Name);

            // Username
            UsernameCell = new LabeledValueCell(AppResources.Username, button1Text: AppResources.Copy);
            UsernameCell.Value.SetBinding <VaultViewLoginPageModel>(Label.TextProperty, s => s.Username);
            UsernameCell.Value.SetBinding <VaultViewLoginPageModel>(Label.FontSizeProperty, s => s.UsernameFontSize);
            UsernameCell.Button1.Command = new Command(() => Copy(Model.Username, AppResources.Username));

            // Password
            PasswordCell = new LabeledValueCell(AppResources.Password, button1Text: string.Empty,
                                                button2Text: AppResources.Copy);
            PasswordCell.Value.SetBinding <VaultViewLoginPageModel>(Label.TextProperty, s => s.MaskedPassword);
            PasswordCell.Value.SetBinding <VaultViewLoginPageModel>(Label.FontSizeProperty, s => s.PasswordFontSize);
            PasswordCell.Button1.SetBinding <VaultViewLoginPageModel>(Button.ImageProperty, s => s.ShowHideImage);
            if (Device.OS == TargetPlatform.iOS)
            {
                PasswordCell.Button1.Margin = new Thickness(10, 0);
            }
            PasswordCell.Button1.Command  = new Command(() => Model.RevealPassword = !Model.RevealPassword);
            PasswordCell.Button2.Command  = new Command(() => Copy(Model.Password, AppResources.Password));
            PasswordCell.Value.FontFamily = Device.OnPlatform(iOS: "Courier", Android: "monospace", WinPhone: "Courier");

            // URI
            UriCell = new LabeledValueCell(AppResources.Website, button1Text: AppResources.Launch);
            UriCell.Value.SetBinding <VaultViewLoginPageModel>(Label.TextProperty, s => s.UriHost);
            UriCell.Button1.SetBinding <VaultViewLoginPageModel>(IsVisibleProperty, s => s.ShowLaunch);
            UriCell.Button1.Command = new Command(() => Device.OpenUri(new Uri(Model.Uri)));

            // Notes
            NotesCell = new LabeledValueCell();
            NotesCell.Value.SetBinding <VaultViewLoginPageModel>(Label.TextProperty, s => s.Notes);
            NotesCell.Value.LineBreakMode = LineBreakMode.WordWrap;

            LoginInformationSection = new TableSection(AppResources.LoginInformation)
            {
                nameCell
            };

            NotesSection = new TableSection(AppResources.Notes)
            {
                NotesCell
            };

            Table = new ExtendedTableView
            {
                Intent          = TableIntent.Settings,
                EnableScrolling = true,
                HasUnevenRows   = true,
                EnableSelection = false,
                Root            = new TableRoot
                {
                    LoginInformationSection,
                    NotesSection
                }
            };

            if (Device.OS == TargetPlatform.iOS)
            {
                Table.RowHeight          = -1;
                Table.EstimatedRowHeight = 70;
            }
            else if (Device.OS == TargetPlatform.Android)
            {
                // NOTE: This is going to cause problems with i18n strings since various languages have difference string sizes
                PasswordCell.Button1.WidthRequest = 40;
                PasswordCell.Button2.WidthRequest = 59;
                UsernameCell.Button1.WidthRequest = 59;
                UriCell.Button1.WidthRequest      = 75;
            }

            Title          = AppResources.ViewLogin;
            Content        = Table;
            BindingContext = Model;
        }
示例#32
0
        private void InitTable()
        {
            AttachmentsCell = new ExtendedTextCell
            {
                Text            = AppResources.Attachments,
                ShowDisclousure = true
            };

            // Sections
            TopSection = new TableSection(AppResources.ItemInformation)
            {
                NameCell
            };

            MiddleSection = new TableSection(Helpers.GetEmptyTableSectionTitle())
            {
                FolderCell,
                FavoriteCell,
                AttachmentsCell
            };

            // Types
            if (Cipher.Type == CipherType.Login)
            {
                LoginTotpCell = new FormEntryCell(AppResources.AuthenticatorKey,
                                                  button1: _deviceInfo.HasCamera ? "camera.png" : null);
                LoginTotpCell.Entry.Text = Cipher.Login?.Totp?.Decrypt(Cipher.OrganizationId);
                LoginTotpCell.Entry.DisableAutocapitalize = true;
                LoginTotpCell.Entry.Autocorrect           = false;
                LoginTotpCell.Entry.FontFamily            =
                    Helpers.OnPlatform(iOS: "Menlo-Regular", Android: "monospace", Windows: "Courier");

                LoginPasswordCell = new FormEntryCell(AppResources.Password, isPassword: true,
                                                      nextElement: LoginTotpCell.Entry, button1: "eye.png", button2: "refresh_alt.png");
                LoginPasswordCell.Entry.Text = Cipher.Login?.Password?.Decrypt(Cipher.OrganizationId);
                LoginPasswordCell.Entry.DisableAutocapitalize = true;
                LoginPasswordCell.Entry.Autocorrect           = false;
                LoginPasswordCell.Entry.FontFamily            =
                    Helpers.OnPlatform(iOS: "Menlo-Regular", Android: "monospace", Windows: "Courier");

                LoginUsernameCell            = new FormEntryCell(AppResources.Username, nextElement: LoginPasswordCell.Entry);
                LoginUsernameCell.Entry.Text = Cipher.Login?.Username?.Decrypt(Cipher.OrganizationId);
                LoginUsernameCell.Entry.DisableAutocapitalize = true;
                LoginUsernameCell.Entry.Autocorrect           = false;

                // Name
                NameCell.NextElement = LoginUsernameCell.Entry;

                // Build sections
                TopSection.Add(LoginUsernameCell);
                TopSection.Add(LoginPasswordCell);
                TopSection.Add(LoginTotpCell);

                // Uris
                UrisSection = new TableSection(Helpers.GetEmptyTableSectionTitle());
                AddUriCell  = new ExtendedTextCell
                {
                    Text      = $"+ {AppResources.NewUri}",
                    TextColor = Colors.Primary
                };
                UrisSection.Add(AddUriCell);
                if (Cipher.Login?.Uris != null)
                {
                    foreach (var uri in Cipher.Login.Uris)
                    {
                        var value = uri.Uri?.Decrypt(Cipher.OrganizationId);
                        UrisSection.Insert(UrisSection.Count - 1,
                                           Helpers.MakeUriCell(value, uri.Match, UrisSection, this));
                    }
                }
            }
            else if (Cipher.Type == CipherType.Card)
            {
                CardCodeCell = new FormEntryCell(AppResources.SecurityCode, Keyboard.Numeric,
                                                 nextElement: NotesCell.Editor);
                CardCodeCell.Entry.Text = Cipher.Card.Code?.Decrypt(Cipher.OrganizationId);

                CardExpYearCell = new FormEntryCell(AppResources.ExpirationYear, Keyboard.Numeric,
                                                    nextElement: CardCodeCell.Entry);
                CardExpYearCell.Entry.Text = Cipher.Card.ExpYear?.Decrypt(Cipher.OrganizationId);

                var month = Cipher.Card.ExpMonth?.Decrypt(Cipher.OrganizationId);
                CardExpMonthCell = new FormPickerCell(AppResources.ExpirationMonth, new string[] {
                    "--", AppResources.January, AppResources.February, AppResources.March, AppResources.April,
                    AppResources.May, AppResources.June, AppResources.July, AppResources.August, AppResources.September,
                    AppResources.October, AppResources.November, AppResources.December
                });
                if (!string.IsNullOrWhiteSpace(month) && int.TryParse(month, out int monthIndex))
                {
                    CardExpMonthCell.Picker.SelectedIndex = monthIndex;
                }
                else
                {
                    CardExpMonthCell.Picker.SelectedIndex = 0;
                }

                var brandOptions = new string[] {
                    "--", "Visa", "Mastercard", "American Express", "Discover", "Diners Club",
                    "JCB", "Maestro", "UnionPay", AppResources.Other
                };
                var brand = Cipher.Card.Brand?.Decrypt(Cipher.OrganizationId);
                CardBrandCell = new FormPickerCell(AppResources.Brand, brandOptions);
                CardBrandCell.Picker.SelectedIndex = 0;
                if (!string.IsNullOrWhiteSpace(brand))
                {
                    var i = 0;
                    foreach (var o in brandOptions)
                    {
                        var option = o;
                        if (option == AppResources.Other)
                        {
                            option = "Other";
                        }

                        if (option == brand)
                        {
                            CardBrandCell.Picker.SelectedIndex = i;
                            break;
                        }
                        i++;
                    }
                }

                CardNumberCell            = new FormEntryCell(AppResources.Number, Keyboard.Numeric);
                CardNumberCell.Entry.Text = Cipher.Card.Number?.Decrypt(Cipher.OrganizationId);

                CardNameCell            = new FormEntryCell(AppResources.CardholderName, nextElement: CardNumberCell.Entry);
                CardNameCell.Entry.Text = Cipher.Card.CardholderName?.Decrypt(Cipher.OrganizationId);

                // Name
                NameCell.NextElement = CardNameCell.Entry;

                // Build sections
                TopSection.Add(CardNameCell);
                TopSection.Add(CardNumberCell);
                TopSection.Add(CardBrandCell);
                TopSection.Add(CardExpMonthCell);
                TopSection.Add(CardExpYearCell);
                TopSection.Add(CardCodeCell);
            }
            else if (Cipher.Type == CipherType.Identity)
            {
                IdCountryCell            = new FormEntryCell(AppResources.Country, nextElement: NotesCell.Editor);
                IdCountryCell.Entry.Text = Cipher.Identity.Country?.Decrypt(Cipher.OrganizationId);

                IdPostalCodeCell            = new FormEntryCell(AppResources.ZipPostalCode, nextElement: IdCountryCell.Entry);
                IdPostalCodeCell.Entry.Text = Cipher.Identity.PostalCode?.Decrypt(Cipher.OrganizationId);
                IdPostalCodeCell.Entry.DisableAutocapitalize = true;
                IdPostalCodeCell.Entry.Autocorrect           = false;

                IdStateCell            = new FormEntryCell(AppResources.StateProvince, nextElement: IdPostalCodeCell.Entry);
                IdStateCell.Entry.Text = Cipher.Identity.State?.Decrypt(Cipher.OrganizationId);

                IdCityCell            = new FormEntryCell(AppResources.CityTown, nextElement: IdStateCell.Entry);
                IdCityCell.Entry.Text = Cipher.Identity.City?.Decrypt(Cipher.OrganizationId);

                IdAddress3Cell            = new FormEntryCell(AppResources.Address3, nextElement: IdCityCell.Entry);
                IdAddress3Cell.Entry.Text = Cipher.Identity.Address3?.Decrypt(Cipher.OrganizationId);

                IdAddress2Cell            = new FormEntryCell(AppResources.Address2, nextElement: IdAddress3Cell.Entry);
                IdAddress2Cell.Entry.Text = Cipher.Identity.Address2?.Decrypt(Cipher.OrganizationId);

                IdAddress1Cell            = new FormEntryCell(AppResources.Address1, nextElement: IdAddress2Cell.Entry);
                IdAddress1Cell.Entry.Text = Cipher.Identity.Address1?.Decrypt(Cipher.OrganizationId);

                IdPhoneCell            = new FormEntryCell(AppResources.Phone, nextElement: IdAddress1Cell.Entry);
                IdPhoneCell.Entry.Text = Cipher.Identity.Phone?.Decrypt(Cipher.OrganizationId);
                IdPhoneCell.Entry.DisableAutocapitalize = true;
                IdPhoneCell.Entry.Autocorrect           = false;

                IdEmailCell            = new FormEntryCell(AppResources.Email, Keyboard.Email, nextElement: IdPhoneCell.Entry);
                IdEmailCell.Entry.Text = Cipher.Identity.Email?.Decrypt(Cipher.OrganizationId);
                IdEmailCell.Entry.DisableAutocapitalize = true;
                IdEmailCell.Entry.Autocorrect           = false;

                IdLicenseNumberCell            = new FormEntryCell(AppResources.LicenseNumber, nextElement: IdEmailCell.Entry);
                IdLicenseNumberCell.Entry.Text = Cipher.Identity.LicenseNumber?.Decrypt(Cipher.OrganizationId);
                IdLicenseNumberCell.Entry.DisableAutocapitalize = true;
                IdLicenseNumberCell.Entry.Autocorrect           = false;

                IdPassportNumberCell            = new FormEntryCell(AppResources.PassportNumber, nextElement: IdLicenseNumberCell.Entry);
                IdPassportNumberCell.Entry.Text = Cipher.Identity.PassportNumber?.Decrypt(Cipher.OrganizationId);
                IdPassportNumberCell.Entry.DisableAutocapitalize = true;
                IdPassportNumberCell.Entry.Autocorrect           = false;

                IdSsnCell            = new FormEntryCell(AppResources.SSN, nextElement: IdPassportNumberCell.Entry);
                IdSsnCell.Entry.Text = Cipher.Identity.SSN?.Decrypt(Cipher.OrganizationId);
                IdSsnCell.Entry.DisableAutocapitalize = true;
                IdSsnCell.Entry.Autocorrect           = false;

                IdCompanyCell            = new FormEntryCell(AppResources.Company, nextElement: IdSsnCell.Entry);
                IdCompanyCell.Entry.Text = Cipher.Identity.Company?.Decrypt(Cipher.OrganizationId);

                IdUsernameCell            = new FormEntryCell(AppResources.Username, nextElement: IdCompanyCell.Entry);
                IdUsernameCell.Entry.Text = Cipher.Identity.Username?.Decrypt(Cipher.OrganizationId);
                IdUsernameCell.Entry.DisableAutocapitalize = true;
                IdUsernameCell.Entry.Autocorrect           = false;

                IdLastNameCell            = new FormEntryCell(AppResources.LastName, nextElement: IdUsernameCell.Entry);
                IdLastNameCell.Entry.Text = Cipher.Identity.LastName?.Decrypt(Cipher.OrganizationId);

                IdMiddleNameCell            = new FormEntryCell(AppResources.MiddleName, nextElement: IdLastNameCell.Entry);
                IdMiddleNameCell.Entry.Text = Cipher.Identity.MiddleName?.Decrypt(Cipher.OrganizationId);

                IdFirstNameCell            = new FormEntryCell(AppResources.FirstName, nextElement: IdMiddleNameCell.Entry);
                IdFirstNameCell.Entry.Text = Cipher.Identity.FirstName?.Decrypt(Cipher.OrganizationId);

                var titleOptions = new string[] {
                    "--", AppResources.Mr, AppResources.Mrs, AppResources.Ms, AppResources.Dr
                };
                IdTitleCell = new FormPickerCell(AppResources.Title, titleOptions);
                var title = Cipher.Identity.Title?.Decrypt(Cipher.OrganizationId);
                IdTitleCell.Picker.SelectedIndex = 0;
                if (!string.IsNullOrWhiteSpace(title))
                {
                    var i = 0;
                    foreach (var o in titleOptions)
                    {
                        i++;
                        if (o == title)
                        {
                            IdTitleCell.Picker.SelectedIndex = i;
                            break;
                        }
                    }
                }

                // Name
                NameCell.NextElement = IdFirstNameCell.Entry;

                // Build sections
                TopSection.Add(IdTitleCell);
                TopSection.Add(IdFirstNameCell);
                TopSection.Add(IdMiddleNameCell);
                TopSection.Add(IdLastNameCell);
                TopSection.Add(IdUsernameCell);
                TopSection.Add(IdCompanyCell);
                TopSection.Add(IdSsnCell);
                TopSection.Add(IdPassportNumberCell);
                TopSection.Add(IdLicenseNumberCell);
                TopSection.Add(IdEmailCell);
                TopSection.Add(IdPhoneCell);
                TopSection.Add(IdAddress1Cell);
                TopSection.Add(IdAddress2Cell);
                TopSection.Add(IdAddress3Cell);
                TopSection.Add(IdCityCell);
                TopSection.Add(IdStateCell);
                TopSection.Add(IdPostalCodeCell);
                TopSection.Add(IdCountryCell);
            }
            else if (Cipher.Type == CipherType.SecureNote)
            {
                // Name
                NameCell.NextElement = NotesCell.Editor;
            }

            FieldsSection = new TableSection(AppResources.CustomFields);
            if (Cipher.Fields != null)
            {
                foreach (var field in Cipher.Fields)
                {
                    var label = field.Name?.Decrypt(Cipher.OrganizationId) ?? string.Empty;
                    var value = field.Value?.Decrypt(Cipher.OrganizationId);
                    var cell  = Helpers.MakeFieldCell(field.Type, label, value, FieldsSection, this);
                    if (cell != null)
                    {
                        FieldsSection.Add(cell);
                    }
                }
            }
            AddFieldCell = new ExtendedTextCell
            {
                Text      = $"+ {AppResources.NewCustomField}",
                TextColor = Colors.Primary
            };
            FieldsSection.Add(AddFieldCell);

            // Make table
            TableRoot = new TableRoot
            {
                TopSection,
                MiddleSection,
                new TableSection(AppResources.Notes)
                {
                    NotesCell
                },
                FieldsSection,
                new TableSection(Helpers.GetEmptyTableSectionTitle())
                {
                    DeleteCell
                }
            };

            if (UrisSection != null)
            {
                TableRoot.Insert(1, UrisSection);
            }

            Table = new ExtendedTableView
            {
                Intent          = TableIntent.Settings,
                EnableScrolling = true,
                HasUnevenRows   = true,
                Root            = TableRoot
            };

            if (Device.RuntimePlatform == Device.iOS)
            {
                Table.RowHeight          = -1;
                Table.EstimatedRowHeight = 70;
            }
            else if (Device.RuntimePlatform == Device.Android)
            {
                Table.BottomPadding = 50;
            }
        }
示例#33
0
        //private EventPage lastEventPage;

        public DayPage()
        {
            //InitializeComponent();
            //myList();

            ToolbarItem toolbarItem = new ToolbarItem
            {
                Text = "Back"
            };

            ToolbarItems.Add(toolbarItem);
            toolbarItem.Clicked += (object sender, EventArgs e) =>
            {
                Navigation.PushAsync(new YearPage());
            };

            TableView tableView = new TableView {
            };

            tableView.Root = new TableRoot();
            TableSection tableSection = new TableSection("Events");

            tableView.Root.Add(tableSection);

            // Add create event button
            StackLayout staticStackLayout = new StackLayout {
                Orientation = StackOrientation.Horizontal, Padding = new Thickness(13, 0)
            };
            Button createEventButton = new Button {
                Text = "Add a new Event"
            };

            createEventButton.Clicked += OnCreateEventButtonClicked;
            staticStackLayout.Children.Add(createEventButton);
            tableSection.Add(new ViewCell {
                View = staticStackLayout
            });
            // Add 24 hours
            for (int hour = 0; hour < 24; hour++)
            {
                StackLayout stackLayout = new StackLayout {
                    Orientation = StackOrientation.Horizontal, Padding = new Thickness(13, 0)
                };
                Label hourLabel = new Label {
                    Text = string.Format("{00}:00", hour), VerticalOptions = LayoutOptions.Center
                };

                stackLayout.Children.Add(hourLabel);
                // Add events

                List <Event> userEvents = User.CurrentUser.Events;
                for (int j = 0; j < userEvents.Count; j++)
                {
                    if (userEvents[j].StartTime().Year == Time.CurrentTime.Year &&
                        userEvents[j].StartTime().Month == Time.CurrentTime.Month &&
                        userEvents[j].StartTime().Day == Time.CurrentTime.Day)
                    {
                        if (userEvents[j].StartTime().Hour <= hour &&
                            userEvents[j].EndTime().Hour >= hour
                            )
                        {
                            stackLayout.Children.Add(AddEvent(userEvents[j]));
                        }
                    }
                }

                ViewCell cell = new ViewCell {
                    View = stackLayout
                };
                tableSection.Add(cell);
            }

            this.Content = new StackLayout
            {
                Children =
                {
                    tableView
                }
            };
        }
示例#34
0
        private void Init()
        {
            PinCell = new ExtendedSwitchCell
            {
                Text = AppResources.UnlockWithPIN,
                On   = _settings.GetValueOrDefault(Constants.SettingPinUnlockOn, false)
            };

            LockOptionsCell = new ExtendedTextCell
            {
                Text            = AppResources.LockOptions,
                Detail          = GetLockOptionsDetailsText(),
                ShowDisclousure = true
            };

            TwoStepCell = new ExtendedTextCell
            {
                Text            = AppResources.TwoStepLogin,
                ShowDisclousure = true
            };

            var securitySecion = new TableSection(AppResources.Security)
            {
                LockOptionsCell,
                PinCell,
                TwoStepCell
            };

            if (_fingerprint.IsAvailable)
            {
                var fingerprintName = Device.OnPlatform(iOS: AppResources.TouchID, Android: AppResources.Fingerprint,
                                                        WinPhone: AppResources.Fingerprint);
                FingerprintCell = new ExtendedSwitchCell
                {
                    Text      = string.Format(AppResources.UnlockWith, fingerprintName),
                    On        = _settings.GetValueOrDefault(Constants.SettingFingerprintUnlockOn, false),
                    IsEnabled = _fingerprint.IsAvailable
                };
                securitySecion.Insert(1, FingerprintCell);
            }

            ChangeMasterPasswordCell = new ExtendedTextCell
            {
                Text            = AppResources.ChangeMasterPassword,
                ShowDisclousure = true
            };

            ChangeEmailCell = new ExtendedTextCell
            {
                Text            = AppResources.ChangeEmail,
                ShowDisclousure = true
            };

            FoldersCell = new ExtendedTextCell
            {
                Text            = AppResources.Folders,
                ShowDisclousure = true
            };

            SyncCell = new ExtendedTextCell
            {
                Text            = AppResources.Sync,
                ShowDisclousure = true
            };

            LockCell = new ExtendedTextCell
            {
                Text = AppResources.Lock
            };

            LogOutCell = new ExtendedTextCell
            {
                Text = AppResources.LogOut
            };

            AboutCell = new ExtendedTextCell
            {
                Text            = AppResources.About,
                ShowDisclousure = true
            };

            HelpCell = new ExtendedTextCell
            {
                Text            = AppResources.HelpAndFeedback,
                ShowDisclousure = true
            };

            var otherSection = new TableSection(AppResources.Other)
            {
                AboutCell,
                HelpCell
            };

            if (Device.OS == TargetPlatform.iOS)
            {
                RateCellLong = new LongDetailViewCell(AppResources.RateTheApp, AppResources.RateTheAppDescriptionAppStore);
                otherSection.Add(RateCellLong);
            }
            else
            {
                RateCell = new ExtendedTextCell
                {
                    Text                = AppResources.RateTheApp,
                    Detail              = AppResources.RateTheAppDescription,
                    ShowDisclousure     = true,
                    DetailLineBreakMode = LineBreakMode.WordWrap
                };
                otherSection.Add(RateCell);
            }

            Table = new CustomTable
            {
                Root = new TableRoot
                {
                    securitySecion,
                    new TableSection(AppResources.Account)
                    {
                        ChangeMasterPasswordCell,
                        ChangeEmailCell
                    },
                    new TableSection(AppResources.Manage)
                    {
                        FoldersCell,
                        SyncCell
                    },
                    new TableSection(AppResources.CurrentSession)
                    {
                        LockCell,
                        LogOutCell
                    },
                    otherSection
                }
            };

            Title   = AppResources.Settings;
            Content = Table;
        }
示例#35
0
        public static Cell MakeFieldCell(FieldType type, string label, string value,
                                         TableSection fieldsSection, Page page)
        {
            Cell           cell;
            FormEntryCell  feCell = null;
            FormSwitchCell fsCell = null;

            switch (type)
            {
            case FieldType.Text:
            case FieldType.Hidden:
                var hidden = type == FieldType.Hidden;
                cell = feCell = new FormEntryCell(label, isPassword: hidden,
                                                  button1: hidden ? "eye.png" : "cog_alt.png", button2: hidden ? "cog_alt.png" : null);
                feCell.Entry.Text = value;
                feCell.Entry.DisableAutocapitalize = true;
                feCell.Entry.Autocorrect           = false;

                if (hidden)
                {
                    feCell.Entry.FontFamily = OnPlatform(iOS: "Menlo-Regular", Android: "monospace",
                                                         Windows: "Courier");
                    feCell.Button1.Command = new Command(() =>
                    {
                        feCell.Entry.InvokeToggleIsPassword();
                        feCell.Button1.Image = "eye" +
                                               (!feCell.Entry.IsPasswordFromToggled ? "_slash" : string.Empty) + ".png";
                    });
                }
                break;

            case FieldType.Boolean:
                cell = fsCell = new FormSwitchCell(label, "cog_alt.png");
                fsCell.Switch.IsToggled = value == "true";
                break;

            default:
                cell = null;
                break;
            }

            if (cell != null)
            {
                var optionsButton = feCell != null ? feCell.Button2 ?? feCell.Button1 : fsCell.Button1;
                optionsButton.Command = new Command(async() =>
                {
                    var optionsVal = await page.DisplayActionSheet(AppResources.Options, AppResources.Cancel,
                                                                   null, AppResources.Edit, AppResources.Remove);
                    if (optionsVal == AppResources.Remove)
                    {
                        if (fieldsSection.Contains(cell))
                        {
                            fieldsSection.Remove(cell);
                        }

                        if (feCell != null)
                        {
                            feCell.Dispose();
                        }
                        cell   = null;
                        feCell = null;
                        fsCell = null;
                    }
                    else if (optionsVal == AppResources.Edit)
                    {
                        var existingLabel = feCell?.Label.Text ?? fsCell?.Label.Text;
                        var daService     = Resolver.Resolve <IDeviceActionService>();
                        var editLabel     = await daService.DisplayPromptAync(AppResources.CustomFieldName,
                                                                              null, existingLabel);
                        if (editLabel != null)
                        {
                            if (feCell != null)
                            {
                                feCell.Label.Text = editLabel;
                            }
                            else if (fsCell != null)
                            {
                                fsCell.Label.Text = editLabel;
                            }
                        }
                    }
                });
            }

            return(cell);
        }
示例#36
0
        protected override void Init()
        {
            var layout = new StackLayout();
            var button = new Button {
                Text = "Click"
            };
            var tablesection = new TableSection {
                Title = "Switches"
            };
            var tableview = new TableView {
                Intent = TableIntent.Form, Root = new TableRoot {
                    tablesection
                }
            };
            var viewcell1 = new ViewCell {
                View = new StackLayout {
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    Orientation       = StackOrientation.Horizontal,
                    Children          =
                    {
                        new Label  {
                            Text = "Switch 1", HorizontalOptions = LayoutOptions.StartAndExpand
                        },
                        new Switch {
                            AutomationId = "switch1", HorizontalOptions = LayoutOptions.End, IsToggled = true
                        }
                    }
                }
            };
            var viewcell2 = new ViewCell {
                View = new StackLayout {
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    Orientation       = StackOrientation.Horizontal,
                    Children          =
                    {
                        new Label  {
                            Text = "Switch 2", HorizontalOptions = LayoutOptions.StartAndExpand
                        },
                        new Switch {
                            AutomationId = "switch2", HorizontalOptions = LayoutOptions.End, IsToggled = true
                        }
                    }
                }
            };
            Label label = new Label {
                Text = "Switch 3", HorizontalOptions = LayoutOptions.StartAndExpand
            };
            Switch switchie = new Switch {
                AutomationId = "switch3", HorizontalOptions = LayoutOptions.End, IsToggled = true, IsEnabled = false
            };

            switchie.Toggled += (sender, e) => {
                label.Text = "FAIL";
            };
            var viewcell3 = new ViewCell {
                View = new StackLayout {
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    Orientation       = StackOrientation.Horizontal,
                    Children          =
                    {
                        label,
                        switchie,
                    }
                }
            };

            tablesection.Add(viewcell1);
            tablesection.Add(viewcell2);
            tablesection.Add(viewcell3);

            button.Clicked += (sender, e) => {
                if (_removed)
                {
                    tablesection.Insert(1, viewcell2);
                }
                else
                {
                    tablesection.Remove(viewcell2);
                }

                _removed = !_removed;
            };

            layout.Children.Add(button);
            layout.Children.Add(tableview);

            Content = layout;
        }
        public EntryCellTablePage()
        {
            Title = "EntryCell Table Gallery - Legacy";

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

            int timesEntered = 1;

            var entryCell = new EntryCell {
                Label = "Enter text", Placeholder = "I am a placeholder"
            };

            entryCell.Completed += (sender, args) => {
                ((EntryCell)sender).Label = "Entered: " + timesEntered;
                timesEntered++;
            };

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

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

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

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

            var table = new TableView {
                Root = root
            };

            Content = table;
        }
示例#38
0
        private void Init()
        {
            EditItem = new EditLoginToolBarItem(this, _loginId);
            ToolbarItems.Add(EditItem);
            if (Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Windows)
            {
                ToolbarItems.Add(new DismissModalToolBarItem(this));
            }

            // Name
            var nameCell = new LabeledValueCell(AppResources.Name);

            nameCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewLoginPageModel.Name));

            // Username
            UsernameCell = new LabeledValueCell(AppResources.Username, button1Text: AppResources.Copy);
            UsernameCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewLoginPageModel.Username));
            UsernameCell.Button1.Command     = new Command(() => Copy(Model.Username, AppResources.Username));
            UsernameCell.Value.LineBreakMode = LineBreakMode.WordWrap;

            // Password
            PasswordCell = new LabeledValueCell(AppResources.Password, button1Text: string.Empty,
                                                button2Text: AppResources.Copy);
            PasswordCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewLoginPageModel.MaskedPassword));
            PasswordCell.Button1.SetBinding(Button.ImageProperty, nameof(VaultViewLoginPageModel.ShowHideImage));
            if (Device.RuntimePlatform == Device.iOS)
            {
                PasswordCell.Button1.Margin = new Thickness(10, 0);
            }
            PasswordCell.Button1.Command     = new Command(() => Model.RevealPassword = !Model.RevealPassword);
            PasswordCell.Button2.Command     = new Command(() => Copy(Model.Password, AppResources.Password));
            PasswordCell.Value.FontFamily    = Helpers.OnPlatform(iOS: "Menlo-Regular", Android: "monospace", WinPhone: "Courier");
            PasswordCell.Value.LineBreakMode = LineBreakMode.WordWrap;

            // URI
            UriCell = new LabeledValueCell(AppResources.Website, button1Text: AppResources.Launch);
            UriCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewLoginPageModel.UriHost));
            UriCell.Button1.SetBinding(IsVisibleProperty, nameof(VaultViewLoginPageModel.ShowLaunch));
            UriCell.Button1.Command = new Command(() =>
            {
                if (Device.RuntimePlatform == Device.Android && Model.Uri.StartsWith("androidapp://"))
                {
                    MessagingCenter.Send(Application.Current, "LaunchApp", Model.Uri);
                }
                else if (Model.Uri.StartsWith("http://") || Model.Uri.StartsWith("https://"))
                {
                    Device.OpenUri(new Uri(Model.Uri));
                }
            });

            // Totp
            TotpCodeCell = new LabeledValueCell(AppResources.VerificationCodeTotp, button1Text: AppResources.Copy, subText: "--");
            TotpCodeCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewLoginPageModel.TotpCodeFormatted));
            TotpCodeCell.Value.SetBinding(Label.TextColorProperty, nameof(VaultViewLoginPageModel.TotpColor));
            TotpCodeCell.Button1.Command = new Command(() => Copy(Model.TotpCode, AppResources.VerificationCodeTotp));
            TotpCodeCell.Sub.SetBinding(Label.TextProperty, nameof(VaultViewLoginPageModel.TotpSecond));
            TotpCodeCell.Sub.SetBinding(Label.TextColorProperty, nameof(VaultViewLoginPageModel.TotpColor));
            TotpCodeCell.Value.FontFamily = Helpers.OnPlatform(iOS: "Menlo-Regular", Android: "monospace", WinPhone: "Courier");

            // Notes
            NotesCell = new LabeledValueCell();
            NotesCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewLoginPageModel.Notes));
            NotesCell.Value.LineBreakMode = LineBreakMode.WordWrap;

            LoginInformationSection = new TableSection(AppResources.LoginInformation)
            {
                nameCell
            };

            NotesSection = new TableSection(AppResources.Notes)
            {
                NotesCell
            };

            Table = new ExtendedTableView
            {
                Intent          = TableIntent.Settings,
                EnableScrolling = true,
                HasUnevenRows   = true,
                EnableSelection = true,
                Root            = new TableRoot
                {
                    LoginInformationSection
                }
            };

            if (Device.RuntimePlatform == Device.iOS)
            {
                Table.RowHeight          = -1;
                Table.EstimatedRowHeight = 70;
            }
            else if (Device.RuntimePlatform == Device.Android)
            {
                // NOTE: This is going to cause problems with i18n strings since various languages have difference string sizes
                PasswordCell.Button1.WidthRequest = 40;
                PasswordCell.Button2.WidthRequest = 59;
                UsernameCell.Button1.WidthRequest = 59;
                TotpCodeCell.Button1.WidthRequest = 59;
                UriCell.Button1.WidthRequest      = 75;
            }

            Title          = AppResources.ViewLogin;
            Content        = Table;
            BindingContext = Model;
        }
示例#39
0
        protected async override void OnAppearing()
        {
            _pageDisappeared  = false;
            NotesCell.Tapped += NotesCell_Tapped;
            EditItem.InitEvents();

            var login = await _loginService.GetByIdAsync(_loginId);

            if (login == null)
            {
                await Navigation.PopForDeviceAsync();

                return;
            }

            Model.Update(login);

            if (LoginInformationSection.Contains(UriCell))
            {
                LoginInformationSection.Remove(UriCell);
            }
            if (Model.ShowUri)
            {
                LoginInformationSection.Add(UriCell);
            }

            if (LoginInformationSection.Contains(UsernameCell))
            {
                LoginInformationSection.Remove(UsernameCell);
            }
            if (Model.ShowUsername)
            {
                LoginInformationSection.Add(UsernameCell);
            }

            if (LoginInformationSection.Contains(PasswordCell))
            {
                LoginInformationSection.Remove(PasswordCell);
            }
            if (Model.ShowPassword)
            {
                LoginInformationSection.Add(PasswordCell);
            }

            if (Table.Root.Contains(NotesSection))
            {
                Table.Root.Remove(NotesSection);
            }
            if (Model.ShowNotes)
            {
                Table.Root.Add(NotesSection);
            }

            // Totp
            if (LoginInformationSection.Contains(TotpCodeCell))
            {
                LoginInformationSection.Remove(TotpCodeCell);
            }
            if (login.Totp != null && (_tokenService.TokenPremium || login.OrganizationUseTotp))
            {
                var totpKey = login.Totp.Decrypt(login.OrganizationId);
                if (!string.IsNullOrWhiteSpace(totpKey))
                {
                    Model.TotpCode = Crypto.Totp(totpKey);
                    if (!string.IsNullOrWhiteSpace(Model.TotpCode))
                    {
                        TotpTick(totpKey);
                        Device.StartTimer(new TimeSpan(0, 0, 1), () =>
                        {
                            if (_pageDisappeared)
                            {
                                return(false);
                            }

                            TotpTick(totpKey);
                            return(true);
                        });

                        LoginInformationSection.Add(TotpCodeCell);
                    }
                }
            }

            CleanupAttachmentCells();
            if (Table.Root.Contains(AttachmentsSection))
            {
                Table.Root.Remove(AttachmentsSection);
            }
            if (Model.ShowAttachments && _tokenService.TokenPremium)
            {
                AttachmentsSection = new TableSection(AppResources.Attachments);
                AttachmentCells    = new List <AttachmentViewCell>();
                foreach (var attachment in Model.Attachments.OrderBy(s => s.Name))
                {
                    var attachmentCell = new AttachmentViewCell(attachment, async() =>
                    {
                        await OpenAttachmentAsync(login, attachment);
                    });
                    AttachmentCells.Add(attachmentCell);
                    AttachmentsSection.Add(attachmentCell);
                    attachmentCell.InitEvents();
                }
                Table.Root.Add(AttachmentsSection);
            }

            if (Table.Root.Contains(FieldsSection))
            {
                Table.Root.Remove(FieldsSection);
            }
            if (Model.ShowFields)
            {
                FieldsSection = new TableSection(AppResources.CustomFields);
                foreach (var field in Model.Fields)
                {
                    FieldViewCell fieldCell;
                    switch (field.Type)
                    {
                    case FieldType.Text:
                        fieldCell = new FieldViewCell(this, field, null);
                        break;

                    case FieldType.Hidden:
                        fieldCell = new FieldViewCell(this, field, null, null);
                        break;

                    case FieldType.Boolean:
                        fieldCell = new FieldViewCell(this, field);
                        break;

                    default:
                        continue;
                    }
                    FieldsSection.Add(fieldCell);
                }
                Table.Root.Add(FieldsSection);
            }

            base.OnAppearing();
        }
示例#40
0
        protected override void Init()
        {
            TableView tableView = new TableView();

            var section1 = new TableSection("Section One")
            {
                new ViewCell {
                    View = new Entry {
                        Placeholder = "Entry 1", AutomationId = Entry1
                    }
                },
                new ViewCell {
                    View = new Entry {
                        Placeholder = "Entry 2", AutomationId = Entry2
                    }
                }
            };

            var section2Stack = new StackLayout()
            {
                Orientation = StackOrientation.Horizontal
            };

            section2Stack.Children.Add(new Entry {
                Placeholder = "Entry 3", AutomationId = Entry3
            });
            section2Stack.Children.Add(new Entry {
                Placeholder = "Entry 4", AutomationId = Entry4
            });

            var section2 = new TableSection("Section Two")
            {
                new ViewCell {
                    View = section2Stack
                }
            };

            var section3 = new TableSection("Section Three")
            {
                new ViewCell {
                    View = new Entry {
                        Placeholder = "Entry 5"
                    }
                },
                new ViewCell {
                    View = new Entry {
                        Placeholder = "Entry 6"
                    }
                }
            };

            tableView.Root.Add(section1);
            tableView.Root.Add(section2);
            tableView.Root.Add(section3);

            var layout = new StackLayout {
                Children = { tableView }
            };

            Content = layout;
        }
示例#41
0
        public void InitProps()
        {
            // Name
            var nameCell = new LabeledValueCell(AppResources.Name);

            nameCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewCipherPageModel.Name));
            nameCell.Value.LineBreakMode = LineBreakMode.WordWrap;

            // Notes
            NotesCell = new LabeledValueCell();
            NotesCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewCipherPageModel.Notes));
            NotesCell.Value.LineBreakMode = LineBreakMode.WordWrap;

            switch (_type)
            {
            case CipherType.Login:
                // Username
                LoginUsernameCell = new LabeledValueCell(AppResources.Username, button1Image: "clipboard.png");
                LoginUsernameCell.Value.SetBinding(Label.TextProperty,
                                                   nameof(VaultViewCipherPageModel.LoginUsername));
                LoginUsernameCell.Button1.Command =
                    new Command(() => Copy(Model.LoginUsername, AppResources.Username));
                LoginUsernameCell.Value.LineBreakMode = LineBreakMode.WordWrap;

                // Password
                LoginPasswordCell = new LabeledValueCell(AppResources.Password, button1Image: string.Empty,
                                                         button2Image: "clipboard.png");
                LoginPasswordCell.Value.SetBinding(Label.TextProperty,
                                                   nameof(VaultViewCipherPageModel.MaskedLoginPassword));
                LoginPasswordCell.Button1.SetBinding(Button.ImageProperty,
                                                     nameof(VaultViewCipherPageModel.LoginShowHideImage));
                if (Device.RuntimePlatform == Device.iOS)
                {
                    LoginPasswordCell.Button1.Margin = new Thickness(10, 0);
                }
                LoginPasswordCell.Button1.Command =
                    new Command(() => Model.RevealLoginPassword = !Model.RevealLoginPassword);
                LoginPasswordCell.Button2.Command =
                    new Command(() => Copy(Model.LoginPassword, AppResources.Password));
                LoginPasswordCell.Value.FontFamily =
                    Helpers.OnPlatform(iOS: "Menlo-Regular", Android: "monospace", Windows: "Courier");
                LoginPasswordCell.Value.LineBreakMode = LineBreakMode.WordWrap;

                // Totp
                LoginTotpCodeCell = new LabeledValueCell(
                    AppResources.VerificationCodeTotp, button1Image: "clipboard.png", subText: "--");
                LoginTotpCodeCell.Value.SetBinding(Label.TextProperty,
                                                   nameof(VaultViewCipherPageModel.LoginTotpCodeFormatted));
                LoginTotpCodeCell.Value.SetBinding(Label.TextColorProperty,
                                                   nameof(VaultViewCipherPageModel.LoginTotpColor));
                LoginTotpCodeCell.Button1.Command =
                    new Command(() => Copy(Model.LoginTotpCode, AppResources.VerificationCodeTotp));
                LoginTotpCodeCell.Sub.SetBinding(Label.TextProperty,
                                                 nameof(VaultViewCipherPageModel.LoginTotpSecond));
                LoginTotpCodeCell.Sub.SetBinding(Label.TextColorProperty,
                                                 nameof(VaultViewCipherPageModel.LoginTotpColor));
                LoginTotpCodeCell.Value.FontFamily =
                    Helpers.OnPlatform(iOS: "Menlo-Regular", Android: "monospace", Windows: "Courier");
                break;

            case CipherType.Card:
                CardNameCell = new LabeledValueCell(AppResources.CardholderName);
                CardNameCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewCipherPageModel.CardName));

                CardNumberCell = new LabeledValueCell(AppResources.Number, button1Image: "clipboard.png");
                CardNumberCell.Button1.Command = new Command(() => Copy(Model.CardNumber, AppResources.Number));
                CardNumberCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewCipherPageModel.CardNumber));
                CardNumberCell.Value.LineBreakMode = LineBreakMode.WordWrap;

                CardBrandCell = new LabeledValueCell(AppResources.Brand);
                CardBrandCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewCipherPageModel.CardBrand));

                CardExpCell = new LabeledValueCell(AppResources.Expiration);
                CardExpCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewCipherPageModel.CardExp));

                CardCodeCell = new LabeledValueCell(AppResources.SecurityCode, button1Image: "clipboard.png");
                CardCodeCell.Button1.Command = new Command(() => Copy(Model.CardCode, AppResources.SecurityCode));
                CardCodeCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewCipherPageModel.CardCode));
                break;

            case CipherType.Identity:
                IdNameCell = new LabeledValueCell(AppResources.Name);
                IdNameCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewCipherPageModel.IdName));
                IdNameCell.Value.LineBreakMode = LineBreakMode.WordWrap;

                IdUsernameCell = new LabeledValueCell(AppResources.Username, button1Image: "clipboard.png");
                IdUsernameCell.Button1.Command = new Command(() => Copy(Model.IdUsername, AppResources.Username));
                IdUsernameCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewCipherPageModel.IdUsername));
                IdUsernameCell.Value.LineBreakMode = LineBreakMode.WordWrap;

                IdCompanyCell = new LabeledValueCell(AppResources.Company);
                IdCompanyCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewCipherPageModel.IdCompany));

                IdSsnCell = new LabeledValueCell(AppResources.SSN);
                IdSsnCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewCipherPageModel.IdSsn));

                IdPassportNumberCell = new LabeledValueCell(AppResources.PassportNumber,
                                                            button1Image: "clipboard.png");
                IdPassportNumberCell.Button1.Command =
                    new Command(() => Copy(Model.IdPassportNumber, AppResources.PassportNumber));
                IdPassportNumberCell.Value.SetBinding(Label.TextProperty,
                                                      nameof(VaultViewCipherPageModel.IdPassportNumber));
                IdPassportNumberCell.Value.LineBreakMode = LineBreakMode.WordWrap;

                IdLicenseNumberCell = new LabeledValueCell(AppResources.LicenseNumber,
                                                           button1Image: "clipboard.png");
                IdLicenseNumberCell.Button1.Command =
                    new Command(() => Copy(Model.IdLicenseNumber, AppResources.LicenseNumber));
                IdLicenseNumberCell.Value.SetBinding(Label.TextProperty,
                                                     nameof(VaultViewCipherPageModel.IdLicenseNumber));
                IdLicenseNumberCell.Value.LineBreakMode = LineBreakMode.WordWrap;

                IdEmailCell = new LabeledValueCell(AppResources.Email);
                IdEmailCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewCipherPageModel.IdEmail));

                IdPhoneCell = new LabeledValueCell(AppResources.Phone);
                IdPhoneCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewCipherPageModel.IdPhone));

                IdAddressCell = new LabeledValueCell(AppResources.Address, button1Image: "clipboard.png");
                IdAddressCell.Button1.Command = new Command(() => Copy(Model.IdAddress, AppResources.Address));
                IdAddressCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewCipherPageModel.IdAddress));
                IdAddressCell.Value.LineBreakMode = LineBreakMode.WordWrap;
                break;

            default:
                break;
            }

            ItemInformationSection = new TableSection(AppResources.ItemInformation)
            {
                nameCell
            };

            NotesSection = new TableSection(AppResources.Notes)
            {
                NotesCell
            };

            Table = new ExtendedTableView
            {
                Intent          = TableIntent.Settings,
                EnableScrolling = true,
                HasUnevenRows   = true,
                EnableSelection = true,
                Root            = new TableRoot
                {
                    ItemInformationSection
                }
            };

            if (Device.RuntimePlatform == Device.iOS)
            {
                Table.RowHeight          = -1;
                Table.EstimatedRowHeight = 70;
            }
            else if (Device.RuntimePlatform == Device.Android)
            {
                Table.BottomPadding = 170;
            }
        }
示例#42
0
        private void BuildTable(Cipher cipher)
        {
            // URIs
            if (UrisSection != null && Table.Root.Contains(UrisSection))
            {
                Table.Root.Remove(UrisSection);
            }
            if (Model.ShowLoginUris)
            {
                UrisSection = new TableSection(Helpers.GetEmptyTableSectionTitle());
                foreach (var uri in Model.LoginUris)
                {
                    UrisSection.Add(new UriViewCell(this, uri));
                }
                Table.Root.Add(UrisSection);
            }

            // Notes
            if (Table.Root.Contains(NotesSection))
            {
                Table.Root.Remove(NotesSection);
            }
            if (Model.ShowNotes)
            {
                Table.Root.Add(NotesSection);
            }

            // Fields
            if (Table.Root.Contains(FieldsSection))
            {
                Table.Root.Remove(FieldsSection);
            }
            if (Model.ShowFields)
            {
                FieldsSection = new TableSection(AppResources.CustomFields);
                foreach (var field in Model.Fields)
                {
                    FieldViewCell fieldCell;
                    switch (field.Type)
                    {
                    case FieldType.Text:
                        fieldCell = new FieldViewCell(this, field, null);
                        break;

                    case FieldType.Hidden:
                        fieldCell = new FieldViewCell(this, field, null, null);
                        break;

                    case FieldType.Boolean:
                        fieldCell = new FieldViewCell(this, field);
                        break;

                    default:
                        continue;
                    }
                    FieldsSection.Add(fieldCell);
                }
                Table.Root.Add(FieldsSection);
            }

            // Attachments
            CleanupAttachmentCells();
            if (Table.Root.Contains(AttachmentsSection))
            {
                Table.Root.Remove(AttachmentsSection);
            }
            if (Model.ShowAttachments && (_tokenService.TokenPremium || cipher.OrganizationId != null))
            {
                AttachmentsSection = new TableSection(AppResources.Attachments);
                AttachmentCells    = new List <AttachmentViewCell>();
                foreach (var attachment in Model.Attachments.OrderBy(s => s.Name))
                {
                    var attachmentCell = new AttachmentViewCell(attachment, async() =>
                    {
                        await OpenAttachmentAsync(cipher, attachment);
                    });
                    AttachmentCells.Add(attachmentCell);
                    AttachmentsSection.Add(attachmentCell);
                    attachmentCell.InitEvents();
                }
                Table.Root.Add(AttachmentsSection);
            }

            // Various types
            switch (cipher.Type)
            {
            case CipherType.Login:
                AddSectionCell(LoginUsernameCell, Model.ShowLoginUsername);
                AddSectionCell(LoginPasswordCell, Model.ShowLoginPassword);

                if (ItemInformationSection.Contains(LoginTotpCodeCell))
                {
                    ItemInformationSection.Remove(LoginTotpCodeCell);
                }
                if (cipher.Login?.Totp != null && (_tokenService.TokenPremium || cipher.OrganizationUseTotp))
                {
                    var totpKey = cipher.Login?.Totp.Decrypt(cipher.OrganizationId);
                    if (!string.IsNullOrWhiteSpace(totpKey))
                    {
                        Model.LoginTotpCode = Crypto.Totp(totpKey);
                        if (!string.IsNullOrWhiteSpace(Model.LoginTotpCode))
                        {
                            TotpTick(totpKey);
                            _timerStarted = DateTime.Now;
                            Device.StartTimer(new TimeSpan(0, 0, 1), () =>
                            {
                                if (_timerStarted == null || (DateTime.Now - _timerStarted) > _timerMaxLength)
                                {
                                    return(false);
                                }

                                TotpTick(totpKey);
                                return(true);
                            });

                            ItemInformationSection.Add(LoginTotpCodeCell);
                        }
                    }
                }
                break;

            case CipherType.Card:
                AddSectionCell(CardNameCell, Model.ShowCardName);
                AddSectionCell(CardNumberCell, Model.ShowCardNumber);
                AddSectionCell(CardBrandCell, Model.ShowCardBrand);
                AddSectionCell(CardExpCell, Model.ShowCardExp);
                AddSectionCell(CardCodeCell, Model.ShowCardCode);
                break;

            case CipherType.Identity:
                AddSectionCell(IdNameCell, Model.ShowIdName);
                AddSectionCell(IdUsernameCell, Model.ShowIdUsername);
                AddSectionCell(IdCompanyCell, Model.ShowIdCompany);
                AddSectionCell(IdSsnCell, Model.ShowIdSsn);
                AddSectionCell(IdPassportNumberCell, Model.ShowIdPassportNumber);
                AddSectionCell(IdLicenseNumberCell, Model.ShowIdLicenseNumber);
                AddSectionCell(IdEmailCell, Model.ShowIdEmail);
                AddSectionCell(IdPhoneCell, Model.ShowIdPhone);
                AddSectionCell(IdAddressCell, Model.ShowIdAddress);
                break;

            default:
                break;
            }
        }
示例#43
0
            public async void FilterIssues(string filter = null)
            {
                filter  = filter?.Trim();
                _filter = filter;

                // Deeeee bounce
                await Task.Delay(10);

                if (_filter != filter)
                {
                    return;
                }

                PageToAction.Clear();
                if (String.IsNullOrWhiteSpace(filter) && !App.PreloadTestCasesIssuesList)
                {
                    if (_section != null)
                    {
                        Root.Remove(_section);
                    }
                    return;
                }

                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);
                }

                if (_section != null)
                {
                    Root.Remove(_section);
                }

                _section = new TableSection("Bug Repro");

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

                Root.Add(_section);
            }
示例#44
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;
            }
示例#45
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.windows.Count; i++)
            {
                string tempText   = DataBase.windows[i].Name;
                string tempId     = DataBase.windows[i].id.ToString();
                bool   tempIsAuto = DataBase.windows[i].isAuto;
                int    tempValue  = DataBase.windows[i].curValueOfMotor;
                Grid   grid       = new Grid
                {
                    ColumnDefinitions =
                    {
                        new ColumnDefinition {
                            Width = GridLength.Star
                        },
                        new ColumnDefinition {
                            Width = GridLength.Auto
                        },
                        new ColumnDefinition {
                            Width = 40
                        },
                        new ColumnDefinition {
                            Width = GridLength.Auto
                        },
                        new ColumnDefinition {
                            Width = GridLength.Auto
                        }
                    }
                };
                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);
                Stepper tempSlider = new Stepper {
                    Increment = 10, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, IsEnabled = !tempIsAuto, Value = tempValue, Minimum = 0, Maximum = 100
                };
                tempSlider.ValueChanged += TempSwitch_Toggled;
                grid.Children.Add(tempSlider, 4, 0);
                Label tempLabel = new Label()
                {
                    FontSize = 20, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, Text = Convert.ToString(tempSlider.Value)
                };
                grid.Children.Add(tempLabel, 3, 0);
                tempCell = new ViewCell
                {
                    View = grid
                };
                tempSection.Add(tempCell);
            }
            tempRoot.Add(tempSection);
            TableView tempView = mainField.Content as TableView;

            tempView.Root = tempRoot;
        }
示例#46
0
        public void Init()
        {
            var generatorCell = new ToolsViewCell(AppResources.PasswordGenerator, AppResources.PasswordGeneratorDescription,
                                                  "refresh");

            generatorCell.Tapped += GeneratorCell_Tapped;
            var webCell = new ToolsViewCell(AppResources.WebVault, AppResources.WebVaultDescription, "globe");

            webCell.Tapped += WebCell_Tapped;
            var importCell = new ToolsViewCell(AppResources.ImportLogins, AppResources.ImportLoginsDescription, "cloudup");

            importCell.Tapped += ImportCell_Tapped;

            var section = new TableSection {
                generatorCell
            };

            if (Device.OS == TargetPlatform.iOS)
            {
                var extensionCell = new ToolsViewCell(AppResources.BitwardenAppExtension,
                                                      AppResources.BitwardenAppExtensionDescription, "upload");
                extensionCell.Tapped += (object sender, EventArgs e) =>
                {
                    Navigation.PushModalAsync(new ExtendedNavigationPage(new ToolsExtensionPage()));
                };
                section.Add(extensionCell);
            }
            else
            {
                var autofillServiceCell = new ToolsViewCell(
                    string.Format("{0} ({1})", AppResources.BitwardenAutofillService, AppResources.Beta),
                    AppResources.BitwardenAutofillServiceDescription, "upload");
                autofillServiceCell.Tapped += (object sender, EventArgs e) =>
                {
                    Navigation.PushModalAsync(new ExtendedNavigationPage(new ToolsAutofillServicePage()));
                };
                section.Add(autofillServiceCell);
            }

            section.Add(webCell);
            section.Add(importCell);

            var table = new ExtendedTableView
            {
                EnableScrolling = true,
                Intent          = TableIntent.Settings,
                HasUnevenRows   = true,
                Root            = new TableRoot
                {
                    section
                }
            };

            if (Device.OS == TargetPlatform.iOS)
            {
                table.RowHeight          = -1;
                table.EstimatedRowHeight = 100;
            }

            Title   = AppResources.Tools;
            Content = table;
        }
示例#47
0
文件: RDLFactory.cs 项目: kLeZ/Gecko
        private void GenerateTableSection(TableSection section, XmlWriter writer, DataTable dt, Padding padding, float height)
        {
            string     sectionName = "", templateValue = "", value = "";
            CellColors colors = null;

            switch (section)
            {
            case TableSection.Header:

            {
                sectionName   = "Header";
                templateValue = "{0}";
                colors        = new CellColors(Color.Black, Color.White);
                break;
            }

            case TableSection.Details:

            {
                sectionName   = "Details";
                templateValue = "=Fields!{0}.Value";
                break;
            }

            case TableSection.Footer:

            {
                sectionName   = "Footer";
                templateValue = "{0}";
                break;
            }
            }
            writer.WriteStartElement(sectionName);
            {
                if (section == TableSection.Header)
                {
                    writer.WriteElementString("RepeatOnNewPage", "true");
                }
                writer.WriteStartElement("TableRows");
                {
                    writer.WriteStartElement("TableRow");
                    {
                        writer.WriteElementString("Height", height.ToString(ci) + "cm");
                        writer.WriteStartElement("TableCells");
                        {
                            for (int i = 0; i < dt.Columns.Count; i++)
                            {
                                writer.WriteStartElement("TableCell");
                                {
                                    writer.WriteStartElement("ReportItems");
                                    {
                                        value = String.Format(templateValue, dt.Columns[i].ColumnName);
                                        GenerateTextBox(writer, "textbox" + sectionName + i, RectangleF.Empty, padding, colors, value);
                                    }
                                    writer.WriteEndElement();
                                }
                                writer.WriteEndElement();
                            }
                        }
                        writer.WriteEndElement();
                    }
                    writer.WriteEndElement();
                }
                writer.WriteEndElement();
            }
            writer.WriteEndElement();
        }
示例#48
0
        public SwitchCellTablePage()
        {
            Title = "SwitchCell Table Gallery - Legacy";

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

            var tableSection = new TableSection("Section One")
            {
                new SwitchCell {
                    Text = "text 1", On = true
                },
                new SwitchCell {
                    Text = "text 2"
                },
                new SwitchCell {
                    Text = "text 3", On = true
                },
                new SwitchCell {
                    Text = "text 4", On = false
                },
                new SwitchCell {
                    Text = "text 5", On = true
                },
                new SwitchCell {
                    Text = "text 6"
                },
                new SwitchCell {
                    Text = "text 7", On = true
                },
                new SwitchCell {
                    Text = "text 8", On = false
                },
                new SwitchCell {
                    Text = "text 9", On = true
                },
                new SwitchCell {
                    Text = "text 10"
                },
                new SwitchCell {
                    Text = "text 11", On = true
                },
                new SwitchCell {
                    Text = "text 12", On = false
                },
                new SwitchCell {
                    Text = "text 13", On = true
                },
                new SwitchCell {
                    Text = "text 14"
                },
                new SwitchCell {
                    Text = "text 15", On = true
                },
                new SwitchCell {
                    Text = "text 16", On = false
                },
            };

            var tableSectionTwo = new TableSection("Section Two")
            {
                new SwitchCell {
                    Text = "text 17", On = true
                },
                new SwitchCell {
                    Text = "text 18"
                },
                new SwitchCell {
                    Text = "text 19", On = true
                },
                new SwitchCell {
                    Text = "text 20", On = false
                },
                new SwitchCell {
                    Text = "text 21", On = true
                },
                new SwitchCell {
                    Text = "text 22"
                },
                new SwitchCell {
                    Text = "text 23", On = true
                },
                new SwitchCell {
                    Text = "text 24", On = false
                },
                new SwitchCell {
                    Text = "text 25", On = true
                },
                new SwitchCell {
                    Text = "text 26"
                },
                new SwitchCell {
                    Text = "text 27", On = true
                },
                new SwitchCell {
                    Text = "text 28", On = false
                },
                new SwitchCell {
                    Text = "text 29", On = true
                },
                new SwitchCell {
                    Text = "text 30"
                },
                new SwitchCell {
                    Text = "text 31", On = true
                },
                new SwitchCell {
                    Text = "text 32", On = false
                },
            };

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

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

            Content = table;
        }
示例#49
0
        private async void _refreshButton_Clicked(object sender, EventArgs e)
        {
            _refreshButton.IsEnabled = false;
            await DataBase.refreshData();

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

            for (int i = 0; i < DataBase.windows.Count; i++)
            {
                string tempText   = DataBase.windows[i].Name;
                string tempId     = DataBase.windows[i].id.ToString();
                bool   tempIsAuto = DataBase.windows[i].isAuto;
                int    tempValue  = DataBase.windows[i].curValueOfMotor;
                Grid   grid       = new Grid
                {
                    ColumnDefinitions =
                    {
                        new ColumnDefinition {
                            Width = GridLength.Star
                        },
                        new ColumnDefinition {
                            Width = 20
                        },
                        new ColumnDefinition {
                            Width = 40
                        },
                        new ColumnDefinition {
                            Width = 120
                        }
                    }
                };
                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);
                Slider tempSlider = new Slider {
                    HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, IsEnabled = !tempIsAuto, Value = tempValue, Minimum = 0, Maximum = 100
                };
                tempSlider.ValueChanged += TempSwitch_Toggled;
                grid.Children.Add(tempSlider, 3, 0);
                tempCell = new ViewCell
                {
                    View = grid
                };
                tempSection.Add(tempCell);
            }
            tempRoot.Add(tempSection);
            TableView tempView = mainField.Content as TableView;

            tempView.Root            = tempRoot;
            _refreshButton.IsEnabled = true;
        }
示例#50
0
        private void InitializeComponent()
        {
            if (ResourceLoader.ResourceProvider != null && ResourceLoader.ResourceProvider(typeof(ExceptionPage).GetTypeInfo().Assembly.GetName(), "Views/ExceptionPage.xaml") != null)
            {
                this.__InitComponentRuntime();
                return;
            }
            if (XamlLoader.XamlFileProvider != null && XamlLoader.XamlFileProvider(base.GetType()) != null)
            {
                this.__InitComponentRuntime();
                return;
            }
            BindingExtension   bindingExtension   = new BindingExtension();
            RowDefinition      rowDefinition      = new RowDefinition();
            RowDefinition      rowDefinition2     = new RowDefinition();
            RowDefinition      rowDefinition3     = new RowDefinition();
            ColumnDefinition   columnDefinition   = new ColumnDefinition();
            ColumnDefinition   columnDefinition2  = new ColumnDefinition();
            TranslateExtension translateExtension = new TranslateExtension();
            Label              label             = new Label();
            BindingExtension   bindingExtension2 = new BindingExtension();
            Label              label2            = new Label();
            Grid               grid = new Grid();
            TranslateExtension translateExtension2 = new TranslateExtension();
            BindingExtension   bindingExtension3   = new BindingExtension();
            SelectCell         selectCell          = new SelectCell();
            TranslateExtension translateExtension3 = new TranslateExtension();
            BindingExtension   bindingExtension4   = new BindingExtension();
            SelectCell         selectCell2         = new SelectCell();
            TranslateExtension translateExtension4 = new TranslateExtension();
            BindingExtension   bindingExtension5   = new BindingExtension();
            TranslateExtension translateExtension5 = new TranslateExtension();
            NewEntryCell       newEntryCell        = new NewEntryCell();
            TranslateExtension translateExtension6 = new TranslateExtension();
            BindingExtension   bindingExtension6   = new BindingExtension();
            PhotoCell          photoCell           = new PhotoCell();
            TableSection       tableSection        = new TableSection();
            TableRoot          tableRoot           = new TableRoot();
            TableView          tableView           = new TableView();
            TranslateExtension translateExtension7 = new TranslateExtension();
            BindingExtension   bindingExtension7   = new BindingExtension();
            Button             button     = new Button();
            Grid               grid2      = new Grid();
            ScrollView         scrollView = new ScrollView();
            NameScope          nameScope  = new NameScope();

            NameScope.SetNameScope(this, nameScope);
            NameScope.SetNameScope(scrollView, nameScope);
            NameScope.SetNameScope(grid2, nameScope);
            NameScope.SetNameScope(rowDefinition, nameScope);
            NameScope.SetNameScope(rowDefinition2, nameScope);
            NameScope.SetNameScope(rowDefinition3, nameScope);
            NameScope.SetNameScope(grid, nameScope);
            NameScope.SetNameScope(columnDefinition, nameScope);
            NameScope.SetNameScope(columnDefinition2, nameScope);
            NameScope.SetNameScope(label, nameScope);
            NameScope.SetNameScope(label2, nameScope);
            NameScope.SetNameScope(tableView, nameScope);
            NameScope.SetNameScope(tableRoot, nameScope);
            NameScope.SetNameScope(tableSection, nameScope);
            NameScope.SetNameScope(selectCell, nameScope);
            NameScope.SetNameScope(selectCell2, nameScope);
            NameScope.SetNameScope(newEntryCell, nameScope);
            NameScope.SetNameScope(photoCell, nameScope);
            ((INameScope)nameScope).RegisterName("photocell", photoCell);
            if (photoCell.StyleId == null)
            {
                photoCell.StyleId = "photocell";
            }
            NameScope.SetNameScope(button, nameScope);
            this.photocell = photoCell;
            this.SetValue(ViewModelLocator.AutowireViewModelProperty, new bool?(true));
            bindingExtension.Path = "Title";
            BindingBase binding = ((IMarkupExtension <BindingBase>)bindingExtension).ProvideValue(null);

            this.SetBinding(Page.TitleProperty, binding);
            grid2.SetValue(Grid.RowSpacingProperty, 0.0);
            rowDefinition.SetValue(RowDefinition.HeightProperty, new GridLengthTypeConverter().ConvertFromInvariantString("Auto"));
            grid2.GetValue(Grid.RowDefinitionsProperty).Add(rowDefinition);
            rowDefinition2.SetValue(RowDefinition.HeightProperty, new GridLengthTypeConverter().ConvertFromInvariantString("*"));
            grid2.GetValue(Grid.RowDefinitionsProperty).Add(rowDefinition2);
            rowDefinition3.SetValue(RowDefinition.HeightProperty, new GridLengthTypeConverter().ConvertFromInvariantString("Auto"));
            grid2.GetValue(Grid.RowDefinitionsProperty).Add(rowDefinition3);
            grid.SetValue(VisualElement.BackgroundColorProperty, new Color(0.92156863212585449, 0.92156863212585449, 0.92156863212585449, 1.0));
            grid.SetValue(Xamarin.Forms.Layout.PaddingProperty, new Thickness(10.0, 10.0, 10.0, 10.0));
            columnDefinition.SetValue(ColumnDefinition.WidthProperty, new GridLengthTypeConverter().ConvertFromInvariantString("*"));
            grid.GetValue(Grid.ColumnDefinitionsProperty).Add(columnDefinition);
            columnDefinition2.SetValue(ColumnDefinition.WidthProperty, new GridLengthTypeConverter().ConvertFromInvariantString("3*"));
            grid.GetValue(Grid.ColumnDefinitionsProperty).Add(columnDefinition2);
            label.SetValue(Grid.ColumnProperty, 0);
            translateExtension.Text = "curaddress";
            IMarkupExtension    markupExtension     = translateExtension;
            XamlServiceProvider xamlServiceProvider = new XamlServiceProvider();
            Type typeFromHandle = typeof(IProvideValueTarget);

            object[] array = new object[0 + 5];
            array[0] = label;
            array[1] = grid;
            array[2] = grid2;
            array[3] = scrollView;
            array[4] = this;
            xamlServiceProvider.Add(typeFromHandle, new SimpleValueTargetProvider(array, Label.TextProperty));
            xamlServiceProvider.Add(typeof(INameScopeProvider), new NameScopeProvider
            {
                NameScope = nameScope
            });
            Type typeFromHandle2 = typeof(IXamlTypeResolver);
            XmlNamespaceResolver xmlNamespaceResolver = new XmlNamespaceResolver();

            xmlNamespaceResolver.Add("", "http://xamarin.com/schemas/2014/forms");
            xmlNamespaceResolver.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
            xmlNamespaceResolver.Add("prism", "clr-namespace:Prism.Mvvm;assembly=Prism.Forms");
            xmlNamespaceResolver.Add("layout", "clr-namespace:RFID.Layout");
            xmlNamespaceResolver.Add("local", "clr-namespace:RFID");
            xamlServiceProvider.Add(typeFromHandle2, new XamlTypeResolver(xmlNamespaceResolver, typeof(ExceptionPage).GetTypeInfo().Assembly));
            xamlServiceProvider.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(42, 50)));
            object text = markupExtension.ProvideValue(xamlServiceProvider);

            label.Text = text;
            label.SetValue(Label.TextColorProperty, new Color(0.501960813999176, 0.501960813999176, 0.501960813999176, 1.0));
            BindableObject         bindableObject        = label;
            BindableProperty       fontSizeProperty      = Label.FontSizeProperty;
            IExtendedTypeConverter extendedTypeConverter = new FontSizeConverter();
            string value = "Default";
            XamlServiceProvider xamlServiceProvider2 = new XamlServiceProvider();
            Type typeFromHandle3 = typeof(IProvideValueTarget);

            object[] array2 = new object[0 + 5];
            array2[0] = label;
            array2[1] = grid;
            array2[2] = grid2;
            array2[3] = scrollView;
            array2[4] = this;
            xamlServiceProvider2.Add(typeFromHandle3, new SimpleValueTargetProvider(array2, Label.FontSizeProperty));
            xamlServiceProvider2.Add(typeof(INameScopeProvider), new NameScopeProvider
            {
                NameScope = nameScope
            });
            Type typeFromHandle4 = typeof(IXamlTypeResolver);
            XmlNamespaceResolver xmlNamespaceResolver2 = new XmlNamespaceResolver();

            xmlNamespaceResolver2.Add("", "http://xamarin.com/schemas/2014/forms");
            xmlNamespaceResolver2.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
            xmlNamespaceResolver2.Add("prism", "clr-namespace:Prism.Mvvm;assembly=Prism.Forms");
            xmlNamespaceResolver2.Add("layout", "clr-namespace:RFID.Layout");
            xmlNamespaceResolver2.Add("local", "clr-namespace:RFID");
            xamlServiceProvider2.Add(typeFromHandle4, new XamlTypeResolver(xmlNamespaceResolver2, typeof(ExceptionPage).GetTypeInfo().Assembly));
            xamlServiceProvider2.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(42, 106)));
            bindableObject.SetValue(fontSizeProperty, extendedTypeConverter.ConvertFromInvariantString(value, xamlServiceProvider2));
            label.SetValue(View.HorizontalOptionsProperty, LayoutOptions.FillAndExpand);
            label.SetValue(View.VerticalOptionsProperty, LayoutOptions.Center);
            label.SetValue(Label.HorizontalTextAlignmentProperty, new TextAlignmentConverter().ConvertFromInvariantString("Center"));
            grid.Children.Add(label);
            label2.SetValue(Grid.ColumnProperty, 1);
            bindingExtension2.Path = "CurLocation";
            BindingBase binding2 = ((IMarkupExtension <BindingBase>)bindingExtension2).ProvideValue(null);

            label2.SetBinding(Label.TextProperty, binding2);
            BindableObject         bindableObject2        = label2;
            BindableProperty       fontSizeProperty2      = Label.FontSizeProperty;
            IExtendedTypeConverter extendedTypeConverter2 = new FontSizeConverter();
            string value2 = "Default";
            XamlServiceProvider xamlServiceProvider3 = new XamlServiceProvider();
            Type typeFromHandle5 = typeof(IProvideValueTarget);

            object[] array3 = new object[0 + 5];
            array3[0] = label2;
            array3[1] = grid;
            array3[2] = grid2;
            array3[3] = scrollView;
            array3[4] = this;
            xamlServiceProvider3.Add(typeFromHandle5, new SimpleValueTargetProvider(array3, Label.FontSizeProperty));
            xamlServiceProvider3.Add(typeof(INameScopeProvider), new NameScopeProvider
            {
                NameScope = nameScope
            });
            Type typeFromHandle6 = typeof(IXamlTypeResolver);
            XmlNamespaceResolver xmlNamespaceResolver3 = new XmlNamespaceResolver();

            xmlNamespaceResolver3.Add("", "http://xamarin.com/schemas/2014/forms");
            xmlNamespaceResolver3.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
            xmlNamespaceResolver3.Add("prism", "clr-namespace:Prism.Mvvm;assembly=Prism.Forms");
            xmlNamespaceResolver3.Add("layout", "clr-namespace:RFID.Layout");
            xmlNamespaceResolver3.Add("local", "clr-namespace:RFID");
            xamlServiceProvider3.Add(typeFromHandle6, new XamlTypeResolver(xmlNamespaceResolver3, typeof(ExceptionPage).GetTypeInfo().Assembly));
            xamlServiceProvider3.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(43, 77)));
            bindableObject2.SetValue(fontSizeProperty2, extendedTypeConverter2.ConvertFromInvariantString(value2, xamlServiceProvider3));
            label2.SetValue(View.HorizontalOptionsProperty, LayoutOptions.FillAndExpand);
            label2.SetValue(View.VerticalOptionsProperty, LayoutOptions.Center);
            grid.Children.Add(label2);
            grid2.Children.Add(grid);
            tableView.Intent = TableIntent.Data;
            tableView.SetValue(Grid.RowProperty, 1);
            tableView.SetValue(TableView.HasUnevenRowsProperty, true);
            tableView.SetValue(VisualElement.BackgroundColorProperty, new Color(0.9843137264251709, 0.9843137264251709, 0.9843137264251709, 1.0));
            translateExtension2.Text = "explace";
            IMarkupExtension    markupExtension2     = translateExtension2;
            XamlServiceProvider xamlServiceProvider4 = new XamlServiceProvider();
            Type typeFromHandle7 = typeof(IProvideValueTarget);

            object[] array4 = new object[0 + 7];
            array4[0] = selectCell;
            array4[1] = tableSection;
            array4[2] = tableRoot;
            array4[3] = tableView;
            array4[4] = grid2;
            array4[5] = scrollView;
            array4[6] = this;
            xamlServiceProvider4.Add(typeFromHandle7, new SimpleValueTargetProvider(array4, SelectCell.TitleProperty));
            xamlServiceProvider4.Add(typeof(INameScopeProvider), new NameScopeProvider
            {
                NameScope = nameScope
            });
            Type typeFromHandle8 = typeof(IXamlTypeResolver);
            XmlNamespaceResolver xmlNamespaceResolver4 = new XmlNamespaceResolver();

            xmlNamespaceResolver4.Add("", "http://xamarin.com/schemas/2014/forms");
            xmlNamespaceResolver4.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
            xmlNamespaceResolver4.Add("prism", "clr-namespace:Prism.Mvvm;assembly=Prism.Forms");
            xmlNamespaceResolver4.Add("layout", "clr-namespace:RFID.Layout");
            xmlNamespaceResolver4.Add("local", "clr-namespace:RFID");
            xamlServiceProvider4.Add(typeFromHandle8, new XamlTypeResolver(xmlNamespaceResolver4, typeof(ExceptionPage).GetTypeInfo().Assembly));
            xamlServiceProvider4.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(49, 52)));
            object title = markupExtension2.ProvideValue(xamlServiceProvider4);

            selectCell.Title       = title;
            bindingExtension3.Mode = BindingMode.TwoWay;
            bindingExtension3.Path = "ExPlace";
            BindingBase binding3 = ((IMarkupExtension <BindingBase>)bindingExtension3).ProvideValue(null);

            selectCell.SetBinding(SelectCell.TextProperty, binding3);
            selectCell.SetValue(SelectCell.CanSelectProperty, false);
            tableSection.Add(selectCell);
            translateExtension3.Text = "starttime";
            IMarkupExtension    markupExtension3     = translateExtension3;
            XamlServiceProvider xamlServiceProvider5 = new XamlServiceProvider();
            Type typeFromHandle9 = typeof(IProvideValueTarget);

            object[] array5 = new object[0 + 7];
            array5[0] = selectCell2;
            array5[1] = tableSection;
            array5[2] = tableRoot;
            array5[3] = tableView;
            array5[4] = grid2;
            array5[5] = scrollView;
            array5[6] = this;
            xamlServiceProvider5.Add(typeFromHandle9, new SimpleValueTargetProvider(array5, SelectCell.TitleProperty));
            xamlServiceProvider5.Add(typeof(INameScopeProvider), new NameScopeProvider
            {
                NameScope = nameScope
            });
            Type typeFromHandle10 = typeof(IXamlTypeResolver);
            XmlNamespaceResolver xmlNamespaceResolver5 = new XmlNamespaceResolver();

            xmlNamespaceResolver5.Add("", "http://xamarin.com/schemas/2014/forms");
            xmlNamespaceResolver5.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
            xmlNamespaceResolver5.Add("prism", "clr-namespace:Prism.Mvvm;assembly=Prism.Forms");
            xmlNamespaceResolver5.Add("layout", "clr-namespace:RFID.Layout");
            xmlNamespaceResolver5.Add("local", "clr-namespace:RFID");
            xamlServiceProvider5.Add(typeFromHandle10, new XamlTypeResolver(xmlNamespaceResolver5, typeof(ExceptionPage).GetTypeInfo().Assembly));
            xamlServiceProvider5.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(50, 53)));
            object title2 = markupExtension3.ProvideValue(xamlServiceProvider5);

            selectCell2.Title = title2;
            selectCell2.SetValue(SelectCell.CanSelectProperty, false);
            bindingExtension4.Mode = BindingMode.TwoWay;
            bindingExtension4.Path = "StartTime";
            BindingBase binding4 = ((IMarkupExtension <BindingBase>)bindingExtension4).ProvideValue(null);

            selectCell2.SetBinding(SelectCell.TextProperty, binding4);
            tableSection.Add(selectCell2);
            translateExtension4.Text = "exinfo";
            IMarkupExtension    markupExtension4     = translateExtension4;
            XamlServiceProvider xamlServiceProvider6 = new XamlServiceProvider();
            Type typeFromHandle11 = typeof(IProvideValueTarget);

            object[] array6 = new object[0 + 7];
            array6[0] = newEntryCell;
            array6[1] = tableSection;
            array6[2] = tableRoot;
            array6[3] = tableView;
            array6[4] = grid2;
            array6[5] = scrollView;
            array6[6] = this;
            xamlServiceProvider6.Add(typeFromHandle11, new SimpleValueTargetProvider(array6, NewEntryCell.TitleProperty));
            xamlServiceProvider6.Add(typeof(INameScopeProvider), new NameScopeProvider
            {
                NameScope = nameScope
            });
            Type typeFromHandle12 = typeof(IXamlTypeResolver);
            XmlNamespaceResolver xmlNamespaceResolver6 = new XmlNamespaceResolver();

            xmlNamespaceResolver6.Add("", "http://xamarin.com/schemas/2014/forms");
            xmlNamespaceResolver6.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
            xmlNamespaceResolver6.Add("prism", "clr-namespace:Prism.Mvvm;assembly=Prism.Forms");
            xmlNamespaceResolver6.Add("layout", "clr-namespace:RFID.Layout");
            xmlNamespaceResolver6.Add("local", "clr-namespace:RFID");
            xamlServiceProvider6.Add(typeFromHandle12, new XamlTypeResolver(xmlNamespaceResolver6, typeof(ExceptionPage).GetTypeInfo().Assembly));
            xamlServiceProvider6.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(51, 53)));
            object title3 = markupExtension4.ProvideValue(xamlServiceProvider6);

            newEntryCell.Title     = title3;
            bindingExtension5.Path = "ExInfo";
            BindingBase binding5 = ((IMarkupExtension <BindingBase>)bindingExtension5).ProvideValue(null);

            newEntryCell.SetBinding(NewEntryCell.TextProperty, binding5);
            translateExtension5.Text = "explease";
            IMarkupExtension    markupExtension5     = translateExtension5;
            XamlServiceProvider xamlServiceProvider7 = new XamlServiceProvider();
            Type typeFromHandle13 = typeof(IProvideValueTarget);

            object[] array7 = new object[0 + 7];
            array7[0] = newEntryCell;
            array7[1] = tableSection;
            array7[2] = tableRoot;
            array7[3] = tableView;
            array7[4] = grid2;
            array7[5] = scrollView;
            array7[6] = this;
            xamlServiceProvider7.Add(typeFromHandle13, new SimpleValueTargetProvider(array7, NewEntryCell.HintProperty));
            xamlServiceProvider7.Add(typeof(INameScopeProvider), new NameScopeProvider
            {
                NameScope = nameScope
            });
            Type typeFromHandle14 = typeof(IXamlTypeResolver);
            XmlNamespaceResolver xmlNamespaceResolver7 = new XmlNamespaceResolver();

            xmlNamespaceResolver7.Add("", "http://xamarin.com/schemas/2014/forms");
            xmlNamespaceResolver7.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
            xmlNamespaceResolver7.Add("prism", "clr-namespace:Prism.Mvvm;assembly=Prism.Forms");
            xmlNamespaceResolver7.Add("layout", "clr-namespace:RFID.Layout");
            xmlNamespaceResolver7.Add("local", "clr-namespace:RFID");
            xamlServiceProvider7.Add(typeFromHandle14, new XamlTypeResolver(xmlNamespaceResolver7, typeof(ExceptionPage).GetTypeInfo().Assembly));
            xamlServiceProvider7.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(51, 110)));
            object hint = markupExtension5.ProvideValue(xamlServiceProvider7);

            newEntryCell.Hint = hint;
            tableSection.Add(newEntryCell);
            translateExtension6.Text = "checkphoto";
            IMarkupExtension    markupExtension6     = translateExtension6;
            XamlServiceProvider xamlServiceProvider8 = new XamlServiceProvider();
            Type typeFromHandle15 = typeof(IProvideValueTarget);

            object[] array8 = new object[0 + 7];
            array8[0] = photoCell;
            array8[1] = tableSection;
            array8[2] = tableRoot;
            array8[3] = tableView;
            array8[4] = grid2;
            array8[5] = scrollView;
            array8[6] = this;
            xamlServiceProvider8.Add(typeFromHandle15, new SimpleValueTargetProvider(array8, PhotoCell.TitleProperty));
            xamlServiceProvider8.Add(typeof(INameScopeProvider), new NameScopeProvider
            {
                NameScope = nameScope
            });
            Type typeFromHandle16 = typeof(IXamlTypeResolver);
            XmlNamespaceResolver xmlNamespaceResolver8 = new XmlNamespaceResolver();

            xmlNamespaceResolver8.Add("", "http://xamarin.com/schemas/2014/forms");
            xmlNamespaceResolver8.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
            xmlNamespaceResolver8.Add("prism", "clr-namespace:Prism.Mvvm;assembly=Prism.Forms");
            xmlNamespaceResolver8.Add("layout", "clr-namespace:RFID.Layout");
            xmlNamespaceResolver8.Add("local", "clr-namespace:RFID");
            xamlServiceProvider8.Add(typeFromHandle16, new XamlTypeResolver(xmlNamespaceResolver8, typeof(ExceptionPage).GetTypeInfo().Assembly));
            xamlServiceProvider8.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(52, 70)));
            object title4 = markupExtension6.ProvideValue(xamlServiceProvider8);

            photoCell.Title        = title4;
            bindingExtension6.Path = "ImageFiles";
            BindingBase binding6 = ((IMarkupExtension <BindingBase>)bindingExtension6).ProvideValue(null);

            photoCell.SetBinding(PhotoCell.FilesProperty, binding6);
            photoCell.SetValue(PhotoCell.CanTakeMoreProperty, false);
            tableSection.Add(photoCell);
            tableRoot.Add(tableSection);
            tableView.Root = tableRoot;
            grid2.Children.Add(tableView);
            button.SetValue(View.MarginProperty, new Thickness(20.0));
            translateExtension7.Text = "exsubmit";
            IMarkupExtension    markupExtension7     = translateExtension7;
            XamlServiceProvider xamlServiceProvider9 = new XamlServiceProvider();
            Type typeFromHandle17 = typeof(IProvideValueTarget);

            object[] array9 = new object[0 + 4];
            array9[0] = button;
            array9[1] = grid2;
            array9[2] = scrollView;
            array9[3] = this;
            xamlServiceProvider9.Add(typeFromHandle17, new SimpleValueTargetProvider(array9, Button.TextProperty));
            xamlServiceProvider9.Add(typeof(INameScopeProvider), new NameScopeProvider
            {
                NameScope = nameScope
            });
            Type typeFromHandle18 = typeof(IXamlTypeResolver);
            XmlNamespaceResolver xmlNamespaceResolver9 = new XmlNamespaceResolver();

            xmlNamespaceResolver9.Add("", "http://xamarin.com/schemas/2014/forms");
            xmlNamespaceResolver9.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
            xmlNamespaceResolver9.Add("prism", "clr-namespace:Prism.Mvvm;assembly=Prism.Forms");
            xmlNamespaceResolver9.Add("layout", "clr-namespace:RFID.Layout");
            xmlNamespaceResolver9.Add("local", "clr-namespace:RFID");
            xamlServiceProvider9.Add(typeFromHandle18, new XamlTypeResolver(xmlNamespaceResolver9, typeof(ExceptionPage).GetTypeInfo().Assembly));
            xamlServiceProvider9.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(57, 41)));
            object text2 = markupExtension7.ProvideValue(xamlServiceProvider9);

            button.Text            = text2;
            bindingExtension7.Path = "CommitCommand";
            BindingBase binding7 = ((IMarkupExtension <BindingBase>)bindingExtension7).ProvideValue(null);

            button.SetBinding(Button.CommandProperty, binding7);
            button.SetValue(Button.TextColorProperty, Color.White);
            button.SetValue(VisualElement.BackgroundColorProperty, new Color(0.050980392843484879, 0.27843138575553894, 0.63137257099151611, 1.0));
            button.SetValue(Grid.RowProperty, 2);
            button.SetValue(Button.BorderRadiusProperty, 10);
            button.SetValue(Button.BorderColorProperty, new Color(0.050980392843484879, 0.27843138575553894, 0.63137257099151611, 1.0));
            button.SetValue(Button.BorderWidthProperty, 1.0);
            grid2.Children.Add(button);
            scrollView.Content = grid2;
            this.SetValue(ContentPage.ContentProperty, scrollView);
        }
示例#51
0
        protected override void Init()
        {
            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);
            var step1Label = new Label {
                Text = "• Tap and hold 'Cell2'"
            };
            var step2Label = new Label {
                Text = "• Tap 'Delete me first'"
            };
            var step3Label = new Label {
                Text = "• Tap and hold 'Cell1'"
            };
            var step4Label = new Label {
                Text = "• Tap 'Delete me after'"
            };
            var expectedLabel = new Label {
                Text = "Expected: 'Cell1' and 'Cell2' was deleted"
            };

            Content = new StackLayout
            {
                Padding  = new Thickness(15, 15, 0, 0),
                Children =
                {
                    step1Label,
                    step2Label,
                    step3Label,
                    step4Label,
                    expectedLabel,
                    tableView
                }
            };
        }
示例#52
0
        public CaptureResultsPage()
        {
            BindingContext = captureResultsModel = new CaptureResultsViewModel(Navigation);
            Title          = "Results";

            var image = new Image();

            image.SetBinding(Image.SourceProperty, new Binding("ImageData", BindingMode.Default, converter: new ByteArrayToImageSourceConverter()));
            image.Aspect = Aspect.AspectFit;
            //image.WidthRequest = 200;
            image.HeightRequest = 200;

            var location = new EntryCell {
                Label = "Location", Placeholder = "", IsEnabled = false
            };

            location.SetBinding(EntryCell.TextProperty, new Binding("Location"));

            var audienceTotal = new EntryCell {
                Label = "Audience Total", Placeholder = "", IsEnabled = false
            };

            audienceTotal.SetBinding(EntryCell.TextProperty, new Binding("AudienceTotal"));

            var averageGender = new EntryCell {
                Label = "Average Gender", Placeholder = "", IsEnabled = false
            };

            averageGender.SetBinding(EntryCell.TextProperty, new Binding("AverageGender", BindingMode.Default));

            var averageAge = new EntryCell {
                Label = "Average Age", Placeholder = "", IsEnabled = false
            };

            averageAge.SetBinding(EntryCell.TextProperty, new Binding("AverageAge", BindingMode.Default, stringFormat: "{0:F1}"));

            // Genders
            var genderSection = new TableSection("Genders");

            // Male Audience
            var maleAudience = captureResultsModel.MaleAudience;

            if (maleAudience != null)
            {
                var malesCell = new LinkViewCell("Male Audience");
                malesCell.Tapped += async(sender, e) =>
                                    await Navigation.PushAsync(new MemberGroupDetailsPage(captureResultsModel.MaleAudience));

                genderSection.Add(malesCell);
            }

            // Female Audience
            var femaleAudience = captureResultsModel.FemaleAudience;

            if (femaleAudience != null)
            {
                var femalesCell = new LinkViewCell("Female Audience");
                femalesCell.Tapped += async(sender, e) =>
                                      await Navigation.PushAsync(new MemberGroupDetailsPage(captureResultsModel.FemaleAudience));

                genderSection.Add(femalesCell);
            }

            Content = new TableView
            {
                HasUnevenRows = true,
                Root          = new TableRoot {
                    new TableSection("Photo")
                    {
                        new ViewCell()
                        {
                            View = image
                        }
                    },
                    new TableSection("Audience")
                    {
                        location,
                        audienceTotal,
                        averageGender,
                        averageAge
                    },
                    genderSection
                },
                Intent = TableIntent.Settings
            };
        }
示例#53
0
        public MenuPage(RootPage rootPage)
        {
            Icon  = "menu.png";
            Title = "menu"; // The Title property must be set.

            this.rootPage = rootPage;

            var logoutButton = new Button {
                Text = "Logout", TextColor = Color.White
            };

            logoutButton.Clicked += (sender, e) =>
            {
                Settings.AuthLoginToken = "";

                Navigation.PushModalAsync(new LoginPage());

                //Special Handel for Android Back button
                if (Device.OS == TargetPlatform.Android)
                {
                    Application.Current.MainPage = new LoginPage();
                }
            };
            var layout = new StackLayout
            {
                Spacing         = 0,
                VerticalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor = Color.FromHex("#FF9800"),
            };
            var section = new TableSection()
            {
                new MenuCell {
                    Text = "Mapa", Host = this, ImageSrc = "menu_venue.png"
                },
                new MenuCell {
                    Text = "Lugares", Host = this, ImageSrc = "menu_current_trip.png"
                },
                new MenuCell {
                    Text = "Conversa", Host = this, ImageSrc = "menu_sponsors.png"
                },
                new MenuCell {
                    Text = "Configurações", Host = this, ImageSrc = "menu_settings.png"
                },
                new MenuCell {
                    Text = "Sobre", Host = this, ImageSrc = "menu_profile.png"
                },
            };

            var root = new TableRoot()
            {
                section
            };

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

            var settingView = new SettingsUserView();

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

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

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

            Content = layout;

            var tapGestureRecognizer = new TapGestureRecognizer();

            tapGestureRecognizer.Tapped +=
                (sender, e) =>
            {
                NavigationPage profile = new NavigationPage(new Profile(settingView.profileViewModel.myProfile))
                {
                    BarBackgroundColor = App.BrandColor, BarTextColor = Color.White
                };
                rootPage.Detail      = profile;
                rootPage.IsPresented = false;
            };
            settingView.GestureRecognizers.Add(tapGestureRecognizer);
        }
示例#54
0
        protected override void OnBindingContextChanged()
        {
            base.OnBindingContextChanged();

            var stack = new StackLayout();

            if (Device.RuntimePlatform == Device.iOS)
            {
                stack.Children.Add(
                    new StackLayout
                {
                    Spacing   = 0,
                    IsVisible = (BindingContext as TintColorViewModel).isRunningiOS,
                    Children  =
                    {
                        new Label()
                        {
                            Text   = "Cell accessory TintColor values set in C#:",
                            Margin = 10
                        },
                        new TableView()
                        {
                            HeightRequest = 132,
                            Root          = new TableRoot()
                            {
                                new TableSection()
                                {
                                    CreateTintColorCell("Red", Color.Red, CellGlossAccessoryType.Checkmark),
                                    CreateTintColorCell("Green", Color.Green, CellGlossAccessoryType.Checkmark),
                                    CreateTintColorCell("Blue", Color.Blue, CellGlossAccessoryType.EditIndicator)
                                }
                            }
                        }
                    }
                });

                stack.Children.Add(
                    new Label()
                {
                    Text   = "SwitchCell TintColor values set in C#:",
                    Margin = 10
                });
            }

            /*
             * This is a bit of a hack. Android's renderer for TableView always adds an empty header for a
             * TableSection declaration, while iOS doesn't. To compensate, I'm using a Label to display info text
             * on iOS, and the TableSection on Android since there is no easy way to get rid of it.This is a
             * long-standing bug in the XF TableView on Android.
             * (https://forums.xamarin.com/discussion/18037/tablesection-w-out-header)
             */
            TableSection section;

            if (Device.RuntimePlatform == Device.Android)
            {
                section = new TableSection("SwitchCell TintColor values set in C#:");
            }
            else
            {
                section = new TableSection();
            }
            section.Add(CreateTintColorSwitchCell("Red", Color.Red));
            section.Add(CreateTintColorSwitchCell("Green", Color.Green));
            section.Add(CreateTintColorSwitchCell("Blue", Color.Blue));

            stack.Children.Add(
                new TableView()
            {
                Intent        = TableIntent.Data,
                HeightRequest = DeviceExtensions.OnPlatform <double>(132, 190, 0),
                Root          = new TableRoot()
                {
                    section
                }
            });

            stack.Children.Add(
                new Label()
            {
                Text   = "Switch TintColor values set in C#:",
                Margin = 10
            });

            stack.Children.Add(CreateTintColorSwitch("Red", Color.Red));
            stack.Children.Add(CreateTintColorSwitch("Green", Color.Green));
            stack.Children.Add(CreateTintColorSwitch("Blue", Color.Blue));

            if (Device.RuntimePlatform == Device.iOS)
            {
                var scrollView = new ScrollView();
                scrollView.Content = stack;

                Content = scrollView;
            }
            else
            {
                Content = stack;
            }
        }
        // strict parse means all sections must come in order
        public void ParseAsWASM(string filename, bool strict_parse = true)
        {
            if (!BitConverter.IsLittleEndian)
            {
                throw new NotImplementedException("LEB128 implementation only handles little endian systems");
            }

            using (FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read))
            {
                BinaryReader reader = new BinaryReader(fs);
                uint         magic  = reader.ReadUInt32();
                if (magic != MAGIC)
                {
                    throw new Exception("Not a compiled Web Assembly file.");
                }

                uint version = reader.ReadUInt32();
                if (version > SUPPORTED_VERSION)
                {
                    throw new Exception($"Unsupported version. Expected version <= {SUPPORTED_VERSION}, received {version}.");
                }

                int last_parsed_module = int.MinValue;

                /* Read in each module */

                while (true)
                {
                    int id = reader.PeekChar();

                    // EOF
                    if (id == -1)
                    {
                        break;
                    }

                    if (strict_parse && id < last_parsed_module)
                    {
                        throw new Exception("File contains out of order sections.");
                    }
                    last_parsed_module = id;

                    switch (id)
                    {
                    case (int)WebAssemblyModuleID.Custom:
                        if (strict_parse && custom != null)
                        {
                            throw new Exception("File contains a duplicate custom section.");
                        }
                        custom = new CustomSection(reader);
                        break;

                    case (int)WebAssemblyModuleID.Type:
                        if (strict_parse && type != null)
                        {
                            throw new Exception("File contains a duplicate type section.");
                        }
                        type = new TypeSection(reader);
                        break;

                    case (int)WebAssemblyModuleID.Import:
                        if (strict_parse && import != null)
                        {
                            throw new Exception("File contains a duplicate import section.");
                        }
                        import = new ImportSection(reader);
                        break;

                    case (int)WebAssemblyModuleID.Function:
                        if (strict_parse && function != null)
                        {
                            throw new Exception("File contains a duplicate function section.");
                        }
                        function = new FunctionSection(reader);
                        break;

                    case (int)WebAssemblyModuleID.Table:
                        if (strict_parse && table != null)
                        {
                            throw new Exception("File contains a duplicate table section.");
                        }
                        table = new TableSection(reader);
                        break;

                    case (int)WebAssemblyModuleID.Memory:
                        if (strict_parse && memory != null)
                        {
                            throw new Exception("File contains a duplicate memory section.");
                        }
                        memory = new MemorySection(reader);
                        break;

                    case (int)WebAssemblyModuleID.Global:
                        if (strict_parse && global != null)
                        {
                            throw new Exception("File contains a duplicate global section.");
                        }
                        global = new GlobalSection(reader);
                        break;

                    case (int)WebAssemblyModuleID.Export:
                        if (strict_parse && export != null)
                        {
                            throw new Exception("File contains a duplicate export section.");
                        }
                        export = new ExportSection(reader);
                        break;

                    case (int)WebAssemblyModuleID.Start:
                        if (strict_parse && start != null)
                        {
                            throw new Exception("File contains a duplicate start section.");
                        }
                        start = new StartSection(reader);
                        break;

                    case (int)WebAssemblyModuleID.Element:
                        if (strict_parse && element != null)
                        {
                            throw new Exception("File contains a duplicate element section.");
                        }
                        element = new ElementSection(reader);
                        break;

                    case (int)WebAssemblyModuleID.Code:
                        if (strict_parse && code != null)
                        {
                            throw new Exception("File contains a duplicate code section.");
                        }
                        code = new CodeSection(reader);
                        break;

                    case (int)WebAssemblyModuleID.Data:
                        if (strict_parse && data != null)
                        {
                            throw new Exception("File contains a duplicate data section.");
                        }
                        data = new DataSection(reader);
                        break;

                    // Error
                    default:
                        throw new Exception($"Unknown section {id}.");
                    }
                }

                /* Additional validation */

                // The lengths of vectors produced by the (possibly empty) function and code section must match up.
                if ((function != null && code == null) || (function == null && code != null))
                {
                    throw new Exception("File corrupt. Must include both function and code sections.");
                }
                if (function.types.Length != code.bodies.Length)
                {
                    throw new Exception("File corrupt. Function and code sections do not match up.");
                }

                // TODO: I don't actually check if data overlaps

                // TODO: Validate everything in this list
                // https://webassembly.github.io/spec/core/valid/modules.html
            }
        }
示例#56
0
        public void Init()
        {
            VM.BindData();
            Title = VM.CurrentLogg.Title;

            PositionActivityIndicator.SetBinding(ActivityIndicator.IsVisibleProperty, new Binding("IsLoadingPosition"));

            var tableSection = new TableSection();

            tableSection.Add(new JL_TextCell("Posisjon", VM.CurrentLogg.Coordinates, delegate(object sender, EventArgs args)
            {
                Navigation.PushModalAsync(new PositionPage(VM.CurrentLogg, delegate(PositionPage page)
                {
                    VM.CurrentLogg.Latitude  = page.VM.LatitudeString;
                    VM.CurrentLogg.Longitude = page.VM.LongitudeString;
                    VM.Save();
                }));
            }));
            tableSection.Add(new JL_TextCell("Art", VM.CurrentLogg.Art.Navn, delegate(object sender, EventArgs args)
            {
                Navigation.PushAsync(new ArtSelectorPage(VM.CurrentLogg));
            }));
            tableSection.Add(CreateNumericTextCell("Antall treff", VM.CurrentLogg.Treff.ToString(), delegate(EntryPage entryPage)
            {
                VM.CurrentLogg.Treff = GetNumericValue(entryPage.Value);
                if (VM.CurrentLogg.Treff > VM.CurrentLogg.Skudd)
                {
                    VM.CurrentLogg.Skudd = VM.CurrentLogg.Treff;
                }
                if (VM.CurrentLogg.Skudd > VM.CurrentLogg.Sett)
                {
                    VM.CurrentLogg.Sett = VM.CurrentLogg.Skudd;
                }

                VM.Save();
            }));
            tableSection.Add(CreateNumericTextCell("Antall skudd", VM.CurrentLogg.Skudd.ToString(), delegate(EntryPage entryPage)
            {
                VM.CurrentLogg.Skudd = GetNumericValue(entryPage.Value);
                if (VM.CurrentLogg.Skudd > VM.CurrentLogg.Sett)
                {
                    VM.CurrentLogg.Sett = VM.CurrentLogg.Skudd;
                }
                VM.Save();
            }));
            tableSection.Add(CreateNumericTextCell("Antall observert", VM.CurrentLogg.Sett.ToString(), delegate(EntryPage entryPage)
            {
                VM.CurrentLogg.Sett = GetNumericValue(entryPage.Value);
                VM.Save();
            }));

            tableSection.Add(new JL_TextCell("Jeger", VM.CurrentLogg.Jeger.Navn, delegate(object sender, EventArgs args)
            {
                var jakt = App.Database.GetJakt(VM.CurrentLogg.JaktId);
                Navigation.PushAsync(new JegerSelectorPage(jakt.ID, jakt.JegerIds, VM.CurrentLogg));
            }));
            tableSection.Add(new JL_TextCell("Hund", VM.CurrentLogg.Dog.Navn, delegate(object sender, EventArgs args)
            {
                var jakt = App.Database.GetJakt(VM.CurrentLogg.JaktId);
                Navigation.PushAsync(new DogSelectorPage(jakt.ID, jakt.DogIds, VM.CurrentLogg));
            }));
            tableSection.Add(new JL_ImageCell("Bilde", VM.CurrentLogg.Image, ImageCell_OnTapped));
            tableSection.Add(new JL_TextCell("Tidspunkt", VM.CurrentLogg.DateFormatted,
                                             delegate(object sender, EventArgs args)
            {
                Navigation.PushAsync(new DatePage("Tidspunkt", VM.CurrentLogg.Dato, callback: DateSelected, useTime: true));
            }));


            var customFieldsSection = new TableSection("Ekstra felter");

            foreach (var item in App.Database.GetSelectedLoggTyper())
            {
                switch (item.Key)
                {
                case "Gender":
                    customFieldsSection.Add(new JL_TextCell(item.Navn, VM.CurrentLogg.Gender,
                                                            delegate(object sender, EventArgs args)
                    {
                        var items = new List <string>();
                        items.Add("Hannkjønn");
                        items.Add("Hunnkjønn");
                        Navigation.PushAsync(new SingleItemPicker("Velg kjønn", items,
                                                                  delegate(SingleItemPicker picker)
                        {
                            VM.CurrentLogg.Gender = picker.SelectedItem;
                            VM.Save();
                        }));
                    }));
                    break;

                case "Age":
                    customFieldsSection.Add(new JL_TextCell(item.Navn, VM.CurrentLogg.Age,
                                                            delegate(object sender, EventArgs args)
                    {
                        var items = new List <string>();
                        items.Add("Kalv");
                        items.Add("1 1/2 år");
                        items.Add("2 1/2 år og eldre");
                        Navigation.PushAsync(new SingleItemPicker("Alder på storvilt", items,
                                                                  delegate(SingleItemPicker picker)
                        {
                            VM.CurrentLogg.Age = picker.SelectedItem;
                            VM.Save();
                        }));
                    }));
                    break;

                case "Tags":
                    customFieldsSection.Add(new JL_EntryCell(item.Navn, VM.CurrentLogg.Tags.ToString(), "CurrentLogg.Tags", EntryComplete)
                    {
                        Keyboard = Keyboard.Numeric
                    });
                    break;

                case "Weight":
                    customFieldsSection.Add(new JL_EntryCell(item.Navn, VM.CurrentLogg.Weight.ToString(), "CurrentLogg.Weight", EntryComplete)
                    {
                        Keyboard = Keyboard.Numeric
                    });
                    break;

                case "ButchWeight":
                    customFieldsSection.Add(new JL_EntryCell(item.Navn, VM.CurrentLogg.ButchWeight.ToString(), "CurrentLogg.ButchWeight", EntryComplete)
                    {
                        Keyboard = Keyboard.Numeric
                    });
                    break;

                case "WeaponType":
                    customFieldsSection.Add(new JL_TextCell(item.Navn, VM.CurrentLogg.WeaponType,
                                                            delegate(object sender, EventArgs args)
                    {
                        Navigation.PushAsync(
                            new EntryPage(
                                item.Navn,
                                VM.CurrentLogg.WeaponType)
                        {
                            Callback = delegate(EntryPage entryPage)
                            {
                                VM.CurrentLogg.WeaponType = entryPage.Value;
                                VM.Save();
                            },
                            AutoCompleteEntries = VM.AllLogs.Select(l => l.WeaponType).Where(a => !a.Equals(VM.CurrentLogg.WeaponType, StringComparison.CurrentCultureIgnoreCase))
                        }
                            );
                    }));
                    break;

                case "Weather":
                    customFieldsSection.Add(new JL_EntryCell(item.Navn, VM.CurrentLogg.Weather, "CurrentLogg.Weather", EntryComplete));
                    break;
                }
            }

            Content = new TableViewJL
            {
                HasUnevenRows = true,
                Root          = new TableRoot
                {
                    tableSection,
                    customFieldsSection,
                    new TableSection()
                    {
                        new JL_ButtonCell("Slett logg", ButtonDelete_OnClicked)
                    }
                }
            };
        }
示例#57
0
文件: Issue2615.cs 项目: tytok/maui
        public Issue2615()
        {
            Title = "Test Blank Rows";

            var tableView = new TableView();

            tableView.HasUnevenRows = true;

            var tableHeaderSection = new TableSection();

            var viewHeaderCell = new ViewCell();

            var headerCellLayout = new StackLayout();

            headerCellLayout.Orientation       = StackOrientation.Vertical;
            headerCellLayout.Spacing           = 6;
            headerCellLayout.HorizontalOptions = LayoutOptions.Fill;
            headerCellLayout.VerticalOptions   = LayoutOptions.Fill;

            var largeNumberLabel = new Label();

            largeNumberLabel.FontFamily        = "HelveticaNeue-Light";
            largeNumberLabel.FontSize          = 52;
            largeNumberLabel.Text              = "90";
            largeNumberLabel.TextColor         = Color.FromRgb(0.00392156885936856, 0.47843137383461, 0.996078431606293);
            largeNumberLabel.HorizontalOptions = LayoutOptions.Center;
            largeNumberLabel.VerticalOptions   = LayoutOptions.Fill;
            headerCellLayout.Children.Add(largeNumberLabel);

            var nameLabel = new Label();

            nameLabel.FontFamily        = "HelveticaNeue-Light";
            nameLabel.FontSize          = 17;
            nameLabel.Text              = "Name: John Doe";
            nameLabel.HorizontalOptions = LayoutOptions.CenterAndExpand;
            nameLabel.VerticalOptions   = LayoutOptions.Center;
            headerCellLayout.Children.Add(nameLabel);

            viewHeaderCell.Height = 100;
            viewHeaderCell.View   = headerCellLayout;
            tableHeaderSection.Add(viewHeaderCell);
            tableView.Root.Add(tableHeaderSection);

            for (int sectionNumber = 1; sectionNumber < 11; sectionNumber++)
            {
                var tableSection = new TableSection("Section #" + sectionNumber);

                for (int cellNumber = 1; cellNumber < 11; cellNumber++)
                {
                    var viewCell       = new ViewCell();
                    var viewCellLayout = new StackLayout();
                    viewCellLayout.Orientation       = StackOrientation.Horizontal;
                    viewCellLayout.Spacing           = 6;
                    viewCellLayout.Padding           = new Thickness(20, 10);
                    viewCellLayout.HorizontalOptions = LayoutOptions.Center;
                    viewCellLayout.VerticalOptions   = LayoutOptions.Center;

                    var titleLabel = new Label();
                    titleLabel.FontFamily = "HelveticaNeue-Light";
                    titleLabel.FontSize   = 17;
                    titleLabel.Text       = "Cell #" + cellNumber;
                    viewCellLayout.Children.Add(titleLabel);

                    viewCell.View = viewCellLayout;

                    tableSection.Add(viewCell);
                }

                tableView.Root.Add(tableSection);
            }

            Content = tableView;
        }
示例#58
0
        public void IsReadOnly()
        {
            var section = new TableSection() as ICollection <Cell>;

            Assert.False(section.IsReadOnly);
        }
示例#59
0
        public static FormEntryCell MakeUriCell(string value, UriMatchType?match, TableSection urisSection, Page page)
        {
            var label = string.Format(AppResources.URIPosition, urisSection.Count);
            var cell  = new FormEntryCell(label, entryKeyboard: Keyboard.Url, button1: "cog_alt.png");

            cell.Entry.Text = value;
            cell.Entry.DisableAutocapitalize = true;
            cell.Entry.Autocorrect           = false;
            cell.MetaData = new Dictionary <string, object> {
                ["match"] = match
            };

            cell.Button1.Command = new Command(async() =>
            {
                var optionsVal = await page.DisplayActionSheet(AppResources.Options, AppResources.Cancel,
                                                               null, AppResources.MatchDetection, AppResources.Remove);

                if (optionsVal == AppResources.MatchDetection)
                {
                    var options = UriMatchOptionsMap.Select(v => v.Value).ToList();
                    options.Insert(0, AppResources.Default);
                    var exactingMatchVal = cell.MetaData["match"] as UriMatchType?;

                    var matchIndex = exactingMatchVal.HasValue ?
                                     Array.IndexOf(UriMatchOptionsMap.Keys.ToArray(), exactingMatchVal) + 1 : 0;
                    options[matchIndex] = $"✓ {options[matchIndex]}";

                    var optionsArr = options.ToArray();
                    var val        = await page.DisplayActionSheet(AppResources.URIMatchDetection, AppResources.Cancel,
                                                                   null, options.ToArray());

                    UriMatchType?selectedVal = null;
                    if (val == null || val == AppResources.Cancel)
                    {
                        selectedVal = exactingMatchVal;
                    }
                    else if (val.Replace("✓ ", string.Empty) != AppResources.Default)
                    {
                        selectedVal = UriMatchOptionsMap.ElementAt(Array.IndexOf(optionsArr, val) - 1).Key;
                    }
                    cell.MetaData["match"] = selectedVal;
                }
                else if (optionsVal == AppResources.Remove)
                {
                    if (urisSection.Contains(cell))
                    {
                        urisSection.Remove(cell);
                        if (cell is FormEntryCell feCell)
                        {
                            feCell.Dispose();
                        }
                        cell = null;

                        for (int i = 0; i < urisSection.Count; i++)
                        {
                            if (urisSection[i] is FormEntryCell uriCell)
                            {
                                uriCell.Label.Text = string.Format(AppResources.URIPosition, i + 1);
                            }
                        }
                    }
                }
            });

            return(cell);
        }
示例#60
0
        public ImageCellTablePage()
        {
            Title = "ImageCell Table Gallery - Legacy";

            if (Device.RuntimePlatform == Device.iOS && Device.Idiom == TargetIdiom.Tablet)
            {
                Padding = new Thickness(0, 0, 0, 60);
            }

            var tableSection = new TableSection("Section One")
            {
                new ImageCell {
                    Text = "Text 1", ImageSource = new FileImageSource {
                        File = "crimson.jpg"
                    }
                },
                new ImageCell {
                    Text = "Text 2", Detail = "Detail 1", ImageSource = new FileImageSource {
                        File = "crimson.jpg"
                    }
                },
                new ImageCell {
                    Text = "Text 3", ImageSource = new FileImageSource {
                        File = "cover1.jpg"
                    }
                },
                new ImageCell {
                    Text = "Text 4", Detail = "Detail 2", ImageSource = new FileImageSource {
                        File = "cover1.jpg"
                    }
                },
                new ImageCell {
                    Text = "Text 5", ImageSource = new FileImageSource {
                        File = "oasis.jpg"
                    }
                },
                new ImageCell {
                    Text = "Text 6", Detail = "Detail 3", ImageSource = new FileImageSource {
                        File = "oasis.jpg"
                    }
                },
                new ImageCell {
                    Text = "Text 7", ImageSource = new FileImageSource {
                        File = "crimson.jpg"
                    }
                },
                new ImageCell {
                    Text = "Text 8", Detail = "Detail 4", ImageSource = new FileImageSource {
                        File = "crimson.jpg"
                    }
                },
                new ImageCell {
                    Text = "Text 9", ImageSource = new FileImageSource {
                        File = "cover1.jpg"
                    }
                },
                new ImageCell {
                    Text = "Text 10", Detail = "Detail 5", ImageSource = new FileImageSource {
                        File = "cover1.jpg"
                    }
                },
                new ImageCell {
                    Text = "Text 11", ImageSource = new FileImageSource {
                        File = "oasis.jpg"
                    }
                },
                new ImageCell {
                    Text = "Text 12", Detail = "Detail 6", ImageSource = new FileImageSource {
                        File = "oasis.jpg"
                    }
                },
            };

            ImageCell imageCell = null;

            imageCell = new ImageCell
            {
                Text        = "not tapped",
                ImageSource = "oasis.jpg",
                Command     = new Command(() =>
                {
                    imageCell.Text = "tapped";
                    (imageCell.ImageSource as FileImageSource).File = "crimson.jpg";
                })
            };
            var tableSectionTwo = new TableSection("Section Two")
            {
                new ImageCell {
                    Text = "Text 13", ImageSource = new FileImageSource {
                        File = "crimson.jpg"
                    }
                },
                new ImageCell {
                    Text = "Text 14", Detail = "Detail 7", ImageSource = new FileImageSource {
                        File = "crimson.jpg"
                    }
                },
                new ImageCell {
                    Text = "Text 15", ImageSource = new FileImageSource {
                        File = "cover1.jpg"
                    }
                },
                new ImageCell {
                    Text = "Text 16", Detail = "Detail 8", ImageSource = new FileImageSource {
                        File = "cover1.jpg"
                    }
                },
                new ImageCell {
                    Text = "Text 17", ImageSource = new FileImageSource {
                        File = "oasis.jpg"
                    }
                },
                new ImageCell {
                    Text = "Text 18", Detail = "Detail 9", ImageSource = new FileImageSource {
                        File = "oasis.jpg"
                    }
                },
                new ImageCell {
                    Text = "Text 19", ImageSource = new FileImageSource {
                        File = "crimson.jpg"
                    }
                },
                new ImageCell {
                    Text = "Text 20", Detail = "Detail 10", ImageSource = new FileImageSource {
                        File = "crimson.jpg"
                    }
                },
                new ImageCell {
                    Text = "Text 21", ImageSource = new FileImageSource {
                        File = "cover1.jpg"
                    }
                },
                new ImageCell {
                    Text = "Text 22", Detail = "Detail 11", ImageSource = new FileImageSource {
                        File = "cover1.jpg"
                    }
                },
                new ImageCell {
                    Text = "Text 23", ImageSource = new FileImageSource {
                        File = "oasis.jpg"
                    }
                },
                new ImageCell {
                    Text = "Text 24", Detail = "Detail 12", ImageSource = new FileImageSource {
                        File = "oasis.jpg"
                    }
                },
                imageCell,
            };

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

            var table = new TableView
            {
                AutomationId = CellTypeList.CellTestContainerId,
                Root         = root,
            };

            Content = table;
        }