コード例 #1
0
ファイル: ItemSearchPage.cs プロジェクト: boxuanzhang/woolies
        public ItemSearchPage()
        {
            BackgroundColor = Color.White;
            Title = "Search";

            SearchBar searchEntry = new SearchBar {
                VerticalOptions = LayoutOptions.Start,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor = Color.FromHex("#044A0C")
            };

            searchEntry.SearchButtonPressed += OnSearchBarButtonPressed;

            listView = new ListView ();
            listView.ItemTemplate = new DataTemplate
                    (typeof (SearchPageCell));
            listView.ItemSelected += (sender, e) => {
                var todoItem = (TapandGo.Data.ItemsData)e.SelectedItem;
                var todoPage = new TapandGo.Views.ItemDetailPage();
                todoPage.BindingContext = todoItem;

                ((App)App.Current).ResumeAtTodoId = todoItem.ID;
                Debug.WriteLine("setting ResumeAtTodoId = " + todoItem.ID);

                Navigation.PushAsync(todoPage);
            };

            var layout = new StackLayout();
            layout.Children.Add(searchEntry);
            layout.Children.Add(listView);
            layout.VerticalOptions = LayoutOptions.FillAndExpand;
            Content = layout;
        }
コード例 #2
0
        public ForumListPage()
        {
            var searchBar = new SearchBar
            {
                Placeholder = "Search Forum ",
                BackgroundColor = Color.White,
                CancelButtonColor = App.BrandColor,
            };
            var vetlist = new ListView
            {
                HasUnevenRows = false,
                ItemTemplate = new DataTemplate(typeof(CustomListStyle)),
                ItemsSource = ForumListData.GetData(),
                BackgroundColor = Color.White,
                RowHeight = 50,
            };

            //vetlist.SetBinding<ArticlePageViewModel>();
            Content = new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor = Color.White,
                Children = { searchBar, vetlist }
            };

              vetlist.ItemSelected += (sender, e) =>
                {
                     var selectedObject = e.SelectedItem as CPMobile.Models.ForumType;

                 var forumPage = new ForumDetailListPage(selectedObject.title,selectedObject.ForumId);
                 Navigation.PushAsync(forumPage);
                };
        }
コード例 #3
0
        public SearchBarDemoPage()
        {
            Label header = new Label
            {
                Text = "SearchBar",
                Font = Font.BoldSystemFontOfSize(50),
                HorizontalOptions = LayoutOptions.Center
            };

            SearchBar searchBar = new SearchBar
            {
                Placeholder = "Xamarin.Forms Property",
            };
            searchBar.SearchButtonPressed += OnSearchBarButtonPressed;

            resultsLabel = new Label();

            // Accomodate iPhone status bar.
            this.Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5);

            // Build the page.
            this.Content = new StackLayout
            {
                Children = 
                {
                    header,
                    searchBar,
                    new ScrollView
                    {
                        Content = resultsLabel,
                        VerticalOptions = LayoutOptions.FillAndExpand
                    }
                }
            };
        }
コード例 #4
0
ファイル: Bugzilla33890.cs プロジェクト: Costo/Xamarin.Forms
		protected override void Init ()
		{
			Label header = new Label {
				Text = "Search Bar",
				FontAttributes = FontAttributes.Bold,
				FontSize = 50,
				HorizontalOptions = LayoutOptions.Center
			};

			SearchBar searchBar = new SearchBar {
				Placeholder = "Enter anything",
				CancelButtonColor = Color.Red
			};

			Label reproSteps = new Label {
				Text =
					"Tap on the search bar and enter some text. The 'Cancel' button should appear. If the 'Cancel' button is not red, this is broken.",
				HorizontalOptions = LayoutOptions.Center
			};

			Content = new StackLayout {
				Children = {
					header,
					searchBar,
					reproSteps
				}
			};
		}
コード例 #5
0
		public void TestConstructor ()
		{
			SearchBar searchBar = new SearchBar ();

			Assert.Null (searchBar.Placeholder);
			Assert.Null (searchBar.Text);
		}
コード例 #6
0
ファイル: SearchPage.cs プロジェクト: maxklippa/eCommerce
        public SearchPage(IEnumerable<Product> products)
        {
            _products = products;
            _productsList = new ObservableCollection<Product>(_products);

            var searchBar = new SearchBar();
            searchBar.TextChanged += OnSearchBarTextChanged;

            var listView = new ListView();
            listView.ItemTapped += OnListViewItemTapped;
            listView.ItemsSource = _productsList;
            listView.RowHeight = 80;
            listView.ItemTemplate = new DataTemplate(typeof(ProductCell));

            Title = "Product";

            Content = new StackLayout
            {
                Children =
                {
                    searchBar,
                    listView
                }
            };
        }
コード例 #7
0
        public SearchBarDemoPage()
        {
            Label header = new Label
            {
                Text = "SearchBar",
                Font = Font.SystemFontOfSize(50, FontAttributes.Bold),
                HorizontalOptions = LayoutOptions.Center
            };

            SearchBar searchBar = new SearchBar
            {
                Placeholder = "Xamarin.Forms Property",
            };
            searchBar.SearchButtonPressed += OnSearchBarButtonPressed;

            resultsLabel = new Label();

            // Build the page.
            this.Content = new StackLayout
            {
                Children = 
                {
                    header,
                    searchBar,
                    new ScrollView
                    {
                        Content = resultsLabel,
                        VerticalOptions = LayoutOptions.FillAndExpand
                    }
                }
            };
        }
コード例 #8
0
 private void InitializeSearchBar()
 {
     _searchBar = new SearchBar
     {
         Placeholder = "Search",
     };
     _searchBar.TextChanged -= OnSearchTextChanged;
     _searchBar.TextChanged += OnSearchTextChanged;
     _searchBar.BackgroundColor = Device.OnPlatform(Color.White, Color.White, Color.Black);
 }
コード例 #9
0
		public void TestSearchButtonPressed ()
		{
			SearchBar searchBar = new SearchBar ();

			bool thrown = false;
			searchBar.SearchButtonPressed += (sender, e) => thrown = true;

			((ISearchBarController)searchBar).OnSearchButtonPressed ();

			Assert.True (thrown);
		}
コード例 #10
0
		public void TestContentsChanged ()
		{
			SearchBar searchBar = new SearchBar ();

			bool thrown = false;

			searchBar.TextChanged += (sender, e) => thrown = true;

			searchBar.Text = "Foo";

			Assert.True (thrown);
		}
コード例 #11
0
		public void TestSearchCommandParameter ()
		{
			var searchBar = new SearchBar ();

			object param = "Testing";
			object result = null;
			searchBar.SearchCommand = new Command (p => { result = p; });
			searchBar.SearchCommandParameter = param;

			((ISearchBarController)searchBar).OnSearchButtonPressed ();

			Assert.AreEqual (param, result);
		}
コード例 #12
0
        public SearchGame()
        {
            this.BackgroundImage = "33.jpg";

            SearchBar searchBar = new SearchBar
            {
                Placeholder = "Serach Game",
            };

            var layout = new StackLayout ();
            //searchBar.SearchButtonPressed += OnSearchBarButtonPressed;
            layout.Children.Add (new BoxView {Color = Color.Transparent, HeightRequest = 20});
            layout.Children.Add (searchBar);

            Content = layout;
        }
コード例 #13
0
		public CheeseSearchView ()
		{
			viewModel = new SearchReviewsViewModel ();

			this.BindingContext = viewModel;

			Title = "Search Cheese Reviews!";
			searchResults = new ListView ();
			searchBar = new SearchBar () { Placeholder = "Reviewer Email" };

			// Search bar doesn't seem to want to bind 
			// to the command parameter for some reason
			// hack our way to make it work
			searchBar.TextChanged += (sender, e) => {
				viewModel.EmailAddress = ((SearchBar)sender).Text;
			};

			searchResults.SetBinding (ListView.ItemsSourceProperty, "Reviews");

			var cell = new DataTemplate (typeof(TextCell));
			cell.SetBinding (TextCell.TextProperty, "Display");

			searchResults.ItemTemplate = cell;


			var addButtonItem = new ToolbarItem ();
			addButtonItem.Text = "Add";
			addButtonItem.Clicked += async (sender, e) => {
				var addReview = new AddReviewView();

				var navPage = new NavigationPage(addReview);

				await Navigation.PushModalAsync(navPage);
			};

			this.ToolbarItems.Add (addButtonItem);

			searchBar.SearchCommandParameter = searchBar.Text;
			searchBar.SearchCommand = viewModel.SearchReviewsCommand;

			Content = new StackLayout { 
				Children = {
					searchBar,
					searchResults
				}
			};
		}
コード例 #14
0
ファイル: MoreNav.xaml.cs プロジェクト: boxuanzhang/woolies
        public MoreNav() {
            InitializeComponent();

            SearchBar searchEntry = new SearchBar {
                Text = "Search for items",
                VerticalOptions = LayoutOptions.Start,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor = Color.FromHex("#044A0C")

            };
            searchEntry.Focused += OnsearchBarChanged;

            var loginButton = new Button {
                Text = "Login",
                TextColor = Color.Black,
                BackgroundColor = Color.Transparent

            };
            loginButton.Clicked += Login_Nav;

            var registerButton = new Button {
                Text = "Register",
                TextColor = Color.Black,
                BackgroundColor = Color.Transparent

            };
            registerButton.Clicked += Register_Nav;

  
            var aboutButton = new Button {
                Text = "About",
                TextColor = Color.Black,
                BackgroundColor = Color.Transparent

            };
            aboutButton.Clicked += About_Nav;

            var layout = new StackLayout();
            layout.Children.Add(searchEntry);
            layout.Children.Add(loginButton);
            layout.Children.Add(registerButton);
            layout.Children.Add(aboutButton);

            Content = layout;
          

        }
コード例 #15
0
        public TeamsView()
        {
            BindingContext = new TeamsViewModel();

            var stack = new StackLayout {
                Orientation = StackOrientation.Vertical,
                Padding = new Thickness(0, 0, 0, 8)
            };

            var activity = new ActivityIndicator {
                Color = Helpers.Color.Greenish.ToFormsColor(),
                IsEnabled = true
            };
            activity.SetBinding (ActivityIndicator.IsVisibleProperty, "IsBusy");
            activity.SetBinding (ActivityIndicator.IsRunningProperty, "IsBusy");

            stack.Children.Add (activity);
            var searchBar = new SearchBar();
            searchBar.TextChanged +=  (sender, e) => {
                ViewModel.FilterTeams(searchBar.Text);
            };
            var listView = new ListView();

            listView.ItemsSource = ViewModel.Teams;
            var cell = new DataTemplate(typeof(HorizontalListTextCell));

            cell.SetBinding (ImageCell.TextProperty, "Name");
            cell.SetBinding(ImageCell.DetailProperty, "Abbreviation");
            //            cell.SetBinding(ImageCell.ImageSourceProperty, "");

            listView.ItemTapped +=  (sender, args) => {
                if(listView.SelectedItem == null)
                    return;
                this.Navigation.PushAsync(new TeamDetailView(listView.SelectedItem as Team));
                listView.SelectedItem = null;
            };

            listView.ItemTemplate = cell;
            stack.Children.Add(searchBar);
            stack.Children.Add (listView);

            Content = stack;
        }
コード例 #16
0
        public SearchPage()
        {
            Title = "Incidents";

            this.Padding = new Thickness (0, Device.OnPlatform (20, 0, 0), 0, 0);

            label = new Label { Text = "Incidents", HorizontalOptions = LayoutOptions.CenterAndExpand };
            service = new InMemoryIncidentService (Constants.Incidents);

            listview = new ListView ();
            listview.ItemsSource = service.RetrieveIncidents ();

            searchbar = new SearchBar () {
                Placeholder = "Search",
            };

            searchbar.TextChanged += (sender, e) => {
                if (!string.IsNullOrEmpty (searchbar.Text))
                    listview.ItemsSource = SearchIncidents (searchbar.Text);
                else
                    listview.ItemsSource = service.RetrieveIncidents ();
            };

            searchbar.SearchButtonPressed += (sender, e) => {
                if (!string.IsNullOrEmpty (searchbar.Text))
                    listview.ItemsSource = SearchIncidents (searchbar.Text);
                else
                    listview.ItemsSource = service.RetrieveIncidents ();

            };

            var stack = new StackLayout () {
                Orientation = StackOrientation.Vertical,
                Children = {
                    label,
                    searchbar,
                    listview
                }
            };

            Content = stack;
        }
コード例 #17
0
        public MapPage()
        {
            Title = "Search For a Business";
            BackgroundColor = Color.FromHex("#0DA195");
            list = new MallListView ();

            Grid content = new Grid ();

            RowDefinition r = new RowDefinition ();
            r.Height = new GridLength (2, GridUnitType.Star);
            content.RowDefinitions.Insert (0, r);

            r = new RowDefinition ();
            r.Height = new GridLength (7, GridUnitType.Star);
            content.RowDefinitions.Insert (1, r);

            r = new RowDefinition ();
            r.Height =  new GridLength (1.2, GridUnitType.Star);
            content.RowDefinitions.Insert (2, r);

            searchbar = new SearchBar () {
                Placeholder = "Search",
            };

            searchbar.TextChanged += (sender, e) => list.FilterLocations (searchbar.Text);
            searchbar.SearchButtonPressed += (sender, e) => {
                list.FilterLocations (searchbar.Text);
            };

            var stack = new StackLayout () {
                Children = {
                    list
                }
            };
            content.Children.Add (searchbar, 0, 0);
            content.Children.Add (stack, 0, 1);
            content.Children.Add (createFooter (), 0, 2);

            Content = content;
        }
コード例 #18
0
        public SearchBeersPage()
        {
            Title = "Search";

            //TODO Add your BreweryDB Key
            BreweryDB.BreweryDBClient.Initialize("", "SampleApp", 1);

            listView = new ListView();

            var cell = new DataTemplate(typeof(TextCell));
            cell.SetBinding(TextCell.TextProperty, "Name");
            cell.SetBinding(TextCell.DetailProperty, "Description");

            listView.ItemTemplate = cell;

            listView.ItemSelected += delegate
            {
                var beer = listView.SelectedItem as Beer;
                if(beer == null)
                    return;
                Navigation.PushAsync(new BeerDetails(beer));
                listView.SelectedItem = null;
            };

            searchBar = new SearchBar
            {
                Placeholder = "Search for beer"
            };

            searchBar.SearchButtonPressed += async delegate
            {
               var results =  await new BreweryDB.BreweryDBSearch<Beer>(searchBar.Text).Search();
               listView.ItemsSource = results;
            };

            Content = new StackLayout
            {
                Children = {searchBar, listView}
            };
        }
コード例 #19
0
		public void SearchBarTextChangedEventArgs (string initialText, string finalText)
		{
			var searchBar = new SearchBar {
				Text = initialText
			};

			SearchBar searchBarFromSender = null;
			string oldText = null;
			string newText = null;

			searchBar.TextChanged += (s, e) => {
				searchBarFromSender = (SearchBar)s;
				oldText = e.OldTextValue;
				newText = e.NewTextValue;
			};

			searchBar.Text = finalText;

			Assert.AreEqual (searchBar, searchBarFromSender);
			Assert.AreEqual (initialText, oldText);
			Assert.AreEqual (finalText, newText);
		}
コード例 #20
0
        public FavoriteListPage()
        {
            Title = "Favorite";
            NavigationPage.SetHasNavigationBar(this, true);
            BindingContext=favViewModel = new FavoriteListViewModel();
            favViewModel.GetFavoriteListCommand.Execute(null);
            var searchBar = new SearchBar
            {
                Placeholder = "Search Forum ",
                BackgroundColor = Color.White,
                CancelButtonColor = App.BrandColor,
            };
            var vetlist = new ListView
            {
                HasUnevenRows = false,
                ItemTemplate = new DataTemplate(typeof(CustomListStyle)),
                ItemsSource = favViewModel.FavList,
                BackgroundColor = Color.White,
                RowHeight = 50,
            };

            //vetlist.SetBinding<ArticlePageViewModel>();
            Content = new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor = Color.White,
                Children = { searchBar, vetlist }
            };

            vetlist.ItemSelected += (sender, e) =>
            {
                var selectedObject = e.SelectedItem as CPMobile.Models.Item;

                var favPage = new WebViewPage(selectedObject.title, selectedObject.websiteLink.HttpUrlFix());
                Navigation.PushAsync(favPage);
            };
        }
コード例 #21
0
ファイル: Issue764.cs プロジェクト: Costo/Xamarin.Forms
		protected override void Init ()
		{
			Title = "Issue 764";

			var searchBar = new SearchBar {
				Placeholder = "Search Me!"
			};

			var label = new Label {
				Text = "Pending Search"
			};

			searchBar.SearchButtonPressed += (s, e) => label.Text = "Search Activated";

			var layout = new StackLayout { 
				Children =  {
					searchBar,
					label
				}
			};

			Content = layout;
		}
