예제 #1
1
        public App()
        {
            Picker pickerArrival = new Picker ();
            pickerArrival.Items.Add ("Android");
            pickerArrival.Items.Add ("iOS");
            pickerArrival.Items.Add ("Windows Phone");

            Button bt = new Button {
                Text = "Select OS",
            };

            bt.Clicked += (e, sender) => {
                Console.WriteLine ("Selected item: " + pickerArrival.Items [pickerArrival.SelectedIndex] +
                " - index: " + pickerArrival.SelectedIndex);
            };

            // The root page of your application
            MainPage = new ContentPage {
                Content = new StackLayout {
                    VerticalOptions = LayoutOptions.Center,
                    Children = {
                        pickerArrival,
                        bt
                    }
                }
            };
        }
예제 #2
1
파일: OptionPage.cs 프로젝트: Zepsen/App1
        private ScrollView GenerateOptionLayout()
        {
            var stack = new StackLayout { Orientation = StackOrientation.Vertical };

            var peak = new Entry { Keyboard = Keyboard.Numeric, Placeholder = "Peak" };
            peak.SetBinding(Entry.TextProperty, OptionViewModel.PeakCommandPropertyName);
            stack.Children.Add(peak);

            var distance = new Entry { Keyboard = Keyboard.Numeric, Placeholder = "Distance" };
            distance.SetBinding(Entry.TextProperty, OptionViewModel.DistanceCommandPropertyName);
            stack.Children.Add(distance);

            var dogAllowed = new Switch();
            dogAllowed.SetBinding(Switch.IsToggledProperty, OptionViewModel.DogAllowedCommandPropertyName);
            stack.Children.Add(dogAllowed);

            var goodForKids = new Switch();
            goodForKids.SetBinding(Switch.IsToggledProperty, OptionViewModel.GoodForKidsCommandPropertyName);
            stack.Children.Add(goodForKids);

            var seasonStart = new Picker { Title = "SeasonStart" };
            foreach (var season in options.Seasons)
            {
                seasonStart.Items.Add(season.Value);
            }
            seasonStart.SetBinding(Picker.SelectedIndexProperty, OptionViewModel.SeasonStartCommandPropertyName);
            stack.Children.Add(seasonStart);

            var seasonEnd = new Picker { Title = "SeasonEnd" };
            foreach (var season in options.Seasons)
            {
                seasonEnd.Items.Add(season.Value);
            }
            seasonEnd.SetBinding(Picker.SelectedIndexProperty, OptionViewModel.SeasonEndCommandPropertyName);
            stack.Children.Add(seasonEnd);

            var trailType = new Picker() { Title = "Trail Type" };
            stack.Children.Add(trailType);
            foreach (var type in options.TrailsTypes)
            {
                trailType.Items.Add(type.Value);
            }
            trailType.SetBinding(Picker.SelectedIndexProperty, OptionViewModel.TypeCommandPropertyName);

            var trailDurationType = new Picker() { Title = "Trail Duration Type" };
            foreach (var durType in options.TrailsDurationTypes)
            {
                trailDurationType.Items.Add(durType.Value);
            }
            trailDurationType.SetBinding(Picker.SelectedIndexProperty, OptionViewModel.DurationTypeCommandPropertyName);
            stack.Children.Add(trailDurationType);

            var button = GenericsContent.GenerateDefaultButton("Update");
            button.SetBinding(Button.CommandProperty, OptionViewModel.UpdateCommandPropertyName);
            stack.Children.Add(button);

            return new ScrollView { Content = stack };
        }
예제 #3
0
		public JobCodeLayout (List<ProjectCode> codes)
		{
			jobEntry = new Entry {
				Placeholder = "Enter job",
				Keyboard = Keyboard.Numeric,
				HorizontalOptions = LayoutOptions.FillAndExpand
			};

			codePicker = new Picker {
				Title = "Select Code",
				HorizontalOptions = LayoutOptions.FillAndExpand
			};
			var billableCodes = codes;
			if (billableCodes.Any ()) {
				foreach (var x in billableCodes) {
					codePicker.Items.Add (x.code_ID);
				}
			} else {
				codePicker.Items.Add ("Default Code");
			}

			this.HorizontalOptions = LayoutOptions.FillAndExpand;
			this.Orientation = StackOrientation.Horizontal;
			this.Children.Add (jobEntry);
			this.Children.Add (codePicker);
		}
예제 #4
0
        public PickerItemPage()
        {
            InitializeComponent();


            Label header = new Label
            {
                Text              = "Picker",
                FontSize          = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                HorizontalOptions = LayoutOptions.Center
            };

            Xamarin.Forms.Picker picker = new Xamarin.Forms.Picker
            {
                Title           = "Color",
                VerticalOptions = LayoutOptions.CenterAndExpand
            };
            picker.On <iOS>().SetUpdateMode(UpdateMode.WhenFinished);

            foreach (string colorName in nameToColor.Keys)
            {
                picker.Items.Add(colorName);
            }

            // Create BoxView for displaying picked Color
            BoxView boxView = new BoxView
            {
                WidthRequest      = 150,
                HeightRequest     = 150,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.CenterAndExpand
            };

            picker.SelectedIndexChanged += (sender, args) =>
            {
                if (picker.SelectedIndex == -1)
                {
                    boxView.Color = Color.Default;
                }
                else
                {
                    string colorName = picker.Items[picker.SelectedIndex];
                    boxView.Color = nameToColor[colorName];
                }
            };

            // 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,
                    picker,
                    boxView
                }
            };
        }
 private void SetColors(Picker picker)
 {
     foreach (var color in Configurations.ColorNames)
     {
         picker.Items.Add(color);
     }
 }
예제 #6
0
        public static ViewCell createList(List<string> source, string Label)
        {
            Picker picker = new Picker
            {
                Title = Label,
                VerticalOptions = LayoutOptions.EndAndExpand
            };

            foreach (var item in source)
            {
                picker.Items.Add(item);
            }

            return new ViewCell()
            {
                View = new StackLayout
                {
                    Orientation = StackOrientation.Horizontal,
                    Spacing = 0,
                    Children = {
                       picker

                    }
                }
            };
        }
예제 #7
0
        /**********************************************************************
         *********************************************************************/
        void CreateRunningProcessesContent(StackLayout layout)
        {
            //caption
            var sl_runningProcesses = new StackLayout()
            {
                Orientation = StackOrientation.Horizontal
            };
            var l_Processes = new Label
            {
                Text            = "Running Processes",
                FontSize        = App._h3FontSize,
                VerticalOptions = LayoutOptions.Center,
                TextDecorations = TextDecorations.Underline
            };

            sl_runningProcesses.Children.Add(l_Processes);

            //picker
            p_runningprocesses = new Xamarin.Forms.Picker()
            {
                FontSize = App._textFontSize,
                HorizontalTextAlignment = TextAlignment.Center //do not change
            };
            for (int i = 2; i < 6; i++)
            {
                p_runningprocesses.Items.Add(i.ToString());
            }
            p_runningprocesses.SelectedIndexChanged += RunningProcessesChanged;

            sl_runningProcesses.Children.Add(p_runningprocesses);
            layout.Children.Add(sl_runningProcesses);

            //spacing
            AddSpace(layout);
        }
예제 #8
0
        Dictionary <int, String> BuildProcessesDict(int runningProcesses, Dictionary <int, String> dict, Dictionary <String, Xamarin.Forms.Picker> dict2)
        {
            for (int i = 0; i < runningProcesses; i++)
            {
                String v = "";
                foreach (String resourceName in resourceNameList)
                {
                    Xamarin.Forms.Picker p1 = resourcesDict[resourceName];
                    String amount           = p1.SelectedItem.ToString();
                    if (amount != "0")
                    {
                        String key = resourceName + i.ToString();
                        Xamarin.Forms.Picker p;
                        if (dict2.TryGetValue(key, out p))
                        {
                            v += p.SelectedItem.ToString();
                        }
                    }
                }
                //Debug.WriteLine("v: " + v);

                dict.Add(i, v);
            }

            return(dict);
        }
예제 #9
0
파일: SettingsPage.cs 프로젝트: r0345/EIMA
		public void networkedUI(){
			var upSpeed = new Label
			{
				Text = "Update Speed",
				FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
				FontAttributes = FontAttributes.Bold,
			};

			picker = new Picker
			{
				VerticalOptions = LayoutOptions.Center
			};
			var data = DataManager.getInstance ();

			picker.SelectedIndexChanged += (sender, args) =>
			data.setUpdateSpeed (updateData [picker.SelectedIndex]);

			foreach (string datamember in updateData) {
				picker.Items.Add (datamember);
			}
			var stackLayout = new StackLayout ();
			stackLayout.Children.Add (settings);
			stackLayout.Children.Add (upSpeed);
			stackLayout.Children.Add (picker);
			Content = stackLayout;
			setSettings ();

		}
예제 #10
0
        private void OnPickerSelectedIndexChanged(object sender, EventArgs e)
        {
            Picker picker = sender as Picker;

            if (picker.SelectedItem == null)
            {
                return;
            }
            ApprovalPendingModel selectedPickerItem = picker.SelectedItem as ApprovalPendingModel;

            functionIdTxt             = selectedPickerItem.functionId;
            shortMobileNameTxt        = selectedPickerItem.shortMobileName;
            typeUpdatedTxt            = selectedPickerItem.type;
            notifyDefinitionTxt       = selectedPickerItem.notifyDefinition;
            processStageFunctionIdTxt = selectedPickerItem.processStageFunctionId;
            statusUpdatedTxt          = selectedPickerItem.id;
            if (typeUpdatedTxt.Equals("U") || typeUpdatedTxt.Equals("u"))
            {
                vm.ProcessUserListVisible    = true;
                processStageUserPicker.Title = vm.assignedToFullNameTxt;
                GetProcessStageUserList();
            }
            else
            {
                vm.ProcessUserListVisible = false;
            }
        }
		public MultipleChoiceQuestion ()
		{
			Title = "Multiple Choice";

			Label q1 = new Label{ Text = "Identify the visual field defect below." };

			var answers = new String[]{"Choose an option", "Bitemporal hemianopia", "Binasal hemianopia", "Central scotoma", "Right homonymous hemianopia", "Temporal homonymous hemianopia"};

			Picker q1a = new Picker ();

			foreach (var a in answers) {
				q1a.Items.Add (a);
			}

			var button = new Button {Text="Submit"};
			button.Clicked += (object sender, EventArgs e) =>  {
				if(q1a.SelectedIndex == 1){
					DisplayAlert("Correct!", "Well done, that's the right answer", "OK");
				}else{
					DisplayAlert("Incorrect", String.Format("The correct answer is {0}", answers[1]), "OK");
				}
			};

			Content = new StackLayout { 
				Children = {
					q1,
					new Image{
						Source = ImageSource.FromUri(new Uri("http://i.imgur.com/q7l03ZG.png"))
					},
					q1a,
					button
				}
			};
		}
예제 #12
0
        public SettingsPage()
        {
            InitializeComponent();
            Label groupsLabel = new Label()
            {
                Text = "Группы:", FontSize = 20, HorizontalTextAlignment = TextAlignment.Start, FontAttributes = FontAttributes.Bold, Margin = new Thickness(0, 0, 0, 5.0)
            };
            Label urlLabel = new Label()
            {
                Text = "Ссылка:", FontSize = 20, HorizontalTextAlignment = TextAlignment.Start, FontAttributes = FontAttributes.Bold, Margin = new Thickness(0, 0, 0, 5.0)
            };

            urlEntry = new Entry();
            picker   = new Picker();
            refreshSettings.Command = new Command(async() =>
            {
                /*await Downloader.GetSchedule();
                 * groupL = Downloader.GetGroups(Downloader.dataSet.Tables["Речная"]);
                 * picker.ItemsSource = groupL;*/
                refreshSettings.IsRefreshing = false;
            });
            picker.Title         = "Выберите группу";
            urlEntry.Placeholder = "Введите ссылку на расписание";
            accept.Margin        = new Thickness(0, 0, 10, 0);
            stackSettings.Children.Add(groupsLabel);
            stackSettings.Children.Add(picker);
            stackSettings.Children.Add(urlLabel);
            stackSettings.Children.Add(urlEntry);
        }
 private void InitializeComponent() {
     this.LoadFromXaml(typeof(MeasurementConverter));
     CfPicker = this.FindByName<Picker>("CfPicker");
     CfEntry = this.FindByName<Entry>("CfEntry");
     CtPicker = this.FindByName<Picker>("CtPicker");
     CtLabel = this.FindByName<Label>("CtLabel");
 }
 internal void InitPicker(Picker picker)
 {
     foreach (string colorName in _nameToColor.Keys)
     {
         picker.Items.Add(colorName);
     }
 }
예제 #15
0
        private bool CompareSelectedIndex(Picker myPicker, string name)
        {
            if (myPicker.SelectedIndex == -1)
                return false;


            return myPicker.Items[myPicker.SelectedIndex] == name;
        }
 private void InitializeComponent() {
     this.LoadFromXaml(typeof(ExportPage));
     grid = this.FindByName<global::DevExpress.Mobile.DataGrid.GridControl>("grid");
     cbExportType = this.FindByName<Picker>("cbExportType");
     btnExport = this.FindByName<Button>("btnExport");
     txtPath = this.FindByName<Label>("txtPath");
     btnOpen = this.FindByName<Button>("btnOpen");
 }
 private void InitializeComponent()
 {
     this.LoadFromXaml(typeof(MunitConverter));
     startPicker = this.FindByName<Picker>("startPicker");
     startEntry = this.FindByName<Entry>("startEntry");
     endPicker = this.FindByName<Picker>("endPicker");
     endLabel = this.FindByName<Label>("endLabel");
 }
