// this is called by TS when the command is started public override List<InputDefinition> DefineInput() { List<InputDefinition> inputList = new List<InputDefinition>(); Picker myPicker = new Picker(); ModelObject myPart1 = myPicker.PickObject(Picker.PickObjectEnum.PICK_ONE_PART); ModelObject myPart2 = myPicker.PickObject(Picker.PickObjectEnum.PICK_ONE_PART); InputDefinition input1 = new InputDefinition(myPart1.Identifier); InputDefinition input2 = new InputDefinition(myPart2.Identifier); inputList.Add(input1); inputList.Add(input2); return inputList; }
protected override void Init() { var picker = new Picker { IsEnabled = false }; picker.Items.Add("item"); picker.Items.Add("item 2"); Content = new StackLayout { Children = { picker, new Button { Command = new Command(() => { if (picker.IsEnabled) picker.IsEnabled = false; else picker.IsEnabled = true; }), Text = "Enable/Disable Picker" } } }; }
protected override void Init () { var picker = new Picker () { Items = {"Leonardo", "Donatello", "Raphael", "Michaelangelo" } }; var label = new Label () {Text = "This test is successful if the picker below spans the width of the screen. If the picker is just a sliver on the left edge of the screen, this test has failed." }; Content = new StackLayout () { Children = {label, picker}}; }
static void Main(string[] args) { Console.Write("TestBot"); var rounds = int.Parse(Console.ReadLine()); var rand = new Random(rounds ^ Magic); picker = new Picker<Move>(rand); picker.AddItem(Move.Paper, 100d / 3d); picker.AddItem(Move.Rock, 100d / 3d); picker.AddItem(Move.Scissors, 100d / 3d); var patternEnumerator = CreatePattern(rounds, rand).GetEnumerator(); while (true) { patternEnumerator.MoveNext(); Console.Write((int)patternEnumerator.Current); int opponent; if (int.TryParse(Console.ReadLine(), out opponent)) { } else break; } }
/// <summary> /// combined event for content / media / member /// </summary> /// <param name="sender"></param> /// <param name="savedEntities"></param> private void Saved(IService sender, IEnumerable<IContentBase> savedEntities) { foreach (IContentBase savedEntity in savedEntities) { // for each property foreach (PropertyType propertyType in savedEntity.PropertyTypes.Where(x => PickerPropertyValueConverter.IsPicker(x.PropertyEditorAlias))) { // create picker supplying all values Picker picker = new Picker(savedEntity.Id, propertyType.Alias, propertyType.DataTypeDefinitionId, savedEntity.GetValue(propertyType.Alias)); if (!string.IsNullOrWhiteSpace(picker.RelationTypeAlias)) { bool isRelationsOnly = picker.GetDataTypePreValue("saveFormat").Value == "relationsOnly"; if (isRelationsOnly) { if (picker.SavedValue == null) { picker.PickedKeys = new string[] { }; } else { // manually set on picker obj, so it doesn't then attempt to read picked keys from the database picker.PickedKeys = SaveFormat.GetSavedKeys(picker.SavedValue.ToString()).ToArray(); // delete saved value (setting it to null) //savedEntity.SetValue(propertyType.Alias, null); //if (sender is IContentService) //{ // ((IContentService)sender).Save((IContent)savedEntity, 0, false); //} //else if (sender is IMediaService) //{ // ((IMediaService)sender).Save((IMedia)savedEntity, 0, false); //} //else if (sender is IMemberService) //{ // ((IMemberService)sender).Save((IMember)savedEntity, false); //} } } // update database RelationMapping.UpdateRelationMapping( picker.ContextId, // savedEntity.Id picker.PropertyAlias, // propertyType.Alias picker.RelationTypeAlias, isRelationsOnly, picker.PickedIds.ToArray()); } } } }
public Issue1228 () { var grd = new Grid (); var layout = new StackLayout (); var picker = new Picker { BackgroundColor = Color.Pink }; picker.Items.Add ("A"); picker.Items.Add ("B"); picker.Items.Add ("C"); picker.Items.Add ("D"); picker.Items.Add ("E"); layout.Children.Add (picker); layout.Children.Add (new Editor { BackgroundColor = Color.Red, VerticalOptions = LayoutOptions.End }); layout.Children.Add (new Editor { BackgroundColor = Color.Red, VerticalOptions = LayoutOptions.End }); layout.Children.Add (new Editor { BackgroundColor = Color.Red, VerticalOptions = LayoutOptions.End }); layout.Children.Add (new Editor { BackgroundColor = Color.Red, VerticalOptions = LayoutOptions.End }); layout.Children.Add (new Editor { BackgroundColor = Color.Red, VerticalOptions = LayoutOptions.End }); layout.Children.Add (new Editor { BackgroundColor = Color.Red, VerticalOptions = LayoutOptions.End }); layout.Children.Add (new SearchBar { BackgroundColor = Color.Gray, CancelButtonColor = Color.Red }); layout.Children.Add (new Editor { BackgroundColor = Color.Red, VerticalOptions = LayoutOptions.End }); layout.Children.Add (new Editor { BackgroundColor = Color.Red, VerticalOptions = LayoutOptions.End }); layout.Children.Add (new Editor { BackgroundColor = Color.Red, VerticalOptions = LayoutOptions.End }); layout.Children.Add (new Editor { BackgroundColor = Color.Red, VerticalOptions = LayoutOptions.End }); layout.Children.Add (new Editor { BackgroundColor = Color.Red, VerticalOptions = LayoutOptions.End }); layout.Children.Add (new Editor { BackgroundColor = Color.Red, VerticalOptions = LayoutOptions.End }); layout.Children.Add (new Editor { BackgroundColor = Color.Red, VerticalOptions = LayoutOptions.End }); layout.Children.Add (new Editor { BackgroundColor = Color.Red, VerticalOptions = LayoutOptions.End }); layout.Children.Add (new Entry { BackgroundColor = Color.Blue }); layout.Children.Add (new SearchBar { BackgroundColor = Color.Gray, CancelButtonColor = Color.Red }); grd.Children.Add (layout); Content = new ContentView { Content = new ScrollView { Padding = new Thickness (0, 20, 0, 0), Orientation = ScrollOrientation.Vertical, Content = grd, HeightRequest = 400, VerticalOptions = LayoutOptions.Start }, BackgroundColor = Color.Lime, HeightRequest = 400 }; }
public void TestSetSelectedIndexOnNullRows() { var picker = new Picker (); Assert.IsEmpty (picker.Items); Assert.AreEqual (-1, picker.SelectedIndex); picker.SelectedIndex = 2; Assert.AreEqual (-1, picker.SelectedIndex); }
public Issue2339 () { var picker = new Picker { Items = {"One", "Two", "Three"} }; var pickerBtn = new Button { Text = "Click me to call .Focus on Picker" }; pickerBtn.Clicked += (sender, args) => { picker.Focus (); }; var pickerBtn2 = new Button { Text = "Click me to call .Unfocus on Picker" }; pickerBtn2.Clicked += (sender, args) => { picker.Unfocus (); }; var pickerBtn3 = new Button { Text = "Click me to .Focus () picker, wait 2 seconds, and .Unfocus () picker", Command = new Command (async () => { picker.Focus (); await Task.Delay (2000); picker.Unfocus (); }) }; var focusFiredCount = 0; var unfocusFiredCount = 0; var focusFiredLabel = new Label { Text = "Picker Focused: " + focusFiredCount }; var unfocusedFiredLabel = new Label { Text = "Picker UnFocused: " + unfocusFiredCount }; picker.Focused += (s, e) => { focusFiredCount++; focusFiredLabel.Text = "Picker Focused: " + focusFiredCount; }; picker.Unfocused += (s, e) => { unfocusFiredCount++; unfocusedFiredLabel.Text = "Picker UnFocused: " + unfocusFiredCount; }; Content = new StackLayout { Children = { focusFiredLabel, unfocusedFiredLabel, pickerBtn, pickerBtn2, pickerBtn3, picker } }; }
public void Interact(Picker picker) { if (!IsPickedUp) { transform.parent = picker.PickupAnchor.transform; transform.localPosition = Vector3.zero; transform.GetComponent<Rigidbody>().useGravity = false; transform.GetComponent<Rigidbody>().isKinematic = true; transform.gameObject.layer = LayerMask.NameToLayer("PickedUp"); this.IsPickedUp = true; } }
public void TestSelectedIndexChangedOnCollectionShrink() { var picker = new Picker { Items = { "John", "Paul", "George", "Ringo" }, SelectedIndex = 3 }; Assert.AreEqual (3, picker.SelectedIndex); picker.Items.RemoveAt (3); picker.Items.RemoveAt (2); Assert.AreEqual (1, picker.SelectedIndex); picker.Items.Clear (); Assert.AreEqual (-1, picker.SelectedIndex); }
public PickerPage () { Picker = new Picker { Title = "Select Item", AutomationId = "picker" }; var items = new List<string> { "item", "item2", "item3", "item4" }; foreach (var i in items) Picker.Items.Add (i); Picker.FocusChangeRequested += Picker_FocusChangeRequested; Picker.SelectedIndexChanged += Picker_SelectedIndexChanged; StackLayout stack = new StackLayout { Padding = 20 }; stack.Children.Add (Picker); Content = stack; }
public void TestSelectedIndexInRange () { var picker = new Picker { Items = { "John", "Paul", "George", "Ringo" } }; picker.SelectedIndex = 2; Assert.AreEqual (2, picker.SelectedIndex); picker.SelectedIndex = 42; Assert.AreEqual (3, picker.SelectedIndex); picker.SelectedIndex = -1; Assert.AreEqual (-1, picker.SelectedIndex); picker.SelectedIndex = -42; Assert.AreEqual (-1, picker.SelectedIndex); }
static void Main(string[] args) { Console.Write("SpanBot V0.1"); var rounds = int.Parse(Console.ReadLine()); picker = new Picker<Move>(new Random(rounds ^ Magic)); picker.AddItem(Move.Paper, 100 / 3); picker.AddItem(Move.Rock, 100 / 3); picker.AddItem(Move.Scissors, 100 / 3); var opponentsMoves = new List<Move>(); while (true) { var move = Move.None; if (opponentsMoves.Count < PatternFindLength + 1) { move = picker.NextItem(); Console.WriteLine($"Randomly picked {move}"); //Console.Write((int)move); } else { var matches = FindPatterns(opponentsMoves, opponentsMoves.Take(PatternFindLength).ToList(), 10, 0); var afterBestMatch = opponentsMoves[matches.First().Item2]; move = afterBestMatch.WinningMove(); Console.WriteLine($"Pattern matched {move}"); //Console.Write((int)move); } int opponentOut; if (int.TryParse(Console.ReadLine(), out opponentOut)) { var opponent = (Move)opponentOut; opponentsMoves.Add(opponent); Console.WriteLine($"{move} against {opponent} -> {move.WouldWin(opponent)}"); } else break; } }
public MainWindow() { InitializeComponent(); _items = new ObservableCollection<TorgetItem>(); _cfgManager = new FinnConfigManager(); _config = _cfgManager.LoadConfiguration(); _picker = new Picker(new WebClient { Encoding = Encoding.UTF8 }, new FinnHtmlParser()); _picker.ScanCompeleted += PickerOnScanCompeleted; _picker.Run(_config); InitSettings(_config); _balloonPool = new BalloonPool(_config.BalloonTimeOut); DataContext = this; }
public Issue1777 () { StackLayout stackLayout = new StackLayout(); Content = stackLayout; TableView tableView = new TableView(); stackLayout.Children.Add( tableView); TableRoot tableRoot = new TableRoot(); tableView.Root = tableRoot; TableSection tableSection = new TableSection("Table"); tableRoot.Add(tableSection); ViewCell viewCell = new ViewCell (); tableSection.Add (viewCell); ContentView contentView = new ContentView (); contentView.HorizontalOptions = LayoutOptions.FillAndExpand; viewCell.View = contentView; _pickerTable = new Picker (); _pickerTable.HorizontalOptions = LayoutOptions.FillAndExpand; contentView.Content = _pickerTable; Label label = new Label (); label.Text = "Normal"; stackLayout.Children.Add (label); _pickerNormal = new Picker (); stackLayout.Children.Add (_pickerNormal); Button button = new Button (); button.Clicked += button_Clicked; button.Text = "do magic"; stackLayout.Children.Add (button); //button_Clicked(button, EventArgs.Empty); _pickerTable.SelectedIndex = 0; _pickerNormal.SelectedIndex = 0; }
/// <summary> /// Gets the picker automation peer. /// </summary> /// <param name="picker">The picker.</param> /// <returns>A TimePickerAutomationPeer for this Picker.</returns> protected override PickerAutomationPeer CreatePickerAutomationPeer(Picker picker) { return new TimePickerAutomationPeer((TimePicker)picker); }
protected override void Init () { var instructions = @"In the picker below, select the option labeled 'Two'. If the selection immediately disappears, the test has failed. In the TimePicker below, change the time to 5:21 PM. If the selection immediately disappears, the test has failed. In the DatePicker below, change the date to May 25, 1977. If the selection immediately disappears, the test has failed."; var tableInstructions = new Label { Text = instructions }; var picker = new Picker (); var pickerItems = new List<string> { "One", "Two", "Three" }; foreach(string item in pickerItems) { picker.Items.Add(item); } var datePicker = new DatePicker (); var timePicker = new TimePicker (); var tableView = new TableView() { BackgroundColor = Color.Green }; var tableSection = new TableSection(); var pickerCell = new ViewCell { View = picker }; var datepickerCell = new ViewCell { View = datePicker }; var timepickerCell = new ViewCell { View = timePicker }; tableSection.Add(pickerCell); tableSection.Add(timepickerCell); tableSection.Add(datepickerCell); var tableRoot = new TableRoot() { tableSection }; tableView.Root = tableRoot; var listItems = new List<string> { "One" }; var listView = new ListView { Header = instructions, BackgroundColor = Color.Pink, ItemTemplate = new DataTemplate(typeof(CustomCell)), ItemsSource = listItems }; var nonListDatePicker = new DatePicker(); var nonListTimePicker = new TimePicker(); var nonListPicker = new Picker(); foreach(string item in pickerItems) { nonListPicker.Items.Add(item); } Content = new StackLayout { VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, Children = { new Label { Text = instructions }, nonListPicker, nonListDatePicker, nonListTimePicker, tableInstructions, tableView, listView } }; }
protected EditText GetNativeControl(Picker picker) { var renderer = GetRenderer(picker); var viewRenderer = renderer.View as AppCompat.PickerRenderer; return viewRenderer.Control; }
public CreateFootballPlayerPage() { Title = "Registration"; BackgroundColor = Color.Teal; var stackLayout = new StackLayout { Orientation = StackOrientation.Vertical, Spacing = 10, Padding = 20 }; Label firstNameLabel = new Label { TextColor = Color.Black, Text = "First Name" }; stackLayout.Children.Add(firstNameLabel); firstNameField = new Entry { TextColor = Color.White }; stackLayout.Children.Add(firstNameField); Label lastNameLabel = new Label { TextColor = Color.Black, Text = "Last Name" }; stackLayout.Children.Add(lastNameLabel); lastNameField = new Entry { TextColor = Color.White }; stackLayout.Children.Add(lastNameField); Label dateOfBirthLabel = new Label { TextColor = Color.Black, Text = "Date Of Birth" }; stackLayout.Children.Add(dateOfBirthLabel); dateOfBirth = new DatePicker { MaximumDate = DateTime.Now }; stackLayout.Children.Add(dateOfBirth); Label countryLabel = new Label { TextColor = Color.Black, Text = "Country" }; stackLayout.Children.Add(countryLabel); countryList = new string[] { "India", "Japan", "China", "Korea" }; countryPicker = new Picker { Title = null }; foreach (string country in countryList) { countryPicker.Items.Add(country); } stackLayout.Children.Add(countryPicker); playerImage = new Image { }; stackLayout.Children.Add(playerImage); Button playerImageButton = new Button { Text = "Select an Image" }; playerImageButton.Clicked += imageButtonClicked; stackLayout.Children.Add(playerImageButton); Button saveButton = new Button { Text = "Save", }; saveButton.Clicked += saveButtonClicked; stackLayout.Children.Add(saveButton); Content = new ScrollView { Content = stackLayout }; }
private void ActionMudarIndex(object sender, EventArgs e) { Picker obj = (Picker)sender; resultado.Text = obj.SelectedItem.ToString() + " - " + obj.SelectedIndex.ToString(); }
public override void OnControlDragged(Vector2I previousMousePosition) { Vector2I mousePosition = Context.UiManager.MousePosition; if (InBoundsAndActive(mousePosition)) { Vector3 currentLookAt = new Picker(Context, Context.ScreenSize/2).GroundIntersection; Vector3 targetLookAt = new Vector3(((float)(mousePosition.X-Position.X)*Context.World.Size.X)/Size.X,0, ((float)(Size.Y-(mousePosition.Y - Position.Y)) * Context.World.Size.Y) / Size.Y); Context.Camera.Position += targetLookAt - currentLookAt; } }
public EditPurchase(Spend spend, int index) { InitializeComponent(); serializer = new Serializer(); profile = serializer.Deserialize("Test_user.xml"); StackLayout stackLayout = new StackLayout(); Label enter = new Label { Text = "History of purchases", FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)), HorizontalOptions = LayoutOptions.Center }; nameOfPruchase = new Entry { Placeholder = "Name of purchase", Text = spend.Name }; description = new Entry { Placeholder = "Description", Text = spend.Description }; amount = new Entry { Placeholder = "Amount", Text = spend.Amount.ToString() }; categoryPicker = new Picker { Title = "Category" }; foreach (var category in profile.Categories) { categoryPicker.Items.Add(category.Name); } Button EditButton = new Button { Text = "Edit", HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.End }; Button DeleteButton = new Button { Text = "Delete", HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.End }; SpendBefore = spend; indexOfElement = index; EditButton.Clicked += Edit_Purchase_Button_Click; DeleteButton.Clicked += Delete_Purchase_Button_Click; stackLayout.Children.Add(nameOfPruchase); stackLayout.Children.Add(categoryPicker); stackLayout.Children.Add(description); stackLayout.Children.Add(amount); stackLayout.Children.Add(EditButton); stackLayout.Children.Add(DeleteButton); Content = stackLayout; }
/// <summary> /// Begins when the behavior attached to the view /// </summary> /// <param name="bindable">bindable value</param> protected override void OnAttachedTo(SampleView bindable) { if (bindable == null) { return; } base.OnAttachedTo(bindable); this.schedule = bindable.Content.FindByName <Syncfusion.SfSchedule.XForms.SfSchedule>("Schedule"); if (this.schedule?.Locale == "ja") { this.localizationViewModel = new LocalizationViewModel(); this.localePicker = bindable.FindByName <Picker>("localePicker"); if (this.localePicker == null) { return; } this.localePicker.SelectedIndex = 0; this.localePicker.SelectedIndexChanged += this.LocalePicker_SelectedIndexChanged; this.schedule.DataSource = this.localizationViewModel.JapaneseAppointments; } this.viewPicker = bindable.FindByName <Picker>("viewPicker"); if (this.viewPicker == null) { return; } if (bindable.GetType().Equals(typeof(RecursiveAppointments))) { this.viewPicker.SelectedIndex = 3; switch (Device.RuntimePlatform) { case Device.iOS: this.schedule.MonthViewSettings.AppointmentDisplayMode = AppointmentDisplayMode.Appointment; if (Device.RuntimePlatform == Device.iOS && Device.Idiom == TargetIdiom.Tablet) { schedule.MonthViewSettings.AppointmentIndicatorCount = 4; } else if (Device.RuntimePlatform == Device.iOS) { schedule.MonthViewSettings.AppointmentIndicatorCount = 2; } break; case Device.Android: this.schedule.MonthViewSettings.AppointmentDisplayMode = AppointmentDisplayMode.Appointment; break; case Device.UWP: this.schedule.MonthViewSettings.AppointmentDisplayMode = AppointmentDisplayMode.Indicator; break; case Device.WPF: this.schedule.MonthViewSettings.AppointmentDisplayMode = AppointmentDisplayMode.Indicator; break; } } else if (bindable.GetType().Equals(typeof(ViewCustomization))) { this.viewPicker.SelectedIndex = 3; } else if (bindable.GetType().Equals(typeof(Localization))) { this.schedule.MonthViewSettings.AppointmentDisplayMode = AppointmentDisplayMode.Appointment; this.schedule.MonthViewSettings.AppointmentDisplayCount = 2; if (Device.RuntimePlatform == Device.iOS && Device.Idiom == TargetIdiom.Tablet) { schedule.MonthViewSettings.AppointmentIndicatorCount = 4; } else if (Device.RuntimePlatform == Device.iOS) { schedule.MonthViewSettings.AppointmentIndicatorCount = 2; } this.viewPicker.SelectedIndex = 3; } else { switch (Device.RuntimePlatform) { case Device.iOS: schedule.ScheduleView = ScheduleView.MonthView; if (Device.Idiom == TargetIdiom.Tablet) { schedule.MonthViewSettings.AppointmentIndicatorCount = 4; } else { schedule.MonthViewSettings.AppointmentIndicatorCount = 2; } this.viewPicker.SelectedIndex = 3; break; case Device.Android: schedule.ScheduleView = ScheduleView.MonthView; this.viewPicker.SelectedIndex = 3; break; case Device.UWP: schedule.ScheduleView = ScheduleView.WeekView; this.viewPicker.SelectedIndex = 1; break; case Device.WPF: schedule.ScheduleView = ScheduleView.WeekView; this.viewPicker.SelectedIndex = 1; break; } } if (bindable.GetType().Equals(typeof(GettingStarted))) { switch (Device.RuntimePlatform) { case Device.iOS: schedule.ShowAppointmentsInline = true; break; case Device.Android: schedule.ShowAppointmentsInline = true; break; case Device.UWP: schedule.ShowAppointmentsInline = false; schedule.MonthViewSettings.ShowAgendaView = false; break; case Device.WPF: schedule.ShowAppointmentsInline = false; schedule.MonthViewSettings.ShowAgendaView = false; break; } } this.viewPicker.SelectedIndexChanged += this.ViewPicker_SelectedIndexChanged; }
public Issue1593() { var title = new Label { Text = "Select League", FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)), TextColor = Color.White }; #region Season Filter var seasonLabel = new Label { Text = "Season", FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), TextColor = Color.White }; var seasonPicker = new Picker { WidthRequest = 140, Title = "Season", Items = { "Test 1", "Test 2" } }; var seasonPanel = new StackLayout { Children = { seasonLabel, seasonPicker } }; #endregion #region Sport Filter var sportLabel = new Label { Text = "Sport", FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), TextColor = Color.White }; var sportPicker = new Picker { WidthRequest = 140, Title = "Sport", Items = { "Test 1", "Test 2" } }; var sportPanel = new StackLayout { Children = { sportLabel, sportPicker } }; #endregion var filtersPanel = new StackLayout { Padding = new Thickness(0, 10, 0, 0), Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.Fill, Children = { seasonPanel, sportPanel } }; var leagues = new ListView { MinimumHeightRequest = 100, ItemsSource = new[] { "Test 1", "Test 2", "Test 3", "Test 4", "Test 5", "Test 6", "Test 7", "Test 8", "Test 9", "Test 10", "Test 11", "Test 12", "Test 13", "Test 14", "Test 15", }, BackgroundColor = Color.Gray, ItemTemplate = new DataTemplate(() => { var leagueName = new Label { FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)), BackgroundColor = Color.Transparent, TextColor = Color.White, VerticalOptions = LayoutOptions.CenterAndExpand, LineBreakMode = LineBreakMode.WordWrap }; leagueName.SetBinding(Label.TextProperty, "."); var row = new StackLayout { Padding = new Thickness(5, 0, 5, 0), BackgroundColor = Color.Transparent, Orientation = StackOrientation.Horizontal, VerticalOptions = LayoutOptions.CenterAndExpand, Children = { leagueName } }; return(new ViewCell { View = row }); }) }; var activityIndicator = new ActivityIndicator { VerticalOptions = LayoutOptions.CenterAndExpand, IsVisible = false }; var titlePanel = new StackLayout { Orientation = StackOrientation.Horizontal, Spacing = 50, Children = { title, activityIndicator } }; var standingsButton = new Button { Text = "Standings", HorizontalOptions = LayoutOptions.CenterAndExpand }; var scheduleButton = new Button { Text = "Schedule", HorizontalOptions = LayoutOptions.CenterAndExpand }; var buttonPanel = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.CenterAndExpand, Children = { standingsButton, scheduleButton } }; Content = new StackLayout { Padding = 20, Children = { titlePanel, filtersPanel, leagues, buttonPanel } }; }
PCache ComputePCacheFromMesh() { var meshCache = ComputeDataCache(m_Mesh); Picker picker = null; if (m_Distribution == Distribution.Sequential) { if (m_MeshBakeMode == MeshBakeMode.Vertex) { picker = new SequentialPickerVertex(meshCache); } else if (m_MeshBakeMode == MeshBakeMode.Triangle) { picker = new SequentialPickerTriangle(meshCache); } } else if (m_Distribution == Distribution.Random) { if (m_MeshBakeMode == MeshBakeMode.Vertex) { picker = new RandomPickerVertex(meshCache, m_SeedMesh); } else if (m_MeshBakeMode == MeshBakeMode.Triangle) { picker = new RandomPickerTriangle(meshCache, m_SeedMesh); } } else if (m_Distribution == Distribution.RandomUniformArea) { picker = new RandomPickerUniformArea(meshCache, m_SeedMesh); } if (picker == null) { throw new InvalidOperationException("Unable to find picker"); } var positions = new List <Vector3>(); var normals = m_ExportNormals ? new List <Vector3>() : null; var colors = m_ExportColors ? new List <Vector4>() : null; var uvs = m_ExportUV ? new List <Vector4>() : null; for (int i = 0; i < m_OutputPointCount; ++i) { if (i % 64 == 0) { var cancel = EditorUtility.DisplayCancelableProgressBar("pCache bake tool", string.Format("Sampling data... {0}/{1}", i, m_OutputPointCount), (float)i / (float)m_OutputPointCount); if (cancel) { return(null); } } var vertex = picker.GetNext(); positions.Add(vertex.position); if (m_ExportNormals) { normals.Add(vertex.normal); } if (m_ExportColors) { colors.Add(vertex.color); } if (m_ExportUV) { uvs.Add(vertex.uvs.Any() ? vertex.uvs[0] : Vector4.zero); } } var file = new PCache(); file.AddVector3Property("position"); if (m_ExportNormals) { file.AddVector3Property("normal"); } if (m_ExportColors) { file.AddColorProperty("color"); } if (m_ExportUV) { file.AddVector4Property("uv"); } EditorUtility.DisplayProgressBar("pCache bake tool", "Generating pCache...", 0.0f); file.SetVector3Data("position", positions); if (m_ExportNormals) { file.SetVector3Data("normal", normals); } if (m_ExportColors) { file.SetColorData("color", colors); } if (m_ExportUV) { file.SetVector4Data("uv", uvs); } EditorUtility.ClearProgressBar(); return(file); }
public DetailsPage() { var saveButton = new Button() { Text = "Save it!" }; CustomerName = new Entry { Placeholder = "Please enter your name" }; DOB = new DatePicker { Format = "D" }; Gender = new Switch { //HorizontalOptions =LayoutOptions }; Desc = new Entry { Text = "" , Placeholder = "Description" }; CountryList = new Picker { }; string[] countryStrings = new string[5]; countryStrings [0] = "India"; countryStrings [1] = "USA"; countryStrings [2] = "JAPAN"; countryStrings [3] = "UK"; countryStrings [4] = "Australia"; foreach (string country in countryStrings) { CountryList.Items.Add(country); } var maleFemale = new Label(); maleFemale.Text = "M"; CountryList.Title = "Select Country"; saveButton.Clicked += SaveButton_Clicked; AbsoluteLayout.SetLayoutBounds(maleFemale, new Rectangle(400F, 200F, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize)); // this.Content = new StackLayout { // //Spacing = 15, // //HorizontalOptions = LayoutOptions.CenterAndExpand, // Children = { // CustomerName // , // DOB, // // new Label{ // // Text ="Gender" // }, // Gender, // Desc, // maleFemale, // CountryList, // saveButton // // } // // }; var gen = new Label { Text = "Gender" }; RelativeLayout layout = new RelativeLayout { Padding = 10 }; layout.Children.Add(CustomerName, Constraint.Constant(80), Constraint.Constant(10)); layout.Children.Add(DOB, Constraint.Constant(80), Constraint.Constant(50)); layout.Children.Add(gen, Constraint.Constant(80), Constraint.Constant(90)); layout.Children.Add(Gender, Constraint.Constant(80), Constraint.Constant(130)); layout.Children.Add(Desc, Constraint.Constant(80), Constraint.Constant(210)); layout.Children.Add(maleFemale, Constraint.Constant(160), Constraint.Constant(90)); layout.Children.Add(CountryList, Constraint.Constant(80), Constraint.Constant(250)); layout.Children.Add(saveButton, Constraint.Constant(80), Constraint.Constant(290)); this.Content = layout; Gender.Toggled += (sender, e) => { if (Gender.IsToggled) { maleFemale.Text = "F"; } else { maleFemale.Text = "M"; } }; }
// Issue1075 // BoxView doesn't update color public Issue1075 () { Label header = new Label { Text = "Picker", #pragma warning disable 618 Font = Font.BoldSystemFontOfSize(50), #pragma warning restore 618 HorizontalOptions = LayoutOptions.Center }; Picker picker = new Picker { Title = "Color", VerticalOptions = LayoutOptions.CenterAndExpand }; foreach (string color in new string[] { "Aqua", "Black", "Blue", "Fuschia", "Gray", "Green", "Lime", "Maroon", "Navy", "Olive", "Purple", "Red", "Silver", "Teal", "White", "Yellow" }) { picker.Items.Add(color); } // Create BoxView for displaying pickedColor BoxView boxView = new BoxView { WidthRequest = 150, HeightRequest = 150, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.CenterAndExpand }; var button = new Button { Text = "Change to blue", Command = new Command (() => boxView.BackgroundColor = Color.Aqua) }; picker.SelectedIndexChanged += (sender, args) => { if (picker.SelectedIndex == -1) { boxView.Color = Color.Default; } else { string selectedItem = picker.Items[picker.SelectedIndex]; FieldInfo colorField = typeof(Color).GetTypeInfo().GetDeclaredField(selectedItem); boxView.Color = (Color)colorField.GetValue(null); } }; // Accomodate iPhone status bar. Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 0); // Build the page. Content = new StackLayout { Children = { header, picker, boxView, button } }; }
public void Interact(Picker picker) { IsActive = !IsActive; anim.SetBool("IsActive", IsActive); Daytimecontrol.timeControl.reset(); }
public FindRide(List <Locations> locations) { InitializeComponent(); Title = "Find a Ride"; Label lblOrigin = new Label { Text = "Origin:", HorizontalOptions = LayoutOptions.Start }; Label lblDestination = new Label { Text = "Destination:", HorizontalOptions = LayoutOptions.Start }; Picker pickerOrigin = new Picker { VerticalOptions = LayoutOptions.CenterAndExpand }; Picker pickerDestination = new Picker { VerticalOptions = LayoutOptions.CenterAndExpand }; foreach (Locations loc in locations) { pickerOrigin.Items.Add(loc.name); pickerDestination.Items.Add(loc.name); } Label lblData = new Label { Text = "Date:", VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalTextAlignment = TextAlignment.Start }; DatePicker datepicker = new DatePicker { Date = DateTime.Now, Format = "dd-MM-yyyy", MinimumDate = DateTime.Now.Date, MaximumDate = DateTime.Now.AddMonths(6) }; Label lblTime = new Label { Text = "Time:", VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalTextAlignment = TextAlignment.Start }; TimePicker timepicker = new TimePicker { Time = DateTime.Now.TimeOfDay }; Button btnAdd = new Button { IsEnabled = false, Margin = 10, Text = "Buscar caronas", VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand }; btnAdd.Clicked += async(sender, e) => { string origin = pickerOrigin.Items[pickerOrigin.SelectedIndex]; string destination = pickerDestination.Items[pickerDestination.SelectedIndex]; string date = datepicker.Date.ToString("dd-MM-yyyy"); string time = timepicker.Time.ToString(@"hh\:mm"); try { string jsonFoundRides = await Web.WebService.GET(Settings.WebServiceURL + API.API_GetRides + origin + "/" + destination + "/" + date + "/" + time); if (jsonFoundRides == "[]" || jsonFoundRides == null) { await DisplayAlert("No rides Found!", "No rides were found that matches your search.", "Ok"); } else { await Navigation.PushAsync(new ListFoundRides(jsonFoundRides)); } } catch (WebException we) { await DisplayAlert("Error", we.Message, "Ok"); } }; pickerOrigin.SelectedIndexChanged += (sender, args) => { if (pickerOrigin.SelectedIndex == pickerDestination.SelectedIndex) { btnAdd.IsEnabled = false;; pickerOrigin.BackgroundColor = Color.Red; pickerDestination.BackgroundColor = Color.Red; } else { btnAdd.IsEnabled = (pickerOrigin.SelectedIndex != -1 && pickerDestination.SelectedIndex != -1); pickerOrigin.BackgroundColor = Color.Default; pickerDestination.BackgroundColor = Color.Default; } }; pickerDestination.SelectedIndexChanged += (sender, args) => { if (pickerOrigin.SelectedIndex == pickerDestination.SelectedIndex) { btnAdd.IsEnabled = false; pickerOrigin.BackgroundColor = Color.Red; pickerDestination.BackgroundColor = Color.Red; } else { btnAdd.IsEnabled = (pickerOrigin.SelectedIndex != -1 && pickerDestination.SelectedIndex != -1); pickerOrigin.BackgroundColor = Color.Default; pickerDestination.BackgroundColor = Color.Default; } }; // Accomodate iPhone status bar. this.Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5); this.Content = new StackLayout { Children = { lblOrigin, pickerOrigin, lblDestination, pickerDestination, lblData, datepicker, lblTime, timepicker, btnAdd } }; }
static Picker CreateImageSourcePicker(string title, Action <Func <ImageSource> > onSelected) { var items = new[] { new ImageSourcePickerItem { Text = "<none>", Getter = () => null }, new ImageSourcePickerItem { Text = "App Resource", Getter = () => ImageSource.FromFile("bank.png") }, new ImageSourcePickerItem { Text = "Embedded", Getter = () => ImageSource.FromResource("System.Maui.Controls.GalleryPages.crimson.jpg", typeof(App)) }, new ImageSourcePickerItem { Text = "Stream", Getter = () => ImageSource.FromStream(() => typeof(App).GetTypeInfo().Assembly.GetManifestResourceStream("System.Maui.Controls.coffee.png")) }, new ImageSourcePickerItem { Text = "URI", Getter = () => new UriImageSource { Uri = new Uri("https://beehive.blob.core.windows.net/staticimages/FeatureImages/MutantLizard01.png"), CachingEnabled = false } }, new ImageSourcePickerItem { Text = "Font Glyph", Getter = () => { var fontFamily = ""; switch (Device.RuntimePlatform) { case Device.iOS: fontFamily = "Ionicons"; break; case Device.UWP: fontFamily = "Assets/Fonts/ionicons.ttf#ionicons"; break; case Device.Android: default: fontFamily = "fonts/ionicons.ttf#"; break; } return(new FontImageSource { Color = Color.Black, FontFamily = fontFamily, Glyph = "\uf233", Size = 24, }); } }, }; var picker = new Picker { Title = title, ItemsSource = items, ItemDisplayBinding = new Binding("Text"), }; picker.SelectedIndexChanged += (sender, e) => { var item = (ImageSourcePickerItem)picker.SelectedItem; var text = item.Text; onSelected?.Invoke(item.Getter); }; return(picker); }
public AddTransportPage() { this.Title = "Dodaj surowce z transportu"; var db = new SQLiteConnection(_dbPath); StackLayout stackLayout = new StackLayout(); _picker = new Picker() { ItemsSource = db.Table <Surowiec>().OrderBy(x => x.Name).ToList(), Title = "Wybierz surowiec", TitleColor = Color.Gold, }; _idEntry = new Entry() { Placeholder = "ID", IsVisible = false, }; _countEntry = new Entry() { Keyboard = Keyboard.Text, Placeholder = "Wprowadź ilość surowca", }; _picker2 = new Picker() { ItemsSource = db.Table <Surowiec>().OrderBy(x => x.Name).ToList(), Title = "Wybierz surowiec", TitleColor = Color.Gold, }; _idEntry2 = new Entry() { Placeholder = "ID", IsVisible = false, }; _countEntry2 = new Entry() { Keyboard = Keyboard.Text, Placeholder = "Wprowadź ilość surowca", }; _picker3 = new Picker() { ItemsSource = db.Table <Surowiec>().OrderBy(x => x.Name).ToList(), Title = "Wybierz surowiec", TitleColor = Color.Gold, }; _idEntry3 = new Entry() { Placeholder = "ID", IsVisible = false, }; _countEntry3 = new Entry() { Keyboard = Keyboard.Text, Placeholder = "Wprowadź ilość surowca", }; _picker4 = new Picker() { ItemsSource = db.Table <Surowiec>().OrderBy(x => x.Name).ToList(), Title = "Wybierz surowiec", TitleColor = Color.Gold, }; _idEntry4 = new Entry() { Placeholder = "ID", IsVisible = false, }; _countEntry4 = new Entry() { Keyboard = Keyboard.Text, Placeholder = "Wprowadź ilość surowca", }; _picker5 = new Picker() { ItemsSource = db.Table <Surowiec>().OrderBy(x => x.Name).ToList(), Title = "Wybierz surowiec", TitleColor = Color.Gold, }; _idEntry5 = new Entry() { Placeholder = "ID", IsVisible = false, }; _countEntry5 = new Entry() { Keyboard = Keyboard.Text, Placeholder = "Wprowadź ilość surowca", }; _AddButton = new Button(); _AddButton.Text = "Dodaj"; _AddButton.Clicked += _AddButton_Clicked; stackLayout.Children.Add(_picker); stackLayout.Children.Add(_idEntry); stackLayout.Children.Add(_countEntry); stackLayout.Children.Add(_picker2); stackLayout.Children.Add(_idEntry2); stackLayout.Children.Add(_countEntry2); stackLayout.Children.Add(_picker3); stackLayout.Children.Add(_idEntry3); stackLayout.Children.Add(_countEntry3); stackLayout.Children.Add(_picker4); stackLayout.Children.Add(_idEntry4); stackLayout.Children.Add(_countEntry4); stackLayout.Children.Add(_picker5); stackLayout.Children.Add(_idEntry5); stackLayout.Children.Add(_countEntry5); stackLayout.Children.Add(_AddButton); Content = stackLayout; }
public Issue10497() { Title = "Issue 10497"; var layout = new StackLayout(); var instructions = new Label { BackgroundColor = Color.Black, TextColor = Color.White, Text = "If loading the page you don't see the scrollbar in each CollectionView Item, the test has passed." }; var scrollBarVisibilityPicker = new Picker { Title = "VerticalScrollBarVisibility", ItemsSource = new List <string> { "Default", "Always", "Never" }, SelectedIndex = 0 }; var collectionView = new CollectionView { Margin = new Thickness(0, 0, 50, 0) }; collectionView.ItemsSource = new List <string> { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5", "Lorem ipsum dolor sit amet, consectetur adipiscing elit", "Item 7", "Item 8", "Item 9", "Item 10" }; collectionView.ItemTemplate = new DataTemplate(() => { var label = new Label { HeightRequest = 60, FontSize = 75 }; label.SetBinding(Label.TextProperty, "."); return(label); }); layout.Children.Add(instructions); layout.Children.Add(scrollBarVisibilityPicker); layout.Children.Add(collectionView); Content = layout; scrollBarVisibilityPicker.SelectedIndexChanged += (sender, args) => { switch (scrollBarVisibilityPicker.SelectedIndex) { case 0: collectionView.VerticalScrollBarVisibility = ScrollBarVisibility.Default; break; case 1: collectionView.VerticalScrollBarVisibility = ScrollBarVisibility.Always; break; case 2: collectionView.VerticalScrollBarVisibility = ScrollBarVisibility.Never; break; } }; }
public Cursor(Code2015 game, Game parent, GameScene scene, GameState gamelogic, Picker picker, CitySelectInfo citySelectInfo, ObjectSelectInfo objSelectInfo, RBallTypeSelect sendBallSelect, MiniMap map, SelectionMarker marker, RankInfo rankInfo) { this.parent = parent; this.logic = gamelogic; this.player = gamelogic.LocalHumanPlayer; this.rankInfo = rankInfo; this.game = game; this.renderSys = game.RenderSystem; this.scene = scene; this.picker = picker; this.selectionMarker = marker; this.citySelectInfo = citySelectInfo; this.objSelectInfo = objSelectInfo; this.sendBallSelect = sendBallSelect; this.miniMap = map; FileLocation fl = FileSystem.Instance.Locate("cursor.tex", GameFileLocs.GUI); cursor = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("cursor_u.tex", GameFileLocs.GUI); cursor_up = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("cursor_l.tex", GameFileLocs.GUI); cursor_left = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("cursor_d.tex", GameFileLocs.GUI); cursor_down = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("cursor_r.tex", GameFileLocs.GUI); cursor_right = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("cursor_lu.tex", GameFileLocs.GUI); cursor_ul = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("cursor_ru.tex", GameFileLocs.GUI); cursor_ur = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("cursor_ld.tex", GameFileLocs.GUI); cursor_dl = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("cursor_rd.tex", GameFileLocs.GUI); cursor_dr = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("cursor_move.tex", GameFileLocs.GUI); cursor_move = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("cursor_stop.tex", GameFileLocs.GUI); cursor_stop = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("cursor_toofar.tex", GameFileLocs.GUI); cursor_toofar = UITextureManager.Instance.CreateInstance(fl); cursor_sel = new Texture[11]; for (int i = 0; i < cursor_sel.Length; i++) { fl = FileSystem.Instance.Locate("selcursor" + (i + 13).ToString("D2") + ".tex", GameFileLocs.GUI); cursor_sel[i] = UITextureManager.Instance.CreateInstance(fl); } cursor_attack = new Texture[11]; for (int i = 0; i < cursor_attack.Length; i++) { fl = FileSystem.Instance.Locate("selcursor" + (i + 1).ToString("D2") + ".tex", GameFileLocs.GUI); cursor_attack[i] = UITextureManager.Instance.CreateInstance(fl); } cursorState = MouseCursor.Normal; }
/// <summary> /// Initialize components that work on Windows. /// </summary> void InitializeForWindows() { #if WINDOWS GearsetResources.Font = GearsetResources.Content.Load<SpriteFont>("Default"); GearsetResources.FontTiny = GearsetResources.Content.Load<SpriteFont>("Tiny"); GearsetResources.FontAlert = GearsetResources.Content.Load<SpriteFont>("Alert"); GearsetResources.GameWindow = (Form)Control.FromHandle(_game.Window.Handle); GearsetResources.Mouse = new MouseComponent(); // Add the game assembly to the compiler references. ReflectionHelper.CompilerParameters.ReferencedAssemblies.Add(GearsetResources.Game.GetType().Assembly.Location); DataSamplerManager = new DataSamplerManager(); Components.Add(DataSamplerManager); Alerter = new Alerter(); Components.Add(Alerter); var plotter = new Plotter(); Plotter = plotter; Components.Add(plotter); // Create the components of the console. Picker = new Picker(); Components.Add(Picker); GearsetResources.AboutWindow = new AboutWindow(); GearsetResources.AboutWindow.DataContext = GearsetResources.AboutViewModel; Widget = new Widget(); Components.Add(Widget); Inspector = new InspectorManager(); Components.Add(Inspector); // Asynchronously check if there's a new version available ThreadPool.QueueUserWorkItem(CheckNewVersion); Finder = new Finder(); Components.Add(Finder); Logger = new LoggerManager(); Components.Add(Logger); Bender = new Bender(); Components.Add(Bender); //this.Persistor = new Persistor(); //this.Components.Add(persistor); Inspector.Inspect("Gearset Settings", Settings, false); Inspector.Inspect("Game", GearsetResources.Game, false); GearsetResources.GameWindow.Resize += GameWindow_Resize; GearsetResources.GameWindow.GotFocus += GameWindow_GotFocus; GearsetResources.GameWindow.Activated += GameWindow_Activated; #endif }
public LabelAutoFitPage() { LinesSlider.Effects.Add(new Forms9Patch.SliderStepSizeEffect(1.0)); BackgroundColor = Color.LightGray; Padding = 10; #region Editor var editor = new Editor { Text = text1, TextColor = Color.Black, BackgroundColor = Color.White, HeightRequest = 130, FontSize = 15, }; #endregion #region Xamarin Forms label var effect = Effect.Resolve("Forms9Patch.EmbeddedResourceFontEffect"); //xfLabel.Effects.Add(effect); #endregion #region Forms9Patch Label var listener = FormsGestures.Listener.For(f9pLabel); listener.Tapped += (object sender, FormsGestures.TapEventArgs e) => { System.Diagnostics.Debug.WriteLine("Point=[" + e.ElementTouches[0] + "] Index=[" + f9pLabel.IndexAtPoint(e.ElementTouches[0]) + "]"); }; #endregion #region Mode var modeSwitch = new Switch { IsToggled = false, HorizontalOptions = LayoutOptions.End, }; modeSwitch.Toggled += (sender, e) => { if (modeSwitch.IsToggled) { f9pLabel.HtmlText = editor.Text; } else { f9pLabel.Text = editor.Text; } }; #endregion #region Sync text between Editor and Labels editor.TextChanged += (sender, e) => { xfLabel.Text = editor.Text; if (modeSwitch.IsToggled) { f9pLabel.HtmlText = editor.Text; } else { f9pLabel.Text = editor.Text; } }; #endregion #region Frames for Labels var frameForF9P = new Frame { HeightRequest = 100, //WidthRequest = 200, Padding = 0, Content = f9pLabel, CornerRadius = 0 }; var frameForXF = new Frame { HeightRequest = 100, //WidthRequest = 200, Padding = 0, Content = xfLabel, CornerRadius = 0 }; #endregion #region Impose Height var imposeHeightSwitch = new Switch { IsToggled = true }; var heightRequestSlider = new Slider(0, 800, 100); heightRequestSlider.Effects.Add(new Forms9Patch.SliderStepSizeEffect(0.5)); var imposedHeightGrid = new Grid { RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = GridLength.Star }, new RowDefinition { Height = GridLength.Star } }, ColumnDefinitions = new ColumnDefinitionCollection { new ColumnDefinition { Width = GridLength.Auto }, new ColumnDefinition { Width = GridLength.Star }, }, }; var heightRequestLabel = new Forms9Patch.Label("HeightRequest: " + 100); imposedHeightGrid.Children.Add(new Forms9Patch.Label("Impose Height?"), 0, 0); imposedHeightGrid.Children.Add(heightRequestLabel, 1, 0); imposedHeightGrid.Children.Add(imposeHeightSwitch, 0, 1); imposedHeightGrid.Children.Add(heightRequestSlider, 1, 1); imposeHeightSwitch.Toggled += (ihs, ihsArgs) => { double heightRequest = imposeHeightSwitch.IsToggled ? heightRequestSlider.Value : -1; frameForXF.HeightRequest = heightRequest; frameForF9P.HeightRequest = heightRequest; heightRequestSlider.IsVisible = imposeHeightSwitch.IsToggled; heightRequestLabel.IsVisible = imposeHeightSwitch.IsToggled; vtAlignmentSelector.IsVisible = imposeHeightSwitch.IsToggled; vtAlignmentSelectorLabel.IsVisible = imposeHeightSwitch.IsToggled; }; heightRequestSlider.ValueChanged += (hrs, hrsArgs) => { double heightRequest = imposeHeightSwitch.IsToggled ? heightRequestSlider.Value : -1; frameForXF.HeightRequest = heightRequest; frameForF9P.HeightRequest = heightRequest; heightRequestLabel.Text = "HeightRequest: " + heightRequestSlider.Value.ToString("####.###"); }; #endregion #region Font Size selection fontSizeSlider.ValueChanged += OnFontSizeSliderValueChanged; LineHeightSlider.ValueChanged += OnLineHeightSlider_ValueChanged; f9pLabel.FittedFontSizeChanged += (object sender, double e) => { fittedFontSizeLabel.Text = "FittedFontSize: " + e; }; #endregion #region Lines selection var linesLabel = new Label { Text = "Lines: 5" }; LinesSlider.ValueChanged += (sender, e) => { linesLabel.Text = "Lines: " + ((int)Math.Round(LinesSlider.Value)); f9pLabel.Lines = ((int)Math.Round(LinesSlider.Value)); }; #endregion #region AutoFit Selection var fitSelector = new Forms9Patch.SegmentedControl(); fitSelector.Segments.Add(new Forms9Patch.Segment { Text = "None", Command = new Command(x => { f9pLabel.AutoFit = Forms9Patch.AutoFit.None; }) }); var widthSegment = new Forms9Patch.Segment { Text = "Width", Command = new Command(x => { f9pLabel.AutoFit = Forms9Patch.AutoFit.Width; }), //IsEnabled = f9pLabel.HasImposedSize, //BindingContext = f9pLabel }; //widthSegment.SetBinding(Forms9Patch.Segment.IsEnabledProperty, "HasImposedSize"); fitSelector.Segments.Add(widthSegment); var linesSegment = new Forms9Patch.Segment { Text = "Lines", Command = new Command(x => { f9pLabel.AutoFit = Forms9Patch.AutoFit.Lines; }), //IsEnabled = f9pLabel.HasImposedSize, //BindingContext = f9pLabel }; //linesSegment.SetBinding(Forms9Patch.Segment.IsEnabledProperty, "HasImposedSize"); fitSelector.Segments.Add(linesSegment); fitSelector.SelectIndex(0); #endregion #region Alignment Selection hzAlignmentSelector.Segments.Add( new Forms9Patch.Segment { Text = "Start", Command = new Command(x => { f9pLabel.HorizontalTextAlignment = TextAlignment.Start; xfLabel.HorizontalTextAlignment = TextAlignment.Start; }) } ); hzAlignmentSelector.Segments.Add( new Forms9Patch.Segment { Text = "Center", Command = new Command(x => { f9pLabel.HorizontalTextAlignment = TextAlignment.Center; xfLabel.HorizontalTextAlignment = TextAlignment.Center; }) } ); hzAlignmentSelector.Segments.Add( new Forms9Patch.Segment { Text = "End", Command = new Command(x => { f9pLabel.HorizontalTextAlignment = TextAlignment.End; xfLabel.HorizontalTextAlignment = TextAlignment.End; }) } ); vtAlignmentSelector.Segments.Add( new Forms9Patch.Segment { Text = "Start", Command = new Command(x => { f9pLabel.VerticalTextAlignment = TextAlignment.Start; xfLabel.VerticalTextAlignment = TextAlignment.Start; }) } ); vtAlignmentSelector.Segments.Add( new Forms9Patch.Segment { Text = "Center", Command = new Command(x => { f9pLabel.VerticalTextAlignment = TextAlignment.Center; xfLabel.VerticalTextAlignment = TextAlignment.Center; }) } ); vtAlignmentSelector.Segments.Add( new Forms9Patch.Segment { Text = "End", Command = new Command(x => { f9pLabel.VerticalTextAlignment = TextAlignment.End; xfLabel.VerticalTextAlignment = TextAlignment.End; }) } ); hzAlignmentSelector.SelectIndex(0); vtAlignmentSelector.SelectIndex(0); #endregion #region BreakMode selection var breakModeSelector = new Forms9Patch.SegmentedControl(); breakModeSelector.Segments.Add( new Forms9Patch.Segment { Text = "NoWrap", Command = new Command(x => { f9pLabel.LineBreakMode = LineBreakMode.NoWrap; xfLabel.LineBreakMode = LineBreakMode.NoWrap; }) } ); breakModeSelector.Segments.Add( new Forms9Patch.Segment { Text = "Char", Command = new Command(x => { f9pLabel.LineBreakMode = LineBreakMode.CharacterWrap; xfLabel.LineBreakMode = LineBreakMode.CharacterWrap; }) } ); breakModeSelector.Segments.Add( new Forms9Patch.Segment { Text = "Word", Command = new Command(x => { f9pLabel.LineBreakMode = LineBreakMode.WordWrap; xfLabel.LineBreakMode = LineBreakMode.WordWrap; }) } ); breakModeSelector.Segments.Add( new Forms9Patch.Segment { Text = "Head", Command = new Command(x => { f9pLabel.LineBreakMode = LineBreakMode.HeadTruncation; xfLabel.LineBreakMode = LineBreakMode.HeadTruncation; }) } ); breakModeSelector.Segments.Add( new Forms9Patch.Segment { Text = "Mid", Command = new Command(x => { f9pLabel.LineBreakMode = LineBreakMode.MiddleTruncation; xfLabel.LineBreakMode = LineBreakMode.MiddleTruncation; }) } ); breakModeSelector.Segments.Add( new Forms9Patch.Segment { Text = "Tail", Command = new Command(x => { f9pLabel.LineBreakMode = LineBreakMode.TailTruncation; xfLabel.LineBreakMode = LineBreakMode.TailTruncation ; }) } ); breakModeSelector.SelectIndex(2); #endregion #region FontSelection Picker fontPicker = new Picker { Title = "Default", HorizontalOptions = LayoutOptions.EndAndExpand, }; var fontFamilies = Forms9Patch.FontExtensions.LoadedFontFamilies(); foreach (var fontFamily in fontFamilies) { fontPicker.Items.Add(fontFamily); } fontPicker.SelectedIndexChanged += (sender, e) => { if (fontPicker.SelectedIndex > -1 && fontPicker.SelectedIndex < fontFamilies.Count) { f9pLabel.FontFamily = fontFamilies[fontPicker.SelectedIndex]; xfLabel.FontFamily = fontFamilies[fontPicker.SelectedIndex]; } }; #endregion Content = new ScrollView { Padding = 0, Content = new StackLayout { Padding = 10, Children = { /* * new Label { Text = "Text:" }, * editor, */ new StackLayout { Orientation = StackOrientation.Horizontal, Children = { new Label { Text = "HTML Formatted:", HorizontalOptions = LayoutOptions.StartAndExpand, }, modeSwitch }, }, /* * new Label { Text = "Xamarin.Forms.Label:" }, * frameForXF, */ new Label { Text = "Forms9Patch.Label:" }, frameForF9P, LabelSizeLabel, new StackLayout { Orientation = StackOrientation.Horizontal, Children = { new Label { Text = "Font:", HorizontalOptions = LayoutOptions.Start }, fontPicker, } }, fontSizeLabel, fontSizeSlider, lineHeightLabel, LineHeightSlider, fittedFontSizeLabel, new Label { Text = "AutoFit:" }, fitSelector, linesLabel, LinesSlider, imposedHeightGrid, vtAlignmentSelectorLabel, vtAlignmentSelector, new Label { Text = "Horizontal Alignment:" }, hzAlignmentSelector, new Label { Text = "Truncation Mode:" }, breakModeSelector, } } }; SizeChanged += LabelAutoFitPage_SizeChanged; frameForF9P.SizeChanged += LabelAutoFitPage_SizeChanged; }
private void ReadQuiz() { string jsonString = returnJsonString(); //COnvert the JSON String into a list of objects List <RootObject> result = (List <RootObject>)JsonConvert.DeserializeObject(jsonString, typeof(List <RootObject>)); foreach (var question in result) { //Only get the results from the corresponding quiz if (question.id == ChooseQuiz.quizIdClicked) { //This foreach populates only the quesion header foreach (var item in question.questions) { Label questionId = new Label(); questionId.Text = ("Question: " + item.id + " - " + item.text).ToString(); questionId.FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)); questionId.FontAttributes = FontAttributes.Bold; Label help = new Label(); help.Text = ("Hint: " + item.help); ViewCellHeader = new ViewCell() { View = new StackLayout { Margin = new Thickness(0, 10, 0, 0), Orientation = StackOrientation.Vertical, VerticalOptions = LayoutOptions.Center, Children = { new StackLayout { Orientation = StackOrientation.Vertical, Children = { questionId, help } } } } }; //This manages the date fields and textboxes if (item.type == "date" || item.type == "Date" || item.type == "textbox") { //For single Line entries Entry singleLineEntry = new Entry(); //Get existing data from saved file (if it exists) singleLineEntry.Text = myAnswerManager.ProvideAnswerText(item.id); ViewCell ViewCellAnswer = new ViewCell() { View = new StackLayout { Orientation = StackOrientation.Vertical, VerticalOptions = LayoutOptions.Center, Children = { singleLineEntry } } }; //Update the Answers if the user leaves the UI element singleLineEntry.Unfocused += (sender, e) => { myAnswerManager.UpdateAnswerList(item.id, false, false, singleLineEntry.Text); }; section.Add(ViewCellHeader); section.Add(ViewCellAnswer); } //this manages the textareas if (item.type == "textarea") { //For single Line entries Editor multilineEditor = new Editor { HeightRequest = 50 }; //Get existing data from saved file (if it exists) multilineEditor.Text = myAnswerManager.ProvideAnswerText(item.id); ViewCell ViewCellAnswer = new ViewCell() { View = new StackLayout { Orientation = StackOrientation.Vertical, Children = { multilineEditor } } }; //Update the Answers if the user leaves the UI element multilineEditor.Unfocused += (sender, e) => { myAnswerManager.UpdateAnswerList(item.id, false, false, multilineEditor.Text); }; section.Add(ViewCellHeader); section.Add(ViewCellAnswer); } if (item.type == "choice" || item.type == "options") { Picker pickerView = new Picker { Title = "Pick one", BackgroundColor = Xamarin.Forms.Color.LightGray, VerticalOptions = LayoutOptions.Center }; foreach (var pickerItem in item.options) { pickerView.Items.Add(pickerItem); } //Get existing data from saved file (if it exists) String answerText = myAnswerManager.ProvideAnswerText(item.id); if (answerText != "") { pickerView.SelectedIndex = Convert.ToInt32(answerText); } ViewCell ViewCellAnswer = new ViewCell() { View = new StackLayout { Orientation = StackOrientation.Vertical, Children = { pickerView } } }; //Update the Answers if the user leaves the UI element pickerView.Unfocused += (sender, e) => { myAnswerManager.UpdateAnswerList(item.id, false, false, pickerView.SelectedIndex.ToString()); }; section.Add(ViewCellHeader); section.Add(ViewCellAnswer); } if (item.type == "slidingoption") { //Get existing data from saved file (if it exists) String answerText = myAnswerManager.ProvideAnswerText(item.id); float answerPosition = 1.0f; if (answerText != "") { answerPosition = float.Parse(answerText); } sliderView = new Slider { Minimum = 0.0f, Maximum = 2.0f, Value = answerPosition, VerticalOptions = LayoutOptions.Center }; OptionItems = new List <string>(); OptionItemsImage = new List <string>(); foreach (var optionItem in item.options) { OptionItems.Add(optionItem); } foreach (var optionItem in item.optionVisuals) { OptionItemsImage.Add(optionItem); } sliderPositionText = new Label { Text = OptionItems[Convert.ToInt32(sliderView.Value)] }; sliderPositionImage = new Label { Text = OptionItemsImage[Convert.ToInt32(sliderView.Value)] }; //Update the Answers if the user changes theslider value sliderView.ValueChanged += (sender, e) => { //https://forums.xamarin.com/discussion/22473/can-you-limit-a-slider-to-only-allow-integer-values-hopefully-snapping-to-the-next-integer var newStep = Math.Round(e.NewValue / 1.0); sliderView.Value = newStep * 1.0; sliderPositionText.Text = OptionItems[Convert.ToInt32(sliderView.Value)]; sliderPositionImage.Text = OptionItemsImage[Convert.ToInt32(sliderView.Value)]; myAnswerManager.UpdateAnswerList(item.id, false, false, sliderView.Value.ToString()); }; ViewCell ViewCellAnswer = new ViewCell() { View = new StackLayout { Orientation = StackOrientation.Vertical, Children = { sliderView, sliderPositionText, sliderPositionImage } } }; section.Add(ViewCellHeader); section.Add(ViewCellAnswer); } if (item.type == "scale") { //Get existing data from saved file (if it exists) String answerText = myAnswerManager.ProvideAnswerText(item.id); double answerPosition = Convert.ToDouble(item.end * 0.5f); if (answerText != "") { answerPosition = double.Parse(answerText); } Stepper stepperView = new Stepper { Minimum = Convert.ToDouble(item.start), Maximum = Convert.ToDouble(item.end), Value = answerPosition, VerticalOptions = LayoutOptions.Center, Increment = Convert.ToDouble(item.increment) //Here I was also wanting to utilise the colouring of the slider //but I could not seem to bring up the MinimumTrackTintColor and //MaximumTrackTintColor methods. If I could have done this then I //would have applied the gradients. }; Label stepperValue = new Label { Text = stepperView.Value.ToString() }; StepperChange myStepperChange = new StepperChange(); myStepperChange.setLabel(stepperValue); //This is a hack here. I did it this way so that multiple steppers do not interfere with each other stepperView.ValueChanged += (sender, e) => { //See how I have pased on (sender, e) myStepperChange.OnStepperValueChanged(sender, e); myAnswerManager.UpdateAnswerList(item.id, false, false, stepperView.Value.ToString()); }; ViewCell ViewCellAnswer = new ViewCell() { View = new StackLayout { Orientation = StackOrientation.Vertical, Children = { stepperView, stepperValue } } }; section.Add(ViewCellHeader); section.Add(ViewCellAnswer); } if (item.type == "multiplechoice") { //This approach was referenced from http://proquestcombo.safaribooksonline.com.ezproxy-b.deakin.edu.au/video/programming/mobile/9781771373371# multipleChoiceAnswers = new List <MultipleChoiceAnswer>(); //Get existing data from saved file (if it exists) and load into a List foreach (var optionItem in item.options) { multipleChoiceAnswers.Add(new MultipleChoiceAnswer(optionItem, myAnswerManager.ProvideAnswerMultipleChoice(item.id, optionItem))); } ListView listView = new ListView { ItemsSource = multipleChoiceAnswers, ItemTemplate = new DataTemplate(() => { Label lblDescription = new Label(); lblDescription.SetBinding(Label.TextProperty, "Description"); Label lblIsChecked = new Label(); lblIsChecked.SetBinding(Label.TextProperty, "IsCheckedString"); Xamarin.Forms.Switch swIsChecked = new Xamarin.Forms.Switch(); swIsChecked.SetBinding(Xamarin.Forms.Switch.IsToggledProperty, "isChecked"); //Update the Answers if the user changes the UI element swIsChecked.Toggled += (sender, e) => // I got this line from https://stackoverflow.com/questions/32975894/xamarin-forms-switch-sends-toggled-event-when-value-is-updated { if (e != null) { var optionText = lblDescription.Text; foreach (var multianswer in multipleChoiceAnswers) { if (multianswer.Description == optionText) { if (multianswer.isChecked == true) { multianswer.isChecked = false; //Save the toggle myAnswerManager.UpdateAnswerList(item.id, true, false, lblDescription.Text); } else { multianswer.isChecked = true; //Save the toggle myAnswerManager.UpdateAnswerList(item.id, true, true, lblDescription.Text); } lblIsChecked.Text = multianswer.IsCheckedString; } } } }; return(new ViewCell { Height = 100, View = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.StartAndExpand, Children = { new StackLayout { VerticalOptions = LayoutOptions.Center, Spacing = 0, Children = { swIsChecked } }, new StackLayout { VerticalOptions = LayoutOptions.Center, Spacing = 0, Children = { lblDescription, lblIsChecked } } } } }); } ) }; ViewCell ViewCellAnswer = new ViewCell() { View = new StackLayout { Orientation = StackOrientation.Vertical, Children = { listView } } }; section.Add(ViewCellHeader); section.Add(ViewCellAnswer); } } } } tblQuizes.Root.Add(section); }
/// <summary> /// Gets the picker automation peer. /// </summary> /// <param name="picker">The picker.</param> /// <returns>A PickerAutomationPeer for the picker.</returns> protected abstract PickerAutomationPeer CreatePickerAutomationPeer(Picker picker);
public ShowModalWithTransparentBkgndGalleryPage() { BackgroundColor = Color.LightPink; var layout = new StackLayout(); _modalPresentationStylesPicker = new Picker(); var modalPresentationStyles = Enum.GetNames(typeof(UIModalPresentationStyle)).Select(m => m).ToList(); _modalPresentationStylesPicker.Title = "Select ModalPresentation Style"; _modalPresentationStylesPicker.ItemsSource = modalPresentationStyles; _modalPresentationStylesPicker.SelectedIndex = 2; _modalPresentationStylesPicker.SelectedIndexChanged += (sender, args) => { var selected = _modalPresentationStylesPicker.SelectedItem; switch (selected) { case "Automatic": _pageWithTransparentBkgnd.On <iOS>().SetModalPresentationStyle(UIModalPresentationStyle.Automatic); break; case "FormSheet": _pageWithTransparentBkgnd.On <iOS>().SetModalPresentationStyle(UIModalPresentationStyle.FormSheet); break; case "FullScreen": _pageWithTransparentBkgnd.On <iOS>().SetModalPresentationStyle(UIModalPresentationStyle.FullScreen); break; case "OverFullScreen": _pageWithTransparentBkgnd.On <iOS>().SetModalPresentationStyle(UIModalPresentationStyle.OverFullScreen); break; case "PageSheet": _pageWithTransparentBkgnd.On <iOS>().SetModalPresentationStyle(UIModalPresentationStyle.PageSheet); break; } }; if (Device.RuntimePlatform == Device.iOS) { layout.Children.Add(_modalPresentationStylesPicker); } var showTransparentModalPageButton = new Button() { Text = "Show Transparent Modal Page", VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Center }; showTransparentModalPageButton.Clicked += ShowModalBtnClicked; layout.Children.Add(showTransparentModalPageButton); layout.Children.Add(_pageLifeCycleCount); layout.Children.Add(_modalLifeCycleCount); Content = layout; _pageWithTransparentBkgnd = new PageWithTransparentBkgnd(); _pageWithTransparentBkgnd.Appearing += (_, __) => { _appearingModalCount++; UpdateLabels(); }; _pageWithTransparentBkgnd.Disappearing += (_, __) => { _disappearingModalCount++; UpdateLabels(); }; _pageWithTransparentBkgnd.On <iOS>().SetModalPresentationStyle(UIModalPresentationStyle.OverFullScreen); }
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 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 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 { ItemsSource = viewModel.Items, ItemsLayout = itemsLayout, ItemTemplate = itemTemplate, BackgroundColor = Color.LightGray, PeekAreaInsets = new Thickness(0, 0, 100, 0), Margin = new Thickness(12), AutomationId = "TheCarouselView" }; 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; }
public PickerTaskPayload(Picker picker, PickerTask task) { Picker = picker; Task = task; }
public void Load(XDocument doc, string folder) { Picker.Load(doc); }
static ContentPage PickerPage() { var pickerInit = new Picker { TextColor = Color.Red, Items = { "Item 1", "Item 2", "Item 3" }, SelectedIndex = 1 }; var pickerColorDefaultToggle = new Picker { Items = { "Item 1", "Item 2", "Item 3" }, SelectedIndex = 1 }; var defaultText = "Should have default color text"; var pickerColorLabel = new Label { Text = defaultText }; var toggleButton = new Button { Text = "Toggle Picker Text Color" }; toggleButton.Clicked += (sender, args) => { if (pickerColorDefaultToggle.TextColor.IsDefault) { pickerColorDefaultToggle.TextColor = Color.Fuchsia; pickerColorLabel.Text = "Should have fuchsia text"; } else { pickerColorDefaultToggle.TextColor = Color.Default; pickerColorLabel.Text = defaultText; } }; const string disabledText = "Picker is Disabled; Should have default disabled color."; var pickerDisabledlabel = new Label { Text = disabledText }; var pickerColorDisabled = new Picker { IsEnabled = false, TextColor = Color.Green, Items = { "Item 1", "Item 2", "Item 3" }, SelectedIndex = 1 }; var buttonToggleEnabled = new Button() { Text = "Toggle IsEnabled" }; buttonToggleEnabled.Clicked += (sender, args) => { pickerColorDisabled.IsEnabled = !pickerColorDisabled.IsEnabled; if (!pickerColorDisabled.IsEnabled) { pickerDisabledlabel.Text = disabledText; } else { pickerDisabledlabel.Text = "Picker is Enabled; Should Be Green"; } }; return(new ContentPage { Title = "Picker", Padding = Device.RuntimePlatform == Device.iOS ? new Thickness(0, 20, 0, 0) : new Thickness(0), Content = new StackLayout { VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, Children = { pickerColorLabel, pickerColorDefaultToggle, toggleButton, pickerInit, pickerDisabledlabel, pickerColorDisabled, buttonToggleEnabled } } }); }
public int GetCounts(string folder, string name) { return(Picker.GetItemCount(name)); }
public ShareLocationPage() { ICalendar calendar = DependencyService.Get <ICalendar>(); Button button = new Button { Text = "Get Location!", Font = Font.SystemFontOfSize(NamedSize.Large), BorderWidth = 1, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.CenterAndExpand }; button.Clicked += OnButtonClicked; Button calendarButton = new Button { Text = "Insert into calendar!", Font = Font.SystemFontOfSize(NamedSize.Large), BorderWidth = 1, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.CenterAndExpand }; calendarButton.Clicked += OnCalendarButtonClicked; Button reminderButton = new Button { Text = "Insert into reminder!", Font = Font.SystemFontOfSize(NamedSize.Large), BorderWidth = 1, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.CenterAndExpand }; reminderButton.Clicked += OnReminderButtonClicked; locationLabel = new Label { Text = "Location", Font = Font.SystemFontOfSize(NamedSize.Large), HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.CenterAndExpand }; reminderLabel = new Label { //Text = "Reminder", Font = Font.SystemFontOfSize(NamedSize.Large), HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.CenterAndExpand }; string reminderText = calendar.getReminder().ToString(); reminderLabel.Text = reminderText; datePicker = new DatePicker { Format = "D", VerticalOptions = LayoutOptions.CenterAndExpand }; timePicker = new TimePicker(); Button deleteReminder = new Button { Text = "Remove reminder", Font = Font.SystemFontOfSize(NamedSize.Large), BorderWidth = 1, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.CenterAndExpand }; deleteReminder.Clicked += onDeleteButtonClicked; Picker picker = new Picker { Title = "Calendar", VerticalOptions = LayoutOptions.CenterAndExpand }; Content = new StackLayout { Children = { button, calendarButton, reminderButton, locationLabel, reminderLabel, deleteReminder, picker, datePicker, timePicker } }; }
public void Save(object configurationItem) { Picker.Save((Picker)configurationItem); }
public VectorSpeechBubblePage() { this.Title = "Vector Speech Bubble"; this.BackgroundColor = ColorHelper.MyLightBlue.ToFormsColor(); var bubble = new VectorSpeechBubble { Text = "Hello there. Do you have a minute to talk?", ArrowDirection = ArrowDirections.RightBottom, BorderColor = Color.White, BorderWidth = 4d, // Padding = new Thickness(8d,8d,8d,8d), // TODO: Auto calculate padding based on the arrow direction and size. This padding should be in addition to HasShadow = true, HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Start, }; var arrowDirectionPicker = new Picker { HorizontalOptions = LayoutOptions.End, WidthRequest = 150d, }; foreach (var direction in System.Enum.GetNames(typeof(ArrowDirections))) { arrowDirectionPicker.Items.Add(direction); } arrowDirectionPicker.SelectedIndex = arrowDirectionPicker.Items.IndexOf(ArrowDirections.RightBottom.ToString()); arrowDirectionPicker.SelectedIndexChanged += (object sender, System.EventArgs e) => { var selectedValue = arrowDirectionPicker.Items[arrowDirectionPicker.SelectedIndex]; var direction = (ArrowDirections)System.Enum.Parse(typeof(ArrowDirections), selectedValue); bubble.ArrowDirection = direction; }; var shadowSwitch = new Switch() { HorizontalOptions = LayoutOptions.End, WidthRequest = 150d }; var fillColorPicker = new ColorPicker() { HorizontalOptions = LayoutOptions.End, WidthRequest = 150d }; fillColorPicker.SelectedColor = Color.Silver; var gradientColorPicker = new ColorPicker() { HorizontalOptions = LayoutOptions.End, WidthRequest = 150d }; gradientColorPicker.SelectedColor = Color.Default; var borderColorPicker = new ColorPicker() { HorizontalOptions = LayoutOptions.End, WidthRequest = 150d }; borderColorPicker.SelectedColor = Color.Purple; var borderWidthSlider = new Slider(0d, 100d, 4d) { HorizontalOptions = LayoutOptions.End, WidthRequest = 150d }; var cornerRadiusSlider = new Slider(0d, 50d, 10d) { HorizontalOptions = LayoutOptions.End, WidthRequest = 150d }; var widthSlider = new Slider { Minimum = 0d, Maximum = Application.Current.MainPage.Width - 20d, Value = Application.Current.MainPage.Width, HorizontalOptions = LayoutOptions.End, WidthRequest = 150d, }; var heightSlider = new Slider { Minimum = 0d, Maximum = 300d, Value = 50d, HorizontalOptions = LayoutOptions.End, WidthRequest = 150d, }; var sliderLabelStyle = new Style(typeof(Label)) { Setters = { new Setter { Property = Label.FontProperty, Value = Font.SystemFontOfSize(NamedSize.Micro) }, new Setter { Property = Label.YAlignProperty, Value = TextAlignment.Center }, }, }; var borderWidthLabel = new Label { Style = sliderLabelStyle }; var cornerRadiusLabel = new Label { Style = sliderLabelStyle }; // new Label { Font = Font.SystemFontOfSize (NamedSize.Micro), YAlign = TextAlignment.Center }; var heightLabel = new Label { Style = sliderLabelStyle }; // new Label { Font = Font.SystemFontOfSize (NamedSize.Micro), YAlign = TextAlignment.Center }; var widthLabel = new Label { Style = sliderLabelStyle }; // new Label { Font = Font.SystemFontOfSize (NamedSize.Micro), YAlign = TextAlignment.Center }; this.Content = new ScrollView { Content = new StackLayout { Padding = new Thickness(4d, 4d, 4d, 4d), Spacing = 4d, Children = { new StackLayout { Orientation = StackOrientation.Horizontal, Children = { new Label { Text = "Arrow Direction", HorizontalOptions = LayoutOptions.FillAndExpand, YAlign = TextAlignment.Center }, arrowDirectionPicker, } }, new StackLayout { Orientation = StackOrientation.Horizontal, Children = { new Label { Text = "Has Shadow", HorizontalOptions = LayoutOptions.FillAndExpand, YAlign = TextAlignment.Center }, shadowSwitch, } }, new StackLayout { Orientation = StackOrientation.Horizontal, Children = { new Label { Text = "Fill Color", HorizontalOptions = LayoutOptions.FillAndExpand, YAlign = TextAlignment.Center }, fillColorPicker, } }, new StackLayout { Orientation = StackOrientation.Horizontal, Children = { new Label { Text = "Gradient Color", HorizontalOptions = LayoutOptions.FillAndExpand, YAlign = TextAlignment.Center }, gradientColorPicker, } }, new StackLayout { Orientation = StackOrientation.Horizontal, Children = { new Label { Text = "Border Color", HorizontalOptions = LayoutOptions.FillAndExpand, YAlign = TextAlignment.Center }, borderColorPicker, } }, new StackLayout { Orientation = StackOrientation.Horizontal, Children = { new Label { Text = "Border Width", HorizontalOptions = LayoutOptions.FillAndExpand, YAlign = TextAlignment.Center }, borderWidthLabel, borderWidthSlider, } }, new StackLayout { Orientation = StackOrientation.Horizontal, Children = { new Label { Text = "Corner Radius", HorizontalOptions = LayoutOptions.FillAndExpand, YAlign = TextAlignment.Center }, cornerRadiusLabel, cornerRadiusSlider, } }, new StackLayout { Orientation = StackOrientation.Horizontal, Children = { new Label { Text = "Width", HorizontalOptions = LayoutOptions.FillAndExpand, YAlign = TextAlignment.Center }, widthLabel, widthSlider, } }, new StackLayout { Orientation = StackOrientation.Horizontal, Children = { new Label { Text = "Height", HorizontalOptions = LayoutOptions.FillAndExpand, YAlign = TextAlignment.Center }, heightLabel, heightSlider, } }, new BoxView { HeightRequest = 12d }, // For some additional spacing bubble, }, } }; bubble.SetBinding(VectorSpeechBubble.FillColorProperty, new Binding("SelectedColor", BindingMode.OneWay, source: fillColorPicker)); bubble.SetBinding(VectorSpeechBubble.GradientFillColorProperty, new Binding("SelectedColor", BindingMode.OneWay, source: gradientColorPicker)); bubble.SetBinding(VectorSpeechBubble.BorderColorProperty, new Binding("SelectedColor", BindingMode.OneWay, source: borderColorPicker)); bubble.SetBinding(VectorSpeechBubble.BorderWidthProperty, new Binding("Value", BindingMode.TwoWay, source: borderWidthSlider)); bubble.SetBinding(VectorSpeechBubble.CornerRadiusProperty, new Binding("Value", BindingMode.TwoWay, source: cornerRadiusSlider)); bubble.SetBinding(VectorSpeechBubble.WidthRequestProperty, new Binding("Value", BindingMode.TwoWay, source: widthSlider)); bubble.SetBinding(VectorSpeechBubble.HeightRequestProperty, new Binding("Value", BindingMode.TwoWay, source: heightSlider)); bubble.SetBinding(VectorSpeechBubble.HasShadowProperty, new Binding("IsToggled", BindingMode.TwoWay, source: shadowSwitch)); borderWidthLabel.SetBinding(Label.TextProperty, new Binding("Value", BindingMode.OneWay, source: borderWidthSlider, stringFormat: "{0:0.0}")); cornerRadiusLabel.SetBinding(Label.TextProperty, new Binding("Value", BindingMode.OneWay, source: cornerRadiusSlider, stringFormat: "{0:0.0}")); heightLabel.SetBinding(Label.TextProperty, new Binding("Value", BindingMode.OneWay, source: heightSlider)); widthLabel.SetBinding(Label.TextProperty, new Binding("Value", BindingMode.OneWay, source: widthSlider)); }
public Page1() { Picker picker; Entry entry; Image img; { Grid 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) } } }; picker = new Picker { Title = "Уезды Эстонии" }; picker.Items.Add("Валгамаа"); picker.Items.Add("Вильяндимаа"); picker.Items.Add("Вырумаа"); picker.Items.Add("Ида-Вирумаа"); picker.Items.Add("Йыгевамаа"); picker.Items.Add("Ляэне-Вирумаа"); picker.Items.Add("Ляэнемаа"); picker.Items.Add("Пылвамаа"); picker.Items.Add("Пярнумаа"); picker.Items.Add("Рапламаа"); picker.Items.Add("Сааремаа"); picker.Items.Add("Тартумаа"); picker.Items.Add("Харьюмаа"); picker.Items.Add("Хийумаа"); picker.Items.Add("Ярвамаа"); gr.Children.Add(picker, 0, 0); picker.SelectedIndexChanged += Picker_SelectedIndexChanged; stol = new Picker { Title = "Административные центры уездов" }; stol.Items.Add("Валга"); stol.Items.Add("Вильянди"); stol.Items.Add("Выру"); stol.Items.Add("Йихви"); stol.Items.Add("Йигева"); stol.Items.Add("Раквере"); stol.Items.Add("Хаапсалу"); stol.Items.Add("Пылва"); stol.Items.Add("Пярну"); stol.Items.Add("Рапла"); stol.Items.Add("Курусааре"); stol.Items.Add("Тарту"); stol.Items.Add("Таллинн"); stol.Items.Add("Кярдла"); stol.Items.Add("Пайде"); gr.Children.Add(stol, 0, 0); stol.SelectedIndexChanged += Stol_SelectedIndexChanged; entry = new Entry { Text = "Уезд" }; gr.Children.Add(entry, 1, 1); img = new Image { Source = "harju.jpg" }; { if (stol.SelectedIndex == 0) { img.Source = "valga.png"; picker.Title = picker.Items[stol.SelectedIndex]; } else if (stol.SelectedIndex == 1) { img.Source = "viljandi.jpg"; picker.Title = picker.Items[stol.SelectedIndex]; } else if (stol.SelectedIndex == 2) { img.Source = "voruma.jpg"; picker.Title = picker.Items[stol.SelectedIndex]; } else if (stol.SelectedIndex == 3) { img.Source = "ida.jpg"; picker.Title = picker.Items[stol.SelectedIndex]; } else if (stol.SelectedIndex == 4) { img.Source = "jigi.jpg"; picker.Title = picker.Items[stol.SelectedIndex]; } else if (stol.SelectedIndex == 5) { img.Source = "laene.jpg"; picker.Title = picker.Items[stol.SelectedIndex]; } else if (stol.SelectedIndex == 6) { img.Source = "laenemaa.jpg"; picker.Title = picker.Items[stol.SelectedIndex]; } else if (stol.SelectedIndex == 7) { img.Source = "polvama.jpg"; picker.Title = picker.Items[stol.SelectedIndex]; } else if (stol.SelectedIndex == 8) { img.Source = "parnu.jpg"; picker.Title = picker.Items[stol.SelectedIndex]; } else if (stol.SelectedIndex == 9) { img.Source = "rapla.jpg"; picker.Title = picker.Items[stol.SelectedIndex]; } else if (stol.SelectedIndex == 10) { img.Source = "sarema.jpg"; picker.Title = picker.Items[stol.SelectedIndex]; } else if (stol.SelectedIndex == 11) { img.Source = "tartu.jpg"; picker.Title = picker.Items[stol.SelectedIndex]; } else if (stol.SelectedIndex == 12) { img.Source = "harju.jpg"; picker.Title = picker.Items[stol.SelectedIndex]; } else if (stol.SelectedIndex == 13) { img.Source = "hiju.jpg"; picker.Title = picker.Items[stol.SelectedIndex]; } else if (stol.SelectedIndex == 14) { img.Source = "jarva.jpg"; picker.Title = picker.Items[stol.SelectedIndex]; } } { if (picker.SelectedIndex == 0) { img.Source = "valga.png"; stol.Title = stol.Items[stol.SelectedIndex]; entry.Text = "Уезд Валгамаа расположен в южной части Эстонии. Этот регион граничит с Латвийской республикой. Административным центром уезда является город Валга, побратимом которого считается латвийский Валка. В некоторой степени эти города составляют единое целое, однако административно они разделены границей."; } else if (picker.SelectedIndex == 1) { img.Source = "viljandi.jpg"; stol.Title = stol.Items[stol.SelectedIndex]; entry.Text = "Ви́льяндимаа — уезд в Эстонии, расположенный в южной части страны. Административный центр — город Вильянди. Уезд состоит из трёх городов и 9 волостей."; } else if (picker.SelectedIndex == 2) { img.Source = "voruma.jpg"; stol.Title = stol.Items[stol.SelectedIndex]; entry.Text = "Вырумаа (эст. Võrumaa или Võru maakond, выруск. Võromaa или Võro maakund) — уезд в Эстонии, расположенный в юго-восточной части страны. Граничит с Россией, Латвией, уездами Валгамаа и Пылвамаа. Административный центр — город Выру (тж. Верро). Уезд в административном отношении делится на один город и 4 волости (с 2017 года)."; } else if (picker.SelectedIndex == 3) { img.Source = "ida.jpg"; stol.Title = stol.Items[stol.SelectedIndex]; entry.Text = "И́да-Ви́румаа (эст. Ida-Virumaa), или И́да-Ви́руский уезд (эст. Ida-Viru maakond) — уезд (мааконд) на северо-востоке Эстонии, граничит на севере и востоке с Россией. Территория уезда простирается до Финского залива на севере, до реки Нарвы на востоке и до Чудского озера на юге. На западе и юго-западе уезда граница тянется через леса и болота Алутагузе[2], вдоль территории Ляэне-Вируского и Йыгеваского уездов. Площадь Ида-Вирумаа — 3364,05 км², что составляет 7,4 % от площади всей Эстонии. В середине северной части уезда, в 165 км от Таллина, находится административный центр Ида-Вирумаа — город Йыхви. "; } else if (picker.SelectedIndex == 4) { img.Source = "jigi.jpg"; stol.Title = stol.Items[stol.SelectedIndex]; entry.Text = "Йыгевамаа (эст. Jõgevamaa или Jõgeva maakond) — уезд в Эстонии, расположенный в восточной части страны. Административный центр — город Йыгева. Уезд в административном отношении делится на 3 города и 10 волостей. "; } else if (picker.SelectedIndex == 5) { img.Source = "laene.jpg"; stol.Title = stol.Items[stol.SelectedIndex]; entry.Text = "Ля́эне-Ви́румаа (эст. Lääne-Virumaa или Lääne-Viru maakond) — уезд в Эстонии, расположенный в северо-восточной части страны. Административный центр — город Раквере. "; } else if (picker.SelectedIndex == 6) { img.Source = "laenemaa.jpg"; stol.Title = stol.Items[stol.SelectedIndex]; entry.Text = "Ляэнемаа (эст. Läänemaa или Lääne maakond) — уезд в Эстонии, расположенный на крайнем западе материковой части страны. С севера и запада омывается Балтийским морем. Граничит с уездами Харьюмаа на северо-востоке, Рапламаа на востоке и Пярнумаа на юге. Административный центр — город Хаапсалу. Уезд в административном отношении делится на 1 город и 9 волостей."; } else if (picker.SelectedIndex == 7) { img.Source = "polvama.jpg"; stol.Title = stol.Items[stol.SelectedIndex]; entry.Text = "Пы́лвамаа (старое написание Пыльвамаа; эст. Põlvamaa или Põlva maakond) — уезд на юго-востоке Эстонии. Граничит с Россией на востоке, а также с уездами Вырумаа, Валгамаа и Тартумаа. Административный центр — город Пылва. До административной реформы местных самоуправлений Эстонии 2017 года уезд делился на 13 волостей, после — на 3 волости"; } else if (picker.SelectedIndex == 8) { img.Source = "parnu.jpg"; stol.Title = stol.Items[stol.SelectedIndex]; entry.Text = "Пярнумаа (эст. Pärnumaa или Pärnu maakond) — самый крупный по площади уезд в Эстонии, расположенный в юго-западной части страны на побережье Рижского залива. Граничит с уездами Ляэнемаа и Рапламаа на севере и Ярвамаа и Вильяндимаа на востоке. Административный центр — город Пярну. Уезд в административном отношении делится на 2 города и 17 волостей."; } else if (picker.SelectedIndex == 9) { img.Source = "rapla.jpg"; stol.Title = stol.Items[stol.SelectedIndex]; entry.Text = "Рапламаа (эст. Raplamaa или Rapla maakond) — уезд в Эстонии, расположенный в западной части страны. Граничит с уездами Ярвамаа на востоке, Пярнумаа на юге, Ляэнемаа на западе и Харьюмаа на севере. Административный центр — город Рапла. Уезд в административном отношении делится на 10 волостей."; } else if (picker.SelectedIndex == 10) { img.Source = "sarema.jpg"; stol.Title = stol.Items[stol.SelectedIndex]; entry.Text = "Са́аремаа (эст. Saaremaa или Saare maakond) — уезд в Эстонии, территория которого состоит из островов Сааремаа, Муху, Абрука, Вилсанди, Рухну и других более мелких островов."; } else if (picker.SelectedIndex == 11) { img.Source = "tartu.jpg"; stol.Title = stol.Items[stol.SelectedIndex]; entry.Text = "Та́ртумаа (также Та́ртуский уе́зд — эст. Tartu maakond) — один из 15 уездов Эстонской Республики. Административный центр — город Тарту. Площадь — 2993 км², население — 153 479 (2012). "; } else if (picker.SelectedIndex == 12) { img.Source = "harju.jpg"; stol.Title = stol.Items[stol.SelectedIndex]; entry.Text = "Харьюмаа, или Харью (эст. Harju maakond или Harjumaa), — один из 15 уездов Эстонии. Административный центр — столица страны Таллин. С 21 декабря 2009 года старейшина уезда — Юлле Раясалу (Ülle Rajasalu). "; } else if (picker.SelectedIndex == 13) { img.Source = "hiju.jpg"; stol.Title = stol.Items[stol.SelectedIndex]; entry.Text = "Хийумаа (эст. Hiiu maakond) — уезд в Эстонии, территория которого состоит из острова Хийумаа и окружающих его малых островов. Административный центр уезда — город Кярдла. "; } else if (picker.SelectedIndex == 14) { img.Source = "jarva.jpg"; stol.Title = stol.Items[stol.SelectedIndex]; entry.Text = "Ярвамаа (эст. Järvamaa или Järva maakond) — уезд в Эстонии, расположенный в центральной части страны. Административный центр — город Пайде. Уезд в административном отношении делится на один городской муниципалитет и две волости."; } } { } } }
private void OnDisable() { Picker.Clear(); }
public MainPage() { Picker picker; Entry entry; Image img; { Grid 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) } } }; picker = new Picker { Title = "Уезды Эстонии" }; picker.Items.Add("Валгамаа"); picker.Items.Add("Вильяндимаа"); picker.Items.Add("Вырумаа"); picker.Items.Add("Ида-Вирумаа"); picker.Items.Add("Йыгевамаа"); picker.Items.Add("Ляэне-Вирумаа"); gr.Children.Add(picker, 0, 0); picker.SelectedIndexChanged += Picker_SelectedIndexChanged; stol = new Picker { Title = "Административные центры уездов" }; stol.Items.Add("Валга"); stol.Items.Add("Вильянди"); stol.Items.Add("Выру"); stol.Items.Add("Йихви"); stol.Items.Add("Йигева"); stol.Items.Add("Раквере"); gr.Children.Add(stol, 0, 0); stol.SelectedIndexChanged += Stol_SelectedIndexChanged; entry = new Entry { Text = "Уезд" }; gr.Children.Add(entry, 1, 1); img = new Image { Source = "harju.jpg" }; { if (stol.SelectedIndex == 0) { img.Source = "valgamaa.jpg"; picker.Title = picker.Items[stol.SelectedIndex]; } else if (stol.SelectedIndex == 1) { img.Source = "viljandimaa.jpg"; picker.Title = picker.Items[stol.SelectedIndex]; } else if (stol.SelectedIndex == 2) { img.Source = "vorumaa.jpg"; picker.Title = picker.Items[stol.SelectedIndex]; } else if (stol.SelectedIndex == 3) { img.Source = "idaviru.jpg"; picker.Title = picker.Items[stol.SelectedIndex]; } else if (stol.SelectedIndex == 4) { img.Source = "jogevamaa.jpg"; picker.Title = picker.Items[stol.SelectedIndex]; } else if (stol.SelectedIndex == 5) { img.Source = "laavirumaa.jpg"; picker.Title = picker.Items[stol.SelectedIndex]; } } { if (picker.SelectedIndex == 0) { img.Source = "valgamaa.png"; stol.Title = stol.Items[stol.SelectedIndex]; entry.Text = "Уезд Валгамаа расположен в южной части Эстонии. Этот регион граничит с Латвийской республикой. Административным центром уезда является город Валга, побратимом которого считается латвийский Валка. В некоторой степени эти города составляют единое целое, однако административно они разделены границей."; } else if (picker.SelectedIndex == 1) { img.Source = "viljandimaa.jpg"; stol.Title = stol.Items[stol.SelectedIndex]; entry.Text = "Ви́льяндимаа — уезд в Эстонии, расположенный в южной части страны. Административный центр — город Вильянди. Уезд состоит из трёх городов и 9 волостей."; } else if (picker.SelectedIndex == 2) { img.Source = "vorumaa.jpg"; stol.Title = stol.Items[stol.SelectedIndex]; entry.Text = "Вырумаа (эст. Võrumaa или Võru maakond, выруск. Võromaa или Võro maakund) — уезд в Эстонии, расположенный в юго-восточной части страны. Граничит с Россией, Латвией, уездами Валгамаа и Пылвамаа. Административный центр — город Выру (тж. Верро). Уезд в административном отношении делится на один город и 4 волости (с 2017 года)."; } else if (picker.SelectedIndex == 3) { img.Source = "idaviru.jpg"; stol.Title = stol.Items[stol.SelectedIndex]; entry.Text = "И́да-Ви́румаа (эст. Ida-Virumaa), или И́да-Ви́руский уезд (эст. Ida-Viru maakond) — уезд (мааконд) на северо-востоке Эстонии, граничит на севере и востоке с Россией. Территория уезда простирается до Финского залива на севере, до реки Нарвы на востоке и до Чудского озера на юге. На западе и юго-западе уезда граница тянется через леса и болота Алутагузе[2], вдоль территории Ляэне-Вируского и Йыгеваского уездов. Площадь Ида-Вирумаа — 3364,05 км², что составляет 7,4 % от площади всей Эстонии. В середине северной части уезда, в 165 км от Таллина, находится административный центр Ида-Вирумаа — город Йыхви. "; } else if (picker.SelectedIndex == 4) { img.Source = "jogevamaa.jpg"; stol.Title = stol.Items[stol.SelectedIndex]; entry.Text = "Йыгевамаа (эст. Jõgevamaa или Jõgeva maakond) — уезд в Эстонии, расположенный в восточной части страны. Административный центр — город Йыгева. Уезд в административном отношении делится на 3 города и 10 волостей. "; } else if (picker.SelectedIndex == 5) { img.Source = "laavirumaa.jpg"; stol.Title = stol.Items[stol.SelectedIndex]; entry.Text = "Ля́эне-Ви́румаа (эст. Lääne-Virumaa или Lääne-Viru maakond) — уезд в Эстонии, расположенный в северо-восточной части страны. Административный центр — город Раквере. "; } } { } } }
public TermsPage(int pageNumber, int totalPageNumbers) { viewModel = new TermsPageViewModel(); BindingContext = viewModel; #region Create Scenario Stack var scenarioLabel = new Label { Text = "Scenario", FontAttributes = FontAttributes.Bold }; var scenarioPicker = new Picker(); scenarioPicker.Items.Add("1"); scenarioPicker.Items.Add("2"); scenarioPicker.Items.Add("3"); scenarioPicker.SetBinding(Picker.SelectedIndexProperty, "PickerValue"); var scenarioStack = new StackLayout { Orientation = StackOrientation.Horizontal, Children = { scenarioLabel, scenarioPicker }, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center }; #endregion #region Create Scenario Label var term1Label = new Label { Text = "Down Payment to BFC" }; var term2Label = new Label { Text = "Amount Financed" }; var term3Label = new Label { Text = "Compounding Period" }; var term4Label = new Label { Text = "Funding Program" }; var term5Label = new Label { Text = "Funding Source" }; var term6Label = new Label { Text = "Payment/Terms/Run Rate" }; var term7Label = new Label { Text = "Security Deposit" }; var term8Label = new Label { Text = "Advanced Payments" }; var term9Label = new Label { Text = "Total Time" }; var term10Label = new Label { Text = "Doc Fee" }; var term11Label = new Label { Text = "Purchase Options" }; var term12Label = new Label { Text = "Purchase Options Type" }; var term13Label = new Label { Text = "Additional Collatoral" }; var term14Label = new Label { Text = "Total Initial Cash" }; var term15Label = new Label { Text = "Total Referral Cash" }; var term16Label = new Label { Text = "Other Income/Expense" }; var term17Label = new Label { Text = "IRR" }; var term18Label = new Label { Text = "One-Off Profit / PTS / Source" }; var term19Label = new Label { Text = "Commission" }; var term20Label = new Label { Text = "T-Value Calculation" }; #endregion #region Create Labels for Scenario Data var term1Data = new Label(); term1Data.SetBinding(Label.TextProperty, "Term1Data"); var term2Data = new Label(); term2Data.SetBinding(Label.TextProperty, "Term2Data"); var term3Data = new Label(); term3Data.SetBinding(Label.TextProperty, "Term3Data"); var term4Data = new Label(); term4Data.SetBinding(Label.TextProperty, "Term4Data"); var term5Data = new Label(); term5Data.SetBinding(Label.TextProperty, "Term5Data"); var term6Data = new Label(); term6Data.SetBinding(Label.TextProperty, "Term6Data"); var term7Data = new Label(); term7Data.SetBinding(Label.TextProperty, "Term7Data"); var term8Data = new Label(); term8Data.SetBinding(Label.TextProperty, "Term8Data"); var term9Data = new Label(); term9Data.SetBinding(Label.TextProperty, "Term9Data"); var term10Data = new Label(); term10Data.SetBinding(Label.TextProperty, "Term10Data"); var term11Data = new Label(); term11Data.SetBinding(Label.TextProperty, "Term11Data"); var term12Data = new Label(); term12Data.SetBinding(Label.TextProperty, "Term12Data"); var term13Data = new Label(); term13Data.SetBinding(Label.TextProperty, "Term13Data"); var term14Data = new Label(); term14Data.SetBinding(Label.TextProperty, "Term14Data"); var term15Data = new Label(); term15Data.SetBinding(Label.TextProperty, "Term15Data"); var term16Data = new Label(); term16Data.SetBinding(Label.TextProperty, "Term16Data"); var term17Data = new Label(); term17Data.SetBinding(Label.TextProperty, "Term17Data"); var term18Data = new Label(); term18Data.SetBinding(Label.TextProperty, "Term18Data"); var term19Data = new Label(); term19Data.SetBinding(Label.TextProperty, "Term19Data"); var term20Data = new Label(); term20Data.SetBinding(Label.TextProperty, "Term20Data"); #endregion #region Create & Populate Grid var dataGrid = new Grid { HorizontalOptions = LayoutOptions.Center, 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) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, 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) }, } }; dataGrid.Children.Add(term1Label, 0, 0); dataGrid.Children.Add(term2Label, 0, 1); dataGrid.Children.Add(term3Label, 0, 2); dataGrid.Children.Add(term4Label, 0, 3); dataGrid.Children.Add(term5Label, 0, 4); dataGrid.Children.Add(term6Label, 0, 5); dataGrid.Children.Add(term7Label, 0, 6); dataGrid.Children.Add(term8Label, 0, 7); dataGrid.Children.Add(term9Label, 0, 8); dataGrid.Children.Add(term10Label, 0, 9); dataGrid.Children.Add(term11Label, 0, 10); dataGrid.Children.Add(term12Label, 0, 11); dataGrid.Children.Add(term13Label, 0, 12); dataGrid.Children.Add(term14Label, 0, 13); dataGrid.Children.Add(term15Label, 0, 14); dataGrid.Children.Add(term16Label, 0, 15); dataGrid.Children.Add(term17Label, 0, 16); dataGrid.Children.Add(term18Label, 0, 17); dataGrid.Children.Add(term19Label, 0, 18); dataGrid.Children.Add(term20Label, 0, 19); dataGrid.Children.Add(term1Data, 1, 0); dataGrid.Children.Add(term2Data, 1, 1); dataGrid.Children.Add(term3Data, 1, 2); dataGrid.Children.Add(term4Data, 1, 3); dataGrid.Children.Add(term5Data, 1, 4); dataGrid.Children.Add(term6Data, 1, 5); dataGrid.Children.Add(term7Data, 1, 6); dataGrid.Children.Add(term8Data, 1, 7); dataGrid.Children.Add(term9Data, 1, 8); dataGrid.Children.Add(term10Data, 1, 9); dataGrid.Children.Add(term11Data, 1, 10); dataGrid.Children.Add(term12Data, 1, 11); dataGrid.Children.Add(term13Data, 1, 12); dataGrid.Children.Add(term14Data, 1, 13); dataGrid.Children.Add(term15Data, 1, 14); dataGrid.Children.Add(term16Data, 1, 15); dataGrid.Children.Add(term17Data, 1, 16); dataGrid.Children.Add(term18Data, 1, 17); dataGrid.Children.Add(term19Data, 1, 18); dataGrid.Children.Add(term20Data, 1, 19); #endregion var termsScrollView = new ScrollView { Content = dataGrid }; var pageNumberLabel = new Label { Text = $"Page {pageNumber} of {totalPageNumbers}", FontAttributes = FontAttributes.Bold, HorizontalOptions = LayoutOptions.Center }; var scenarioListStack = new StackLayout { Children = { pageNumberLabel, scenarioStack, termsScrollView } }; Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5); Content = scenarioListStack; }
// Добавить предмет в DropAll private void MI_Add_Click(object sender, RoutedEventArgs e) { if(DropAll.IndexOf((DropAll)L_DropAll_NPC.SelectedItem) != -1) { DropAll drop = (DropAll)L_DropAll_NPC.SelectedItem; Picker pick = new Picker(TypeFile.ItemALL); pick.ShowDialog(); ItemAllLod lod = FileManager.ItemAllLod.Where(p => p.ItemID == pick.SelectItem).FirstOrDefault(); if (lod == null) return; DropAll.Items item = new DropAll.Items() { idx = lod.ItemID, name = lod.Name, percent = 0, TexCol = lod.TexCol, TexID = lod.TexID, TexRow = lod.TexRow}; drop.Item.Add(item); Items.Add(item); L_DropAllItems.ItemsSource = Items; } }
public CustomCell() { StackLayout cellWrapper = new StackLayout(); StackLayout stack = new StackLayout(); var picker = new Picker(); var datePicker = new DatePicker (); var timePicker = new TimePicker (); var items = new List<string> { "One", "Two", "Three" }; foreach(string item in items) { picker.Items.Add(item); } cellWrapper.BackgroundColor = Color.FromHex("#eee"); stack.Orientation = StackOrientation.Vertical; stack.Children.Add(picker); stack.Children.Add(timePicker); stack.Children.Add(datePicker); cellWrapper.Children.Add(stack); View = cellWrapper; }
// Меню выбора Item private void T_DropALL_ID_Item_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e) { if (L_DropAllItems.SelectedItem == null) return; Picker picker = new Picker(TypeFile.ItemALL); picker.ShowDialog(); if (picker.SelectItem == -2 || picker.SelectItem == -1) return; T_DropALL_ID_Item.Text = picker.SelectItem.ToString(); }
private void Control_Click(object sender, EventArgs e) { Picker model = Element; var picker = new NumberPicker(Context); if (model.Items != null && model.Items.Any()) { picker.MaxValue = model.Items.Count - 1; picker.MinValue = 0; picker.SetDisplayedValues(model.Items.ToArray()); //picker.SetBackgroundColor(Android.Graphics.Color.WhiteSmoke); picker.TextAlignment = TextAlignmentCenter; picker.WrapSelectorWheel = false; picker.Value = model.SelectedIndex; } var layout = new LinearLayout(Context) { Orientation = Orientation.Vertical }; layout.AddView(picker); ElementController.SetValueFromRenderer(VisualElement.IsFocusedProperty, true); var builder = new AlertDialog.Builder(Context); builder.SetView(layout); //builder.SetTitle(model.Title ?? ""); builder.SetNegativeButton(App.cancel, (s, a) => { MessagingCenter.Send <Object>(this, "Cancel_Clicked"); }); builder.SetPositiveButton(App.ok, (s, a) => { ElementController.SetValueFromRenderer(Picker.SelectedIndexProperty, picker.Value); // It is possible for the Content of the Page to be changed on SelectedIndexChanged. // In this case, the Element & Control will no longer exist. if (Element != null) { if (model.Items.Count > 0 && Element.SelectedIndex >= 0) { Control.Text = model.Items[Element.SelectedIndex]; } ElementController.SetValueFromRenderer(VisualElement.IsFocusedProperty, false); // It is also possible for the Content of the Page to be changed when Focus is changed. // In this case, we'll lose our Control. } MessagingCenter.Send <Object>(this, "Ok_Clicked"); }); _dialog = builder.Create(); _dialog.DismissEvent += (ssender, args) => { ElementController?.SetValueFromRenderer(VisualElement.IsFocusedProperty, false); }; _dialog.Show(); }
static ContentPage PickerPage() { var pickerInit = new Picker { TextColor = Color.Red, Items = { "Item 1", "Item 2", "Item 3" }, SelectedIndex = 1 }; var pickerColorDefaultToggle = new Picker { Items = { "Item 1", "Item 2", "Item 3" } , SelectedIndex = 1 }; var defaultText = "Should have default color text"; var pickerColorLabel = new Label { Text = defaultText }; var toggleButton = new Button { Text = "Toggle Picker Text Color" }; toggleButton.Clicked += (sender, args) => { if (pickerColorDefaultToggle.TextColor.IsDefault) { pickerColorDefaultToggle.TextColor = Color.Fuchsia; pickerColorLabel.Text = "Should have fuchsia text"; } else { pickerColorDefaultToggle.TextColor = Color.Default; pickerColorLabel.Text = defaultText; } }; const string disabledText = "Picker is Disabled; Should have default disabled color."; var pickerDisabledlabel = new Label { Text = disabledText }; var pickerColorDisabled = new Picker { IsEnabled = false, TextColor = Color.Green, Items = { "Item 1", "Item 2", "Item 3" }, SelectedIndex = 1 }; var buttonToggleEnabled = new Button() { Text = "Toggle IsEnabled" }; buttonToggleEnabled.Clicked += (sender, args) => { pickerColorDisabled.IsEnabled = !pickerColorDisabled.IsEnabled; if (!pickerColorDisabled.IsEnabled) { pickerDisabledlabel.Text = disabledText; } else { pickerDisabledlabel.Text = "Picker is Enabled; Should Be Green"; } }; return new ContentPage { Title = "Picker", Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, Device.OnPlatform(00, 0, 0)), Content = new StackLayout { VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, Children = { pickerColorLabel, pickerColorDefaultToggle, toggleButton, pickerInit, pickerDisabledlabel, pickerColorDisabled, buttonToggleEnabled } } }; }
// Добавить NPC в DropAll private void MI_Add_npc_Click(object sender, RoutedEventArgs e) { if (!DBInfoConnection.TestConnection()) { ShowWindow("Нет подключения"); return; } DropAllListNPC(); Picker pick = new Picker(TypeFile.MobAll); pick.ShowDialog(); if (pick.SelectItem == -2 || pick.SelectItem == -1) return; DropAll npc = new DropAll(); npc.NpcID = pick.SelectItem; npc.NpcName = pick.SelectName; npc.Item = new List<DropAll.Items>() { new DropAll.Items() { idx = 85, name = "Камень Богов", percent = 0, TexID = 0, TexCol = 8, TexRow = 1 } }; DropAllAction(InquirySQL.ActionSQL.ADD, npc.NpcID, 85, 0); // Добавить в БД DropAll.Add(npc); L_DropAll_NPC.ItemsSource = DropAll; }
/// <summary> /// Initializes a new instance of the <see cref="ProbePage"/> class. /// </summary> /// <param name="probe">Probe to display.</param> public ProbePage(Probe probe) { Title = "Probe"; StackLayout contentLayout = new StackLayout { Orientation = StackOrientation.Vertical, VerticalOptions = LayoutOptions.FillAndExpand }; string type = ""; if (probe is ListeningProbe) { type = "Listening"; } else if (probe is PollingProbe) { type = "Polling"; } contentLayout.Children.Add(new ContentView { Content = new Label { Text = probe.DisplayName + (type == "" ? "" : " (" + type + ")"), FontSize = 20, FontAttributes = FontAttributes.Italic, TextColor = Color.Accent, HorizontalOptions = LayoutOptions.Center }, Padding = new Thickness(0, 10, 0, 10) }); foreach (StackLayout stack in UiProperty.GetPropertyStacks(probe)) { contentLayout.Children.Add(stack); } #region script probes if (probe is ScriptProbe) { ScriptProbe scriptProbe = probe as ScriptProbe; Button editScriptsButton = new Button { Text = "Edit Scripts", FontSize = 20 }; contentLayout.Children.Add(editScriptsButton); editScriptsButton.Clicked += async(o, e) => { await Navigation.PushAsync(new ScriptRunnersPage(scriptProbe)); }; Button shareScriptButton = new Button { Text = "Share Definition", FontSize = 20 }; contentLayout.Children.Add(shareScriptButton); shareScriptButton.Clicked += (o, e) => { string sharePath = SensusServiceHelper.Get().GetSharePath(".json"); using (StreamWriter shareFile = new StreamWriter(sharePath)) { shareFile.WriteLine(JsonConvert.SerializeObject(probe, SensusServiceHelper.JSON_SERIALIZER_SETTINGS)); } SensusServiceHelper.Get().ShareFileAsync(sharePath, "Probe Definition", "application/json"); }; } #endregion #region proximity probe if (probe is IPointsOfInterestProximityProbe) { Button editTriggersButton = new Button { Text = "Edit Triggers", FontSize = 20, HorizontalOptions = LayoutOptions.FillAndExpand }; contentLayout.Children.Add(editTriggersButton); editTriggersButton.Clicked += async(o, e) => { await Navigation.PushAsync(new ProximityTriggersPage(probe as IPointsOfInterestProximityProbe)); }; } #endregion #region anonymization List <PropertyInfo> anonymizableProperties = probe.DatumType.GetProperties().Where(property => property.GetCustomAttribute <Anonymizable>() != null).ToList(); if (anonymizableProperties.Count > 0) { contentLayout.Children.Add(new Label { Text = "Anonymization", FontSize = 20, FontAttributes = FontAttributes.Italic, TextColor = Color.Accent, HorizontalOptions = LayoutOptions.Center }); List <StackLayout> anonymizablePropertyStacks = new List <StackLayout>(); foreach (PropertyInfo anonymizableProperty in anonymizableProperties) { Anonymizable anonymizableAttribute = anonymizableProperty.GetCustomAttribute <Anonymizable>(true); Label propertyLabel = new Label { Text = anonymizableAttribute.PropertyDisplayName ?? anonymizableProperty.Name + ":", FontSize = 20, HorizontalOptions = LayoutOptions.Start }; // populate a picker of anonymizers for the current property Picker anonymizerPicker = new Picker { Title = "Select Anonymizer", HorizontalOptions = LayoutOptions.FillAndExpand }; anonymizerPicker.Items.Add("Do Not Anonymize"); foreach (Anonymizer anonymizer in anonymizableAttribute.AvailableAnonymizers) { anonymizerPicker.Items.Add(anonymizer.DisplayText); } anonymizerPicker.SelectedIndexChanged += (o, e) => { Anonymizer selectedAnonymizer = null; if (anonymizerPicker.SelectedIndex > 0) { selectedAnonymizer = anonymizableAttribute.AvailableAnonymizers[anonymizerPicker.SelectedIndex - 1]; // subtract one from the selected index since the JsonAnonymizer's collection of anonymizers start after the "None" option within the picker. } probe.Protocol.JsonAnonymizer.SetAnonymizer(anonymizableProperty, selectedAnonymizer); }; // set the picker's index to the current anonymizer (or "Do Not Anonymize" if there is no current) Anonymizer currentAnonymizer = probe.Protocol.JsonAnonymizer.GetAnonymizer(anonymizableProperty); int currentIndex = 0; if (currentAnonymizer != null) { currentIndex = anonymizableAttribute.AvailableAnonymizers.IndexOf(currentAnonymizer) + 1; } anonymizerPicker.SelectedIndex = currentIndex; StackLayout anonymizablePropertyStack = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, Children = { propertyLabel, anonymizerPicker } }; anonymizablePropertyStacks.Add(anonymizablePropertyStack); } foreach (StackLayout anonymizablePropertyStack in anonymizablePropertyStacks.OrderBy(s => (s.Children[0] as Label).Text)) { contentLayout.Children.Add(anonymizablePropertyStack); } } #endregion Content = new ScrollView { Content = contentLayout }; }
// Меню выбора изменения NPC private void T_DropAll_ID_NPC_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e) { if (L_DropAll_NPC.SelectedItem == null) return; Picker pick = new Picker(TypeFile.MobAll); pick.ShowDialog(); if (pick.SelectItem == -2 || pick.SelectItem == -1) return; var oldNpc = (DropAll)L_DropAll_NPC.SelectedItem; if (oldNpc != null) { DropAllAction(InquirySQL.ActionSQL.DEL, oldNpc.NpcID); // Удалить старый НПС DropAll.Where(p => p.NpcID == oldNpc.NpcID).FirstOrDefault().NpcID = pick.SelectItem; // Изменить ид старого нпс на новый DropAll.Where(p => p.NpcID == oldNpc.NpcID).FirstOrDefault().NpcName = pick.SelectName; foreach (var item in Items) { DropAllAction(InquirySQL.ActionSQL.ADD, pick.SelectItem, item.idx, item.percent); // Запись нового нпс со всеми предметами } ShowWindow("NPC изменен на " + pick.SelectName); } }
void RenderCurrentRallyUI(Rally currentRally) { Grid upperLayout = new Grid { HorizontalOptions = LayoutOptions.FillAndExpand, MinimumHeightRequest = 100 }; upperLayout.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); upperLayout.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); upperLayout.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(2, GridUnitType.Star) }); upperLayout.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); Label timerLabel = new Label { TextColor = Color.Black, FontSize = 40, FontAttributes = FontAttributes.Bold, HorizontalOptions = LayoutOptions.CenterAndExpand }; timerLabel.BindingContext = timer; timerLabel.SetBinding(Label.TextProperty, "TimerString"); upperLayout.Children.Add(timerLabel, 1, 0); Button messageInviteesButton = new Button { Text = "\U00002709", FontSize = 20, FontAttributes = FontAttributes.Bold, TextColor = Color.Black, HorizontalOptions = LayoutOptions.End }; messageInviteesButton.Clicked += delegate { openNewMessagePage(); }; upperLayout.Children.Add(messageInviteesButton, 2, 0); parentLayout.Children.Add(upperLayout); Label invitation = new Label { Text = currentRally.invitation, TextColor = Color.Black, FontSize = 20, FontAttributes = FontAttributes.Bold, HorizontalOptions = LayoutOptions.Center }; parentLayout.Children.Add(invitation); Label summary = new Label { TextColor = Color.Black, FontSize = 20, HorizontalOptions = LayoutOptions.CenterAndExpand }; summary.BindingContext = currentRally; summary.SetBinding(Label.TextProperty, "inviteeSummary"); parentLayout.Children.Add(summary); Picker sortPicker = new Picker { Title = "Sort by", TextColor = Color.Black, FontSize = 20, HorizontalOptions = LayoutOptions.Fill, BackgroundColor = Color.Transparent }; sortPicker.Items.Add("Sort A-Z"); sortPicker.Items.Add("Sort Z-A"); sortPicker.Items.Add("Show Only Accepted"); sortPicker.Items.Add("Show Only Declined"); sortPicker.Items.Add("Show Only Undetermined"); sortPicker.Items.Add("Show Only Unreplied"); sortPicker.SelectedIndexChanged += delegate { switch (sortPicker.SelectedIndex) { case 0: visibleInviteeList = currentRally.invitees.OrderBy(i => i.Name).ToList(); refreshVisibleInviteeList(); break; case 1: visibleInviteeList = currentRally.invitees.OrderByDescending(i => i.Name).ToList(); refreshVisibleInviteeList(); break; case 2: visibleInviteeList = currentRally.invitees.Where(i => (i.Status == 3)).ToList(); refreshVisibleInviteeList(); break; case 3: visibleInviteeList = currentRally.invitees.Where(i => (i.Status == 2)).ToList(); refreshVisibleInviteeList(); break; case 4: visibleInviteeList = currentRally.invitees.Where(i => (i.Status == 1)).ToList(); refreshVisibleInviteeList(); break; case 5: visibleInviteeList = currentRally.invitees.Where(i => (i.Status == 0)).ToList(); refreshVisibleInviteeList(); break; } }; sortPicker.SelectedIndex = 0; parentLayout.Children.Add(sortPicker); inviteeScrollView = new ScrollView { BackgroundColor = Color.Transparent }; inviteeStack = new StackLayout { Orientation = StackOrientation.Vertical }; foreach (RallyContact invitee in visibleInviteeList) { StackLayout inviteeStackTemplate = new StackLayout { Orientation = StackOrientation.Horizontal, Margin = new Thickness(10) }; Button inviteeTemplate = new Button { Text = invitee.Name, TextColor = Color.Black, FontSize = 20, HorizontalOptions = LayoutOptions.StartAndExpand, BackgroundColor = Color.Transparent }; Button semanticDisplayButton = new Button { HorizontalOptions = LayoutOptions.End, BackgroundColor = Color.Transparent, TextColor = Color.Black, FontSize = 20 }; semanticDisplayButton.Clicked += delegate { invitee.incrementStatus(); currentRally.refreshInviteeSummary(); }; semanticDisplayButton.BindingContext = invitee; semanticDisplayButton.SetBinding(Button.TextProperty, "StatusString"); /*ImageButton statusTemplate = new ImageButton * { * Source = "checkMark.png" * };*/ //statusButtons.Add(semanticDisplayButton); inviteeStackTemplate.Children.Add(inviteeTemplate); inviteeStackTemplate.Children.Add(semanticDisplayButton); inviteeStack.Children.Add(inviteeStackTemplate); } inviteeScrollView.Content = inviteeStack; parentLayout.Children.Add(inviteeScrollView); Label errorLabel = new Label { IsVisible = false, HorizontalOptions = LayoutOptions.Center }; parentLayout.Children.Add(errorLabel); this.Content = parentLayout; }