コード例 #22
0
ファイル: SearchItem.cs プロジェクト: jackphilippi/SmartCart
        public SearchItem()
        {
            Title = "Search Item";
            list = new SearchListView ();

            SearchBar searchBar = new SearchBar {
                Placeholder = " Type your search query ",
            };

            searchBar.TextChanged += (sender, e) => list.FilterSearchList (searchBar.Text);
            searchBar.SearchButtonPressed += (sender, e) => {
                list.FilterSearchList (searchBar.Text);
            };

            var stack = new StackLayout () {
                Children = {
                    searchBar,
                    list
                }
            };

            Content = stack;
        }
コード例 #23
0
		public HomePage ()
		{
			Title = "App Settings";
			var searchBar = new SearchBar { 
				Placeholder = "Search by Name ", 
				BackgroundColor = Color.White, CancelButtonColor = AppStyle.BrandColor,
			};

			var vetlist = new ListView {
				HasUnevenRows = true,
				ItemTemplate = new DataTemplate (typeof(VetCell)),
				ItemsSource = VetData.GetData (),
				SeparatorColor = Color.FromHex ("#ddd"),
			};

			var layout = new StackLayout {
				Children = {
					searchBar,
					vetlist
				}
			};

			Content = layout;
		}
コード例 #24
0
 public static void UpdateCancelButtonColor(this SearchBar platformView, ISearchBar searchBar)
 {
     platformView.SetClearButtonColor(searchBar.CancelButtonColor.ToPlatformEFL());
 }
コード例 #25
0
        public static NavigationPage GetTestCases()
        {
            TestCaseScreen testCaseScreen = null;
            var            rootLayout     = new StackLayout();

            var testCasesRoot = new ContentPage
            {
                Title   = "Bug Repro's",
                Content = rootLayout
            };

            var searchBar = new SearchBar()
            {
                MinimumHeightRequest = 42,                 // Need this for Android N, see https://bugzilla.xamarin.com/show_bug.cgi?id=43975
                AutomationId         = "SearchBarGo"
            };

            var searchButton = new Button()
            {
                Text         = "Search And Go To Issue",
                AutomationId = "SearchButton",
                Command      = new Command(() =>
                {
                    try
                    {
                        if (TestCaseScreen.PageToAction.ContainsKey(searchBar.Text?.Trim()))
                        {
                            TestCaseScreen.PageToAction[searchBar.Text?.Trim()]();
                        }
                        else if (!testCaseScreen.TryToNavigateTo(searchBar.Text?.Trim()))
                        {
                            throw new Exception($"Unable to Navigate to {searchBar.Text}");
                        }
                    }
                    catch (Exception e)
                    {
                        System.Diagnostics.Debug.WriteLine(e.Message);
                        Console.WriteLine(e.Message);
                    }
                })
            };

            var leaveTestCasesButton = new Button
            {
                AutomationId = "GoBackToGalleriesButton",
                Text         = "Go Back to Galleries",
                Command      = new Command(() => testCasesRoot.Navigation.PopModalAsync())
            };

            rootLayout.Children.Add(leaveTestCasesButton);
            rootLayout.Children.Add(searchBar);
            rootLayout.Children.Add(searchButton);

            testCaseScreen = new TestCaseScreen();

            rootLayout.Children.Add(CreateTrackerFilter(testCaseScreen));

            rootLayout.Children.Add(testCaseScreen);

            searchBar.TextChanged += (sender, args) => SearchBarOnTextChanged(sender, args, testCaseScreen);

            var page = new NavigationPage(testCasesRoot);

            switch (Device.RuntimePlatform)
            {
            case Device.iOS:
            case Device.Android:
            default:
                page.Title = "Test Cases";
                break;

            case Device.UWP:
                page.Title = "Tests";
                break;
            }
            return(page);
        }
コード例 #26
0
        public MacOSTestGallery()
        {
            mainDemoStack.Children.Add(MakeNewStackLayout());
            var items = new List <MyItem1>();

            for (int i = 0; i < 5000; i++)
            {
                items.Add(new MyItem1 {
                    Reference = "Hello this is a big text " + i.ToString(), ShowButton = i % 2 == 0, Image = "bank.png"
                });
            }

            var header = new Label {
                Text = "HELLO HEADER ", FontSize = 40, BackgroundColor = Color.Pink
            };
            var lst4 = new ListView {
                Header = header, ItemTemplate = new DataTemplate(typeof(DemoViewCell)), BackgroundColor = Color.Yellow, HeightRequest = 300, RowHeight = 50, ItemsSource = items,
            };

            var lst = new ListView {
                ItemTemplate = new DataTemplate(typeof(DemoEntryCell)), BackgroundColor = Color.Yellow, HeightRequest = 300, RowHeight = 50, ItemsSource = items,
            };
            var lst1 = new ListView {
                ItemTemplate = new DataTemplate(typeof(DemoTextCell)), BackgroundColor = Color.Yellow, HeightRequest = 300, RowHeight = 50, ItemsSource = items,
            };
            var lst2 = new ListView {
                ItemTemplate = new DataTemplate(typeof(DemoSwitchCell)), BackgroundColor = Color.Yellow, HeightRequest = 300, RowHeight = 50, ItemsSource = items,
            };
            var lst3 = new ListView {
                ItemTemplate = new DataTemplate(typeof(DemoImageCell)), BackgroundColor = Color.Yellow, HeightRequest = 300, RowHeight = 50, ItemsSource = items,
            };

            var bigbUtton = new Button {
                WidthRequest = 200, HeightRequest = 300, ImageSource = "bank.png"
            };

            var picker = new DatePicker();

            var timePicker = new TimePicker {
                Format = "T", Time = TimeSpan.FromHours(2)
            };

            var editor = new Editor {
                Text = "Edit this text on editor", HeightRequest = 100, TextColor = Color.Yellow, BackgroundColor = Color.Gray
            };

            var entry = new Entry {
                Placeholder = "Edit this text on entry", PlaceholderColor = Color.Pink, TextColor = Color.Yellow, BackgroundColor = Color.Green
            };

            var frame = new Frame {
                HasShadow = true, BackgroundColor = Color.Maroon, BorderColor = Color.Lime, MinimumHeightRequest = 100
            };


            var image = new Image {
                HeightRequest = 100, Source = "crimson.jpg"
            };

            var picker1 = new Picker {
                Title = "Select a team player", TextColor = Color.Pink, BackgroundColor = Color.Silver
            };

            picker1.Items.Add("Rui");
            picker1.Items.Add("Jason");
            picker1.Items.Add("Ez");
            picker1.Items.Add("Stephane");
            picker1.Items.Add("Samantha");
            picker1.Items.Add("Paul");

            picker1.SelectedIndex = 1;

            var progress = new ProgressBar {
                BackgroundColor = Color.Purple, Progress = 0.5, HeightRequest = 50
            };

            picker1.SelectedIndexChanged += (sender, e) =>
            {
                entry.Text = $"Selected {picker1.Items[picker1.SelectedIndex]}";

                progress.Progress += 0.1;
            };

            var searchBar = new SearchBar {
                BackgroundColor = Color.Olive, TextColor = Color.Maroon, CancelButtonColor = Color.Pink
            };

            searchBar.Placeholder          = "Please search";
            searchBar.PlaceholderColor     = Color.Orange;
            searchBar.SearchButtonPressed += (sender, e) =>
            {
                searchBar.Text = "Search was pressed";
            };

            var slider = new Slider {
                BackgroundColor = Color.Lime, Value = 0.5
            };

            slider.ValueChanged += (sender, e) =>
            {
                editor.Text = $"Slider value changed {slider.Value}";
            };

            var stepper = new Stepper {
                BackgroundColor = Color.Yellow, Maximum = 100, Minimum = 0, Value = 10, Increment = 0.5
            };

            stepper.ValueChanged += (sender, e) =>
            {
                editor.Text = $"Stepper value changed {stepper.Value}";
            };

            var labal = new Label {
                Text = "This is a Switch"
            };
            var switchR = new Switch {
                BackgroundColor = Color.Fuchsia, IsToggled = true
            };

            switchR.Toggled += (sender, e) =>
            {
                entry.Text = $"switchR is toggled {switchR.IsToggled}";
            };
            var layoutSwitch = new StackLayout {
                Orientation = StackOrientation.Horizontal, BackgroundColor = Color.Green
            };

            layoutSwitch.Children.Add(labal);
            layoutSwitch.Children.Add(switchR);

            var webView = new WebView {
                HeightRequest = 200, Source = "http://google.pt"
            };

            var mainStck = new StackLayout
            {
                Spacing           = 10,
                BackgroundColor   = Color.Blue,
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center,
                Children          =
                {
                    lst4,
                    lst,
                    lst1,
                    lst2,
                    lst3,
                    webView,
                    layoutSwitch,
                    stepper,
                    slider,
                    searchBar,
                    progress,
                    picker1,
                    image,
                    frame,
                    entry,
                    editor,
                    picker,
                    timePicker,
                    bigbUtton,
                    new Button {
                        Text = "Click Me",                                                                      BackgroundColor           = Color.Gray
                    },
                    new Button {
                        ImageSource = "bank.png",                                                               BackgroundColor           = Color.Gray
                    },
                    CreateButton(new Button.ButtonContentLayout(Button.ButtonContentLayout.ImagePosition.Left,    10)),
                    CreateButton(new Button.ButtonContentLayout(Button.ButtonContentLayout.ImagePosition.Top, 10)),
                    CreateButton(new Button.ButtonContentLayout(Button.ButtonContentLayout.ImagePosition.Bottom,  10)),
                    CreateButton(new Button.ButtonContentLayout(Button.ButtonContentLayout.ImagePosition.Right, 10)),
                    mainDemoStack
                }
            };
            var lbl = new Label {
                Text = "Second label", TextColor = Color.White, VerticalTextAlignment = TextAlignment.Start, HorizontalTextAlignment = TextAlignment.Center
            };

            mainStck.Children.Add(new Label {
                Text = "HELLO XAMARIN FORMS MAC", TextColor = Color.White, HorizontalTextAlignment = TextAlignment.Center
            });
            mainStck.Children.Add(lbl);
            mainStck.Children.Add(new BoxView {
                Color = Color.Pink, HeightRequest = 200
            });

            var scroller = new ScrollView {
                BackgroundColor = Color.Yellow, HorizontalOptions = LayoutOptions.Center
            };

            scroller.Scrolled += (sender, e) =>
            {
                lbl.Text = $"Current postion {scroller.ScrollY}";
            };

            scroller.Content = mainStck;

            var actv = new ActivityIndicator {
                BackgroundColor = Color.White, Color = Color.Fuchsia, IsRunning = true
            };

            mainStck.Children.Add(actv);

            bigbUtton.Clicked += async(sender, e) =>
            {
                await scroller.ScrollToAsync(actv, ScrollToPosition.Center, true);

                actv.Color = Color.Default;
            };

            Content = scroller;
        }
コード例 #27
0
        void SetupMauiLayout()
        {
            const string loremIpsum =
                "Lorem ipsum dolor sit amet, consectetur adipiscing elit. " +
                "Quisque ut dolor metus. Duis vel iaculis mauris, sit amet finibus mi. " +
                "Etiam congue ornare risus, in facilisis libero tempor eget. " +
                "Phasellus mattis mollis libero ut semper. In sit amet sapien odio. " +
                "Sed interdum ullamcorper dui eu rutrum. Vestibulum non sagittis justo. " +
                "Cras rutrum scelerisque elit, et porta est lobortis ac. " +
                "Pellentesque eu ornare tortor. Sed bibendum a nisl at laoreet.";

            var verticalStack = new VerticalStackLayout()
            {
                Spacing = 5, BackgroundColor = Colors.AntiqueWhite
            };
            var horizontalStack = new HorizontalStackLayout()
            {
                Spacing = 2, BackgroundColor = Colors.CornflowerBlue
            };


            verticalStack.Add(CreateSampleGrid());

            verticalStack.Add(new Label {
                Text = " ", Padding = new Thickness(10)
            });
            var label = new Label {
                Text = "End-aligned text", BackgroundColor = Colors.Fuchsia, HorizontalTextAlignment = TextAlignment.End
            };

            label.Margin = new Thickness(15, 10, 20, 15);

            SemanticProperties.SetHint(label, "Hint Text");
            SemanticProperties.SetDescription(label, "Description Text");

            verticalStack.Add(label);
            verticalStack.Add(new Label {
                Text = "This should be BIG text!", FontSize = 24, HorizontalOptions = LayoutOptions.End
            });

            SemanticProperties.SetHeadingLevel((BindableObject)verticalStack.Children.Last(), SemanticHeadingLevel.Level1);
            verticalStack.Add(new Label {
                Text = "This should be BOLD text!", FontAttributes = FontAttributes.Bold, HorizontalOptions = LayoutOptions.Center
            });
            verticalStack.Add(new Label {
                Text = "This should be a CUSTOM font!", FontFamily = "Dokdo"
            });


#if __ANDROID__
            string fontFamily = "ionicons.ttf#";
#elif WINDOWS
            string fontFamily = "Assets/ionicons.ttf#ionicons";
#else
            string fontFamily = "Ionicons";
#endif

            verticalStack.Add(new Image {
                Source = new FontImageSource()
                {
                    FontFamily = fontFamily, Glyph = '\uf2fe'.ToString()
                }
            });
            verticalStack.Add(new Label {
                Text = "This should have padding", Padding = new Thickness(40), BackgroundColor = Colors.LightBlue
            });
            verticalStack.Add(new Label {
                Text = loremIpsum
            });
            verticalStack.Add(new Label {
                Text = loremIpsum, MaxLines = 2
            });
            verticalStack.Add(new Label {
                Text = loremIpsum, LineBreakMode = LineBreakMode.TailTruncation
            });
            verticalStack.Add(new Label {
                Text = loremIpsum, MaxLines = 2, LineBreakMode = LineBreakMode.TailTruncation
            });
            verticalStack.Add(new Label {
                Text = "This should have five times the line height! " + loremIpsum, LineHeight = 5, MaxLines = 2
            });

            SemanticProperties.SetHeadingLevel((BindableObject)verticalStack.Children.Last(), SemanticHeadingLevel.Level2);

            var visibleClearButtonEntry = new Entry()
            {
                ClearButtonVisibility = ClearButtonVisibility.WhileEditing, Placeholder = "This Entry will show clear button if has input."
            };
            var hiddenClearButtonEntry = new Entry()
            {
                ClearButtonVisibility = ClearButtonVisibility.Never, Placeholder = "This Entry will not..."
            };

            verticalStack.Add(visibleClearButtonEntry);
            verticalStack.Add(hiddenClearButtonEntry);

            verticalStack.Add(new Editor {
                Placeholder = "This is an editor placeholder."
            });
            verticalStack.Add(new Editor {
                Placeholder = "Green Text Color.", TextColor = Colors.Green
            });
            var paddingButton = new Button
            {
                Padding         = new Thickness(40),
                Text            = "This button has a padding!!",
                BackgroundColor = Colors.Purple,
            };

            verticalStack.Add(paddingButton);

            var underlineLabel = new Label {
                Text = "underline", TextDecorations = TextDecorations.Underline
            };
            verticalStack.Add(underlineLabel);

            verticalStack.Add(new ActivityIndicator());
            verticalStack.Add(new ActivityIndicator {
                Color = Colors.Red, IsRunning = true
            });

            var button = new Button()
            {
                Text = _viewModel.Text, WidthRequest = 200
            };
            button.Clicked += async(sender, e) =>
            {
                var events = _services.GetRequiredService <ILifecycleEventService>();
                events.InvokeEvents <Action <string> >("CustomEventName", action => action("VALUE"));

                var location = await Geolocation.GetLocationAsync(new GeolocationRequest(GeolocationAccuracy.Lowest));

                Debug.WriteLine($"I tracked you down to {location.Latitude}, {location.Longitude}! You can't hide!");
            };

            var button2 = new Button()
            {
                TextColor       = Colors.Green,
                Text            = "Hello I'm a button",
                BackgroundColor = Colors.Purple,
                Margin          = new Thickness(12)
            };

            horizontalStack.Add(button);
            horizontalStack.Add(button2);

            horizontalStack.Add(new Label {
                Text = "And these buttons are in a HorizontalStackLayout", VerticalOptions = LayoutOptions.Center
            });

            verticalStack.Add(horizontalStack);

            verticalStack.Add(new Button {
                Text = "CharacterSpacing"
            });
            verticalStack.Add(new Button {
                CharacterSpacing = 8, Text = "CharacterSpacing"
            });

            var checkbox = new CheckBox();
            checkbox.CheckedChanged += (sender, e) =>
            {
                Debug.WriteLine($"Checked Changed to '{e.Value}'");
            };
            verticalStack.Add(checkbox);
            verticalStack.Add(new CheckBox {
                BackgroundColor = Colors.LightPink
            });
            verticalStack.Add(new CheckBox {
                IsChecked = true, Color = Colors.Aquamarine
            });

            verticalStack.Add(new Editor());
            verticalStack.Add(new Editor {
                Text = "Editor"
            });
            verticalStack.Add(new Editor {
                Text = "Lorem ipsum dolor sit amet", MaxLength = 10
            });
            verticalStack.Add(new Editor {
                Text = "Predictive Text Off", IsTextPredictionEnabled = false
            });
            verticalStack.Add(new Editor {
                Text = "Lorem ipsum dolor sit amet", FontSize = 10, FontFamily = "dokdo_regular"
            });
            verticalStack.Add(new Editor {
                Text = "ReadOnly Editor", IsReadOnly = true
            });


            var entry = new Entry();
            entry.TextChanged += (sender, e) =>
            {
                Debug.WriteLine($"Text Changed from '{e.OldTextValue}' to '{e.NewTextValue}'");
            };

            verticalStack.Add(entry);
            verticalStack.Add(new Entry {
                Text = "Entry", TextColor = Colors.DarkRed, FontFamily = "Dokdo", MaxLength = -1
            });
            verticalStack.Add(new Entry {
                IsPassword = true, TextColor = Colors.Black, Placeholder = "Pasword Entry"
            });
            verticalStack.Add(new Entry {
                IsTextPredictionEnabled = false
            });
            verticalStack.Add(new Entry {
                Placeholder = "This should be placeholder text"
            });
            verticalStack.Add(new Entry {
                Text = "This should be read only property", IsReadOnly = true
            });
            verticalStack.Add(new Entry {
                MaxLength = 5, Placeholder = "MaxLength text"
            });
            verticalStack.Add(new Entry {
                Text = "This should be text with character spacing", CharacterSpacing = 10
            });
            verticalStack.Add(new Entry {
                Keyboard = Keyboard.Numeric, Placeholder = "Numeric Entry"
            });
            verticalStack.Add(new Entry {
                Keyboard = Keyboard.Email, Placeholder = "Email Entry"
            });

            verticalStack.Add(new ProgressBar {
                Progress = 0.5
            });
            verticalStack.Add(new ProgressBar {
                Progress = 0.5, BackgroundColor = Colors.LightCoral
            });
            verticalStack.Add(new ProgressBar {
                Progress = 0.5, ProgressColor = Colors.Purple
            });

            var searchBar = new SearchBar();
            searchBar.CharacterSpacing = 4;
            searchBar.Text             = "A search query";
            verticalStack.Add(searchBar);

            var placeholderSearchBar = new SearchBar();
            placeholderSearchBar.Placeholder = "Placeholder";
            verticalStack.Add(placeholderSearchBar);


            var monkeyList = new List <string>
            {
                "Baboon",
                "Capuchin Monkey",
                "Blue Monkey",
                "Squirrel Monkey",
                "Golden Lion Tamarin",
                "Howler Monkey",
                "Japanese Macaque"
            };

            var picker = new Picker {
                Title = "Select a monkey", FontFamily = "Dokdo"
            };

            picker.ItemsSource = monkeyList;
            verticalStack.Add(picker);

            verticalStack.Add(new Slider());

            verticalStack.Add(new Stepper());
            verticalStack.Add(new Stepper {
                BackgroundColor = Colors.IndianRed
            });
            verticalStack.Add(new Stepper {
                Minimum = 0, Maximum = 10, Value = 5
            });

            verticalStack.Add(new Switch());
            verticalStack.Add(new Switch()
            {
                OnColor = Colors.Green
            });
            verticalStack.Add(new Switch()
            {
                ThumbColor = Colors.Yellow
            });
            verticalStack.Add(new Switch()
            {
                OnColor = Colors.Green, ThumbColor = Colors.Yellow
            });

            verticalStack.Add(new DatePicker());
            verticalStack.Add(new DatePicker {
                CharacterSpacing = 6
            });
            verticalStack.Add(new DatePicker {
                FontSize = 24
            });

            verticalStack.Add(new TimePicker());
            verticalStack.Add(new TimePicker {
                Time = TimeSpan.FromHours(8), CharacterSpacing = 6
            });

            verticalStack.Add(new Image()
            {
                Source = "dotnet_bot.png"
            });

            Content = new ScrollView
            {
                Content = verticalStack
            };
        }