예제 #18
0
        public Settings()
        {
            Title = "Juego de Memoria";
            Icon = "house.png";

            StackLayout panel = new StackLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Orientation = StackOrientation.Vertical,
                Spacing = 10,
                Padding = new Thickness(20, Device.OnPlatform(40, 20, 20), 20, 20),
            };

            Button start = new Button
            {
                Text = "Iniciar juego",
                TextColor = Color.White,
                BackgroundColor = Color.Green,
            };

            start.Clicked += delegate
            {
                App.Navigation.PushAsync(new GamePage(nivel, this.Width));
            };

            panel.Children.Add(new Label
            {
                Text = "Dificultad",
                TextColor = Color.Black,
            });

            var dificultad = new Picker
            {
                Title = "Dificultad",
            };
            dificultad.Items.Add("Fácil");
            dificultad.Items.Add("Normal");
            dificultad.SelectedIndex = 0;
            dificultad.SelectedIndexChanged += (sender, args) =>
            {
                nivel = dificultad.SelectedIndex;
            };

            panel.Children.Add(dificultad);
            panel.Children.Add(start);

            panel.Children.Add(new Label
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Text = "\n\n\nMemorama versión 1.0.0\nRafaelcNet 2014",
                Font = Font.SystemFontOfSize(18),
                TextColor = Color.Black,
            });

            Content = panel;

        }
예제 #19
0
        public dataPicker()
        {
            Grid gr = new Grid
            {
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                }
            };

            pick = new Xamarin.Forms.Picker
            {
                Title = "keeld"
            };
            pick.Items.Add("C#");
            pick.Items.Add("python");
            pick.Items.Add("C++");
            pick.Items.Add("VisualBasic");
            pick.Items.Add("Java");

            gr.Children.Add(pick, 0, 0);
            pick.SelectedIndexChanged += Pick_SelectedIndexChanged;

            editor = new Editor {
                Placeholder = "vali keel"
            };

            editor = new Editor {
                Placeholder = "vali keel nimekirjas"
            };
            gr.Children.Add(editor, 1, 0);

            dpicker = new DatePicker
            {
                Format      = "D",
                MinimumDate = DateTime.Now.AddDays(-10),
                MaximumDate = DateTime.Now.AddDays(10),
            };
            gr.Children.Add(dpicker, 1, 1);
            Content = gr;
        }
예제 #20
0
        public static StackLayout GetSelectedItemPositionPicker(FlexPie chart)
        {
            StackLayout stack = new StackLayout();

            stack.Orientation = StackOrientation.Horizontal;

            Label label = new Label();

            label.Text = "Selected Item Position";

            Picker picker = new Picker();

            picker.VerticalOptions = LayoutOptions.FillAndExpand;
            picker.HorizontalOptions = LayoutOptions.FillAndExpand;
            picker.Title = "Selected Item Position";

            picker.Items.Add("None");
            picker.Items.Add("Left");
            picker.Items.Add("Top");
            picker.Items.Add("Right");
            picker.Items.Add("Bottom");

            picker.SelectedIndex = 2;

            picker.SelectedIndexChanged += (e, sender) =>
            {
                Picker sentPicker = (Picker)e;

                ChartPositionType legendPoistion = ChartPositionType.Bottom;

                switch (sentPicker.SelectedIndex)
                {
                    case 0:
                        legendPoistion = ChartPositionType.None;
                        break;
                    case 1:
                        legendPoistion = ChartPositionType.Left;
                        break;
                    case 2:
                        legendPoistion = ChartPositionType.Top;
                        break;
                    case 3:
                        legendPoistion = ChartPositionType.Right;
                        break;
                    case 4:
                        legendPoistion = ChartPositionType.Bottom;
                        break;
                }

                chart.SelectedItemPosition = legendPoistion;
            };

            stack.Children.Add(label);
            stack.Children.Add(picker);

            return stack;

        }
예제 #21
0
        // Can give some params default value later!!
        public RaffleListPage(bool isLocationDetected, IList<RaffleLocation> raffleLocations, RaffleLocation userSelectedLocation, GeonamesCountrySubdivision countrySubdivision, bool includeSocialMedia)
        {
            InitializeComponent();
            NavigationPage.SetHasBackButton(this, false);
            Title = "Raffle List";

            LocationDetected = isLocationDetected;
            IncludeSocialMedia = includeSocialMedia;
            _viewModel = new RaffleListViewModel(isLocationDetected, raffleLocations, userSelectedLocation, countrySubdivision);

            var locationPicker = new Picker();
            locationPicker.HorizontalOptions = LayoutOptions.Center;
            layout.Children.Add(locationPicker);

            locationPicker.Items.Add(_viewModel.LocationName);
            locationPicker.SelectedIndex = 0;
            locationPicker.IsEnabled = false;

            if (_viewModel.RaffleLocation == null) // only happen when locationDetected == true
            {
                layout.Children.Add(new StackLayout
                    {
                        Children =
                        { new Label
                            {
                                Text = "Sorry. There is no available raffle at your location.",
                                HorizontalOptions = LayoutOptions.CenterAndExpand,
                                VerticalOptions = LayoutOptions.CenterAndExpand,
                            }
                        },
                        Padding = new Thickness(20, 0, 20, 0),
                        VerticalOptions = LayoutOptions.CenterAndExpand,
                    }
                );
            }
            else
            {
                GetRaffleEventsAndCreateList(_viewModel.LocationName);
            }

            // Previous UX
//            else
//            {
//                foreach (var location in raffleLocations)
//                {
//                    locationPicker.Items.Add(location.Name);
//                }
//                locationPicker.IsEnabled = true;
//                locationPicker.SelectedIndexChanged += (sender, e) =>
//                {
//                    if (layout.Children.Count == 2)
//                    {
//                        layout.Children.RemoveAt(1);
//                    }
//                    GetRaffleEventsAndCreateList(locationPicker.Items[locationPicker.SelectedIndex]);
//                };
//            }
        }
        public PickerDemoPage()
        {
            Label header = new Label
            {
                Text = "Picker",
                Font = Font.BoldSystemFontOfSize(50),
                HorizontalOptions = LayoutOptions.Center
            };

            Picker picker = new Picker
            {
                Title = "Color",
                VerticalOptions = LayoutOptions.CenterAndExpand
            };

            foreach (string colorName in nameToColor.Keys)
            {
                picker.Items.Add(colorName);
            }

            // Create BoxView for displaying picked Color
            BoxView boxView = new BoxView
            {
                WidthRequest = 150,
                HeightRequest = 150,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.CenterAndExpand
            };

            picker.SelectedIndexChanged += (sender, args) =>
                {
                    if (picker.SelectedIndex == -1)
                    {
                        boxView.Color = Color.Default;
                    }
                    else
                    {
                        string colorName = picker.Items[picker.SelectedIndex];
                        boxView.Color = nameToColor[colorName];
                    }
                };

            // 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,
                    picker,
                    boxView
                }
            };

        }
예제 #23
0
 private void InitializeComponent()
 {
     this.LoadFromXaml(typeof(Home));
     grid = this.FindByName<Grid>("grid");
     SortByPicker = this.FindByName<Picker>("SortByPicker");
     TagsBtn = this.FindByName<Button>("TagsBtn");
     newsfeedScroll = this.FindByName<ScrollView>("newsfeedScroll");
     NewsSection = this.FindByName<StackLayout>("NewsSection");
 }
        LocationPickerPage(IRepository repo, IRace race)
        {
            // todo - summarise the race details
            Title = race.Code;

            Picker locationpicker = new Picker { WidthRequest = 300, Title = "Locations" };
            locationpicker.Items.Clear();
            repo.LocationList.Select(l => l.Name).ForEach (locationpicker.Items.Add);

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

            var button = new Button { Text = "Go!", IsEnabled = false };

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

            Func<bool> enable = () => (!string.IsNullOrEmpty(_token) && locationpicker.SelectedIndex >= 0 && !string.IsNullOrEmpty(locationpicker.Items[locationpicker.SelectedIndex]));

            entry.TextChanged += (object sender, TextChangedEventArgs e) =>
            {
                _token = entry.Text;
                button.IsEnabled = enable();
            };

            locationpicker.SelectedIndexChanged += (object sender, EventArgs e) =>
            {
                button.IsEnabled = enable();
            };

            button.Clicked += (object sender, EventArgs e) =>
            {
                IEnumerable<IBoat> boats = repo.BoatList;
                var location =
                    new LocationFactory()
                        .SetName(locationpicker.Items[locationpicker.SelectedIndex])
                        .SetToken(_token)
                        .SetItems(repo)
                        .Create();
                var tim = new TimingItemManager(new List<IRepository> { repo}, location, boats);
                var page = TimingMasterDetailPage.Create(tim);

                Navigation.PushAsync(page);
            };

            var dump = new Button { Text = "Dump", IsEnabled = true };
            dump.Clicked += (object sender, EventArgs e) =>
            {
                repo.Dump();
            };

            Content = new StackLayout {
                Children = {
                    locationpicker,
                    entry, button, dump
                }
            };
        }
예제 #25
0
        public maakonnad()
        {
            gr = new Grid
            {
                RowDefinitions =
                {
                    new RowDefinition{Height=new GridLength(1,GridUnitType.Star)},
                    new RowDefinition{Height=new GridLength(1,GridUnitType.Star)},
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition{Width=new GridLength(1,GridUnitType.Star)},
                    new ColumnDefinition{Width=new GridLength(1,GridUnitType.Star)}
                }
            };
            ent = new Entry { Text = " " };
            pic1 = new Picker { Title = "Уезды" };
            pic2 = new Picker { Title = "Столицы уездов" };
            pic1.Items.Add("ИДАВИРУМАА");
            pic1.Items.Add("ЙЫГЕВАМАА");
            pic1.Items.Add("ЛЯЭНЕМАА");
            pic1.Items.Add("ЛЯЭНЕ-ВИРУМАА");
            pic1.Items.Add("ПЫЛВАМАА");
            pic1.Items.Add("ПЯРНУМАА");
            pic1.Items.Add("РАПЛАМАА");
            pic1.Items.Add("СААРЕМАА");
            pic1.Items.Add("ТАРТУМАА");
            pic1.Items.Add("ХАРЬЮМАА");
            pic1.Items.Add("ХИЙУМАА");
            pic1.Items.Add("ЯРВАМАА");
            pic1.Items.Add("ВЫРУМАА");
            pic1.Items.Add("ВИЛЬЯНДИМАА");
            pic1.Items.Add("ВАЛГАМАА");
            pic1.SelectedIndexChanged += Pic1_SelectedIndexChanged;
            pic2.SelectedIndexChanged += Pic2_SelectedIndexChanged;

            pic2.Items.Add("Йыхви");
            pic2.Items.Add("Йыгева");
            pic2.Items.Add("Хаапсалу");
            pic2.Items.Add("Раквере");
            pic2.Items.Add("Пылва");
            pic2.Items.Add("Пярну");
            pic2.Items.Add("Рапла");
            pic2.Items.Add("Курессааре");
            pic2.Items.Add("Тарту");
            pic2.Items.Add("Таллинн");
            pic2.Items.Add("Кярдла");
            pic2.Items.Add("Пайде");
            pic2.Items.Add("Выру");
            pic2.Items.Add("Выру");
            pic2.Items.Add("Валга");
            gr.Children.Add(pic1, 0, 0);
            gr.Children.Add(pic2, 1, 0);
            gr.Children.Add(ent, 1, 1);
            Content = gr;
        }
예제 #26
0
 private void InitializeComponent()
 {
     this.LoadFromXaml(typeof(Contact_Us));
     content = this.FindByName<StackLayout>("content");
     emailAddress = this.FindByName<Entry>("emailAddress");
     problemPicker = this.FindByName<Picker>("problemPicker");
     subjectSection = this.FindByName<StackLayout>("subjectSection");
     respondSwitch = this.FindByName<Switch>("respondSwitch");
     refrerence = this.FindByName<StackLayout>("refrerence");
 }
예제 #27
0
        private void Picker_SelectedIndexChanged(object sender, EventArgs e)
        {
            int selectedTheme = Preferences.Get($"{PreferenceName.SelectedTheme}", (int)SelectedThemeEnum.Auto);

            Xamarin.Forms.Picker picker = sender as Xamarin.Forms.Picker;
            if (selectedTheme != picker.SelectedIndex)
            {
                MainPage.SetTheme((SelectedThemeEnum)picker.SelectedIndex);
            }
        }
예제 #28
0
		private async Task InitializeComponents()
		{
			products = await ProductService.Instance.ReadAll ();
			clients = await ClientService.Instance.ReadAll ();

			StackLayout layout = new StackLayout ();

			priceEntry = new Entry () { 
				Placeholder = "Precio",
				Keyboard = Keyboard.Numeric
			};

			layout.Children.Add ( priceEntry );

			quantityStepper = new Entry () {
				Placeholder = "Cantidad",
				Keyboard = Keyboard.Numeric
			};

			layout.Children.Add ( quantityStepper );

			detailsEditor = new Editor () {
				HeightRequest = 100,
				Text = "Detalles"
			};

			layout.Children.Add ( detailsEditor );

			productPicker = new Picker () {
				Title = "Elija un producto"
			};
			foreach( var p in products ) {
				productPicker.Items.Add ( p.Name );
			}
			layout.Children.Add ( productPicker );

			clientPicker = new Picker () { 
				Title = "Elija un cliente"
			};
			foreach( var c in clients ) {
				clientPicker.Items.Add ( c.Name );
			}
			layout.Children.Add ( clientPicker );

			orderButton = new CustomButton () { 
				Text = "Enviar",
				BackgroundImage = "blue-button-hi.png"
			};

			layout.Children.Add ( orderButton );

			Content = layout;

			orderButton.Clicked += OrderButton_Clicked;
		}
