예제 #1
0
        public FactionPicker()
        {
            StackLayout factions = new StackLayout
            {
                Orientation = StackOrientation.Horizontal
            };

            foreach (var faction in App.Current.TagRideProperties.Value.Factions)
            {
                FactionIconView view = new FactionIconView
                {
                    Faction      = faction,
                    WidthRequest = 100
                };

                var tapGestureRecognizer = new TapGestureRecognizer();
                tapGestureRecognizer.NumberOfTapsRequired = 1;
                tapGestureRecognizer.Tapped += OnFactionViewTapped;

                view.GestureRecognizers.Add(tapGestureRecognizer);

                factions.Children.Add(view);
            }

            Content = new ScrollView
            {
                Content     = factions,
                Orientation = ScrollOrientation.Horizontal
            };
        }
예제 #2
0
 public void ClearSelection()
 {
     if (Selected != null)
     {
         Selected.BackgroundColor = Color.Transparent;
     }
     Selected = null;
     SelectionChanged?.Invoke(null);
 }
예제 #3
0
        static void OnFactionPropertyChanged(BindableObject bindable, object oldValue, object newValue)
        {
            FactionIconView   view       = bindable as FactionIconView;
            FactionProperties properties = newValue as FactionProperties;

            if (properties != null)
            {
                view.image.Source = ImageSource.FromUri(TagRidePropertyUtils.FactionIconUri(App.Current.TagRideProperties.Value, properties));
                view.label.Text   = properties.Name;
            }
            else
            {
                view.image.Source = null;
                view.label.Text   = "faction";
            }
        }