コード例 #28
0
ファイル: CoreGallery.cs プロジェクト: jackyrul/Xamarin.Forms
        public CoreRootPage(Page rootPage, NavigationBehavior navigationBehavior = NavigationBehavior.PushAsync)
        {
            ValidateRegistrar();

            IStringProvider stringProvider = DependencyService.Get <IStringProvider>();

            Title = stringProvider.CoreGalleryTitle;

            var corePageView = new CorePageView(rootPage, navigationBehavior);

            var searchBar = new SearchBar()
            {
                AutomationId = "SearchBar"
            };

            var testCasesButton = new Button
            {
                Text         = "Go to Test Cases",
                AutomationId = "GoToTestButton",
                Command      = new Command(async() =>
                {
                    if (!string.IsNullOrEmpty(searchBar.Text))
                    {
                        await corePageView.PushPage(searchBar.Text);
                    }
                    else
                    {
                        await Navigation.PushModalAsync(TestCases.GetTestCases());
                    }
                })
            };

            var stackLayout = new StackLayout()
            {
                Children =
                {
                    testCasesButton,
                    searchBar,
                    new Button {
                        Text    = "Click to Force GC",
                        Command = new Command(() => {
                            GC.Collect();
                            GC.WaitForPendingFinalizers();
                            GC.Collect();
                        })
                    }
                }
            };

            this.SetAutomationPropertiesName("Gallery");
            this.SetAutomationPropertiesHelpText("Lists all gallery pages");

            Content = new AbsoluteLayout
            {
                Children =
                {
                    { new CoreRootView(), new Rectangle(0, 0.0,   1, 0.35), AbsoluteLayoutFlags.All },
                    { stackLayout,        new Rectangle(0, 0.5,   1, 0.30), AbsoluteLayoutFlags.All },
                    { corePageView,       new Rectangle(0, 1.0, 1.0, 0.35), AbsoluteLayoutFlags.All },
                }
            };
        }
コード例 #29
0
 void NotifyPropertiesChanged()
 {
     NotifyOfPropertyChange(() => SelectedExplorerItem);
     SearchBar.NotifyPropertiesChanged();
 }
コード例 #30
0
        public Search()
        {
            InitializeComponent();
            BackgroundColor = Settings.BlackRBGColor;

            mainCore.searchLoaded += Search_searchLoaded;

            //BindingContext = new SearchPageViewer();

            mySearchResultCollection = new ObservableCollection <SearchResult>()
            {
            };

            SearchBar searchBar = new SearchBar()
            {
                Placeholder       = "Movie Search...",
                CancelButtonColor = Color.FromRgb(190, 190, 190),
                TranslationY      = 3,
            };

            searchBar.TextChanged         += SearchBar_TextChanged;
            searchBar.SearchButtonPressed += SearchBar_SearchButtonPressed;
            if (Device.RuntimePlatform == Device.Android)
            {
                /*
                 * searchBar.TextColor = Color.FromHex(MainPage.primaryColor);
                 * searchBar.PlaceholderColor = Color.FromHex(MainPage.primaryColor);
                 * searchBar.CancelButtonColor = Color.FromHex(MainPage.primaryColor);
                 */
            }
            listView = new ListView {
                // Source of data items.
                ItemsSource = mySearchResultCollection,
                RowHeight   = 50,

                // Define template for displaying each item.
                // (Argument of DataTemplate constructor is called for
                //      each item; it must return a Cell derivative.)
                ItemTemplate = new DataTemplate(() => {
                    // Create views with bindings for displaying each property.

                    Label nameLabel = new Label();
                    Label desLabel  = new Label();
                    // Image poster = new Image();
                    nameLabel.SetBinding(Label.TextProperty, "Title");
                    desLabel.SetBinding(Label.TextProperty, "Extra");
                    // poster.SetBinding(Image.SourceProperty, "Poster");
                    //  desLabel.FontSize = nameLabel.FontSize / 1.2f;
                    desLabel.FontSize   = 12;
                    desLabel.TextColor  = Color.FromHex("#828282"); //
                    nameLabel.TextColor = Color.FromHex("#e6e6e6");
                    nameLabel.FontSize  = 15;

                    desLabel.TranslationX  = 10;
                    nameLabel.TranslationX = 10;



                    //nameLabel.SetBinding(Label.d, "Extra");

                    /*
                     * Label birthdayLabel = new Label();
                     * birthdayLabel.SetBinding(Label.TextProperty,
                     *  new Binding("Birthday", BindingMode.OneWay,
                     *      null, null, "Born {0:d}"));
                     *
                     * BoxView boxView = new BoxView();
                     * boxView.SetBinding(BoxView.ColorProperty, "FavoriteColor");*/

                    // Return an assembled ViewCell.
                    return(new ViewCell {
                        View = new StackLayout {
                            Padding = new Thickness(0, 9),
                            Orientation = StackOrientation.Horizontal,
                            Children =
                            {
                                //boxView,
                                new StackLayout
                                {
                                    VerticalOptions = LayoutOptions.CenterAndExpand,
                                    Spacing = 0,
                                    Children =
                                    {
                                        //    poster,
                                        nameLabel,
                                        desLabel,
                                        //birthdayLabel
                                    }
                                }
                            }
                        }
                    });
                })
            };
            listView.ItemTapped    += ListView_ItemTapped;
            listView.SeparatorColor = Color.Transparent;
            listView.VerticalScrollBarVisibility = Settings.ScrollBarVisibility;

            // Accomodate iPhone status bar.
            // this.Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5);

            // Build the page.
            this.Content = new StackLayout {
                Children =
                {
                    searchBar,
                    new Image()
                    {
                        Source = App.GetImageSource("gradient.png"),HeightRequest                                        = 3, HorizontalOptions = LayoutOptions.Fill, ScaleX = 100, Opacity = 0.3
                    },
                    listView
                    //new BoxView() {Color = Color.LightGray,HeightRequest=1,TranslationY=-2 ,}, // {Color = new Color(   .188, .247, .624) { },HeightRequest=2 },
                }
            };
            // searchBar.Text = startText;
            // print(">>" + startText);
            //searchBar.Focus();
            // print(MainSearchResultList.ItemsSource.ToString()  + "<<<<<<<<<");
        }
コード例 #31
0
        protected override void OnAppearing()
        {
            base.OnAppearing();

            SearchBar.Focus();
        }
コード例 #32
0
        void OnSearchBarButtonPressed(object sender, EventArgs args)
        {
            // Get the search text.
            SearchBar searchBar  = (SearchBar)sender;
            string    searchText = searchBar.Text;

            // Create a List and initialize the results Label.
            var list = new List <Tuple <Type, Type> >();

            resultsLabel.Text = "";

            // Get Xamarin.Forms assembly.
            Assembly xamarinFormsAssembly = typeof(View).GetTypeInfo().Assembly;

            // Loop through all the types.
            foreach (Type type in xamarinFormsAssembly.ExportedTypes)
            {
                TypeInfo typeInfo = type.GetTypeInfo();

                // Public types only.
                if (typeInfo.IsPublic)
                {
                    // Loop through the properties.
                    foreach (PropertyInfo property in typeInfo.DeclaredProperties)
                    {
                        // Check for a match
                        if (property.Name.Equals(searchText))
                        {
                            // Add it to the list.
                            list.Add(Tuple.Create <Type, Type>(type, property.PropertyType));
                        }
                    }
                }
            }

            if (list.Count == 0)
            {
                resultsLabel.Text =
                    String.Format("No Xamarin.Forms properties with " +
                                  "the name of {0} were found",
                                  searchText);
            }
            else
            {
                resultsLabel.Text = "The ";

                foreach (Tuple <Type, Type> tuple in list)
                {
                    resultsLabel.Text +=
                        String.Format("{0} type defines a property named {1} of type {2}",
                                      tuple.Item1.Name, searchText, tuple.Item2.Name);

                    if (tuple != list.Last())
                    {
                        resultsLabel.Text += "; and the ";
                    }
                }

                resultsLabel.Text += ".";
            }
        }
コード例 #33
0
        void Search_TextChanged(System.Object sender, EventArgs e)
        {
            SearchBar searchBar = (SearchBar)sender;

            listView.ItemsSource = Groups.Where(x => x.ToLower().Contains(searchBar.Text.ToLower()));
        }