예제 #29
0
        public App() {
            _ViewModel = new TestModel();
            var insetLabel = new Label();
            insetLabel.SetBinding(Label.TextProperty, nameof(TestModel.SvgInsets), stringFormat: "Stretchable Insets: {0:C2}");
            var resourcePicker = new Picker() {
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };
            foreach (var resourceName in TestModel.AvailableResourceNames) {
                resourcePicker.Items.Add(resourceName);
            }
            resourcePicker.SetBinding(Picker.SelectedIndexProperty, nameof(TestModel.SvgResourceIndex), BindingMode.TwoWay);
            var insetSlider = new Slider() {
                Minimum = 0,
                Maximum = 35,
                Value = _ViewModel.AllSidesInset,
            };
            insetSlider.SetBinding(Slider.ValueProperty, nameof(TestModel.AllSidesInset), BindingMode.TwoWay);
            var slicingSvg = new SvgImage() {
                SvgAssembly = typeof(App).GetTypeInfo().Assembly,
                WidthRequest = 300,
                HeightRequest = 300,
            };
            slicingSvg.SetBinding(SvgImage.SvgStretchableInsetsProperty, nameof(TestModel.SvgInsets));
            slicingSvg.SetBinding(SvgImage.SvgPathProperty, nameof(TestModel.SvgResourcePath));
            var svgButton = new Button() {
                WidthRequest = 300,
                HeightRequest = 300,
            };

            // The root page of your application
            MainPage = new NavigationPage (new ContentPage {
                Title = "9-Slice SVG Scaling",
                Content = new StackLayout {
                    VerticalOptions = LayoutOptions.Start,
                    HorizontalOptions = LayoutOptions.Center,
                    Children = {
                        insetLabel,
                        resourcePicker,
                        insetSlider,
                        new AbsoluteLayout() {
                            WidthRequest = 300,
                            HeightRequest = 300,
                            Children = {
                                slicingSvg,
                                svgButton,
                            },
                        },
                    },
                    BindingContext = _ViewModel,
                },
            });
            svgButton.Clicked += (sender, e) => {
                MainPage.DisplayAlert("Tapped!", "SVG button tapped!", "OK");
            };
        }
예제 #30
0
        public FeedbackPage()
        {
            Title = "Feedback";

            Button sendButton = new Button
            {
                Text = "Send",
                TextColor = Theme.LinkColor,
                BackgroundColor = Theme.ButtonBackgroundColor,
                BorderColor = Theme.FrameBorderColor
            };

            Picker title = new Picker()
            {
                Items =
                {
                    "Feedback",
                    "Bug Report",
                    "Feature Request"
                },
                TextColor = Theme.TextColor,
                BackgroundColor = Theme.FrameColor,
                SelectedIndex = 0
            };

            Editor body = new Editor
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
            };

            sendButton.Clicked += async (sender, args) =>
            {
                await DependencyService.Get<ISendMail>().SendMail(title.Items[title.SelectedIndex], body.Text);
            };

            Content = new ScrollView
            {
                Content = new MarginFrame(10, Theme.BackgroundColor)
                {
                    Content = new StackLayout
                    {
                        Children =
                        {
                            new Label { Text = "Subject:", TextColor = Theme.TextColor},
                            title,
                            //new Label { Text = "From:", TextColor = Theme.TextColor},
                            //from,
                            new Label { Text = "Message:", TextColor = Theme.TextColor},
                            body,
                            sendButton
                        }
                    }
                }
            };
        }
        public PickerDemoPage()
        {
            Label header = new Label
            {
                Text = "Picker",
                FontSize = 50,
                FontAttributes = FontAttributes.Bold,
                HorizontalOptions = LayoutOptions.Center
            };

            Picker picker = new Picker
            {
                Title = "Color",
                VerticalOptions = LayoutOptions.CenterAndExpand
            };

            foreach (string colorName in nameToColor.Keys)
            {
                picker.Items.Add(colorName);
            }

            // Create BoxView for displaying picked Color
            BoxView boxView = new BoxView
            {
                WidthRequest = 150,
                HeightRequest = 150,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.CenterAndExpand
            };

            picker.SelectedIndexChanged += (sender, args) =>
                {
                    if (picker.SelectedIndex == -1)
                    {
                        boxView.Color = Color.Default;
                    }
                    else
                    {
                        string colorName = picker.Items[picker.SelectedIndex];
                        boxView.Color = nameToColor[colorName];
                    }
                };

            // Build the page.
            this.Content = new StackLayout
            {
                Children =
                {
                    header,
                    picker,
                    boxView
                }
            };
        }
예제 #32
0
		private  Picker GetMenu(){
			Picker p_list_menu = new Picker
			{
				Title = "Cuadros",
				VerticalOptions = LayoutOptions.StartAndExpand
			};

			String [] menuNameList = {"Avance pesca por zona",
				"Avance pesca por región",
				"Avance pesca por puerto",
				"Avance pesca por planta",
				"Avance pesca / descargas por día",
				"Avance pesca / descargas quincena",
				"Avance por grupos",
				"Avance por grupos en [Rango %]",
			};
			foreach (string menuName in menuNameList)
			{
				p_list_menu.Items.Add(menuName);
			}
			p_list_menu.SelectedIndex = 0;

			// WHEN p_list_menu is selected
			p_list_menu.SelectedIndexChanged += (sender, args) =>
			{
				if (p_list_menu.SelectedIndex == -1)
				{
				}
				else
				{
					switch(p_list_menu.SelectedIndex) 
					{
					case 1:
						{
							ShowMyPage();
							break;
						}
					}

				}
			};

			return p_list_menu;
			/*
			return new StackLayout(){
				Spacing = 15,
				VerticalOptions = LayoutOptions.FillAndExpand,
				HorizontalOptions = LayoutOptions.FillAndExpand,
				Orientation = StackOrientation.Vertical,
				Children = {
					p_list_menu
				}
			}*/
		}
		public SelectableEntryCell (List<string> pickerItems,string labelText)
		{	
			Grid grid = new Grid {
				Padding = new Thickness (0, 1, 1, 1),
				RowSpacing = 1,
				ColumnSpacing = 3,		
				VerticalOptions = LayoutOptions.FillAndExpand,
				RowDefinitions = {
					new RowDefinition { Height = new GridLength (30, GridUnitType.Star) }
				},
				ColumnDefinitions = {
					new ColumnDefinition { Width = new GridLength (10, GridUnitType.Absolute) },
					new ColumnDefinition { Width = new GridLength (100, GridUnitType.Absolute) },
					new ColumnDefinition { Width = new GridLength (100, GridUnitType.Star) },
					new ColumnDefinition { Width = new GridLength (40, GridUnitType.Absolute) }
				}
			};
			var label = new Label { 
				Text=labelText,
				TextColor = Color.White,
				HorizontalOptions = LayoutOptions.StartAndExpand,
				VerticalOptions=LayoutOptions.CenterAndExpand
			};
			grid.Children.Add (label,1,2,0,1);
			picker = new Picker{
				HorizontalOptions=LayoutOptions.FillAndExpand,
				VerticalOptions = LayoutOptions.FillAndExpand,
				BackgroundColor = Color.Transparent
			};
			foreach (var i in pickerItems) {
				picker.Items.Add (i);
			}
			picker.SelectedIndexChanged += selectedIndexChanged;
			pickerStacklayout = new StackLayout{ Padding = new Thickness (10, 5, 10, 5),Children={picker} };
			pickerStacklayout.IsVisible = false;
			grid.Children.Add (pickerStacklayout, 2, 3, 0, 1);

			entry = new Entry {
				HorizontalOptions = LayoutOptions.FillAndExpand,
				VerticalOptions = LayoutOptions.FillAndExpand,
				BackgroundColor = Color.Transparent,
				TextColor = Color.White
			};
			entryStacklayout = new StackLayout{ Padding = new Thickness (10, 5, 10, 5), Children = { entry } };
			grid.Children.Add (entryStacklayout,2,3,0,1);

			var showPickerViewButton = new Button {
				Image="Account.png",
				VerticalOptions=LayoutOptions.CenterAndExpand
			};
			showPickerViewButton.Clicked += showPickerView;
			grid.Children.Add (showPickerViewButton, 3, 4, 0, 1);
			View = grid;
		}
 Picker CreateZoomModePicker()
 {
     Picker picker = new Picker();
     picker.VerticalOptions = LayoutOptions.CenterAndExpand;
     picker.HorizontalOptions = LayoutOptions.FillAndExpand;
     picker.Title = "ZoomMode";
     picker.Items.Add("X");
     picker.Items.Add("Y");
     picker.Items.Add("XY");
     picker.SelectedIndexChanged += picker_SelectedIndexChanged;
     return picker;
 }
 private void InitializeComponent()
 {
     this.LoadFromXaml(typeof(CreateFootballPlayerPage));
     ImagePicker = this.FindByName <Image>("ImagePicker");
     ImagePickerTapGesture = this.FindByName <TapGestureRecognizer>("ImagePickerTapGesture");
     FirstNamelbl = this.FindByName <Entry>("FirstNamelbl");
     LastNamelbl = this.FindByName <Entry>("LastNamelbl");
     DateOfBirthPicker = this.FindByName <DatePicker>("DateOfBirthPicker");
     CountryPicker = this.FindByName <Picker>("CountryPicker");
     DescriptionEditor = this.FindByName <Editor>("DescriptionEditor");
     SavePlayerProfileBTN = this.FindByName <Button>("SavePlayerProfileBTN");
 }
        public ListItemView()
        {
            InitializeComponent();

            _viewModel = new ListItemViewModel(new ApiClient(), null);

            BindingContext = _viewModel;

            var picker = new Xamarin.Forms.Picker();

            picker.On <iOS>().SetUpdateMode(UpdateMode.WhenFinished);
        }
예제 #37
0
		public FirstPage()
		{
			// create UI controls
			var myLabel = new Label();
			var myEntry = new Entry();
			var myButton = new Button();
			var myPicker = new Picker();
			myPicker.Items.Add("0");
			myPicker.Items.Add("1");
			myPicker.Items.Add("2");
			myPicker.Items.Add("3");
			myPicker.Items.Add("4");

			// apply translated resources
			myLabel.Text = AppResources.NotesLabel;
			myEntry.Placeholder = AppResources.NotesPlaceholder;
			myPicker.Title = AppResources.PickerName;
			myButton.Text = AppResources.AddButton;

			var flag = new Image();
			flag.Source = ImageSource.FromFile(Device.OnPlatform("flag.png", "flag.png", "Assets/Images/flag.png"));

			// button shows an alert, also translated
			myButton.Clicked += async (sender, e) =>
			{
				var message = AppResources.AddMessageN;
				if (myPicker.SelectedIndex <= 0)
				{
					message = AppResources.AddMessage0;
				}
				else if (myPicker.SelectedIndex == 1)
				{
					message = AppResources.AddMessage1;
				}
				else {
					message = String.Format(message, myPicker.Items[myPicker.SelectedIndex]);
				}
				await DisplayAlert(message, message, AppResources.CancelButton);
			};

			// add to screen
			Content = new StackLayout
			{
				VerticalOptions = LayoutOptions.CenterAndExpand,
				HorizontalOptions = LayoutOptions.CenterAndExpand,
				Children = {
					myLabel,
					myEntry,
					myPicker,
					myButton,
					flag},
			};
		}
 Picker CreatePalettesPicker()
 {
     IEnumerable<FieldInfo> fields = typeof(Palettes).GetRuntimeFields();
     Picker picker = new Picker();
     picker.VerticalOptions = LayoutOptions.CenterAndExpand;
     picker.HorizontalOptions = LayoutOptions.FillAndExpand;
     picker.Title = "Palettes";
     foreach (var item in fields)
     {
         picker.Items.Add(item.Name);
     }
     picker.SelectedIndexChanged += picker_SelectedIndexChanged;
     return picker;
 }
예제 #39
0
        public Barcodes()
        {
            BackgroundColor = Color.White;
            padding = Device.OnPlatform(iOS: new Thickness(8), Android: new Thickness(8), WinPhone: new Thickness(10));
            fontSize = Device.OnPlatform(iOS: 10, Android: 20, WinPhone: 20);
            xDimension = Device.OnPlatform(iOS: 6, Android: 8, WinPhone: 8);
            picker_Symbology = new Picker();

            LoadAllowedCharactersLabel();

            LoadBarcode(ref barcode, BarcodeSymbolType.QRCode, "http://www.syncfusion.com");
            currentBarcode = barcode;
            if (Device.OS == TargetPlatform.WinPhone || Device.OS == TargetPlatform.Windows)
            {
                this.picker_Symbology.BackgroundColor = Color.Gray;
            }
            this.picker_Symbology.Items.Add("QRCode");
            this.picker_Symbology.Items.Add("DataMatrix");
            this.picker_Symbology.Items.Add("Code32");
            this.picker_Symbology.Items.Add("Code39");
            this.picker_Symbology.Items.Add("Code39Extended");
            this.picker_Symbology.Items.Add("Code93");
            this.picker_Symbology.Items.Add("Code93Extended");
            this.picker_Symbology.Items.Add("Code128A");
            this.picker_Symbology.Items.Add("Code128B");
            this.picker_Symbology.Items.Add("Code128C");
            this.picker_Symbology.Items.Add("CodaBar");
            this.picker_Symbology.Items.Add("Code11");
            this.picker_Symbology.SelectedIndex = 0;
            this.picker_Symbology.SelectedIndexChanged += picker_Symbology_SelectedIndexChanged;

            typeLabel = new Label()
            {
                Text = "Barcode Symbology",
                FontSize = fontSize,
                TextColor = Color.Black,
                FontAttributes = FontAttributes.Bold
            };

            barcodeLayout = new StackLayout
            {
                Spacing = padding.Top,
                Padding = padding,
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children = { typeLabel, picker_Symbology, labelLayout, barcode }
            };
            this.ContentView = barcodeLayout;

        }