コード例 #34
0
ファイル: Arama.cs プロジェクト: Stuff2/NoteWorkApp
        public Arama()
        {
            var o = new int(); Device.OnPlatform(iOS: () => o = 20, Android: () => o = 0);

            Padding = new Thickness(0, o, 0, 0);
            Grid a = new Grid();
            Grid b = new Grid()
            {
                BackgroundColor = Color.FromHex("#e6e6e6"),
            };
            ObservableCollection <Profile> plist  = new ObservableCollection <Profile>();
            ObservableCollection <Profile> plist2 = new ObservableCollection <Profile>();
            List <NetWork> k = new List <NetWork>();

            for (var i = 0; i < 57; i++)
            {
                a.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Star)
                });
            }
            for (var i = 0; i < 114; i++)
            {
                a.RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(1, GridUnitType.Star)
                });
            }
            b.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });
            b.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });
            var SBar = new SearchBar()
            {
                BackgroundColor   = Color.White,
                Placeholder       = AppResource.agimplaceholder,
                PlaceholderColor  = Color.Gray,
                CancelButtonColor = Color.Black
            };
            var agimda = new Image()
            {
                Source = "agimda.png"
            };
            var stats = new Image()
            {
                Source = "world.png"
            };
            ScrollView Liste = new ScrollView()
            {
                BackgroundColor = Color.White
            };
            var geri = new Image()
            {
                Source            = "geributonu2.png",
                HorizontalOptions = LayoutOptions.Start,
                Margin            = new Thickness(10, 10, 0, 10),
                HeightRequest     = 30,
                WidthRequest      = 30
            };

            var Ust = new Image()
            {
                Source            = "UstTabLogo.png",
                HorizontalOptions = LayoutOptions.Center,
                Margin            = new Thickness(0, 10, 0, 10),
                HeightRequest     = 30,
                WidthRequest      = 30
            };

            var gayagay = new Image()
            {
                Source = "gaydirganlik.png", VerticalOptions = LayoutOptions.EndAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand
            };
            var gayagay1 = new Image()
            {
                Source = "gaydirganlik2.png", VerticalOptions = LayoutOptions.EndAndExpand, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            var gayagay2 = new Image()
            {
                Source = "gaydirganlik2.png", VerticalOptions = LayoutOptions.EndAndExpand, HorizontalOptions = LayoutOptions.StartAndExpand
            };

            gayagay1.IsVisible = true;
            gayagay2.IsVisible = false;

            var tapGestureRecognizer = new TapGestureRecognizer();

            tapGestureRecognizer.Tapped += async(s, e) => {
                geri.RotationX = 180;
                await Navigation.PopModalAsync();
            };
            geri.GestureRecognizers.Add(tapGestureRecognizer);

            a.Children.Add(agimda, 10, 14);
            Grid.SetColumnSpan(agimda, 18);
            Grid.SetRowSpan(agimda, 18);

            a.Children.Add(stats, 28, 14);
            Grid.SetColumnSpan(stats, 18);
            Grid.SetRowSpan(stats, 18);

            a.Children.Add(gayagay, 0, 29);
            Grid.SetColumnSpan(gayagay, 57);
            Grid.SetRowSpan(gayagay, 2);

            a.Children.Add(gayagay1, 12, 29);
            Grid.SetColumnSpan(gayagay1, 14);
            Grid.SetRowSpan(gayagay1, 2);

            a.Children.Add(gayagay2, 30, 29);
            Grid.SetColumnSpan(gayagay2, 14);
            Grid.SetRowSpan(gayagay2, 2);

            a.Children.Add(SBar, 2, 9);
            Grid.SetColumnSpan(SBar, 53);
            Grid.SetRowSpan(SBar, 8);

            a.Children.Add(Liste, 0, 30);
            Grid.SetColumnSpan(Liste, 57);
            Grid.SetRowSpan(Liste, 83);

            b.Children.Add(geri, 0, 0);

            b.Children.Add(Ust, 0, 0);

            a.Children.Add(b, 0, 0);
            Grid.SetColumnSpan(b, 57);
            Grid.SetRowSpan(b, 8);

            a.BackgroundColor = Color.FromHex("#eee");

            //ağım listesi
            list2.ItemTemplate = new DataTemplate(() =>
            {
                Label nameLabel  = new Label();
                Label nameLabel1 = new Label();
                nameLabel.SetBinding(Label.TextProperty, "FirstName");
                nameLabel1.SetBinding(Label.TextProperty, "LastName");


                return(new ViewCell
                {
                    View = new StackLayout
                    {
                        Padding = new Thickness(0, 5),
                        Orientation = StackOrientation.Horizontal,
                        Children =
                        {
                            new StackLayout
                            {
                                VerticalOptions = LayoutOptions.Center,
                                Orientation = StackOrientation.Horizontal,
                                Spacing = 10,
                                Children =
                                {
                                    nameLabel,
                                    nameLabel1
                                }
                            }
                        }
                    }
                });
            });
            list2.IsPullToRefreshEnabled = true;
            list2.Refreshing            += async(s, e) => {
                var x = await GirisSayfasi.manager.GetNetWorksAsync(GirisSayfasi.manager.prof);

                plist2 = x.Item1;
                k      = x.Item2;
                if (plist2 != null)
                {
                    foreach (var z in plist2)
                    {
                        if (z.FirstName == null)
                        {
                            z.FirstName = "";
                        }

                        if (z.LastName == null)
                        {
                            z.LastName = "";
                        }
                    }
                    list2.ItemsSource = plist2;
                }

                list2.EndRefresh();
            };

            list2.ItemSelected += async(s, e) =>
            {
                var yeniProfil = list2.SelectedItem as NoteWork.Modals.Profile;
                var nets       = k.Find(items => items.FPID == GirisSayfasi.manager.prof.ID && items.SPID == yeniProfil.ID);
                var bool1      = await GirisSayfasi.manager.IsNetWork(yeniProfil);

                Navigation.PushModalAsync(new BaskasininProfili(yeniProfil, nets, bool1));
            };

            a.Children.Add(list2, 2, 35);
            Grid.SetColumnSpan(list2, 53);
            Grid.SetRowSpan(list2, 60);
            //ağım listesi sonu


            //dünya listesi
            list.ItemTemplate = new DataTemplate(() =>
            {
                Label nameLabel  = new Label();
                Label nameLabel1 = new Label();
                nameLabel.SetBinding(Label.TextProperty, "FirstName");
                nameLabel1.SetBinding(Label.TextProperty, "LastName");


                return(new ViewCell
                {
                    View = new StackLayout
                    {
                        Padding = new Thickness(0, 5),
                        Orientation = StackOrientation.Horizontal,
                        Children =
                        {
                            new StackLayout
                            {
                                VerticalOptions = LayoutOptions.Center,
                                Orientation = StackOrientation.Horizontal,
                                Spacing = 10,
                                Children =
                                {
                                    nameLabel,
                                    nameLabel1
                                }
                            }
                        }
                    }
                });
            });
            list.IsPullToRefreshEnabled = true;


            list.Refreshing += async(s, e) =>
            {
                plist = await GirisSayfasi.manager.GetProfileAsync();

                if (plist != null)
                {
                    foreach (var z in plist)
                    {
                        if (z.FirstName == null)
                        {
                            z.FirstName = "";
                        }

                        if (z.LastName == null)
                        {
                            z.LastName = "";
                        }
                    }
                    list.ItemsSource = plist;
                }

                list.EndRefresh();
            };

            var bos = new NetWork()
            {
                ID              = "",
                SPID            = "",
                FPID            = "",
                Distinctive     = "",
                FirstImpression = "",
                MeetState       = "",
                MeetWhen        = "",
                MeetWhere       = "",
                NetWorks        = "",
            };

            list.ItemSelected += async(s, e) =>
            {
                var yeniProfil = list.SelectedItem as NoteWork.Modals.Profile;
                var nets       = bos;
                var bool1      = await GirisSayfasi.manager.IsNetWork(yeniProfil);

                await Navigation.PushModalAsync(new BaskasininProfili(yeniProfil, nets, bool1));
            };

            a.Children.Add(list, 2, 35);
            Grid.SetColumnSpan(list, 53);
            Grid.SetRowSpan(list, 60);
            //dünya listesi sonu

            list.IsVisible  = false;
            list2.IsVisible = true;

            //butonlar
            var tapGestureRecognizer1 = new TapGestureRecognizer();

            tapGestureRecognizer1.Tapped += (s, e) => {
                gayagay1.IsVisible = true;
                gayagay2.IsVisible = false;
                list.IsVisible     = false;
                list2.IsVisible    = true;
            };
            agimda.GestureRecognizers.Add(tapGestureRecognizer1);

            var tapGestureRecognizer2 = new TapGestureRecognizer();

            tapGestureRecognizer2.Tapped += (s, e) => {
                gayagay1.IsVisible = false;
                gayagay2.IsVisible = true;
                list.IsVisible     = true;
                list2.IsVisible    = false;
            };
            stats.GestureRecognizers.Add(tapGestureRecognizer2);
            //butonların sonu


            SBar.Focus();
            SBar.TextChanged += (s, e) => {
                if (list.IsVisible == true)
                {
                    if (string.IsNullOrWhiteSpace(e.NewTextValue))
                    {
                        list.ItemsSource = plist;
                    }
                    else
                    {
                        //|| i.LastName.Contains(e.NewTextValue)|| i.MiddleName.Contains(e.NewTextValue)
                        try
                        {
                            string[]       slist  = e.NewTextValue.Split(' ');
                            List <Profile> prlist = new List <Profile>();
                            for (var z = 0; z < slist.Length; z++)
                            {
                                if (!string.IsNullOrWhiteSpace(slist[z].ToLower()))
                                {
                                    prlist.AddRange(plist.Where(i => i.FirstName.ToLower().Contains(slist[z].ToLower()) || i.LastName.ToLower().Contains(slist[z].ToLower())).OrderBy(c => c.FirstName).Except(prlist.ToList()).ToList());
                                }
                            }
                            ;
                            list.ItemsSource = prlist;
                        }
                        catch (Exception ex)
                        {
                            // DisplayAlert("", ex.Message, "ok");
                        }
                    }
                }

                if (list2.IsVisible == true)
                {
                    if (string.IsNullOrWhiteSpace(e.NewTextValue))
                    {
                        list2.ItemsSource = plist2;
                    }
                    else
                    {
                        //|| i.LastName.Contains(e.NewTextValue)|| i.MiddleName.Contains(e.NewTextValue)
                        try
                        {
                            string[]       slist  = e.NewTextValue.Split(' ');
                            List <Profile> prlist = new List <Profile>();
                            for (var z = 0; z < slist.Length; z++)
                            {
                                if (!string.IsNullOrWhiteSpace(slist[z].ToLower()))
                                {
                                    prlist.AddRange(plist2.Where(i => i.FirstName.ToLower().Contains(slist[z].ToLower()) ||
                                                                 (i.LastName != null && i.LastName.ToLower().Contains(slist[z].ToLower())) ||
                                                                 (i.AssistantName != null && i.AssistantName.ToLower().Contains(slist[z].ToLower())) ||
                                                                 (i.City != null && i.City.ToLower().Contains(slist[z].ToLower())) ||
                                                                 (i.Company != null && i.Company.ToLower().Contains(slist[z].ToLower())) ||
                                                                 (i.EMail != null && i.EMail.ToLower().Contains(slist[z].ToLower())) ||
                                                                 (i.HighSchool != null && i.HighSchool.ToLower().Contains(slist[z].ToLower())) ||
                                                                 (i.Hobbies != null && i.Hobbies.ToLower().Contains(slist[z].ToLower())) ||
                                                                 (i.HomeAddress != null && i.HomeAddress.ToLower().Contains(slist[z].ToLower())) ||
                                                                 (i.Hometown != null && i.Hometown.ToLower().Contains(slist[z].ToLower())) ||
                                                                 (i.JobState != null && i.JobState.ToLower().Contains(slist[z].ToLower())) ||
                                                                 (i.JobTitle != null && i.JobTitle.ToLower().Contains(slist[z].ToLower())) ||
                                                                 (i.OfficeAddress != null && i.OfficeAddress.ToLower().Contains(slist[z].ToLower())) ||
                                                                 (i.PreviousCompanies != null && i.PreviousCompanies.ToLower().Contains(slist[z].ToLower())) ||
                                                                 (i.Profficiencies != null && i.Profficiencies.ToLower().Contains(slist[z].ToLower())) ||
                                                                 (i.Projects != null && i.Projects.ToLower().Contains(slist[z].ToLower())) ||
                                                                 (i.Sertificates != null && i.Sertificates.ToLower().Contains(slist[z].ToLower())) ||
                                                                 (i.Sports != null && i.Sports.ToLower().Contains(slist[z].ToLower())) ||
                                                                 (i.Team != null && i.Team.ToLower().Contains(slist[z].ToLower())) ||
                                                                 (i.TelNo != null && i.TelNo.ToLower().Contains(slist[z].ToLower())) ||
                                                                 (i.Travels != null && i.Travels.ToLower().Contains(slist[z].ToLower())) ||
                                                                 (i.Universities != null && i.Universities.ToLower().Contains(slist[z].ToLower()))
                                                                 ).OrderBy(c => c.FirstName).Except(prlist.ToList()).ToList());

                                    var ld = k.Where(j => (j.MeetWhen != null && j.MeetWhen.ToLower().Contains(slist[z].ToLower())) ||
                                                     (j.MeetWhere != null && j.MeetWhere.ToLower().Contains(slist[z].ToLower())) ||
                                                     (j.MeetState != null && j.MeetState.ToLower().Contains(slist[z].ToLower())) ||
                                                     (j.NetWorks != null && j.NetWorks.ToLower().Contains(slist[z].ToLower())) ||
                                                     (j.Distinctive != null && j.Distinctive.ToLower().Contains(slist[z].ToLower())) ||
                                                     (j.FirstImpression != null && j.FirstImpression.ToLower().Contains(slist[z].ToLower()))).Select(dd => dd.SPID).ToList();

                                    foreach (var bb in ld)
                                    {
                                        prlist.AddRange(plist2.Where(bd => bd.ID == bb).Except(prlist.ToList()).ToList());
                                    }
                                }
                            }
                            ;
                            list2.ItemsSource = prlist;
                        }
                        catch (Exception ex)
                        {
                            // DisplayAlert("", ex.Message, "ok");
                        }
                    }
                }
            };
            list.BeginRefresh();
            list2.BeginRefresh();
            Content = a;
        }
コード例 #35
0
ファイル: App.cs プロジェクト: cmydur/AzureBlobStorage
        public App()
        {
            MobileCenter.Start(typeof(Analytics), typeof(Crashes));
            this.BindingContext = this;
            Button buttonPickImage = new Button {
                Text = "Pick a Photo"
            };
            Button buttonUpload = new Button {
                Text = "Upload ", IsEnabled = false
            };
            Button buttonRefresh = new Button {
                Text = "Refresh ", IsEnabled = false
            };

            buttonRefresh.Clicked   += ButtonRefresh_Clicked;
            buttonUpload.Clicked    += ButtonUpload_Clicked;
            buttonPickImage.Clicked += async(sender, args) =>
            {
                buttonRefresh.IsEnabled             = false;
                Application.Current.MainPage.IsBusy = true;

                loadingIndicator.IsRunning = true;
                await CrossMedia.Current.Initialize();

                var f = await Plugin.Media.CrossMedia.Current.PickPhotoAsync();

                if (f == null)
                {
                    return;
                }
                path                   = f.Path;
                extenstion             = System.IO.Path.GetFileName(f.Path);
                buttonUpload.IsEnabled = true;
                //image.Source = ImageSource.FromStream(() =>
                //{
                //    var stream = f.GetStream();
                //    // f.Dispose();
                //    return stream;
                //});
                //image.HeightRequest = 10.0;
                byteData = ba(f);
                if (byteData != null)
                {
                    uploadedFilename = await AzureBlobContainer.UploadFileAsync(ContainerType.Image, new MemoryStream(byteData), extenstion);
                }

                Thread.Sleep(9000);
                lbl.Text = $"File Uploaded {path } ";
                buttonRefresh.IsEnabled             = true;
                loadingIndicator.IsRunning          = false;
                Application.Current.MainPage.IsBusy = false;
            };

            loadingIndicator = new ActivityIndicator
            {
                Color           = Color.White,
                VerticalOptions = LayoutOptions.Center,
                WidthRequest    = 20,
                HeightRequest   = 20,
                IsEnabled       = true,
                IsVisible       = true,
                IsRunning       = true
            };
            //loadingIndicator.IsEnabled = true;
            loadingIndicator.BindingContext = this;
            loadingIndicator.SetBinding(ActivityIndicator.IsVisibleProperty, "IsBusy", BindingMode.OneWay);

            var overlay = new AbsoluteLayout();

            AbsoluteLayout.SetLayoutFlags(loadingIndicator, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds(loadingIndicator, new Rectangle(0.5, 0.5, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));

            overlay.Children.Add(loadingIndicator);


            searchBar = new SearchBar
            {
                Placeholder = "Enter search term",
                ,
                SearchCommand = new Command(() => { lbl.Text = "Result: " + searchBar.Text + " is what you asked for."; })
            };
            StackLayout content = new StackLayout
            {
                VerticalOptions = LayoutOptions.Start,
                Padding         = new Thickness(10, Xamarin.Forms.Device.OnPlatform(20, 0, 0), 10, 5),
                Children        =
                {
                    searchBar,
                    buttonPickImage,
                    //image,
                    //buttonUpload,
                    buttonRefresh,
                    lbl
                }
            };


            // The root page of your application
            MainPage = new ContentPage
            {
                Content = content
            };
        }
コード例 #36
0
        public ShoppingListsTest()
        {
            BackgroundColor = Color.White;

            Label topLabel = new Label {
                Text = "YOUR LISTS",
                FontSize = 20,
                VerticalOptions = LayoutOptions.Start,
                HorizontalOptions = LayoutOptions.Start,
                TextColor = Color.Black
            };

            Entry addListEntry = new ExtendedEntry {
                Placeholder = "Add a New List...",
                PlaceholderTextColor = Color.Black,
                VerticalOptions = LayoutOptions.Start,
                TextColor = Color.Black
            };

            addListEntry.Completed += (sender, e) => {
                var i = addListEntry.Text;
                TapandGo.Database.Database.GetDatabase().AddNewList(i);
                addListEntry.Text = null;
                addListEntry.Placeholder = "Add a New List...";
                listView.ItemsSource = TapandGo.Database.Database.GetDatabase().GetLists();
            };

            SearchBar searchEntry = new SearchBar {
                Text = "Search for items",
                VerticalOptions = LayoutOptions.Start,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor = Color.FromHex("#044A0C")

            };
            searchEntry.Focused += OnsearchBarChanged;

            listView = new ListView ();
            listView.IsPullToRefreshEnabled = true;
            listView.ItemTemplate = new DataTemplate
                    (typeof(ShoppingListsItemCell));
            listView.ItemSelected += (sender, e) => {
                var todoItem = (TapandGo.Data.ShoppingListsData)e.SelectedItem;

                var todoPage = new TapandGo.Views.IndividualListTest();
                SelectedListId = todoItem.ListId;
                todoPage.BindingContext = todoItem;

                //((App)App.Current).ResumeAtTodoId = todoItem.ListId;
                Debug.WriteLine("setting ResumeAtTodoId = " + todoItem.ListId);

                Navigation.PushAsync(todoPage);
                //if (e.SelectedItem == null) return;
                //((ListView)sender).SelectedItem = null;
            };

            var layout = new StackLayout();
            layout.Children.Add(searchEntry);
            layout.Children.Add(topLabel);
            layout.Children.Add(addListEntry);
            layout.Children.Add(listView);
            layout.VerticalOptions = LayoutOptions.FillAndExpand;
            Content = layout;
        }
コード例 #37
0
        public WildFlowersPage(bool streaming)
        {
            GC.Collect();
            // Initialize variables
            sortField = new WildFlowerSetting();

            this.streaming = streaming;

            // Turn off navigation bar and initialize pageContainer
            NavigationPage.SetHasNavigationBar(this, false);
            AbsoluteLayout pageContainer = ConstructPageContainer();

            // Initialize grid for inner containers
            Grid innerContainer = new Grid {
                Padding = new Thickness(0, Device.OnPlatform(10, 0, 0), 0, 0), ColumnSpacing = 0
            };

            innerContainer.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });


            Grid gridLayout = new Grid {
                VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, ColumnSpacing = 0
            };

            gridLayout.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(50)
            });

            // BACK button
            gridLayout.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });
            gridLayout.Children.Add(BackImageConstructor(), 0, 0);


            // Construct filter button group
            plantFilterGroup = new Grid {
                ColumnSpacing = -1, Margin = new Thickness(0, 8, 0, 5)
            };
            plantFilterGroup.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(40)
            });

            // Add browse filter
            browseFilter = new Button
            {
                Style = Application.Current.Resources["plantFilterButton"] as Style,
                Text  = "Browse"
            };
            browseFilter.Clicked += FilterPlants;
            plantFilterGroup.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });
            plantFilterGroup.Children.Add(browseFilter, 0, 0);

            BoxView divider = new BoxView {
                HeightRequest = 40, WidthRequest = 1, BackgroundColor = Color.White
            };

            plantFilterGroup.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1)
            });
            plantFilterGroup.Children.Add(divider, 1, 0);

            // Add Search filter
            searchFilter = new Button
            {
                Style = Application.Current.Resources["plantFilterButton"] as Style,
                Text  = "Search"
            };

            //searchFilter.Clicked += async (s, e) => { await Navigation.PushAsync(SearchPage, false); };

            //SearchPage.InitRunSearch += HandleRunSearch;
            //SearchPage.InitCloseSearch += HandleCloseSearch;
            plantFilterGroup.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });
            plantFilterGroup.Children.Add(searchFilter, 2, 0);

            BoxView divider2 = new BoxView {
                HeightRequest = 40, WidthRequest = 1, BackgroundColor = Color.White
            };

            plantFilterGroup.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1)
            });
            plantFilterGroup.Children.Add(divider2, 3, 0);

            // Add Favorites filter
            favoritesFilter = new Button
            {
                Style = Application.Current.Resources["plantFilterButton"] as Style,
                Text  = "Favorites"
            };
            favoritesFilter.Clicked += FilterPlants;
            plantFilterGroup.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });
            plantFilterGroup.Children.Add(favoritesFilter, 4, 0);

            gridLayout.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(6, GridUnitType.Star)
            });
            gridLayout.Children.Add(plantFilterGroup, 1, 0);

            // Home button
            gridLayout.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });
            gridLayout.Children.Add(HomeImageConstructor(), 2, 0);

            // Add header to inner container
            innerContainer.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(50)
            });
            innerContainer.Children.Add(gridLayout, 0, 0);

            // Add button group grid
            Grid searchSortGroup = new Grid();

            searchSortGroup.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(40)
            });
            searchSortGroup.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1.7, GridUnitType.Star)
            });
            searchSortGroup.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });

            // Add search bar
            searchBar = new CustomSearchBar
            {
                Placeholder   = "Search by scientific or common name...",
                FontSize      = 12,
                Margin        = new Thickness(Device.OnPlatform(10, 0, 0), 0, 0, 0),
                SearchCommand = new Command(() => { })
            };
            searchBar.TextChanged += SearchBarOnChange;
            searchSortGroup.Children.Add(searchBar, 0, 0);

            // Add sort container
            Grid sortContainer = new Grid {
                ColumnSpacing = 0
            };

            sortContainer.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(0.7, GridUnitType.Star)
            });
            sortContainer.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(0.25, GridUnitType.Star)
            });
            sortContainer.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(0.05, GridUnitType.Star)
            });
            sortContainer.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(40)
            });

            sortButton.Clicked += SortPickerTapped;
            sortContainer.Children.Add(sortButton, 0, 0);

            foreach (string option in sortOptions.Keys)
            {
                sortPicker.Items.Add(option);
            }
            sortPicker.IsVisible = false;
            if (Device.OS == TargetPlatform.iOS)
            {
                sortPicker.Unfocused += SortOnUnfocused;
            }
            else
            {
                sortPicker.SelectedIndexChanged += SortItems;
            }

            sortContainer.Children.Add(sortPicker, 0, 0);

            sortDirection.Clicked += ChangeSortDirection;
            sortContainer.Children.Add(sortDirection, 1, 0);

            searchSortGroup.Children.Add(sortContainer, 1, 0);

            innerContainer.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(40)
            });
            innerContainer.Children.Add(searchSortGroup, 0, 1);


            // Create ListView container
            RelativeLayout listViewContainer = new RelativeLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor = Color.Transparent,
            };

            // Add Plants ListView
            wildFlowerList = new ListView(ListViewCachingStrategy.RecycleElement)
            {
                BackgroundColor = Color.Transparent, RowHeight = 100
            };
            wildFlowerList.ItemTemplate        = CellTemplate();
            wildFlowerList.ItemSelected       += OnItemSelected;
            wildFlowerList.SeparatorVisibility = SeparatorVisibility.None;

            listViewContainer.Children.Add(wildFlowerList,
                                           Constraint.RelativeToParent((parent) => { return(parent.X); }),
                                           Constraint.RelativeToParent((parent) => { return(parent.Y - 105); }),
                                           Constraint.RelativeToParent((parent) => { return(parent.Width * .9); }),
                                           Constraint.RelativeToParent((parent) => { return(parent.Height); })
                                           );


            // Add jump list to right side
            jumpListContainer = new StackLayout {
                Spacing = -1, Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand
            };

            listViewContainer.Children.Add(jumpListContainer,
                                           Constraint.RelativeToParent((parent) => { return(parent.Width * .9); }),
                                           Constraint.RelativeToParent((parent) => { return(parent.Y - 105); }),
                                           Constraint.RelativeToParent((parent) => { return(parent.Width * .1); }),
                                           Constraint.RelativeToParent((parent) => { return(parent.Height); })
                                           );

            // Add ListView and Jump List to grid
            innerContainer.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });
            innerContainer.Children.Add(listViewContainer, 0, 2);

            //Add inner container to page container and set as page content
            pageContainer.Children.Add(innerContainer, new Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.All);
            Content = pageContainer;
            GC.Collect();
        }
コード例 #38
0
        // Constructor de la "View"
        public HomePage()
        {
            stackLayoutGrid = new StackLayout();

            //Inicializar lista
            ListItems = IniciListItems();

            // Título de la aplicación
            this.Title           = "TeeChart DEMO";
            this.BackgroundColor = Color.FromRgb(240, 240, 240);
            if (Device.RuntimePlatform == Device.Android)
            {
                this.Icon = new FileImageSource {
                    File = "home_black_36dp.png"
                }
            }
            ;
            else
            {
                this.Icon = new FileImageSource {
                    File = "mic_home_black_36dp.png"
                }
            };

            // Características de la "App" según el dispositivo
            switch (Device.RuntimePlatform)
            {
            case Device.Android:

                lView.Margin = new Thickness(5, 0, 5, 0);
                break;

            case Device.iOS:

                searchBar = new SearchBar();
                searchBar.BackgroundColor = Color.White;
                searchBar.TextChanged    += sBar_TextChanged;
                On <Xamarin.Forms.PlatformConfiguration.iOS>().SetUseSafeArea(true);
                //InitializeToolbarItem();
                break;
            }

            // Propiedades "listView"
            lView.ItemsSource = ListItems;
            if (Device.RuntimePlatform == Device.Android || Device.RuntimePlatform == Device.UWP)
            {
                lView.RowHeight = 120;
            }
            else
            {
                lView.RowHeight = 110;
            }

            lView.ItemSelected       += (sender, e) => { ((Xamarin.Forms.ListView)sender).SelectedItem = null; };
            lView.ItemTapped         += ItemsListView_ChangeActivity;
            lView.SeparatorVisibility = SeparatorVisibility.None;
            DataTemplatelView();
            ListViewCachingStrategy.RetainElement.Equals(lView);

            // Mostrar elementos
            stackLayoutGrid = new StackLayout();
            stackLayoutGrid.VerticalOptions = LayoutOptions.FillAndExpand;
            if (Device.RuntimePlatform == Device.iOS)
            {
                stackLayoutGrid.Children.Add(searchBar);
            }
            stackLayoutGrid.Children.Add(lView);
            stackLayoutGrid.Margin  = 0;
            stackLayoutGrid.Spacing = 0;

            // Condiciones para algunos elementos
            if (vm == null)
            {
                ViewModel = new HomeViewModel();
            }

            this.ListView  = lView;
            base.ListItems = this.ListItems;
        }
コード例 #39
0
        protected IncrementalPage()
        {
            RowsBeforeTheEndToLoad = 10;
            LastSearch             = string.Empty;
            SearchCount            = 0;
            AllItems = new ObservableCollection <T>();

            SearchBar = new SearchBar {
                Placeholder = "Search for..."
            };
            SearchBar.TextChanged += (sender, args) => LoadSearch(SearchBar.Text);

            LoadingView = new LoadingView {
                IsVisible = false
            };
            LoadingView.SetBinding(LoadingView.IsShowingProperty,
                                   new Binding("IsBusy", source: this));

            ListView = new ListView(ListViewCachingStrategy.RecycleElement)
            {
                VerticalOptions     = LayoutOptions.FillAndExpand,
                SeparatorVisibility = SeparatorVisibility.Default,
                HasUnevenRows       = true,
                ItemsSource         = AllItems
            };
            ListView.ItemAppearing += (sender, e) => {
                if (!IsLoading)
                {
                    var foundIndex = AllItems.IndexOf(e.Item as T);
                    if (foundIndex == AllItems.Count - RowsBeforeTheEndToLoad)
                    {
                        LoadNextPage();
                    }
                }
            };

            var layout = new RelativeLayout();

            layout.Children.Add(
                SearchBar,
                Constraint.Constant(0),
                Constraint.Constant(0),
                Constraint.RelativeToParent(p => p.Width),
                Constraint.Constant(50)
                );
            layout.Children.Add(
                ListView,
                Constraint.Constant(0),
                Constraint.Constant(50),
                Constraint.RelativeToParent(p => p.Width),
                Constraint.RelativeToParent(p => p.Height - 50)
                );
            layout.Children.Add(
                LoadingView,
                Constraint.RelativeToParent(p => p.Width - 100),
                Constraint.RelativeToParent(p => p.Height - 100),
                Constraint.Constant(90),
                Constraint.Constant(90)
                );
            Content = layout;
        }
コード例 #40
0
        private void createGUI()
        {
            NavigationPage.SetHasNavigationBar(this, false); //Quitar barra de navegacion
            ai_inst = new ActivityIndicator()
            {
                Color             = Color.Green,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.CenterAndExpand
            };
            sr_inst = new SearchBar()
            {
                HorizontalTextAlignment = TextAlignment.Start,
                Placeholder             = "Buscar Institución",
                FontSize  = 16,
                TextColor = Color.Black
            };
            // sr_inst.TextChanged += (sender, e) => buscarInstitucion(sr_inst.Text);
            DataTemplate celda = new DataTemplate(typeof(ImageCell));

            celda.SetBinding(TextCell.TextProperty, "id_carrera");
            celda.SetValue(TextCell.TextColorProperty, Color.Gray);
            celda.SetBinding(TextCell.DetailProperty, "carrera");
            celda.SetValue(TextCell.TextColorProperty, Color.Blue);


            lv_inst = new ListView()
            {
                HasUnevenRows = true, //Estandarizar items
                ItemTemplate  = celda
            };
            lv_inst.ItemSelected += (sender, e) =>
            {
                App.Current.MainPage = new DashBoard();
            };
            bv_div = new BoxView()
            {
                Color             = Color.Green,
                HeightRequest     = 2,
                HorizontalOptions = LayoutOptions.Center,
                WidthRequest      = 300
            };
            lb_ninguno = new Label()
            {
                HorizontalTextAlignment = TextAlignment.Center,
                Text       = "Ninguno",
                TextColor  = Color.Gray,
                FontFamily = "Roboto"
            };
            var tapr = new TapGestureRecognizer();

            tapr.Tapped += (sender, e) =>
            {
                DisplayAlert("error", "selecciono inguno", "aceptar");
                //asignar ciertas carcateristicas de un tecnologico especifico
            };
            lb_ninguno.GestureRecognizers.Add(tapr);
            lb_seguir = new Label()
            {
                HorizontalTextAlignment = TextAlignment.Center,
                Text       = "Seguir",
                TextColor  = Color.Gray,
                FontSize   = 18,
                FontFamily = "Roboto"
            };
            lb_seleccionar = new Label()
            {
                HorizontalTextAlignment = TextAlignment.Center,
                Text           = "Selecciona tu Institución",
                FontAttributes = FontAttributes.Bold,
                TextColor      = Color.Gray,
                FontSize       = 26,
                FontFamily     = "Roboto"
            };

            st_inst = new StackLayout()
            {
                Orientation = StackOrientation.Vertical,
                Padding     = new Thickness(20),
                Children    =
                {
                    lb_seguir,
                    lb_seleccionar,
                    sr_inst,
                    ai_inst,
                    lv_inst,
                    bv_div,
                    lb_ninguno
                }
            };
            Content = st_inst;
        }
コード例 #41
0
        static ContentPage SearchBarPage()
        {
            var searchbarTextColorDefaultToggle = new SearchBar()
            {
                Text = "Default SearchBar Text Color"
            };
            var searchbarTextColorToggleButton = new Button()
            {
                Text = "Toggle SearchBar Color"
            };

            searchbarTextColorToggleButton.Clicked += (sender, args) =>
            {
                if (searchbarTextColorDefaultToggle.TextColor == null)
                {
                    searchbarTextColorDefaultToggle.TextColor = Colors.Fuchsia;
                    searchbarTextColorDefaultToggle.Text      = "Should Be Fuchsia";
                }
                else
                {
                    searchbarTextColorDefaultToggle.TextColor = null;
                    searchbarTextColorDefaultToggle.Text      = "Default SearchBar Text Color";
                }
            };

            var searchbarPlaceholderColorDefaultToggle = new SearchBar()
            {
                Placeholder = "Default Placeholder Color"
            };
            var searchbarPlaceholderToggleButton = new Button()
            {
                Text = "Toggle Placeholder Color"
            };

            searchbarPlaceholderToggleButton.Clicked += (sender, args) =>
            {
                if (searchbarPlaceholderColorDefaultToggle.PlaceholderColor == null)
                {
                    searchbarPlaceholderColorDefaultToggle.PlaceholderColor = Colors.Lime;
                    searchbarPlaceholderColorDefaultToggle.Placeholder      = "Should Be Lime";
                }
                else
                {
                    searchbarPlaceholderColorDefaultToggle.PlaceholderColor = null;
                    searchbarPlaceholderColorDefaultToggle.Placeholder      = "Default Placeholder Color";
                }
            };

            return(new ContentPage
            {
                Title = "SearchBar",
                Content = new StackLayout
                {
                    VerticalOptions = LayoutOptions.Fill,
                    HorizontalOptions = LayoutOptions.Fill,
                    Children =
                    {
                        searchbarTextColorDefaultToggle,
                        searchbarTextColorToggleButton,
                        searchbarPlaceholderColorDefaultToggle,
                        searchbarPlaceholderToggleButton
                    }
                }
            });
        }
コード例 #42
0
        public SearchView(LibraryType type)
        {
            //this.BackgroundImage = ImageConstants.backgroundImage;
            BindingContext = new SearchViewModel ();
            categoryType = type;

            var searchBar = new SearchBar ();
            searchBar.SearchButtonPressed += OnSearchBarButtonPressed;
            searchBar.TextChanged += (sender, e) => {
                //var changedSearchBar = (SearchBar)sender;
                if (e.NewTextValue == null) {
                    //this only happens when user taps "Cancel" on iOS
                    ViewModel.LoadItemsCommand.Execute (null);
                    searchlistView.ItemsSource = ViewModel.SearchItems;
                    searchlistView.IsVisible = true;
                    resultlistView.IsVisible = false;
                }
            };

            searchlistView = new ListView () {
                HasUnevenRows = true,
                ItemTemplate = new DataTemplate (typeof(SearchItemTemplate)),
                SeparatorColor = Color.Transparent,
                BackgroundColor = Color.Transparent,
            };

            resultlistView = new ListView () {
                HasUnevenRows = true,
                ItemTemplate = new DataTemplate (typeof(ResultsItemTemplate)),
                //SeparatorColor = Color.Transparent,
                BackgroundColor = Color.Transparent,
            };

            searchlistView.ItemTapped += (sender, e) => {
                var search = (Search)e.Item;
                ViewModel.SearchText = search.SearchText;

                if(categoryType != LibraryType.MyDocuments){
                    ViewModel.LoadResultsCommand.Execute (null);
                    resultlistView.ItemsSource = ViewModel.Files;
                }
                else{
                    ViewModel.LoadDownloadedSearchResultsCommand.Execute (null);
                    resultlistView.ItemsSource = ViewModel.DownloadedFiles;
                }

                searchlistView.IsVisible = false;
                resultlistView.IsVisible = true;
            };

            resultlistView.ItemTapped += (sender, e) => {
                if(categoryType == LibraryType.MyDocuments){
                    var fileItem = (Downloads)e.Item;
                    var page = new DocumentDetails (fileItem);
                    this.Navigation.PushAsync (page,true);
                }
                else{
                    var fileItem = (ProductCatalog)e.Item;
                    var page = new DetailsPopup (fileItem,type);
                    this.Navigation.PushAsync (page,true);
                }
            };

            Content = new PopupLayout {
                //VerticalOptions = LayoutOptions.Center,
                Content = new StackLayout {
                    //BackgroundColor = Color.Black,
                    Children = { searchBar, searchlistView, resultlistView }
                }
            };

            resultlistView.IsVisible = false;
            Title = Translation.Localize("SearchLabel");
        }