예제 #40
0
        public iOSPickerPageCS()
        {
            var monkeyList = new List <string>();

            monkeyList.Add("Baboon");
            monkeyList.Add("Capuchin Monkey");
            monkeyList.Add("Blue Monkey");
            monkeyList.Add("Squirrel Monkey");
            monkeyList.Add("Golden Lion Tamarin");
            monkeyList.Add("Howler Monkey");
            monkeyList.Add("Japanese Macaque");

            var picker = new Xamarin.Forms.Picker {
                Title = "Select a monkey"
            };

            picker.ItemsSource = monkeyList;

            var button = new Button {
                Text = "Toggle Picker UpdateMode"
            };

            button.Clicked += (sender, e) =>
            {
                switch (picker.On <iOS>().UpdateMode())
                {
                case UpdateMode.Immediately:
                    picker.On <iOS>().SetUpdateMode(UpdateMode.WhenFinished);
                    break;

                case UpdateMode.WhenFinished:
                    picker.On <iOS>().SetUpdateMode(UpdateMode.Immediately);
                    break;
                }
            };

            picker.On <iOS>().SetUpdateMode(UpdateMode.WhenFinished);

            Title   = "Picker UpdateMode";
            Content = new StackLayout
            {
                Margin   = new Thickness(20),
                Children =
                {
                    picker, button
                }
            };
        }
예제 #41
0
        public Goui.Html.Element CreateElement()
        {
            var panel = new StackLayout();

            var titleLabel = new Xamarin.Forms.Label
            {
                Text           = "Picker",
                FontSize       = 24,
                FontAttributes = FontAttributes.Bold
            };

            panel.Children.Add(titleLabel);

            _picker = new Picker
            {
                Title = "Hello",
                //VerticalOptions = LayoutOptions.CenterAndExpand,
                ItemsSource = myItems,
            };

            panel.Children.Add(_picker);

            _picker.SelectedIndexChanged += OnPickerValueChanged;

            _label = new Xamarin.Forms.Label
            {
                Text = "Picker value is",
                HorizontalOptions = LayoutOptions.Center
            };
            panel.Children.Add(_label);

            var button = new Xamarin.Forms.Button()
            {
                Text = "Clear"
            };

            button.Clicked += (s, e) => {
                _picker.ItemsSource = new List <string>();
            };
            panel.Children.Add(button);

            var page = new ContentPage
            {
                Content = panel
            };

            return(page.GetGouiElement());
        }
예제 #42
0
        void DisplayOrHideLayout(Xamarin.Forms.Picker picker, Dictionary <String, StackLayout> layoutDict)
        {
            string pickerName = picker.AutomationId;

            StackLayout l;

            if (layoutDict.TryGetValue(pickerName, out l))
            {
                if (picker.SelectedIndex == 0)
                {
                    l.IsVisible = false;
                }
                else
                {
                    l.IsVisible = true;
                }
            }
        }
예제 #43
0
        //METHODS

        /**********************************************************************
         *********************************************************************/
        void CreateContent()
        {
            var scrollView = new Xamarin.Forms.ScrollView
            {
                Margin = new Thickness(10)
            };
            var stackLayout = new StackLayout();

            var stackLayout2 = new StackLayout
            {
                Orientation = StackOrientation.Horizontal
            };
            var stackLayout3 = new StackLayout
            {
                Orientation = StackOrientation.Horizontal
            };

            this.Content       = scrollView;
            scrollView.Content = stackLayout;             //Wrap ScrollView around StackLayout to be able to scroll the content

            //add elements to stackLayout2
            var l_Zero = new Label {
                Text = "0", VerticalOptions = LayoutOptions.Center, VerticalTextAlignment = TextAlignment.Center, FontSize = App._textFontSize
            };

            e_Sequence = new Xamarin.Forms.Entry {
                Keyboard = Keyboard.Numeric, Text = "12340156012356", HorizontalOptions = LayoutOptions.FillAndExpand, VerticalTextAlignment = TextAlignment.Center, FontSize = App._textFontSize
            };


            stackLayout2.Children.Add(l_Zero);
            stackLayout2.Children.Add(e_Sequence);

            //add elements to stackLayout3
            var l_RAM = new Label {
                Text = "RAM:", FontSize = App._textFontSize, VerticalOptions = LayoutOptions.Center
            };

            p_RAM = new Xamarin.Forms.Picker()
            {
                FontSize = App._textFontSize
            };
            p_RAM.Items.Add("1");
            p_RAM.Items.Add("2");
            p_RAM.Items.Add("3");
            p_RAM.Items.Add("4");
            p_RAM.Items.Add("5");
            p_RAM.Items.Add("6");
            p_RAM.Items.Add("7");
            p_RAM.SelectedIndex = 2; //"3"
            var l_Space3 = new Label {
                Text = "  "
            };
            string dtext  = App._disk + ":";
            var    l_DISC = new Label {
                Text = dtext, FontSize = App._textFontSize, VerticalOptions = LayoutOptions.Center
            };

            p_disk = new Xamarin.Forms.Picker()
            {
                FontSize = App._textFontSize
            };
            p_disk.Items.Add("1");
            p_disk.Items.Add("2");
            p_disk.Items.Add("3");
            p_disk.Items.Add("4");
            p_disk.Items.Add("5");
            p_disk.Items.Add("6");
            p_disk.Items.Add("7");
            p_disk.SelectedIndex = 3; //"4"

            stackLayout3.Children.Add(l_RAM);
            stackLayout3.Children.Add(p_RAM);
            stackLayout3.Children.Add(l_Space3);
            stackLayout3.Children.Add(l_DISC);
            stackLayout3.Children.Add(p_disk);

            //add elements to StackLayout
            var l_Strategy = new Label {
                Text     = "Strategy",
                FontSize = App._h3FontSize,
            };

            p_Strategy = new Xamarin.Forms.Picker {
                Title = "Select a Strategy", FontSize = App._textFontSize
            };
            p_Strategy.Items.Add("Optimal Strategy");
            p_Strategy.Items.Add("FIFO");
            p_Strategy.Items.Add("FIFO Second Chance");
            p_Strategy.Items.Add("RNU FIFO");
            p_Strategy.Items.Add("RNU FIFO Second Chance");
            p_Strategy.SelectedIndex = 0; //"Optimal Strategy"
            var l_Space = new Label {
                Text = "  "
            };
            var l_Sequence = new Label {
                Text = "Reference Sequence", FontSize = App._h3FontSize
            };
            var b_DefaultValue = new Button {
                Text            = "Default", HorizontalOptions = LayoutOptions.Start,
                BackgroundColor = App._buttonBackground,
                TextColor       = App._buttonText,
                CornerRadius    = App._buttonCornerRadius,
                FontSize        = App._smallButtonFontSize
            };

            b_DefaultValue.Clicked += B_DefaultValue_Clicked;
            var l_Space2 = new Label {
                Text = "  "
            };
            var l_MemorySize = new Label {
                Text = "Memory Size", FontSize = App._h3FontSize
            };
            var l_MaxSize = new Label {
                FontSize = App._smallTextFontSize,
                Text     = "Maximal size of RAM and " + App._disk + " together: 8"
            };
            var l_Space4 = new Label {
                Text = "  "
            };
            var b_Start = new Button {
                Text            = "Start",
                BackgroundColor = App._buttonBackground,
                TextColor       = App._buttonText,
                CornerRadius    = App._buttonCornerRadius,
                FontSize        = App._buttonFontSize
            };

            b_Start.Clicked += B_Start_Clicked;             //add Click Event(Method)

            stackLayout.Children.Add(l_Strategy);
            stackLayout.Children.Add(p_Strategy);
            stackLayout.Children.Add(l_Space);
            stackLayout.Children.Add(l_Sequence);
            stackLayout.Children.Add(stackLayout2); //Stacklayout2 is nested
            stackLayout.Children.Add(b_DefaultValue);
            stackLayout.Children.Add(l_Space2);
            stackLayout.Children.Add(l_MemorySize);
            stackLayout.Children.Add(stackLayout3);//Stacklayout3 is nested
            stackLayout.Children.Add(l_MaxSize);
            stackLayout.Children.Add(l_Space4);
            stackLayout.Children.Add(b_Start);
            //note : a space label element can somehow only be added once, therefore I needed to define 4 of them
        }
예제 #44
0
 public PickerHandler(NativeComponentRenderer renderer, XF.Picker pickerControl) : base(renderer, pickerControl)
 {
     PickerControl = pickerControl ?? throw new ArgumentNullException(nameof(pickerControl));
     Initialize(renderer);
 }
예제 #45
0
        public PopupsPage()
        {
            Padding = 20;
            _hzLayoutOptions.SelectIndex(1);
            _vtLayoutOptions.SelectIndex(1);

            #region ModalPopup
            cancelModalButton.Clicked += async(sender, e) => await _modalPopup.CancelAsync();

            popPushModalButton.Clicked += (sender, e) =>
            {
                _modalPopup.IsVisible = false;
                _modalPopup.IsVisible = true;
            };
            showModalButton.Clicked += (sender, e) =>
            {
                _modalPopup.HasShadow         = _hasShadow;
                _modalPopup.ShadowInverted    = _shadowInverted;
                _modalPopup.OutlineWidth      = _blueOutline ? 1 : 0;
                _modalPopup.IsVisible         = true;
                _modalPopup.HorizontalOptions = LayoutOption(_hzLayoutOptions);
                _modalPopup.VerticalOptions   = LayoutOption(_vtLayoutOptions);
            };
            #endregion


            #region BubblePopups


            var showBubbleLeftButton = new Forms9Patch.Button(bubbleLeftText)
            {
                BackgroundColor = Color.White, HorizontalOptions = LayoutOptions.Center
            };
            var showBubbleRightButton = new Forms9Patch.Button(bubbleRightText)
            {
                BackgroundColor = Color.White, HorizontalOptions = LayoutOptions.Center
            };
            var showBubbleUpButton = new Forms9Patch.Button(bubbleUpText)
            {
                BackgroundColor = Color.White, HorizontalOptions = LayoutOptions.Center
            };
            var showBubbleDownButton = new Forms9Patch.Button(bubbleDownText)
            {
                BackgroundColor = Color.White, HorizontalOptions = LayoutOptions.Center
            };
            var showBubbleHzButton = new Forms9Patch.Button(bubbleHzText)
            {
                BackgroundColor = Color.White, HorizontalOptions = LayoutOptions.Center
            };
            var showBubbleVtButton = new Forms9Patch.Button(bubbleVtText)
            {
                BackgroundColor = Color.White, HorizontalOptions = LayoutOptions.Center
            };
            var showBubbleAnyButton = new Forms9Patch.Button(bubbleAnyText)
            {
                BackgroundColor = Color.White, HorizontalOptions = LayoutOptions.Center
            };
            var showBubbleNoneButton = new Forms9Patch.Button(bubbleNoneText)
            {
                BackgroundColor = Color.White, HorizontalOptions = LayoutOptions.Center
            };

            var bubblePointerDirectionControl = new SegmentedControl
            {
                Segments =
                {
                    new Segment("←"),
                    new Segment("↑"),
                    new Segment("→"),
                    new Segment("↓"),
                    new Segment("↔"),
                    new Segment("↕"),
                    new Segment("↔ ↕"),
                    new Segment(" ")
                },
                SyncSegmentFontSizes = false,
            };

            var cancelBubbleButton = new Forms9Patch.Button("CANCEL");

            var bubbleTarget = new Forms9Patch.Frame
            {
                OutlineWidth      = 1,
                OutlineColor      = Color.Black,
                OutlineRadius     = 4,
                Content           = new Forms9Patch.Label("BUBBLE TARGET"),
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
            };

            bubble = new BubblePopup(bubbleTarget)
            {
                Content = new Xamarin.Forms.StackLayout
                {
                    Children =
                    {
                        new Forms9Patch.Label("BubblePopup")
                        {
                            FontAttributes = FontAttributes.Bold
                        },
                        bubblePointerDirectionControl,
                        cancelBubbleButton
                    },
                },
            };

            bubblePointerDirectionControl.SegmentTapped += (sender, e) =>
            {
                switch (e.Segment.Text)
                {
                case "←": bubble.PointerDirection = PointerDirection.Left; break;

                case "↑": bubble.PointerDirection = PointerDirection.Up; break;

                case "→": bubble.PointerDirection = PointerDirection.Right; break;

                case "↓": bubble.PointerDirection = PointerDirection.Down; break;

                case "↔": bubble.PointerDirection = PointerDirection.Horizontal; break;

                case "↕": bubble.PointerDirection = PointerDirection.Vertical; break;

                case "↔↕": bubble.PointerDirection = PointerDirection.Any; break;

                case " ": bubble.PointerDirection = PointerDirection.None; break;
                }
            };

            cancelBubbleButton.Clicked += async(sender, e) => await bubble.CancelAsync();

            showBubbleLeftButton.Clicked  += OnBubbleButtonClicked;
            showBubbleRightButton.Clicked += OnBubbleButtonClicked;
            showBubbleUpButton.Clicked    += OnBubbleButtonClicked;
            showBubbleDownButton.Clicked  += OnBubbleButtonClicked;
            showBubbleHzButton.Clicked    += OnBubbleButtonClicked;
            showBubbleVtButton.Clicked    += OnBubbleButtonClicked;
            showBubbleAnyButton.Clicked   += OnBubbleButtonClicked;
            showBubbleNoneButton.Clicked  += OnBubbleButtonClicked;
            #endregion


            #region ActivityPopup
            Forms9Patch.Button showActivityPopupButton = new Forms9Patch.Button("ActivityIndicatorPopup")
            {
                BackgroundColor = Color.White
            };
            showActivityPopupButton.Clicked += (sender, e) =>
            {
                //var activity = Forms9Patch.ActivityIndicatorPopup.Create();
                _activity.CancelOnPageOverlayTouch = true;
                _activity.IsVisible = true;
            };
            #endregion


            #region PermissionPopup
            var showPermissionButton = new Forms9Patch.Button("PermissionPopup")
            {
                BackgroundColor = Color.White
            };
            showPermissionButton.Clicked += (sender, e) =>
            {
                var permission = PermissionPopup.Create("PermissionPopup", "Do you agree?");
                permission.HorizontalOptions = LayoutOption(_hzLayoutOptions);
                permission.VerticalOptions   = LayoutOption(_vtLayoutOptions);
                permission.OutlineColor      = Color.Blue;
                permission.HasShadow         = _hasShadow;
                permission.ShadowInverted    = _shadowInverted;
                permission.OutlineWidth      = _blueOutline ? 1 : 0;
            };
            #endregion


            #region Toast
            var showToastButton = new Forms9Patch.Button("Toast")
            {
                BackgroundColor = Color.White
            };
            showToastButton.Clicked += (sender, e) =>
            {
                var toast = Toast.Create("Toast", "... of the town!");
                toast.OutlineColor      = Color.Blue;
                toast.HasShadow         = _hasShadow;
                toast.ShadowInverted    = _shadowInverted;
                toast.OutlineWidth      = _blueOutline ? 1 : 0;
                toast.HorizontalOptions = LayoutOption(_hzLayoutOptions);
                toast.VerticalOptions   = LayoutOption(_vtLayoutOptions);
            };
            #endregion


            #region TargetedToast
            var showTargetedToash = new Forms9Patch.Button("TargetedToast")
            {
                BackgroundColor = Color.White
            };
            showTargetedToash.Clicked += (sender, e) =>
            {
                var toast = TargetedToast.Create(showTargetedToash, "TargetedToast", "... has the far getted most!");
                toast.OutlineColor      = Color.Blue;
                toast.HasShadow         = _hasShadow;
                toast.ShadowInverted    = _shadowInverted;
                toast.OutlineWidth      = _blueOutline ? 1 : 0;
                toast.HorizontalOptions = LayoutOption(_hzLayoutOptions);
                toast.VerticalOptions   = LayoutOption(_vtLayoutOptions);
            };
            #endregion


            #region TargetedMenu
            showTargetedMenu = new Forms9Patch.Button("TargetedMenu")
            {
                BackgroundColor = Color.White
            };
            var targetedMenu = new Forms9Patch.TargetedMenu(showTargetedMenu)
            {
                Segments =
                {
                    new Segment("Copy",       "<font face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\">&#xE14D;</font>"),
                    new Segment("Cut",        "<font face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\">&#xE14E;</font>"),
                    new Segment("Paste",      "<font face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\">&#xE14F;</font>"),
                    new Segment("Segment A"),
                    new Segment("Segment B"),
                    new Segment("Segment C"),
                    new Segment("Segment D"),
                    new Segment("Segment E"),
                    new Segment("Segment F"),
                    new Segment("Segment G"),
                    new Segment("Segment H"),
                },
                TextColor = Color.White
            };
            showTargetedMenu.Clicked += (s, e) =>
            {
                targetedMenu.IsVisible      = true;
                targetedMenu.HasShadow      = _hasShadow;
                targetedMenu.ShadowInverted = _shadowInverted;
                targetedMenu.IsVisible      = true;
            };
            targetedMenu.SegmentTapped += (s, e) => System.Diagnostics.Debug.WriteLine("TargetedMenu.SegmentTapped: " + e.Segment.Text);
            #endregion


            #region Vertical TargetedMenu
            var showVerticalTargetedMenu = new Forms9Patch.Button("Vertical TargetedMenu")
            {
                BackgroundColor = Color.White
            };
            var verticalTargetedMenu = new Forms9Patch.TargetedMenu(showVerticalTargetedMenu)
            {
                Orientation = StackOrientation.Vertical,
                Segments    =
                {
                    new Segment("Copy",       "<font face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\">&#xE14D;</font>"),
                    new Segment("Cut",        "<font face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\">&#xE14E;</font>"),
                    new Segment("Paste",      "<font face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\">&#xE14F;</font>"),
                    new Segment("Segment A"),
                    new Segment("Segment B"),
                    new Segment("Segment C"),
                    new Segment("Segment D"),
                    new Segment("Segment E"),
                    new Segment("Segment F"),
                    new Segment("Segment G"),
                    new Segment("Segment H"),
                },
            };
            showVerticalTargetedMenu.Clicked += (s, e) =>
            {
                //verticalTargetedMenu.OutlineColor = Color.Blue;
                verticalTargetedMenu.IsVisible      = true;
                verticalTargetedMenu.HasShadow      = _hasShadow;
                verticalTargetedMenu.ShadowInverted = _shadowInverted;
                verticalTargetedMenu.IsVisible      = true;
            };
            verticalTargetedMenu.SegmentTapped += (s, e) => System.Diagnostics.Debug.WriteLine("TargetedMenu.SegmentTapped: " + e.Segment.Text);
            #endregion


            #region SoftwareKeyboardTest

            var yearPicker = new Xamarin.Forms.Picker
            {
                Title       = "SELECT YEAR",
                ItemsSource = new List <string> {
                    "SELECT YEAR", "2000", "2001", "2002", "2003", "2004", "2005", "2006", "2006", "2008", "2009", "2010", "2011", "2012", "2013", "2014", "2015", "2016", "2017", "2018", "2019", "2020"
                },
                SelectedItem  = "SELECT YEAR",
                SelectedIndex = 0,
                TextColor     = Color.LightGray,
            };
            yearPicker.SelectedIndexChanged += (s, e) => yearPicker.TextColor = yearPicker.SelectedIndex == 0 ? Color.LightGray : Color.Blue;

            var monthPicker = new Xamarin.Forms.Picker
            {
                Title       = "SELECT MONTH",
                ItemsSource = new List <string> {
                    "SELECT MONTH", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
                },
                SelectedItem = "SELECT MONTH",
                TextColor    = Color.LightGray,
            };
            monthPicker.SelectedIndexChanged += (s, e) => monthPicker.TextColor = monthPicker.SelectedIndex == 0 ? Color.LightGray : Color.Blue;


            var softwareKeyboardTestButton = new Forms9Patch.Button("Software Keyboard Test")
            {
                BackgroundColor = Color.White
            };
            var softwareKeyboardTestPopup = new ModalPopup
            {
                HorizontalOptions = LayoutOption(_hzLayoutOptions),
                VerticalOptions   = LayoutOption(_vtLayoutOptions),
                Content           =
                    new Xamarin.Forms.StackLayout
                {
                    Children =
                    {
                        yearPicker,
                        monthPicker,
                        new Xamarin.Forms.Entry
                        {
                            Placeholder      = "ENTER FIRST NAME",
                            TextColor        = Color.Blue,
                            PlaceholderColor = Color.LightGray,
                        },
                        new Xamarin.Forms.Entry
                        {
                            Placeholder      = "ENTER LAST NAME",
                            TextColor        = Color.Blue,
                            PlaceholderColor = Color.LightGray,
                        },
                    }
                }
            };
            softwareKeyboardTestButton.Clicked += (s, e) =>
            {
                softwareKeyboardTestPopup.OutlineColor      = Color.Blue;
                softwareKeyboardTestPopup.HasShadow         = _hasShadow;
                softwareKeyboardTestPopup.ShadowInverted    = _shadowInverted;
                softwareKeyboardTestPopup.OutlineWidth      = _blueOutline ? 1 : 0;
                softwareKeyboardTestPopup.IsVisible         = true;
                softwareKeyboardTestPopup.HorizontalOptions = LayoutOption(_hzLayoutOptions);
                softwareKeyboardTestPopup.VerticalOptions   = LayoutOption(_vtLayoutOptions);
            };
            #endregion

            Content = new Xamarin.Forms.ScrollView
            {
                Content = new Xamarin.Forms.StackLayout
                {
                    Children =
                    {
                        new BoxView {
                            HeightRequest = 1
                        },
                        _decoration,
                        new Forms9Patch.Label("HZ LAYOUT ALIGNMENT:"),
                        _hzLayoutOptions,
                        new Forms9Patch.Label("VT LAYOUT ALIGNMENT:"),
                        _vtLayoutOptions,
                        new BoxView {
                            HeightRequest = 1
                        },
                        showModalButton,
                        showBubbleLeftButton,
                        showBubbleRightButton,
                        showBubbleUpButton,
                        showBubbleDownButton,
                        showBubbleHzButton,
                        showBubbleVtButton,
                        showBubbleAnyButton,
                        showBubbleNoneButton,
                        bubbleTarget,
                        showActivityPopupButton,
                        showPermissionButton,
                        showToastButton,
                        showTargetedToash,
                        showTargetedMenu,
                        showVerticalTargetedMenu,
                        softwareKeyboardTestButton,
                        new BoxView {
                            HeightRequest = 1
                        },
                    }
                }
            };

            _decoration.SegmentTapped += (s, e) =>
            {
                switch (e.Segment.Text)
                {
                case _hasShadowText:
                    _hasShadow = !_hasShadow;
                    break;

                case _shadowInvertedText:
                    _shadowInverted = !_shadowInverted;
                    break;

                case _blueOutlineText:
                    _blueOutline = !_blueOutline;
                    break;
                }
            };

            BackgroundColor = Color.LightSlateGray;
        }
예제 #46
0
 public static PickerEvents Events(this Picker This)
 {
     return(new PickerEvents(This));
 }
예제 #47
0
        //METHODS

        /**********************************************************************
         *********************************************************************/
        void CreateContent()
        {
            var scrollView = new Xamarin.Forms.ScrollView
            {
                Margin = new Thickness(10)
            };
            var stackLayout  = new StackLayout();
            var stackLayout2 = new StackLayout()
            {
                Orientation = StackOrientation.Horizontal
            };

            this.Content       = scrollView;
            scrollView.Content = stackLayout; //Wrap ScrollView around StackLayout to be able to scroll the content

            //add elements to stacklayout
            var l_MemorySize = new Label
            {
                FontSize = App._h3FontSize,
                Text     = "Memory Size"
            };
            var l_Exponent = new Label {
                Text = "Exponent: ", VerticalOptions = LayoutOptions.Center, FontSize = App._textFontSize
            };

            p_Exponent = new Xamarin.Forms.Picker()
            {
                FontSize = App._textFontSize, WidthRequest = 40
            };
            p_Exponent.Items.Add("1");
            p_Exponent.Items.Add("2");
            p_Exponent.Items.Add("3");
            p_Exponent.Items.Add("4");
            p_Exponent.Items.Add("5");
            p_Exponent.Items.Add("6");
            p_Exponent.Items.Add("7");
            p_Exponent.Items.Add("8");
            p_Exponent.Items.Add("9");
            p_Exponent.Items.Add("10");
            p_Exponent.Items.Add("11");
            p_Exponent.Items.Add("12");
            p_Exponent.Items.Add("13");
            p_Exponent.Items.Add("14");
            p_Exponent.Items.Add("15");                                         //been to lazy to programm a loop.sorry
            p_Exponent.SelectedIndex         = 4;                               //5
            p_Exponent.SelectedIndexChanged += P_Exponent_SelectedIndexChanged; //add method


            //TO DO: Fire Event when absoulute memorysize needs to be calculated
            l_AbsoluteMemorySize = new Label {
                Text = "Absoulute memory size: 32", FontSize = App._smallTextFontSize
            };
            var l_Space = new Label {
                Text = "  "
            };
            var b_Start = new Button
            {
                Text            = "Start",
                BackgroundColor = App._buttonBackground,
                TextColor       = App._buttonText,
                CornerRadius    = App._buttonCornerRadius,
                FontSize        = App._buttonFontSize
            };

            b_Start.Clicked += B_Start_Clicked; //add Click Event(Method)

            stackLayout.Children.Add(l_MemorySize);
            stackLayout2.Children.Add(l_Exponent);
            stackLayout2.Children.Add(p_Exponent);
            stackLayout.Children.Add(stackLayout2);
            stackLayout.Children.Add(l_AbsoluteMemorySize);
            stackLayout.Children.Add(l_Space);
            stackLayout.Children.Add(b_Start);
        }