コード例 #43
0
        public AlphaSelectUserPage(Action <string> aReciever, IEnumerable <string> ExistUsers = null)
        {
            Reciever = aReciever;
            Title    = L["Select a user"];

            List = new ListView
            {
                ItemTemplate = new DataTemplateEx(AlphaFactory.GetGitHubUserCellType())
                               .SetBindingList("ImageSourceUrl", "Text"),
            };
            List.ItemTapped += (sender, e) =>
            {
                var User = e.Item.GetValue <string>("Text");
                if (null != User)
                {
                    Debug.WriteLine($"Select User: {User}");
                    Reciever(User);
                    Domain.AddRecentUser(User);
                }
                AlphaFactory.MakeSureApp().Navigation.PopAsync();
            };
            List.ItemsSource = Domain.GetRecentUsers()
                               .Where(i => !(ExistUsers?.Contains(i) ?? false))
                               .Select(i => ListItem.Make(i));

            var SearchCommand = new Command
                                (
                async() =>
            {
                List.IsVisible         = false;
                SearchButton.IsVisible = false;
                Indicator.IsVisible    = true;
                Indicator.IsRunning    = true;
                List.ItemsSource       = new object[] { };

                try
                {
                    var Json = await Domain.GetStringFromUrlAsync
                               (
                        GitHub.GetSearchUsersUrl(Search.Text)
                               );
                    Device.BeginInvokeOnMainThread
                    (
                        () =>
                    {
                        try
                        {
                            List.ItemsSource = GitHub.SearchResult <GitHub.SearchUser> .Parse(Json)
                                               .Items
                                               .Select(i => ListItem.Make(i));
                        }
                        catch (Exception Err)
                        {
                            Debug.WriteLine(Err);
                            if (!string.IsNullOrWhiteSpace(Search.Text))
                            {
                                List.ItemsSource = new[] { Search.Text.Trim() }
                                .Select(i => ListItem.Make(i));
                            }
                        }
                        Indicator.IsRunning = false;
                        Indicator.IsVisible = false;
                        List.IsVisible      = true;
                    }
                    );
                }
                catch (Exception Err)
                {
                    Debug.WriteLine(Err);
                    if (!string.IsNullOrWhiteSpace(Search.Text))
                    {
                        List.ItemsSource = new[] { Search.Text.Trim() }
                        .Select(i => ListItem.Make(i));
                    }
                    Indicator.IsRunning = false;
                    Indicator.IsVisible = false;
                    List.IsVisible      = true;
                }
            }
                                );

            Search = new SearchBar
            {
                Placeholder   = L["User's name etc."],
                SearchCommand = SearchCommand,
            };

            Indicator = new ActivityIndicator
            {
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                IsVisible         = false,
            };

            SearchButton = new Button
            {
                VerticalOptions   = LayoutOptions.StartAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Text      = L["Search"],
                Command   = SearchCommand,
                IsVisible = false,
            };

            Search.TextChanged += (sender, e) =>
            {
                var IsNullOrWhiteSpace = string.IsNullOrWhiteSpace(Search.Text);
                List.IsVisible         = IsNullOrWhiteSpace;
                Indicator.IsVisible    = false;
                SearchButton.IsVisible = !IsNullOrWhiteSpace;
            };

            Content = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                //Spacing = 1.0,
                //BackgroundColor = Color.Gray,
                Children =
                {
                    Search,
                    List,
                    Indicator,
                    SearchButton,
                }
            };
        }
コード例 #44
0
        public ButtonsPageCS()
        {
            Title = "Buttons";
            Icon  = "csharp.png";

            // SearchBar

            SearchBar searchBar = new SearchBar
            {
                Placeholder = "Enter your search here.",
            };

            searchBar.TextChanged += (sender, e) =>
            {
                return;
            };
            searchBar.SearchButtonPressed += (sender, e) =>
            {
                return;
            };

            // Filter Toolbar Item

            ToolbarItem toolbarItem = new ToolbarItem
            {
                Text    = "F",
                Command = ShowRoomsFilterPage,
            };

            this.ToolbarItems.Add(
                toolbarItem
                );

            this.SlideMenu = new RoomsFilterPage();

            // Rooms DataTemplate

            var roomsDataTemplate = new DataTemplate(() => {
                var grid = new Grid();

                grid.RowDefinitions.Add(new RowDefinition {
                    Height = 20
                });
                grid.RowDefinitions.Add(new RowDefinition {
                    Height = 120
                });

                grid.RowSpacing    = 0;
                grid.ColumnSpacing = 10;

                grid.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(0.5, GridUnitType.Star)
                });
                grid.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(0.2, GridUnitType.Star)
                });
                grid.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(0.3, GridUnitType.Star)
                });

                var indexLabel = new Label {
                    IsVisible = false
                };
                var nameLabel = new Label {
                    FontAttributes = FontAttributes.Bold
                };

                indexLabel.SetBinding(Label.TextProperty, "Index");
                nameLabel.SetBinding(Label.TextProperty, "Name");

                grid.Children.Add(indexLabel, 0, 1, 0, 1);
                grid.Children.Add(nameLabel, 0, 1, 0, 1);

                var timeSlotsLayout               = new TimeSlotsButtonLayout();
                timeSlotsLayout.Padding           = 20;
                timeSlotsLayout.WidthRequest      = 300;
                timeSlotsLayout.HorizontalOptions = LayoutOptions.Start;
                timeSlotsLayout.SetBinding(TimeSlotsButtonLayout.TimeSlotsSourceProperty, "TimeSlots");
                grid.Children.Add(timeSlotsLayout, 0, 3, 1, 2);

                return(new ViewCell
                {
                    View = grid
                });
            });

            // Rooms ListView

            listView = new ListView
            {
                ItemsSource    = App.RoomsViewModel.Rooms,
                ItemTemplate   = roomsDataTemplate,
                RowHeight      = 150,
                SeparatorColor = Color.Transparent,
            };
            listView.Margin = new Thickness(10);

            // Next Button

            Button nextButton = new Button
            {
                Text              = "Next",
                BindingContext    = App.RoomsViewModel,
                Command           = GoToRoomDetailPage,
                WidthRequest      = 60.0,
                HeightRequest     = 40.0,
                BorderWidth       = 1,
                BorderColor       = Color.Green,
                VerticalOptions   = LayoutOptions.Start,
                HorizontalOptions = LayoutOptions.Fill,
                FontAttributes    = FontAttributes.Bold,
                FontSize          = 11.0,
                BackgroundColor   = Color.Green,
                TextColor         = Color.White,
            };

            nextButton.SetBinding(Button.IsEnabledProperty, "EnableRoomDetailNextButton");

            nextButton.Triggers.Add(new Trigger(typeof(Button))
            {
                Property = Button.IsEnabledProperty,
                Value    = true,
                Setters  =
                {
                    new Setter
                    {
                        Property = Button.BackgroundColorProperty,
                        Value    = "Green"
                    }
                }
            });
            nextButton.Triggers.Add(new Trigger(typeof(Button))
            {
                Property = Button.IsEnabledProperty,
                Value    = false,
                Setters  =
                {
                    new Setter
                    {
                        Property = Button.BackgroundColorProperty,
                        Value    = "LightGray"
                    }
                }
            });

            Content = new StackLayout
            {
                Padding      = new Thickness(0, 0, 0, 0),
                WidthRequest = 300,
                Children     =
                {
                    /*
                     * new Label {
                     *  Text = "Buttons List",
                     *  FontAttributes = FontAttributes.Bold,
                     *  HorizontalOptions = LayoutOptions.Center
                     * },
                     */
                    searchBar,
                    listView,
                    nextButton,
                }
            };
        }
コード例 #45
0
 void OnSearchButtonPressed(object sender, EventArgs e)
 {
     SearchBar bar = (SearchBar)sender;
     //lstData.ItemsSource = DataService.GetSearchResults(bar.Text);
 }
コード例 #46
0
        public JobListPage()
        {
            detailPage = new JobDetailsPage();

            jobList = new ListView
            {
                HasUnevenRows = true,
                IsGroupingEnabled = true,
                GroupDisplayBinding = new Binding("Key"),
                GroupHeaderTemplate = new DataTemplate(typeof(JobGroupingHeaderCell)),
                ItemTemplate = new DataTemplate(typeof(JobCell))
            };
            
            jobList.ItemTapped += async (sender, e) =>
            {                
                var selectedJob = e.Item as Job;
                if (selectedJob != null)
                    await ShowJobDetailsAsync((Job)e.Item);                    
            };


            searchBar = new SearchBar { Placeholder = "Enter search" };
            searchBar.SearchButtonPressed += async (object sender, EventArgs e) => 
            {
                await RefreshAsync();
            };

            var syncButton = new Button
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions = LayoutOptions.CenterAndExpand,
                Font = AppStyle.DefaultFont,
                Text = "Sync",
                WidthRequest = 100
            };

            syncButton.Clicked += async (object sender, EventArgs e) =>
            {
                try
                {
                    syncButton.Text = "Syncing..";
                    await App.JobService.SyncAsync();
                    await this.RefreshAsync();
                }
                finally
                {
                    syncButton.Text = "Sync";
                }
            };

            var clearButton = new Button
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions = LayoutOptions.CenterAndExpand,
                Font = AppStyle.DefaultFont,
                Text = "Clear",
                WidthRequest = 100
            };

            clearButton.Clicked += async (object sender, EventArgs e) =>
            {
                await App.JobService.ClearAllJobs();
                await this.RefreshAsync();
            };

            this.Title = "All Jobs";
            this.Content = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                Children = {
                    searchBar,
                    new StackLayout {
                        Orientation = StackOrientation.Horizontal,
                        Children = {
                            syncButton, clearButton
                        }
                    },                                        
					jobList
				}
            };
        }
コード例 #47
0
        async Task updateList(Connection cnx, List <JobCell> JOBCELLS)
        {
            this.BarBackgroundColor         = Color.FromHex("#B80000");
            settingsButton.BackgroundColor  = Color.FromHex("#B80000");
            materialsButton.BackgroundColor = Color.FromHex("#B80000");
            contactButton.BackgroundColor   = Color.FromHex("#B80000");
            passwordButton.BackgroundColor  = Color.FromHex("#B80000");

            List <Job>     Jobs  = new List <Job>();;
            List <JobCell> Cells = new List <JobCell>();


            if (JOBCELLS == null)
            {
                JobAmounts jobamounts = await GetAmounts(cnx);

                if (!string.IsNullOrEmpty(jobamounts.jobs))
                {
                    int endNumber = Int32.Parse(jobamounts.jobs);
                    Jobs = await GetContent(0, endNumber, cnx);

                    if (Jobs == null)
                    {
                        await DisplayAlert("Error", "There has been an issue retreiving your jobs. Please try again.\n\nIf this keeps happening please restart the app.", "Ok");

                        return;
                    }
                }
                else
                {
                    await DisplayAlert("Error", "There has been an issue retreiving your job count. Please try again.\n\nIf this keeps happening please restart the app.", "Ok");
                }

                foreach (Job job in Jobs)
                {
                    JobCell cell = new JobCell
                    {
                        JobNumber   = job.job.ToString(),
                        Add1        = job.add1,
                        JobColor    = StatusSorter.JobNumberColor(job),
                        Status      = StatusSorter.StatusText(job),
                        StatusColor = StatusSorter.StatusColor(job),
                        CellColor   = StatusSorter.CellColor(job),
                        job         = job
                    };
                    Cells.Add(cell);

                    _Cells = Cells;
                }
            }
            else
            {
                Cells = JOBCELLS;
            }



            Label jobHeader = new Label
            {
                Text                    = Maincnx.Name,
                TextColor               = Color.Black,
                FontSize                = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                FontAttributes          = FontAttributes.Bold,
                HorizontalOptions       = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.Center
            };

            searchbar = new SearchBar()
            {
                Placeholder       = "Search:",
                Text              = searchBarText,
                CancelButtonColor = Color.Red
            };

            searchbar.SearchButtonPressed += SearchBarButtonPressedChanged;
            searchbar.TextChanged         += Searchbar_TextChanged;

            listView = new ListView()
            {
                HasUnevenRows   = true,
                BackgroundColor = Color.White,
                ItemsSource     = Cells,

                ItemTemplate = new DataTemplate(() =>
                {
                    //create views with bindings for displaying each property.
                    Label JobNumber = new Label()
                    {
                        FontSize       = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                        FontAttributes = FontAttributes.Bold
                    };
                    JobNumber.SetBinding(Label.TextProperty, "JobNumber");
                    JobNumber.SetBinding(Label.TextColorProperty, "JobColor");



                    Label JobAddress = new Label()
                    {
                        FontSize       = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
                        FontAttributes = FontAttributes.Italic
                    };
                    JobAddress.SetBinding(Label.TextProperty, "Add1");
                    JobAddress.TextColor = Color.Black;

                    Label Status = new Label();
                    Status.SetBinding(Label.TextProperty, "Status");
                    Status.SetBinding(Label.TextColorProperty, "StatusColor");

                    return(new ViewCell
                    {
                        View = new StackLayout
                        {
                            Padding = new Thickness(0, 5),
                            Orientation = StackOrientation.Horizontal,
                            Children =
                            {
                                JobNumber,
                                //stick in an image here for whatever you want.
                                new StackLayout
                                {
                                    VerticalOptions = LayoutOptions.CenterAndExpand,
                                    Spacing = 0,
                                    Children =
                                    {
                                        JobAddress,
                                        Status
                                    }
                                }
                            }
                        }
                    });
                })
            };

            listView.ItemSelected += ListView_ItemSelected;

            this.Padding = new Thickness(10, 20, 10, 5);


            Tab1.Content = new StackLayout
            {
                Children =
                {
                    jobHeader,
                    searchbar,
                    listView,
                }
            };
        }
コード例 #48
0
        public TimingDetailPage()
        {
            ReaderWriterLockSlim locker = new ReaderWriterLockSlim();
            IDictionary<IBoat, DateTime> times = new Dictionary<IBoat, DateTime>();

            Action updateTitle = () =>
            {
                var u = times.Count(t => t.Key.Number <= 0);
                var i = times.Count(t => t.Key.Number > 0 && t.Value > DateTime.MinValue);

                if(TitleUpdated != null)
                    TitleUpdated(this, new StringEventArgs(string.Format(" - to save: {0} identified, {1} unidentified", i, u)));
            };

            Action saveBoats = () =>
            {
                TimingItemManager manager = (TimingItemManager)BindingContext;
                try
                {
                    locker.EnterWriteLock();
                    manager.SaveBoat(times.Where(kvp => kvp.Value > DateTime.MinValue).Select(t => new Tuple<IBoat, DateTime, string>(t.Key, t.Value, string.Empty)));
                    times.Clear();
                    updateTitle();
                }
                finally
                {
                    locker.ExitWriteLock();
                }
            };
            Action<IBoat, bool> flipflop = (IBoat boat, bool seen) =>
            {
                try
                {
                    locker.EnterWriteLock();
                    boat.Seen = seen;
                    if(times.ContainsKey(boat))
                        times.Remove(boat);
                    times.Add(boat, seen ? DateTime.Now : DateTime.MinValue);
                    updateTitle();
                }
                finally
                {
                    locker.ExitWriteLock();
                }
            };
            Action unidentified = () =>
            {
                flipflop(((TimingItemManager)BindingContext).UnidentifiedBoat, true);
            };
            // 			var anchor = new ToolbarItem("Anchor", "Anchor.png", () => Debug.WriteLine("anchor"), priority: 3);
            var plus = new ToolbarItem("Add", "Add.png", () => unidentified(), priority: 3);
            var sync = new ToolbarItem("Sync", "Syncing.png", saveBoats, priority: 2);
            ToolbarItem more=null;
            Action refreshToolbar = () =>
            {
                ToolbarItems.Clear();
                ToolbarItems.Add(plus);
                ToolbarItems.Add(sync);
                ToolbarItems.Add(more);
            };
            more = new ToolbarItem("More", "More.png", refreshToolbar, priority: 1);
            refreshToolbar();

            var listView = new ListView();
            listView.SetBinding (ListView.ItemsSourceProperty, "Unfinished");
            Action<IBoat> press = async (IBoat boat) =>
            {
                string pin = "Pin to top";
                string send = "Send to End";
                var sheet = await DisplayActionSheet (string.Format("Boat {0}: Send to ... ?", boat.Number), "Cancel", null, pin, send);
                if(sheet == pin)
                {
                    ToolbarItem item = null;
                    Action action = () =>
                    {
                        flipflop(boat, true);
                        ToolbarItems.Remove(item);
                    };
                    item = new ToolbarItem(boat.Number.ToString(), null, action, priority: -1);

                    ToolbarItems.Add(item);
                }
                if(sheet == send)
                {
                    boat.End = true;
                }
                Debug.WriteLine("Action: " + sheet);
            };

            listView.ItemTemplate = new DataTemplate(() => new UnseenCell(press));
            listView.PropertyChanged += (object sender, System.ComponentModel.PropertyChangedEventArgs e) =>
            {
                Debug.WriteLine("underlying change");
            };
            listView.ItemSelected += (object sender, SelectedItemChangedEventArgs e) =>
            {
                if(e.SelectedItem == null)
                    return;
                IBoat boat = (IBoat)e.SelectedItem;
                flipflop(boat, !boat.Seen);
                listView.SelectedItem = null;
            };
            SearchBar searchBar = new SearchBar
            {
                Placeholder = "Filter list",
            };
            searchBar.TextChanged += (object sender, TextChangedEventArgs e) =>
            {
                TimingItemManager manager = (TimingItemManager)BindingContext;
                manager.Filter(searchBar.Text);
            };
            Content = new StackLayout ()
            {
                Children={searchBar, listView}
            };

            // idea: hide a non-starter
        }