예제 #48
0
        public void buildForm()
        {
            var mainLayout = new StackLayout
            {
                Padding = 20
            };


            this.Title = definition.Title;

            foreach (var el in definition.Elements)
            {
                switch (el.Type)
                {
                //Add Label
                case "Label":

                    var label = new Label
                    {
                        Text              = ((FormLabel)el).LabelText,
                        FontAttributes    = FontAttributes.Bold,
                        HorizontalOptions = LayoutOptions.FillAndExpand
                    };

                    //label.SetBinding(Label.TextProperty,$"FormElementCollection[{i}]",BindingMode.TwoWay);

                    mainLayout.Children.Add(label);
                    break;

                //Add Entry
                case "Entry":

                    mainLayout.Children.Add(new Label
                    {
                        Text = ((FormEntryField)el).LabelText,
                        HorizontalOptions = LayoutOptions.FillAndExpand
                    });

                    var _entry = new Entry
                    {
                        Placeholder       = ((FormEntryField)el).PlaceHolderText,
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        Keyboard          = el.NumKeyboard ? Keyboard.Telephone : Keyboard.Default
                    };

                    _entry.TextChanged += (sender, e) =>
                    {
                        ((FormEntryField)el).Text = e.NewTextValue;
                    };

                    mainLayout.Children.Add(_entry);

                    break;

                //Add text field
                case "TextField":
                    mainLayout.Children.Add(new Label
                    {
                        Text = ((FormTextField)el).LabelText,
                        HorizontalOptions = LayoutOptions.FillAndExpand
                    });

                    var editor = new EditorGrows                            //Editor
                    {
                        //Text = ((FormTextField)el).LabelText,
                        HorizontalOptions = LayoutOptions.FillAndExpand
                    };

                    editor.TextChanged += (sender, e) =>
                    {
                        ((FormTextField)el).Text = e.NewTextValue;
                    };

                    mainLayout.Children.Add(editor);

                    break;

                case "Picker":
                    mainLayout.Children.Add(new Label
                    {
                        Text = ((Picker)el).LabelText,
                        HorizontalOptions = LayoutOptions.FillAndExpand
                    });

                    var _picker = new Xamarin.Forms.Picker();
                    _picker.HorizontalOptions = LayoutOptions.FillAndExpand;

                    foreach (var option in ((Picker)el).Values)
                    {
                        _picker.Items.Add(option);
                    }

                    _picker.SelectedIndexChanged += (sender, e) =>
                    {
                        ((Picker)el).SelectedValue = ((Picker)el).Values[((Xamarin.Forms.Picker)sender).SelectedIndex];
                    };

                    mainLayout.Children.Add(_picker);

                    break;

                // ADD Switch
                case "Switch":

                    mainLayout.Children.Add(new Label
                    {
                        Text = ((FormSwitch)el).LabelText,
                        HorizontalOptions = LayoutOptions.FillAndExpand
                    });

                    var _switch = new Switch
                    {
                        IsToggled         = ((FormSwitch)el).DefaultValue,
                        HorizontalOptions = LayoutOptions.FillAndExpand
                    };

                    _switch.Toggled += (object sender, ToggledEventArgs e) =>
                    {
                        ((FormSwitch)el).Value = e.Value;
                    };

                    mainLayout.Children.Add(_switch);

                    break;

                // Add Datepicker
                case "DatePicker":

                    mainLayout.Children.Add(new Label
                    {
                        Text = ((DatePicker)el).LabelText,
                        HorizontalOptions = LayoutOptions.FillAndExpand
                    });

                    var datePicker = new Xamarin.Forms.DatePicker
                    {
                        HorizontalOptions = LayoutOptions.FillAndExpand
                    };

                    datePicker.DateSelected += (sender, e) => {
                        ((DatePicker)el).SelectedDate = e.NewDate;
                    };

                    mainLayout.Children.Add(datePicker);

                    break;

                default:
                    break;
                }
            }

            this.Content = new ScrollView
            {
                Content = mainLayout
            };
        }
        public dataPicker()
        {
            Grid gr = new Grid
            {
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                }
            };

            pick = new Xamarin.Forms.Picker
            {
                Title = "keeld"
            };
            pick.Items.Add("C#");
            pick.Items.Add("python");
            pick.Items.Add("C++");
            pick.Items.Add("VisualBasic");
            pick.Items.Add("Java");

            gr.Children.Add(pick, 0, 0);
            pick.SelectedIndexChanged += Pick_SelectedIndexChanged;

            editor = new Editor {
                Placeholder = "vali keel"
            };

            editor = new Editor {
                Placeholder = "vali keel nimekirjas"
            };
            gr.Children.Add(editor, 1, 0);

            dpicker = new DatePicker
            {
                Format      = "D",
                MinimumDate = DateTime.Now.AddDays(-10),
                MaximumDate = DateTime.Now.AddDays(10),
            };
            dpicker.DateSelected += Dpicker_DateSelected;

            gr.Children.Add(dpicker, 1, 1);

            entry = new Entry {
                Text = "vali kuupäev"
            };

            timepicker = new TimePicker()
            {
                Time = new TimeSpan(DateTime.Now.Hour + 2, DateTime.Now.Minute, DateTime.Now.Second)
            };
            Content = gr;

            frame = new Frame()
            {
                BorderColor     = Color.Purple,
                HasShadow       = true,
                BackgroundColor = Color.LightBlue,
                Content         = new Label {
                    Text = "хаю-хай"
                }
            };
        }
        public CarouselSnapGallery()
        {
            On <iOS>().SetLargeTitleDisplay(LargeTitleDisplayMode.Never);

            var viewModel = new CarouselItemsGalleryViewModel();

            Title = $"CarouselView Snap Options";

            var layout = new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Star
                    }
                }
            };

            var snapPointsStack = new StackLayout
            {
                Margin = new Thickness(12)
            };

            var snapPointsLabel = new Label {
                FontSize = 10, Text = "SnapPointsType:"
            };
            var snapPointsTypes = Enum.GetNames(typeof(SnapPointsType)).Select(b => b).ToList();

            var snapPointsTypePicker = new Xamarin.Forms.Picker
            {
                ItemsSource  = snapPointsTypes,
                SelectedItem = snapPointsTypes[1]
            };

            snapPointsStack.Children.Add(snapPointsLabel);
            snapPointsStack.Children.Add(snapPointsTypePicker);

            layout.Children.Add(snapPointsStack, 0, 0);

            var snapPointsAlignmentsStack = new StackLayout
            {
                Margin = new Thickness(12)
            };

            var snapPointsAlignmentsLabel = new Label {
                FontSize = 10, Text = "SnapPointsAlignment:"
            };
            var snapPointsAlignments = Enum.GetNames(typeof(SnapPointsAlignment)).Select(b => b).ToList();

            var snapPointsAlignmentPicker = new Xamarin.Forms.Picker
            {
                ItemsSource  = snapPointsAlignments,
                SelectedItem = snapPointsAlignments[0]
            };

            snapPointsAlignmentsStack.Children.Add(snapPointsAlignmentsLabel);
            snapPointsAlignmentsStack.Children.Add(snapPointsAlignmentPicker);

            layout.Children.Add(snapPointsAlignmentsStack, 0, 1);

            var itemsLayout = new LinearItemsLayout(ItemsLayoutOrientation.Horizontal)
            {
                SnapPointsType      = SnapPointsType.Mandatory,
                SnapPointsAlignment = SnapPointsAlignment.Start
            };

            var itemTemplate = GetCarouselTemplate();

            var carouselView = new CarouselView
            {
                ItemsLayout     = itemsLayout,
                ItemTemplate    = itemTemplate,
                BackgroundColor = Color.LightGray,
                PeekAreaInsets  = new Thickness(0, 0, 100, 0),
                Margin          = new Thickness(12),
                AutomationId    = "TheCarouselView"
            };

            carouselView.SetBinding(CarouselView.ItemsSourceProperty, "Items");

            layout.Children.Add(carouselView, 0, 2);


            snapPointsTypePicker.SelectedIndexChanged += (sender, e) =>
            {
                if (carouselView.ItemsLayout is LinearItemsLayout linearItemsLayout)
                {
                    Enum.TryParse(snapPointsTypePicker.SelectedItem.ToString(), out SnapPointsType snapPointsType);
                    linearItemsLayout.SnapPointsType = snapPointsType;
                }
            };

            snapPointsAlignmentPicker.SelectedIndexChanged += (sender, e) =>
            {
                if (carouselView.ItemsLayout is LinearItemsLayout linearItemsLayout)
                {
                    Enum.TryParse(snapPointsAlignmentPicker.SelectedItem.ToString(), out SnapPointsAlignment snapPointsAlignment);
                    linearItemsLayout.SnapPointsAlignment = snapPointsAlignment;
                }
            };

            Content        = layout;
            BindingContext = viewModel;
        }
예제 #51
0
        public ChooseRollesPage()
        {
            Xamarin.Forms.Grid grid = new Grid()
            {
                VerticalOptions = LayoutOptions.Fill,

                RowDefinitions =
                {
                    new RowDefinition {
                        Height = 35
                    },
                    new RowDefinition {
                        Height = 35
                    },
                    new RowDefinition {
                        Height = 35
                    },
                    new RowDefinition {
                        Height = 35
                    },
                    new RowDefinition {
                        Height = 35
                    },
                    new RowDefinition {
                        Height = 35
                    },
                    new RowDefinition {
                        Height = 35
                    },
                    new RowDefinition {
                        Height = 35
                    },
                    new RowDefinition {
                        Height = 35
                    },
                    new RowDefinition {
                        Height = 35
                    }
                },

                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = 20
                    },
                    new ColumnDefinition {
                        Width = 200
                    },
                    new ColumnDefinition {
                        Width = 150
                    }
                }
            };

            for (int i = 0; i < 10; i++)
            {
                grid.Children.Add(new Xamarin.Forms.Label
                {
                    VerticalTextAlignment = TextAlignment.Center,
                    BackgroundColor       = Color.White,
                    TextColor             = Color.Red,
                    Text          = (i + 1).ToString(),
                    FontSize      = 14,
                    HeightRequest = 35,
                    WidthRequest  = 50
                }, 0, i);
            }


            for (int i = 0; i < 10; i++)
            {
                grid.Children.Add(new Entry
                {
                    HeightRequest           = 16,
                    WidthRequest            = 151,
                    TextColor               = Color.Black,
                    FontSize                = 14,
                    FontAttributes          = FontAttributes.Bold,
                    HorizontalTextAlignment = TextAlignment.Start,
                    Placeholder             = "Player_" + (i + 1).ToString(),
                    PlaceholderColor        = Color.Red
                }, 1, i);
            }



            for (int i = 0; i < 10; i++)
            {
                grid.Children.Add(choosrollespgpicker[i] = new Xamarin.Forms.Picker
                {
                    BackgroundColor = Color.White,
                    TextColor       = Color.Red,
                    HeightRequest   = 25,
                    WidthRequest    = 140
                }, 2, i);
            }

            for (int i = 0; i < 10; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    choosrollespgpicker[i].Items.Add(Rolles[j].ToString());
                }

                choosrollespgpicker[i].SelectedIndexChanged += ChooseRollesPage_SelectedIndexChanged;
            }


            gotogame.BackgroundColor = Color.White;
            gotogame.WidthRequest    = 30;
            gotogame.HeightRequest   = 30;
            gotogame.Text            = "ВПЕРЕД";
            gotogame.Clicked        += Gotogame_Clicked;
            gotogame.TextColor       = Color.Red;
            gotogame.BorderRadius    = 10;
            gotogame.BorderColor     = Color.Black;
            gotogame.FontSize        = 14;


            StackLayout stackLayout = new StackLayout()
            {
                Children = { grid, gotogame }
            };

            stackLayout.Orientation = StackOrientation.Vertical;
            stackLayout.Spacing     = 8;
            stackLayout.Margin      = 10;
            this.Content            = stackLayout;
            this.BackgroundImage    = "SaluteLMC.png";
        }
예제 #52
0
        public FormsPage()
        {
            JsonSerialize json  = new JsonSerialize();
            var           _form = json.parseJson();

            var mainLayout = new StackLayout
            {
                Padding = 20
            };

            this.Title = _form.Title;

            foreach (var el in _form.Elements)
            {
                switch (el.Type)
                {
                //Add Label
                case "Label":

                    mainLayout.Children.Add(new Label
                    {
                        Text              = ((FormLabel)el).LabelText,
                        FontAttributes    = FontAttributes.Bold,
                        HorizontalOptions = LayoutOptions.FillAndExpand
                    });
                    break;

                //Add Entry
                case "Entry":

                    mainLayout.Children.Add(new Label
                    {
                        Text = ((FormEntryField)el).LabelText,
                        HorizontalOptions = LayoutOptions.FillAndExpand
                    });
                    mainLayout.Children.Add(new Entry
                    {
                        Placeholder       = ((FormEntryField)el).PlaceHolderText,
                        HorizontalOptions = LayoutOptions.FillAndExpand
                    });
                    break;

                //Add text field
                case "TextField":
                    mainLayout.Children.Add(new Label
                    {
                        Text = ((FormTextField)el).LabelText,
                        HorizontalOptions = LayoutOptions.FillAndExpand
                    });
                    mainLayout.Children.Add(new Editor
                    {
                        //Text = ((FormTextField)el).LabelText,
                        HorizontalOptions = LayoutOptions.FillAndExpand
                    });
                    break;

                case "Picker":
                    mainLayout.Children.Add(new Label
                    {
                        Text = ((Picker)el).LabelText,
                        HorizontalOptions = LayoutOptions.FillAndExpand
                    });

                    var _picker = new Xamarin.Forms.Picker();
                    _picker.HorizontalOptions = LayoutOptions.FillAndExpand;

                    foreach (var option in ((Picker)el).Values)
                    {
                        _picker.Items.Add(option);
                    }

                    mainLayout.Children.Add(_picker);

                    break;

                case "Switch":

                    mainLayout.Children.Add(new Label
                    {
                        Text = ((FormSwitch)el).LabelText,
                        HorizontalOptions = LayoutOptions.FillAndExpand
                    });
                    mainLayout.Children.Add(new Switch
                    {
                        IsToggled         = ((FormSwitch)el).DefaultValue,
                        HorizontalOptions = LayoutOptions.FillAndExpand
                    });

                    break;

                case "DatePicker":

                    mainLayout.Children.Add(new Label
                    {
                        Text = ((DatePicker)el).LabelText,
                        HorizontalOptions = LayoutOptions.FillAndExpand
                    });
                    mainLayout.Children.Add(new Xamarin.Forms.DatePicker
                    {
                        HorizontalOptions = LayoutOptions.FillAndExpand
                    });

                    break;

                default:
                    break;
                }
            }

            this.Content = mainLayout;
        }
예제 #53
0
        /**********************************************************************
         *********************************************************************/
        Dictionary <String, Xamarin.Forms.Picker> CreatePickers(
            StackLayout layout,
            Dictionary <String, Xamarin.Forms.Picker> dict,
            Dictionary <String, StackLayout> layoutDict,
            Dictionary <String, Label> labelDict)
        {
            // create container stacklayout which will hold all upcoming resource layouts. First add a layout of 5 labels
            StackLayout containerStackLayout = new StackLayout {
                Orientation = StackOrientation.Horizontal
            };

            StackLayout labelStackLayout = new StackLayout {/*BackgroundColor = Color.Aqua*/
            };

            for (int i = 0; i < 5; i++)
            {
                Label label = new Label
                {
                    Text            = "P" + i + ": ",
                    FontSize        = App._textFontSize,
                    VerticalOptions = LayoutOptions.CenterAndExpand
                };
                labelDict.Add("P" + i + ": ", label);
                labelStackLayout.Children.Add(label);
            }
            containerStackLayout.Children.Add(labelStackLayout);

            /*________________________________________________________________*/
            // create a vertical stacklayout for every resource and add pickers
            foreach (string resourceName in resourceNameList)
            {
                StackLayout resourceStackLayout = new StackLayout {
                    Orientation = StackOrientation.Vertical
                };
                resourceStackLayout.AutomationId = resourceName;
                layoutDict.Add(resourceName, resourceStackLayout);

                // add 5 new pickers to the stacklayout
                for (int i = 0; i < 5; i++)
                {
                    String key = resourceName + i;

                    Xamarin.Forms.Picker picker = new Xamarin.Forms.Picker()
                    {
                        FontSize                = App._textFontSize,
                        WidthRequest            = 38,                  //do not change
                        HorizontalTextAlignment = TextAlignment.Center //do not change
                    };
                    picker.Items.Add("0");
                    picker.SelectedIndex         = 0;
                    picker.SelectedIndexChanged += PickerChanged;
                    picker.AutomationId          = key;
                    resourceStackLayout.Children.Add(picker);
                    dict.Add(key, picker);
                }

                //add vertical stacklayouts to horizontal container layout
                containerStackLayout.Children.Add(resourceStackLayout);
            }
            layout.Children.Add(containerStackLayout);
            return(dict);
        }
        public SwipeTransitionModeGallery()
        {
            Title = "SwipeTransitionMode Gallery";

            var scroll = new Xamarin.Forms.ScrollView();

            var swipeLayout = new StackLayout
            {
                Margin = new Thickness(12)
            };

            var instructions = new Label
            {
                BackgroundColor = Color.Black,
                TextColor       = Color.White,
                Text            = "This Gallery use a Platform Specific only available for Android and iOS."
            };

            swipeLayout.Children.Add(instructions);

            var swipeItemSwipeTransitionModeLabel = new Label
            {
                FontSize = 10,
                Text     = "SwipeTransitionMode:"
            };

            swipeLayout.Children.Add(swipeItemSwipeTransitionModeLabel);

            var swipeItemSwipeTransitionModePicker = new Xamarin.Forms.Picker();

            var swipeTransitionModes = Enum.GetNames(typeof(Xamarin.Forms.PlatformConfiguration.AndroidSpecific.SwipeTransitionMode)).Select(t => t).ToList();

            swipeItemSwipeTransitionModePicker.ItemsSource   = swipeTransitionModes;
            swipeItemSwipeTransitionModePicker.SelectedIndex = 0;               // Reveal

            swipeLayout.Children.Add(swipeItemSwipeTransitionModePicker);

            var deleteSwipeItem = new SwipeItem
            {
                BackgroundColor = Color.Red,
                IconImageSource = "delete.png",
                Text            = "Delete"
            };

            deleteSwipeItem.Invoked += (sender, e) => { DisplayAlert("SwipeView", "Delete Invoked", "Ok"); };

            var swipeItems = new SwipeItems {
                deleteSwipeItem
            };

            swipeItems.Mode = SwipeMode.Reveal;

            var leftSwipeContent = new Grid
            {
                BackgroundColor = Color.Gray
            };

            var leftSwipeLabel = new Label
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                Text = "Swipe to Right"
            };

            leftSwipeContent.Children.Add(leftSwipeLabel);

            var leftSwipeView = new Xamarin.Forms.SwipeView
            {
                HeightRequest = 60,
                WidthRequest  = 300,
                LeftItems     = swipeItems,
                Content       = leftSwipeContent
            };

            swipeLayout.Children.Add(leftSwipeView);

            var rightSwipeContent = new Grid
            {
                BackgroundColor = Color.Gray
            };

            var rightSwipeLabel = new Label
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                Text = "Swipe to Left"
            };

            rightSwipeContent.Children.Add(rightSwipeLabel);

            var rightSwipeView = new Xamarin.Forms.SwipeView
            {
                HeightRequest = 60,
                WidthRequest  = 300,
                RightItems    = swipeItems,
                Content       = rightSwipeContent
            };

            swipeLayout.Children.Add(rightSwipeView);

            var topSwipeContent = new Grid
            {
                BackgroundColor = Color.Gray
            };

            var topSwipeLabel = new Label
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                Text = "Swipe to Top"
            };

            topSwipeContent.Children.Add(topSwipeLabel);

            var topSwipeView = new Xamarin.Forms.SwipeView
            {
                HeightRequest = 60,
                WidthRequest  = 300,
                BottomItems   = swipeItems,
                Content       = topSwipeContent
            };

            swipeLayout.Children.Add(topSwipeView);

            var bottomSwipeContent = new Grid
            {
                BackgroundColor = Color.Gray
            };

            var bottomSwipeLabel = new Label
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                Text = "Swipe to Bottom"
            };

            bottomSwipeContent.Children.Add(bottomSwipeLabel);

            var bottomSwipeView = new Xamarin.Forms.SwipeView
            {
                HeightRequest = 60,
                WidthRequest  = 300,
                TopItems      = swipeItems,
                Content       = bottomSwipeContent
            };

            swipeLayout.Children.Add(bottomSwipeView);

            swipeItemSwipeTransitionModePicker.SelectedIndexChanged += (sender, e) =>
            {
                var swipeTransitionMode = swipeItemSwipeTransitionModePicker.SelectedItem;

                switch (swipeTransitionMode)
                {
                case "Drag":
                    leftSwipeView.On <Android>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.AndroidSpecific.SwipeTransitionMode.Drag);
                    leftSwipeView.On <iOS>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.iOSSpecific.SwipeTransitionMode.Drag);

                    rightSwipeView.On <Android>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.AndroidSpecific.SwipeTransitionMode.Drag);
                    rightSwipeView.On <iOS>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.iOSSpecific.SwipeTransitionMode.Drag);

                    topSwipeView.On <Android>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.AndroidSpecific.SwipeTransitionMode.Drag);
                    topSwipeView.On <iOS>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.iOSSpecific.SwipeTransitionMode.Drag);

                    bottomSwipeView.On <Android>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.AndroidSpecific.SwipeTransitionMode.Drag);
                    bottomSwipeView.On <iOS>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.iOSSpecific.SwipeTransitionMode.Drag);
                    break;

                case "Reveal":
                    leftSwipeView.On <Android>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.AndroidSpecific.SwipeTransitionMode.Reveal);
                    leftSwipeView.On <iOS>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.iOSSpecific.SwipeTransitionMode.Reveal);

                    rightSwipeView.On <Android>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.AndroidSpecific.SwipeTransitionMode.Drag);
                    rightSwipeView.On <iOS>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.iOSSpecific.SwipeTransitionMode.Drag);

                    topSwipeView.On <Android>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.AndroidSpecific.SwipeTransitionMode.Drag);
                    topSwipeView.On <iOS>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.iOSSpecific.SwipeTransitionMode.Drag);

                    bottomSwipeView.On <Android>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.AndroidSpecific.SwipeTransitionMode.Drag);
                    bottomSwipeView.On <iOS>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.iOSSpecific.SwipeTransitionMode.Drag);
                    break;
                }
            };

            scroll.Content = swipeLayout;

            Content = scroll;
        }
예제 #55
0
        //METHODS

        /**********************************************************************
         *********************************************************************/
        void CreateContent()
        {
            // View
            var scrollView = new Xamarin.Forms.ScrollView
            {
                Margin = new Thickness(10)
            };
            var stackLayout = new StackLayout();

            this.Content       = scrollView;
            scrollView.Content = stackLayout; //Wrap ScrollView around StackLayout to be able to scroll the content

            // Algorithm selection
            var l_Algorithm = new Label {
                Text = "Algorithm", FontSize = App._h3FontSize
            };

            p_Algorithm = new Xamarin.Forms.Picker {
                Title = "Select a Strategy", FontSize = App._textFontSize
            };
            p_Algorithm.Items.Add("First Fit");
            p_Algorithm.Items.Add("Next Fit");
            p_Algorithm.Items.Add("Best Fit");
            p_Algorithm.Items.Add("Worst Fit");
            p_Algorithm.Items.Add("Combined Fit");
            p_Algorithm.SelectedIndex = 0; //pre selects First Fit
            var l_Space = new Label {
                Text = " "
            };

            stackLayout.Children.Add(l_Algorithm);
            stackLayout.Children.Add(p_Algorithm);
            stackLayout.Children.Add(l_Space);

            // Fragmentation input
            var l_Fragmentation = new Label {
                Text = "Fragmentation", FontSize = App._h3FontSize
            };

            e_Fragmentation = new Xamarin.Forms.Entry {
                Keyboard = Keyboard.Telephone, Text = "10,4,20,18,7,9,12,15", FontSize = App._textFontSize
            };
            var b_Default = new Button
            {
                Text = "Default",
                HorizontalOptions = LayoutOptions.Start,
                BackgroundColor   = App._buttonBackground,
                TextColor         = App._buttonText,
                CornerRadius      = App._buttonCornerRadius,
                FontSize          = App._smallButtonFontSize
            };

            b_Default.Clicked += (sender, e) => e_Fragmentation.Text = "10,4,20,18,7,9,12,15";
            var l_Space2 = new Label {
                Text = " "
            };

            stackLayout.Children.Add(l_Fragmentation);
            stackLayout.Children.Add(e_Fragmentation);
            stackLayout.Children.Add(b_Default);
            stackLayout.Children.Add(l_Space2);

            // Application Start
            var b_Start = new Button
            {
                Text            = "Start",
                BackgroundColor = App._buttonBackground,
                TextColor       = App._buttonText,
                CornerRadius    = App._buttonCornerRadius,
                FontSize        = App._buttonFontSize
            };

            b_Start.Clicked += B_Start_Clicked;
            stackLayout.Children.Add(b_Start);
        }