コード例 #49
0
        private void inicializarComponente()
        {
            _mainLayout = new AbsoluteLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand
            };

            _mapaLayout = new StackLayout
            {
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Spacing           = 0
            };
            AbsoluteLayout.SetLayoutBounds(_mapaLayout, new Rectangle(0, 0, 1, 1));
            AbsoluteLayout.SetLayoutFlags(_mapaLayout, AbsoluteLayoutFlags.All);
            _mainLayout.Children.Add(_mapaLayout);

            _barraLateralLayout = new StackLayout
            {
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.End,
                VerticalOptions   = LayoutOptions.Center,
                Spacing           = 4,
                //BackgroundColor = Color.Green
            };
            AbsoluteLayout.SetLayoutBounds(_barraLateralLayout, new Rectangle(0.98, 0.5, 0.2, 0.6));
            AbsoluteLayout.SetLayoutFlags(_barraLateralLayout, AbsoluteLayoutFlags.All);
            _mainLayout.Children.Add(_barraLateralLayout);

            _palavraChaveSearchBar = new SearchBar()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.Start,
                BackgroundColor   = Color.White,
                Placeholder       = "Pesquisar...",
                FontSize          = 20,
                HeightRequest     = 42
            };
            _palavraChaveSearchBar.SearchButtonPressed += async(sender, e) => {
                await buscarLocalporPalavraChave(_palavraChaveSearchBar.Text);
            };

            _mapaLayout.Children.Add(_palavraChaveSearchBar);
            _mapaLayout.Children.Add(new BoxView
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.Start,
                BackgroundColor   = Estilo.Current.PrimaryColor,
                HeightRequest     = 1
            });

            _resultadoBuscaListView = new ListView {
                HasUnevenRows = true,
                RowHeight     = -1,
                //SeparatorVisibility = SeparatorVisibility.None,
                SeparatorVisibility = SeparatorVisibility.Default,
                SeparatorColor      = Estilo.Current.PrimaryColor,
                ItemTemplate        = new DataTemplate(typeof(ResultadoBuscaCell))
            };
            _resultadoBuscaListView.SetBinding(ListView.ItemsSourceProperty, new Binding("."));
            _resultadoBuscaListView.ItemTapped += resultadoBuscaItemTapped;

            _Mapa = new CustomMap()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                IsShowingUser     = false
            };
            _Mapa.aoClicar += (sender, e) => {
                try
                {
                    fixarPontoNoMapa(new Pin
                    {
                        Type     = PinType.Place,
                        Position = e.Position,
                        Label    = TituloPadrao,
                        Address  = TituloPadrao
                    });
                }
                catch (Exception erro)
                {
                    UserDialogs.Instance.Alert(erro.Message, "Erro", "Entendi");
                }
            };
            _mapaLayout.Children.Add(_Mapa);

            _excluirPontoButton = new CircleIconButton
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                BackgroundColor   = Estilo.Current.DangerColor,
                TextColor         = Color.White,
                WidthRequest      = 50,
                HeightRequest     = 50,
                FontSize          = 22,
                BorderRadius      = 50,
                Text = "fa-remove"
            };
            _excluirPontoButton.Clicked += (sender, e) => {
                try
                {
                    if (_Mapa.Pins.Count() > 0)
                    {
                        var pins = new List <Pin>();
                        foreach (var pin in _Mapa.Pins)
                        {
                            pins.Add(pin);
                        }
                        pins.RemoveAt(pins.Count() - 1);
                        if (pins.Count() > 0)
                        {
                            var pin = pins[pins.Count() - 1];
                            _Mapa.MoveToRegion(MapSpan.FromCenterAndRadius(pin.Position, Distance.FromMiles(0.5)));
                        }
                        _Mapa.Pins.Clear();
                        foreach (var pin in pins)
                        {
                            _Mapa.Pins.Add(pin);
                        }
                        _Mapa.Polyline = Polyline;
                    }
                }
                catch (Exception erro)
                {
                    UserDialogs.Instance.Alert(erro.Message, "Erro", "Entendi");
                }
            };
            _barraLateralLayout.Children.Add(_excluirPontoButton);

            _limparButton = new CircleIconButton
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                BackgroundColor   = Estilo.Current.WarningColor,
                TextColor         = Color.White,
                WidthRequest      = 50,
                HeightRequest     = 50,
                FontSize          = 22,
                BorderRadius      = 50,
                Text = "fa-trash"
            };
            _limparButton.Clicked += async(sender, e) => {
                if (await UserDialogs.Instance.ConfirmAsync("Deseja limpar a rota?", "Aviso", "Sim", "Não"))
                {
                    try {
                        _Mapa.Pins.Clear();
                        _Mapa.Polyline = Polyline;
                    }
                    catch (Exception erro) {
                        UserDialogs.Instance.Alert(erro.Message, "Erro", "Entendi");
                    }
                }
            };
            _barraLateralLayout.Children.Add(_limparButton);

            _visualizarButton = new CircleIconButton
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                BackgroundColor   = Estilo.Current.SuccessColor,
                TextColor         = Color.White,
                WidthRequest      = 50,
                HeightRequest     = 50,
                FontSize          = 22,
                BorderRadius      = 50,
                Text = "fa-eye"
            };
            _visualizarButton.Clicked += (sender, e) => {
                try
                {
                    _Mapa.zoomPolyline(true);
                }
                catch (Exception erro) {
                    UserDialogs.Instance.Alert(erro.Message, "Erro", "Entendi");
                }
            };
            _barraLateralLayout.Children.Add(_visualizarButton);

            _confirmarButton = new Button
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.End,
                BackgroundColor   = Estilo.Current.PrimaryColor,
                TextColor         = Color.White,
                BorderRadius      = 45,
                Text = "Confirmar"
            };
            _confirmarButton.Pressed += (sender, e) => {
                if (_Mapa.Pins.Count() >= 2)
                {
                    AoSelecionar?.Invoke(this, Polyline);
                }
                else
                {
                    DisplayAlert("Atenção", "Você precisa selecionar pelomenos uma origem e um destino.", "Entendi");
                }
            };
            AbsoluteLayout.SetLayoutBounds(_confirmarButton, new Rectangle(0.5, 0.98, 0.5, 0.1));
            AbsoluteLayout.SetLayoutFlags(_confirmarButton, AbsoluteLayoutFlags.All);
            _mainLayout.Children.Add(_confirmarButton);
        }
コード例 #50
0
        public PFDictionaryPage()
        {
            NavigationPage.SetTitleIcon (this, "hsflogo.png");

            var isConnected = CrossConnectivity.Current.IsConnected;

            if (isConnected) {

                WebView webView = new WebView {
                    Source = new UrlWebViewSource {
                        Url = "http://finance.hsfdev.bienalto.com/jargon-buster",
                    },
                    VerticalOptions = LayoutOptions.FillAndExpand
                };

                //this.Padding = new Thickness (10, Device.OnPlatform (20, 0, 0), 10, 5);

                // Build the page.
                this.Content = new StackLayout {
                    Children = {
                        webView
                    }
                };

            } else {

                Title = "PF Dictionary page";

                list = new PFDictionaryView ();

                searchbar = new SearchBar () {
                    Placeholder = "Search",
                    HeightRequest = 50,
                    BindingContext = Color.Black,
                    BackgroundColor = Color.Silver,
                };

                BackgroundColor = Color.White;

                searchbar.TextChanged += (sender, e) => list.FilterTitle (searchbar.Text);
                searchbar.SearchButtonPressed += (sender, e) => {
                    list.FilterTitle(searchbar.Text);
                };

                var stack = new StackLayout () {
                    Orientation = StackOrientation.Vertical,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions = LayoutOptions.FillAndExpand,
                    Spacing = 0,
                    Children = {
                        searchbar,
                        list,
                    }
                };

                var scrollview = new ScrollView {
                    Content =  stack,

                };

                Content = scrollview;

            }
        }
コード例 #51
0
        public GTNavPage() {
            InitializeComponent();
            locationList = LoadXMLData();
            client = new HttpClient();
            client.MaxResponseContentBufferSize = 256000;

            locations = new ObservableCollection<Location>(locationList);
            LocationSuggestions.ItemsSource = locations; // binds listview in XAML to locations collection

            plotBuses(Routes.Red);

            searchBar = MySearchBar;
            String searchQuery; // changes to what the user searched for
            searchBar.SearchCommand = new Command(() => { //Starts an action once an item is searched
                searchQuery = searchBar.Text;
                searchBar.Text = "OK!";
            }); // sets "on enter" command to populate searchQuery and display success message on bar


            searchBar.TextChanged += (object sender, TextChangedEventArgs e) => // Whenever a new character is entered filter the suggestion results
            {
                if (e.NewTextValue == "") {
                    LocationSuggestions.IsVisible = false;
                } else {
                    LocationSuggestions.IsVisible = true;
                }
                List<Location> searchList = new List<Location>();
                foreach (Location loc in locationList) {
                    if (loc.Name.ToLowerInvariant().Contains(e.NewTextValue)) {
                        searchList.Add(loc);
                    }
                }
                LocationSuggestions.ItemsSource = new ObservableCollection<Location>(searchList);
                Debug.WriteLine(e.NewTextValue);
            };

            LocationSuggestions.ItemSelected += (sender, e) => {
                loc = (Location)e.SelectedItem;
                Debug.WriteLine(loc.ToString());
                
                //Allow the walk and ride buttons to activate
                searchReady = true;
            };

            campusMap = MyCampusMap;
            var sampleMarker = new Position(33.774671, -84.396374);
            campusMap.Marker = new BusMarker {
                Position = sampleMarker,
                Radius = 100
            };
            var pin1 = new CustomPin
            {
                Position = new Position(33.770053, -84.392149),
                Label = "North Ave"
            };
            var pin2 = new CustomPin
            {
                Position = new Position(33.771878, -84.391947),
                Label = "Techwood"
            };
            var pin3 = new CustomPin
            {
                Position = new Position(33.774044, -84.391924),
                Label = "Techwood and Bobby Dodd"
            };
            var pin4 = new CustomPin
            {
                Position = new Position(33.775101, -84.391916),
                Label = "Techwood and 4th"
            };
            var pin5 = new CustomPin
            {
                Position = new Position(33.776793, -84.392025),
                Label = "Techwood and 5th"
            };
            var pin6 = new CustomPin
            {
                Position = new Position(33.777035, -84.394048),
                Label = "Ferst and Fowler"
            };
            var pin7 = new CustomPin
            {
                Position = new Position(33.777515, -84.395585),
                Label = "Ferst and Cherry"
            };
            var pin8 = new CustomPin
            {
                Position = new Position(33.778332, -84.397992),
                Label = "Ferst and Atlantic"
            };
            var pin9 = new CustomPin
            {
                Position = new Position(33.778367, -84.399497),
                Label = "Ferst and State"
            };
            var pin10 = new CustomPin
            {
                Position = new Position(33.778235, -84.401809),
                Label = "Ferst and Hemphill"
            };
            var pin11 = new CustomPin
            {
                Position = new Position(33.778160, -84.404152),
                Label = "McMillan"
            };
            var pin12 = new CustomPin
            {
                Position = new Position(33.779695, -84.404748),
                Label = "8th"
            };
            var pin13 = new CustomPin
            {
                Position = new Position(33.779699, -84.402806),
                Label = "Hemphill"
            };
            var pin14 = new CustomPin
            {
                Position = new Position(33.775135, -84.402674),
                Label = "CRC"
            };
            var pin15 = new CustomPin
            {
                Position = new Position(33.773336, -84.399215),
                Label = "Student Center"
            };
            var pin16 = new CustomPin
            {
                Position = new Position(33.772783, -84.397285),
                Label = "Weber"
            };
            var pin17 = new CustomPin
            {
                Position = new Position(33.772325, -84.395647),
                Label = "Ferst and Cherry"
            };
            campusMap.CustomPins = new List<CustomPin> { pin1, pin2, pin3, pin4, pin5, pin6, pin7, pin8,
                pin9, pin10, pin11, pin12, pin13, pin14, pin15, pin16, pin17};
            foreach(var pin in campusMap.CustomPins)
            {
                campusMap.Pins.Add(pin);
            }

            campusMap.MoveToRegion(MapSpan.FromCenterAndRadius(sampleMarker, Distance.FromMiles(0.6)));

            walkButton = MyWalkButton;
            walkButton.Clicked += OnWalkButtonPressed; // OnWalkButtonPressed happens when button is tapped -- see below
            
            rideButton = MyRideButton;
            rideButton.Clicked += OnRideButtonPressed; // OnRideButtonPressed happens when button is tapped -- see below

            fastButton = MyFastButton;
            fastButton.Clicked += OnFastButtonPressed;

            // add future functionality code here
        }
コード例 #52
0
 public void SearchCompany(string ticker)
 {
     SearchBar.SendKeys(ticker);
     SearchBar.SendKeys(Keys.Enter);
 }
コード例 #53
0
ファイル: SearchBar.Tizen.cs プロジェクト: sung-su/maui
 public static void MapText(SearchBarHandler handler, SearchBar searchBar)
 {
     Platform.TextExtensions.UpdateText(handler.PlatformView, searchBar);
 }
コード例 #54
0
        public TimingDetailPage()
        {
            ReaderWriterLockSlim          locker = new ReaderWriterLockSlim();
            IDictionary <IBoat, DateTime> times  = new Dictionary <IBoat, DateTime>();

            Action updateTitle = () =>
            {
                var u = times.Count(t => t.Key.Number <= 0);
                var i = times.Count(t => t.Key.Number > 0 && t.Value > DateTime.MinValue);

                if (TitleUpdated != null)
                {
                    TitleUpdated(this, new StringEventArgs(string.Format(" - to save: {0} identified, {1} unidentified", i, u)));
                }
            };

            Action saveBoats = () =>
            {
                TimingItemManager manager = (TimingItemManager)BindingContext;
                try
                {
                    locker.EnterWriteLock();
                    manager.SaveBoat(times.Where(kvp => kvp.Value > DateTime.MinValue).Select(t => new Tuple <IBoat, DateTime, string>(t.Key, t.Value, string.Empty)));
                    times.Clear();
                    updateTitle();
                }
                finally
                {
                    locker.ExitWriteLock();
                }
            };
            Action <IBoat, bool> flipflop = (IBoat boat, bool seen) =>
            {
                try
                {
                    locker.EnterWriteLock();
                    boat.Seen = seen;
                    if (times.ContainsKey(boat))
                    {
                        times.Remove(boat);
                    }
                    times.Add(boat, seen ? DateTime.Now : DateTime.MinValue);
                    updateTitle();
                }
                finally
                {
                    locker.ExitWriteLock();
                }
            };
            Action unidentified = () =>
            {
                flipflop(((TimingItemManager)BindingContext).UnidentifiedBoat, true);
            };
//          var anchor = new ToolbarItem("Anchor", "Anchor.png", () => Debug.WriteLine("anchor"), priority: 3);
            var         plus           = new ToolbarItem("Add", "Add.png", () => unidentified(), priority: 3);
            var         sync           = new ToolbarItem("Sync", "Syncing.png", saveBoats, priority: 2);
            ToolbarItem more           = null;
            Action      refreshToolbar = () =>
            {
                ToolbarItems.Clear();
                ToolbarItems.Add(plus);
                ToolbarItems.Add(sync);
                ToolbarItems.Add(more);
            };

            more = new ToolbarItem("More", "More.png", refreshToolbar, priority: 1);
            refreshToolbar();



            var listView = new ListView();

            listView.SetBinding(ListView.ItemsSourceProperty, "Unfinished");
            Action <IBoat> press = async(IBoat boat) =>
            {
                string pin   = "Pin to top";
                string send  = "Send to End";
                var    sheet = await DisplayActionSheet(string.Format("Boat {0}: Send to ... ?", boat.Number), "Cancel", null, pin, send);

                if (sheet == pin)
                {
                    ToolbarItem item   = null;
                    Action      action = () =>
                    {
                        flipflop(boat, true);
                        ToolbarItems.Remove(item);
                    };
                    item = new ToolbarItem(boat.Number.ToString(), null, action, priority: -1);

                    ToolbarItems.Add(item);
                }
                if (sheet == send)
                {
                    boat.End = true;
                }
                Debug.WriteLine("Action: " + sheet);
            };

            listView.ItemTemplate     = new DataTemplate(() => new UnseenCell(press));
            listView.PropertyChanged += (object sender, System.ComponentModel.PropertyChangedEventArgs e) =>
            {
                Debug.WriteLine("underlying change");
            };
            listView.ItemSelected += (object sender, SelectedItemChangedEventArgs e) =>
            {
                if (e.SelectedItem == null)
                {
                    return;
                }
                IBoat boat = (IBoat)e.SelectedItem;
                flipflop(boat, !boat.Seen);
                listView.SelectedItem = null;
            };
            SearchBar searchBar = new SearchBar
            {
                Placeholder = "Filter list",
            };

            searchBar.TextChanged += (object sender, TextChangedEventArgs e) =>
            {
                TimingItemManager manager = (TimingItemManager)BindingContext;
                manager.Filter(searchBar.Text);
            };
            Content = new StackLayout()
            {
                Children = { searchBar, listView }
            };

            // idea: hide a non-starter
        }