예제 #56
0
        public IndicatorCodeGallery()
        {
            Title = "IndicatorView Gallery";

            On <iOS>().SetLargeTitleDisplay(LargeTitleDisplayMode.Never);

            var nItems = 10;

            var layout = new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Star
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    }
                }
            };

            var itemsLayout = new LinearItemsLayout(ItemsLayoutOrientation.Horizontal)
            {
                SnapPointsType      = SnapPointsType.MandatorySingle,
                SnapPointsAlignment = SnapPointsAlignment.Center
            };

            var itemTemplate = ExampleTemplates.CarouselTemplate();

            var carouselView = new CarouselView
            {
                ItemsLayout     = itemsLayout,
                ItemTemplate    = itemTemplate,
                BackgroundColor = Color.LightGray,
                AutomationId    = "TheCarouselView"
            };

            layout.Children.Add(carouselView);

            var generator = new ItemsSourceGenerator(carouselView, nItems, ItemsSourceType.ObservableCollection);

            layout.Children.Add(generator);

            generator.GenerateItems();

            var indicatorView = new IndicatorView
            {
                HorizontalOptions      = LayoutOptions.Center,
                Margin                 = new Thickness(12, 6, 12, 12),
                IndicatorColor         = Color.Gray,
                SelectedIndicatorColor = Color.Black,
                IndicatorsShape        = IndicatorShape.Square,
                AutomationId           = "TheIndicatorView"
            };

            carouselView.IndicatorView = indicatorView;

            layout.Children.Add(indicatorView);

            var stckColors = new StackLayout {
                Orientation = StackOrientation.Horizontal
            };

            stckColors.Children.Add(new Label {
                VerticalOptions = LayoutOptions.Center, Text = "IndicatorColor"
            });

            var colors = new List <string>
            {
                "Black",
                "Blue",
                "Red"
            };

            var colorsPicker = new Xamarin.Forms.Picker
            {
                ItemsSource  = colors,
                WidthRequest = 150
            };

            colorsPicker.SelectedIndex = 0;

            colorsPicker.SelectedIndexChanged += (s, e) =>
            {
                var selectedIndex = colorsPicker.SelectedIndex;

                switch (selectedIndex)
                {
                case 0:
                    indicatorView.IndicatorColor = Color.Black;
                    break;

                case 1:
                    indicatorView.IndicatorColor = Color.Blue;
                    break;

                case 2:
                    indicatorView.IndicatorColor = Color.Red;
                    break;
                }
            };

            stckColors.Children.Add(colorsPicker);

            layout.Children.Add(stckColors);

            var stckTemplate = new StackLayout {
                Orientation = StackOrientation.Horizontal
            };

            stckTemplate.Children.Add(new Label {
                VerticalOptions = LayoutOptions.Center, Text = "IndicatorTemplate"
            });

            var templates = new List <string>
            {
                "Circle",
                "Square",
                "Template"
            };

            var templatePicker = new Xamarin.Forms.Picker
            {
                ItemsSource  = templates,
                WidthRequest = 150,
                TextColor    = Color.Black
            };

            templatePicker.SelectedIndexChanged += (s, e) =>
            {
                var selectedIndex = templatePicker.SelectedIndex;

                switch (selectedIndex)
                {
                case 0:
                    indicatorView.IndicatorTemplate = null;
                    indicatorView.IndicatorsShape   = IndicatorShape.Circle;
                    break;

                case 1:
                    indicatorView.IndicatorTemplate = null;
                    indicatorView.IndicatorsShape   = IndicatorShape.Square;
                    break;

                case 2:
                    indicatorView.IndicatorTemplate = ExampleTemplates.IndicatorTemplate();
                    break;
                }
            };

            templatePicker.SelectedIndex = 0;

            stckTemplate.Children.Add(templatePicker);

            layout.Children.Add(stckTemplate);

            var stckSize = new StackLayout {
                Orientation = StackOrientation.Horizontal
            };

            stckSize.Children.Add(new Label {
                VerticalOptions = LayoutOptions.Center, Text = "Indicator Size"
            });

            indicatorView.IndicatorSize = 10;

            var sizeSlider = new Xamarin.Forms.Slider
            {
                WidthRequest      = 150,
                Value             = indicatorView.IndicatorSize,
                MaximumTrackColor = Color.Gray,
                Maximum           = 20,
                MinimumTrackColor = Color.LightGray,
                Minimum           = 1
            };

            sizeSlider.ValueChanged += (s, e) =>
            {
                var indicatorSize = sizeSlider.Value;
                indicatorView.IndicatorSize = indicatorSize;
            };

            stckSize.Children.Add(sizeSlider);

            layout.Children.Add(stckSize);

            Grid.SetRow(generator, 0);
            Grid.SetRow(stckColors, 1);
            Grid.SetRow(stckTemplate, 2);
            Grid.SetRow(stckSize, 3);
            Grid.SetRow(carouselView, 4);
            Grid.SetRow(indicatorView, 5);

            Content = layout;
        }
예제 #57
0
        //METHODS

        /**********************************************************************
         *********************************************************************/
        void CreateContent()
        {
            var scrollView = new Xamarin.Forms.ScrollView
            {
                Margin = new Thickness(10)
            };
            var stackLayout = new StackLayout();

            var stackLayout2 = new StackLayout
            {
                Orientation = StackOrientation.Horizontal
            };
            var stackLayout3 = new StackLayout
            {
                Orientation = StackOrientation.Horizontal
            };

            this.Content       = scrollView;
            scrollView.Content = stackLayout;             //Wrap ScrollView around StackLayout to be able to scroll the content

            //add elements to stackLayout2
            var l_Tahoe = new Label {
                VerticalOptions = LayoutOptions.Center,
                Text            = "TCP Tahoe",
                TextColor       = Color.Blue,
                FontSize        = App._textFontSize
            };

            s_Tahoe           = new Switch();
            s_Tahoe.IsToggled = true;
            s_Tahoe.Toggled  += S_Tahoe_Toggled; //adds an event

            var l_Space4 = new Label {
                HorizontalOptions = LayoutOptions.FillAndExpand, Text = " "
            };

            var l_Reno = new Label {
                VerticalOptions = LayoutOptions.Center,
                Text            = "TCP Reno",
                TextColor       = Color.Red,
                FontSize        = App._textFontSize
            };

            s_Reno           = new Switch();
            s_Reno.IsToggled = true;
            s_Reno.Toggled  += S_Reno_Toggled; // adds an event

            stackLayout2.Children.Add(l_Tahoe);
            stackLayout2.Children.Add(s_Tahoe);
            stackLayout2.Children.Add(l_Space4);
            stackLayout2.Children.Add(l_Reno);
            stackLayout2.Children.Add(s_Reno);

            //add elements to stacklayout
            var l_Choose = new Label {
                Text = "Strategy", FontSize = App._h3FontSize
            };
            var l_Space = new Label {
                Text = "  "
            };
            var l_initialSetting = new Label {
                Text = "Initial Settings", FontSize = App._h3FontSize
            };
            var l_thresh = new Label {
                Text = "Threshold:", VerticalOptions = LayoutOptions.Center, FontSize = App._textFontSize
            };

            p_Treshold = new Xamarin.Forms.Picker {
                FontSize = App._textFontSize
            };
            //p_Treshold.Items.Add("1");
            p_Treshold.Items.Add("2");
            p_Treshold.Items.Add("3");
            p_Treshold.Items.Add("4");
            p_Treshold.Items.Add("5");
            p_Treshold.Items.Add("6");
            p_Treshold.Items.Add("7");
            p_Treshold.Items.Add("8");
            p_Treshold.Items.Add("9");
            p_Treshold.Items.Add("10");
            p_Treshold.Items.Add("11");
            p_Treshold.Items.Add("12");
            p_Treshold.Items.Add("13");
            p_Treshold.Items.Add("14");
            p_Treshold.Items.Add("15");
            p_Treshold.SelectedIndex = 7; //8
            var l_Space2 = new Label {
                Text = "  "
            };
            var b_Default = new Button {
                Text            = "Default", HorizontalOptions = LayoutOptions.Start,
                BackgroundColor = App._buttonBackground,
                TextColor       = App._buttonText,
                CornerRadius    = App._buttonCornerRadius,
                FontSize        = App._smallButtonFontSize
            };

            b_Default.Clicked += B_Default_Clicked; //add Click Event(Method)
            var b_Start = new Button {
                Text            = "Start",
                BackgroundColor = App._buttonBackground,
                TextColor       = App._buttonText,
                CornerRadius    = App._buttonCornerRadius,
                FontSize        = App._buttonFontSize,
            };

            b_Start.Clicked += B_Start_Clicked;             //add Click Event(Method)
            var l_Space3 = new Label {
                Text = "  "
            };

            stackLayout.Children.Add(l_Choose);
            stackLayout.Children.Add(stackLayout2);
            stackLayout.Children.Add(l_Space);
            stackLayout.Children.Add(l_initialSetting);
            stackLayout3.Children.Add(l_thresh);
            stackLayout3.Children.Add(p_Treshold);
            stackLayout.Children.Add(stackLayout3);
            stackLayout.Children.Add(l_Space2);
            stackLayout.Children.Add(b_Default);
            stackLayout.Children.Add(l_Space3);
            stackLayout.Children.Add(b_Start);
        }
예제 #58
0
 public PickerEvents(Picker This)
     : base(This)
 {
     this.This = This;
 }
예제 #59
0
        //METHODS

        /**********************************************************************
         *********************************************************************/
        void CreateContent()
        {
            var scrollView = new Xamarin.Forms.ScrollView
            {
                Margin = new Thickness(10)
            };
            var stackLayout = new StackLayout();

            var stackLayout2 = new StackLayout
            {
                Orientation = StackOrientation.Horizontal
            };

            var stackLayout3 = new StackLayout
            {
                Orientation = StackOrientation.Horizontal
            };

            this.Content       = scrollView;
            scrollView.Content = stackLayout;             //Wrap ScrollView around StackLayout to be able to scroll the content

            //define and add elements to stacklayout
            var l_Strategy = new Label {
                Text = "Strategy", FontSize = App._h3FontSize
            };

            p_Strategy = new Xamarin.Forms.Picker()
            {
                FontSize = App._textFontSize
            };
            p_Strategy.Items.Add("Go Back N");
            p_Strategy.Items.Add("Selective Repeat");
            p_Strategy.SelectedIndex = 0;//Go Back N
            var l_Space = new Label {
                Text = "  "
            };

            var l_WindowSize = new Label {
                Text = "Window Size", FontSize = App._h3FontSize
            };

            p_WindowSize = new Xamarin.Forms.Picker()
            {
                FontSize = App._textFontSize
            };
            p_WindowSize.Items.Add("2");
            p_WindowSize.Items.Add("3");
            p_WindowSize.Items.Add("4");
            p_WindowSize.Items.Add("5");
            p_WindowSize.SelectedIndex = 3;//5
            var l_Space2 = new Label {
                Text = "  "
            };

            var l_Timeout = new Label {
                Text = "Timeout =", FontSize = App._h3FontSize
            };

            l_TimeoutValue = new Label {
                Text = "11", VerticalOptions = LayoutOptions.Center, FontSize = App._textFontSize
            };
            s_Timeout = new Xamarin.Forms.Slider(11, 20, 11); //min, max, val
            s_Timeout.HorizontalOptions = LayoutOptions.FillAndExpand;
            s_Timeout.ValueChanged     += S_Timeout_ValueChanged;;
            //s_Timeout.Minimum = 0.0f; //minimum roundtrip time
            //s_Timeout.Maximum = 10.0f; //maximum roundtrip time
            var l_TimeoutMi = new Label {
                VerticalOptions = LayoutOptions.Center,
                FontSize        = App._textFontSize,
                Text            = "11"
            };
            var l_TimeoutMa = new Label {
                VerticalOptions = LayoutOptions.Center,
                FontSize        = App._textFontSize,
                Text            = "20"
            };
            var l_RoundtripTime = new Label {
                FontSize = App._smallTextFontSize,
                Text     = "Round Trip Time: 10"
            };
            var l_Space3 = new Label {
                Text = "  "
            };

            var b_Start = new Button {
                Text            = "Start",
                BackgroundColor = App._buttonBackground,
                TextColor       = App._buttonText,
                CornerRadius    = App._buttonCornerRadius,
                FontSize        = App._buttonFontSize
            };

            b_Start.Clicked += B_Start_Clicked;             //add Click Event(Method)

            stackLayout3.Children.Add(l_Timeout);
            stackLayout3.Children.Add(l_TimeoutValue);

            stackLayout2.Children.Add(l_TimeoutMi);
            stackLayout2.Children.Add(s_Timeout);
            stackLayout2.Children.Add(l_TimeoutMa);

            stackLayout.Children.Add(l_Strategy);
            stackLayout.Children.Add(p_Strategy);
            stackLayout.Children.Add(l_Space);
            stackLayout.Children.Add(l_WindowSize);
            stackLayout.Children.Add(p_WindowSize);
            stackLayout.Children.Add(l_Space2);
            stackLayout.Children.Add(stackLayout3);
            stackLayout.Children.Add(stackLayout2);
            stackLayout.Children.Add(l_RoundtripTime);
            stackLayout.Children.Add(l_Space3);
            stackLayout.Children.Add(b_Start);
        }
        public Osnova()
        {
            InitializeComponent();
            Grid   grd = new Grid();
            Picker pick;
            //------------------------------------------------------------
            //Колонны
            ColumnDefinition colDef1 = new ColumnDefinition();
            ColumnDefinition colDef2 = new ColumnDefinition();

            grd.ColumnDefinitions.Add(colDef1);
            grd.ColumnDefinitions.Add(colDef2);
            //Ряды
            RowDefinition rowDef1 = new RowDefinition();
            RowDefinition rowDef2 = new RowDefinition();
            RowDefinition rowDef3 = new RowDefinition();

            grd.RowDefinitions.Add(rowDef1);
            grd.RowDefinitions.Add(rowDef2);
            grd.RowDefinitions.Add(rowDef3);


            //-------------------------------------------------------------
            //Datepicker
            date = new DatePicker
            {
                Format      = "D",
                MinimumDate = DateTime.Now.AddDays(-10),
                MaximumDate = DateTime.Now.AddDays(+10),
            };
            date.DateSelected += Date_DateSelected;
            grd.Children.Add(date, 0, 1);
            //Picker
            pick = new Picker
            {
                Title = "Choose language"
            };
            pick.Items.Add("C#");
            pick.Items.Add("Python");
            pick.Items.Add("C++");
            pick.Items.Add("BisualBasic");
            pick.Items.Add("Java");
            pick.SelectedIndexChanged += Pick_SelectedIndexChanged;
            grd.Children.Add(pick, 0, 0);
            //Editor
            edit = new Editor {
                Placeholder = "Choose language \nIn left column"
            };
            grd.Children.Add(edit, 1, 0);

            //Entry
            entr = new Entry
            {
                Text = "Choose date",
            };
            grd.Children.Add(entr, 1, 1);
            //Frame
            frm = new Frame {
                BackgroundColor = Color.LightGray
            };
            {
            };
            grd.Children.Add(frm, 0, 2);
            Grid.SetColumnSpan(frm, 2);

            //Timepicker СИНХРОНИЗИРОВАННОЕ ВРЕМЯ!!! -------------------------------------------------------------------------------------------------

            /* time = new TimePicker
             * {
             *   Time = new TimeSpan(18, 0, 0),
             *   Time = new TimeSpan (DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second)
             * };
             * grd.Children.Add(time, 1, 1);
             */
            Content = grd;
        }