コード例 #55
0
//		private ToolbarItem tbiShare;
        #endregion

        #region Private Methods

        private View getView()
        {
            fab = new FloatingActionButtonView()
            {
                ImageName    = "ic_sharee.png",
                ColorNormal  = ColorHelper.Blue500,
                ColorPressed = ColorHelper.Blue900,
                ColorRipple  = ColorHelper.Blue500,
                Size         = FloatingActionButtonSize.Normal,
                Clicked      = (sender, args) =>
                {
                    share();
                }
//				ColorNormal = Color.FromHex("ff3498db"),
//				ColorPressed = Color.Black,
//				ColorRipple = Color.FromHex("ff3498db")
            };

            var lblData = new Label()
            {
                FontSize          = Device.GetNamedSize(NamedSize.Medium, this),
                TextColor         = ColorHelper.DarkBlue,
                HorizontalOptions = LayoutOptions.CenterAndExpand
            };

            lblData.SetBinding(Label.TextProperty, "DataString");

            var lblLaurea = new Label()
            {
                FontSize          = Device.GetNamedSize(NamedSize.Medium, this),
                TextColor         = ColorHelper.DarkBlue,
                HorizontalOptions = LayoutOptions.CenterAndExpand
            };

            lblLaurea.SetBinding(Label.TextProperty, "LaureaString");

            lv = new ListView()
            {
                ItemTemplate    = new DataTemplate(typeof(OrarioGiornCell)),
                HasUnevenRows   = true,
                VerticalOptions = LayoutOptions.FillAndExpand,
                SeparatorColor  = Color.Transparent
            };
            lv.SetBinding(ListView.ItemsSourceProperty, "ListOrari");
            lv.ItemSelected += (sender, e) => {
                ((ListView)sender).SelectedItem = null;
            };
//            lv.ItemSelected += lv_ItemSelected;

            var searchbar = new SearchBar()
            {
                Placeholder       = "Cerca",
                VerticalOptions   = LayoutOptions.EndAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };

            //searchbar.SearchButtonPressed += searchbar_SearchButtonPressed;
            searchbar.TextChanged += searchbar_TextChanged;

            var layoutLabel = new StackLayout()
            {
                BackgroundColor = ColorHelper.White,
                Spacing         = 0,
                Padding         = new Thickness(15, 10, 15, 10),
                Orientation     = StackOrientation.Vertical,
                Children        = { lblData, lblLaurea }
            };

            var l = new StackLayout()
            {
                Padding     = new Thickness(15, 10, 15, 10),
                Orientation = StackOrientation.Vertical,
                Children    =
                {
                    layoutLabel,
                    lv,
                    new StackLayout()
                    {
                        Children = { searchbar },BackgroundColor                   = Color.White
                    }
                }
            };

            tbiShowFav = new ToolbarItem("Mostra preferiti", "ic_nostar.png", showFavourites, 0, 0);
            tbiShowAll = new ToolbarItem("Mostra tutti", "ic_star.png", showAll, 0, 0);
//			tbiShare = new ToolbarItem ("Share", "ic_next.png", share, 0, 1);

            if (Settings.SuccessLogin)
            {
                ToolbarItems.Add(tbiShowFav);
            }
//			ToolbarItems.Add(tbiShare);
            //ToolbarItems.Add(tbiShowAll);


            var absolute = new AbsoluteLayout()
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            // Position the pageLayout to fill the entire screen.
            // Manage positioning of child elements on the page by editing the pageLayout.
            AbsoluteLayout.SetLayoutFlags(l, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(l, new Rectangle(0f, 0f, 1f, 1f));
            absolute.Children.Add(l);

            // Overlay the FAB in the bottom-right corner
            AbsoluteLayout.SetLayoutFlags(fab, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds(fab, new Rectangle(1f, 1f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
            absolute.Children.Add(fab);


//            return l;
            return(absolute);
        }
コード例 #56
0
ファイル: Amigos.xaml.cs プロジェクト: jupabequi/COLPLATP20
        public Amigos()
        {
            //BackgroundColor = Color.FromRgb (96, 178, 54);
            BackgroundColor = Color.White;

            var guardaritem = new ToolbarItem {
                Text = "Guardar",
                //Order = ToolbarItemOrder.Secondary
            };

            ToolbarItems.Add (guardaritem);

            SearchBar searchBar = new SearchBar
            {
                Placeholder = "Buscar",
                BackgroundColor= Color.FromRgb (96, 178, 54)
            };
            //searchBar.SearchButtonPressed += OnSearchBarButtonPressed;

            StackLayout laynoticias = new StackLayout ();
            laynoticias.Padding = new Thickness(3, 0, 3, 0);

            LayoutAmigos slayNoticias1 = new LayoutAmigos ();
            LayoutAmigos slayNoticias2 = new LayoutAmigos ();
            LayoutAmigos slayNoticias3 = new LayoutAmigos ();
            LayoutAmigos slayNoticias4 = new LayoutAmigos ();
            LayoutAmigos slayNoticias5 = new LayoutAmigos ();
            LayoutAmigos slayNoticias6 = new LayoutAmigos ();
            LayoutAmigos slayNoticias7 = new LayoutAmigos ();
            LayoutAmigos slayNoticias8 = new LayoutAmigos ();
            LayoutAmigos slayNoticias9 = new LayoutAmigos ();

            laynoticias.Children.Add (slayNoticias1);
            laynoticias.Children.Add (slayNoticias2);
            laynoticias.Children.Add (slayNoticias3);
            laynoticias.Children.Add (slayNoticias4);
            laynoticias.Children.Add (slayNoticias5);
            laynoticias.Children.Add (slayNoticias6);
            laynoticias.Children.Add (slayNoticias7);
            laynoticias.Children.Add (slayNoticias8);
            laynoticias.Children.Add (slayNoticias9);

            RelativeLayout laytbarra = new RelativeLayout ();

            BoxView barra = new BoxView ();
            barra.BackgroundColor = Color.White;
            barra.AnchorY = 60;

            laytbarra.Children.Add (barra,
                Constraint.Constant (0),
                Constraint.Constant (0),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 60;
                }));

            var imgedit = new Image () {
                Source = ImageSource.FromResource ("RedSocial.Resources.user117.png"),
                Aspect = Aspect.AspectFill
            };
            laytbarra.Children.Add (imgedit,
                Constraint.RelativeToParent ((Parent) => {
                    return 10;
                }),
                Constraint.Constant (10),
                Constraint.RelativeToParent ((Parent) => {
                    return 40;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 40;
                }));

            var imgperson = new Image () {
                Source = ImageSource.FromResource ("RedSocial.Resources.user168.png"),
                Aspect = Aspect.AspectFill
            };
            laytbarra.Children.Add (imgperson,
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width/5+10;
                }),
                Constraint.Constant (10),
                Constraint.RelativeToParent ((Parent) => {
                    return 40;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 40;
                }));

            var imgletter = new Image () {
                Source = ImageSource.FromResource ("RedSocial.Resources.premium1.png"),
                Aspect = Aspect.AspectFill
            };
            laytbarra.Children.Add (imgletter,
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width/5*2+10;
                }),
                Constraint.Constant (10),
                Constraint.RelativeToParent ((Parent) => {
                    return 40;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 40;
                }));

            var imgreward = new Image () {
                Source = ImageSource.FromResource ("RedSocial.Resources.social12.png"),
                Aspect = Aspect.AspectFill
            };
            laytbarra.Children.Add (imgreward,
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width/5*3+10;
                }),
                Constraint.Constant (10),
                Constraint.RelativeToParent ((Parent) => {
                    return 40;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 40;
                }));

            var otro = new Image () {
                Source = ImageSource.FromResource ("RedSocial.Resources.email126.png"),
                Aspect = Aspect.AspectFill
            };
            laytbarra.Children.Add (otro,
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width/5*4+10;
                }),
                Constraint.Constant (10),
                Constraint.RelativeToParent ((Parent) => {
                    return 40;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 40;
                }));

            // Accomodate iPhone status bar.
            this.Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0);

            // Build the page.
            this.Content = new StackLayout
            {
                Children =
                {

                    searchBar,

                    new ScrollView
                    {
                        Content = laynoticias,
                        VerticalOptions = LayoutOptions.FillAndExpand
                    },
                    laytbarra

                }
                };
        }
コード例 #57
0
        //Determines the layout of the page and some of its functionalities
        public AccountsPage()
        {
            _accountidLabel = new Label()
            {
                Text = "Account ID",
                HorizontalOptions = LayoutOptions.EndAndExpand
            };

            _bankidLabel = new Label()
            {
                Text = "Bank ID",
                HorizontalOptions = LayoutOptions.StartAndExpand
            };

            searchBar = new SearchBar
            {
                Placeholder = "Enter id of bank",
            };

            //exitbutton used to exit the application to the loginpage
            Button exitButton = new Button()
            {
                Image = (FileImageSource)Device.OnPlatform(
                    iOS: ImageSource.FromFile("Exit.png"),
                    Android: ImageSource.FromFile("Exit.png"),
                    WinPhone: ImageSource.FromFile("Exit.png")),
                VerticalOptions   = LayoutOptions.Start,
                HorizontalOptions = LayoutOptions.EndAndExpand,
                BackgroundColor   = Color.Gray
            };

            exitButton.Clicked += async(sender, args) => await Navigation.PopToRootAsync();

            //This is used to indicate that their is something loading in the background
            ActivityIndicator indicator = new ActivityIndicator()
            {
                VerticalOptions   = LayoutOptions.Start,
                HorizontalOptions = LayoutOptions.Center,
                IsRunning         = true,
                IsVisible         = true
            };

            indicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy");
            indicator.SetBinding(ActivityIndicator.IsVisibleProperty, "IsBusy");

            //Task used to receive the information that will ve presented in the page
            Task.WhenAll(Takingcareofbussiness());

            //Label layout used to identify the fields used in the accounts table
            labelLayout = new StackLayout()
            {
                BackgroundColor = Color.Gray,
                VerticalOptions = LayoutOptions.StartAndExpand,
                Orientation     = StackOrientation.Horizontal,
                Margin          = 10,
                Children        =
                { _bankidLabel, _accountidLabel }
            };

            //menu layouut used to determine the layout of the menu
            menuLayout = new StackLayout()
            {
                BackgroundColor = Color.Gray,
                VerticalOptions = LayoutOptions.StartAndExpand,
                Orientation     = StackOrientation.Horizontal,
                Margin          = 10,
                Children        =
                {
                    new Label {
                        Text = "All of your accounts", HorizontalTextAlignment = TextAlignment.Center, FontAttributes = FontAttributes.Bold
                    },
                    exitButton
                }
            };

            //layout of the accounts page
            Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0);
            Title   = "Accounts";
            Icon    = new FileImageSource {
                File = "robot.png"
            };
            NavigationPage.SetBackButtonTitle(this, "go back");
            BackgroundColor = Color.Teal;
            Content         = new StackLayout
            {
                BackgroundColor = Color.Gray,
                VerticalOptions = LayoutOptions.CenterAndExpand,
                Children        =
                {
                    new Label
                    {
                        Text = "AccountPage should have most of the your accounts", HorizontalTextAlignment = TextAlignment.Center,
                    }
                }
            };
        }
コード例 #58
0
        // TODO: Uncomment once Xamarin.Forms supports this, hopefully w/ version 1.1.
        //IDictionary<Pin,T> PinMap;

        public MapPage(MapViewModel <T> viewModel)
        {
            BindingContext = viewModel;

            this.SetBinding(Page.TitleProperty, "Title");
            this.SetBinding(Page.IconProperty, "Icon");

            var map   = MakeMap();
            var stack = new StackLayout {
                Spacing = 0
            };

#if __ANDROID__ || __IOS__
            var searchAddress = new SearchBar {
                Placeholder = "Search Address", BackgroundColor = Xamarin.Forms.Color.White
            };

            searchAddress.SearchButtonPressed += async(e, a) =>
            {
                var addressQuery = searchAddress.Text;
                searchAddress.Text = "";
                searchAddress.Unfocus();

                var positions = (await(new Geocoder()).GetPositionsForAddressAsync(addressQuery)).ToList();
                if (!positions.Any())
                {
                    return;
                }

                var position = positions.First();
                map.MoveToRegion(MapSpan.FromCenterAndRadius(position,
                                                             Distance.FromMiles(0.1)));
                map.Pins.Add(new Pin
                {
                    Label    = addressQuery,
                    Position = position,
                    Address  = addressQuery
                });
            };

            stack.Children.Add(searchAddress);
#elif WINDOWS_PHONE
            ToolbarItems.Add(new ToolbarItem("filter", "filter.png", async() =>
            {
                var page   = new ContentPage();
                var result = await page.DisplayAlert("Title", "Message", "Accept", "Cancel");
                Debug.WriteLine("success: {0}", result);
            }));

            ToolbarItems.Add(new ToolbarItem("search", "search.png", () =>
            {
            }));
#endif

            map.VerticalOptions = LayoutOptions.FillAndExpand;
            map.HeightRequest   = 100;
            map.WidthRequest    = 960;

            stack.Children.Add(map);
            Content = stack;
        }
コード例 #59
0
        private void Init()
        {

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

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

                return cell;
            });

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

                searchView = this._searchBar;

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

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

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

            this._autoCompleteListView.ItemSelected += ItemSelected;

            this._textChangeItemSelected = false;
        }
コード例 #60
0
ファイル: GridTest.xaml.cs プロジェクト: LuRiZZa/Leftovers
        public GridTest()
        {
            InitializeComponent();



            var page = new NavigationPage();



            //NavigationPage.SetTitleIcon(page, "FoodImage1.jpg");


            catGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(99)
            });

            //this.ToolbarItems.Add(new ToolbarItem("item 1","", () => { }));


            for (int i = 0; i <= 4; i++)
            {
                catGrid.Children.Add(FoodImageAdd(), 0, i);
                //catGrid.Children.Add(FoodLabel(i), 0, i);

                //catGrid.Children.Add(ElectronicsFood(i), 0, i);
                //catGrid.Children.Add(ElectronicsLabel(i), 0, i);

                //catGrid.Children.Add(ClothesAccessories(i), 0, i);
                //catGrid.Children.Add(ClothesAccessoriesLabel(i), 0, i);

                //catGrid.Children.Add(ToiletThings(i), 0, i);
                //catGrid.Children.Add(ToiletAccessoriesLabel(i), 0, i);



                catGrid.Children.Add(CatLbl("Mad og råvarer" + i), 0, i);
                catGrid.Children.Add(ButtonForground(), 0, i);
                // catGrid.Children.Add(LabelBackground(), 0, i);



                //for (int s = i; s <=4; s++)
                //{



                //}
            }



            this.Content = catGrid;



            //Label label = new Label
            //{

            //    Text = "Leftovers",

            //    Font = Font.SystemFontOfSize(NamedSize.Large),

            //    //FontAttributes = FontAttributes.Bold,
            //    HorizontalOptions = LayoutOptions.Center

            //};

            //Label imageFirstLabel = new Label
            //{

            //    Text = "Leftovers",
            //    Font = Font.SystemFontOfSize(NamedSize.Medium),
            //    //FontAttributes = FontAttributes.Bold,
            //    HorizontalOptions = LayoutOptions.Center

            //};



            //imageFirst.GestureRecognizers.Add(new TapGestureRecognizer
            //{
            //    Command = new Command(() => ImageFirstTapped())

            //});



            //imageSecond.GestureRecognizers.Add(new TapGestureRecognizer
            //{
            //    Command = new Command(() => ImageSecondTapped())
            //});

            sResultLabel = new Label
            {
                Text            = "The result is:",
                VerticalOptions = LayoutOptions.FillAndExpand,
                FontSize        = 25
            };



            searchBar = new SearchBar
            {
                Placeholder   = "Enter your search terms here:",
                SearchCommand = new Command(() => { sResultLabel.Text = "result:" + searchBar.Text; }),
                HeightRequest = 50
            };



            //Content = new StackLayout
            //{
            //    VerticalOptions = LayoutOptions.Start,
            //    Children =
            //       {
            //            imageFirst,
            //            imageSecond,
            //           new Label
            //           {
            //               HorizontalTextAlignment = TextAlignment.Center,
            //               Text = "SearchBar",
            //               FontSize = 50
            //           },
            //           searchBar,
            //           new ScrollView
            //           {
            //               Content = sResultLabel,
            //               VerticalOptions = LayoutOptions.FillAndExpand
            //           }


            //       },
            //    Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5)
            //};



            //var toolbar1 = new ToolbarItem
            //{
            //    Text = "item 1 ",



            //};

            //this.ToolbarItems.Add(toolbar1);
        }