Ejemplo n.º 1
0
        private View Icon()
        {
            var icon = new SvgCachedImage()
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                HeightRequest     = 22,
                Aspect            = Aspect.AspectFit,
                Source            = Images.ToolbarIcon,
            };

            icon.ReplaceColor(Colors.TextSpecial);
#if DEBUG
            icon.AddTouchCommand(new Binding(nameof(Toolbar.ShowDebugPopup)));
#endif

            //var layout = new FadeView()
            //{
            //    HorizontalOptions = LayoutOptions.Center,
            //    VerticalOptions = LayoutOptions.Fill,
            //    AnimationTime = 100,
            //    IsVisible = false,
            //    Content = icon,
            //};
            icon.SetBinding(OpacityProperty, nameof(Toolbar.ShowIcon), converter: new BooleanToDoubleConverter(1, 0));

            return(icon);
        }
Ejemplo n.º 2
0
        public MenuCell() : base()
        {
            ContentView cellContent = new ContentView
            {
                Style   = Application.Current.Resources["MasterDetailMenuCell"] as Style,
                Padding = 8
            };

            StackLayout cellContentLayout = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
            };

            StackLayout imageLayout = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Padding     = new Thickness(15, 5, 0, 3)
            };

            SvgCachedImage image = new SvgCachedImage
            {
                WidthRequest  = 30,
                HeightRequest = 30
            };

            image.SetBinding(FFImageLoading.Forms.CachedImage.SourceProperty, "IconSource");

            StackLayout textLayout = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Padding     = new Thickness(25, 5, 0, 3)
            };

            Label text = new Label
            {
                Style             = Application.Current.Resources["MasterDetailMenuLabelCell"] as Style,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.Start
            };

            text.SetBinding(Label.TextProperty, "Title");

            imageLayout.Children.Add(image);
            textLayout.Children.Add(text);

            cellContentLayout.Children.Add(imageLayout);
            cellContentLayout.Children.Add(textLayout);

            cellContent.Content = cellContentLayout;

            this.View = cellContent;
        }
Ejemplo n.º 3
0
        private View CreateIcon()
        {
            var svgCircle = new SvgCachedImage
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Center,
                HeightRequest     = IconSize,
                WidthRequest      = IconSize,
                Aspect            = Aspect.AspectFit,
            };

            svgCircle.SetBinding(CachedImage.SourceProperty, nameof(ViewModel.Goal),
                                 converter: new GoalToBorderIconConverter());
            svgCircle.SetBinding(SvgCachedImage.ReplaceStringMapProperty, nameof(ViewModel.IsCurrentGoal),
                                 converter: new BooleanToReplacementStringMapConverter(Colors.GoalIconActive, Colors.GoalIconInactive));

            var svgShoe = new SvgCachedImage
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Center,
                HeightRequest     = IconSize / 3f,
                WidthRequest      = IconSize / 3f,
                Source            = Images.OnboardingShoe,
                Aspect            = Aspect.AspectFit,
            };

            svgShoe.ReplaceColor(Colors.GoalTextInactive, replaceText: "\"#fff\"");

            return(new Grid()
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions = LayoutOptions.Center,
                Children =
                {
                    svgCircle,
                    svgShoe,
                }
            });
        }
Ejemplo n.º 4
0
        private View CreateAchievementIcon()
        {
            var iconIncomplete = new SvgCachedImage
            {
                HorizontalOptions            = LayoutOptions.Center,
                BackgroundColor              = Colors.Background,
                Aspect                       = Aspect.AspectFit,
                FadeAnimationForCachedImages = false,
            };

            iconIncomplete.SetBinding(CachedImage.SourceProperty, nameof(AchievementViewModel.IconIncomplete));
            iconIncomplete.SetBinding(IsVisibleProperty, nameof(AchievementViewModel.HasBeenAchieved), converter: new InvertedBooleanConverter());

            var iconComplete = new SvgCachedImage()
            {
                HorizontalOptions            = LayoutOptions.Center,
                Aspect                       = Aspect.AspectFit,
                FadeAnimationForCachedImages = false,
            };

            iconComplete.SetBinding(CachedImage.SourceProperty, nameof(AchievementViewModel.IconComplete));
            iconComplete.SetBinding(IsVisibleProperty, nameof(AchievementViewModel.HasBeenAchieved));

            return(new Grid()
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.Start,
                BackgroundColor = Device.RuntimePlatform == Device.Android ? Colors.Background : Color.Transparent,
                HeightRequest = IconSize,
                Children =
                {
                    iconIncomplete,
                    iconComplete,
                }
            });
        }
Ejemplo n.º 5
0
        View GetLayout(Thickness thickness = new Thickness())
        {
            var CategoryContainer = new Grid();

            CategoryContainer.Children.Add(new BoxView
            {
                BackgroundColor = Color.White
            });

            CategoryContainer.Children.Add(new SvgCachedImage
            {
                Margin           = thickness,
                WidthRequest     = 40,
                ReplaceStringMap = new Dictionary <string, string>
                {
                    { "fill=\"currentColor\"", "fill=\"#f7f8f9\"" }
                },
                FadeAnimationEnabled = false,
                Source = "circulo.svg"
            }, 0, 0);

            var CategoryIcon = new SvgCachedImage
            {
                Margin               = thickness,
                HorizontalOptions    = LayoutOptions.Center,
                WidthRequest         = 20,
                FadeAnimationEnabled = false,
            };

            CategoryIcon.SetBinding(SvgCachedImage.SourceProperty, nameof(CategoryModel.Icon));


            //var CategoryIcon = new CachedImage
            //{
            //    HorizontalOptions = LayoutOptions.Center,
            //    WidthRequest = 20,
            //    FadeAnimationEnabled = false,
            //};
            //CategoryIcon.SetBinding(CachedImage.SourceProperty, nameof(CategoryModel.Icon));


            CategoryContainer.Children.Add(CategoryIcon, 0, 0);

            return(CategoryContainer);
        }
Ejemplo n.º 6
0
        private View HealthBoxContainer(View content)
        {
            const int heartIconSize = 40;

            var heartIcon = new SvgCachedImage
            {
                VerticalOptions   = LayoutOptions.Start,
                HorizontalOptions = LayoutOptions.Center,
                Margin            = new Thickness(0, -heartIconSize / 2f, 0, 0),
                HeightRequest     = heartIconSize,
                WidthRequest      = heartIconSize,
                Source            = Images.HealthHeart,
            };

            heartIcon.SetBinding(IsVisibleProperty, nameof(AchievementViewModel.HasBeenAchieved));

            var roundedBottom = new ShapeView()
            {
                VerticalOptions   = LayoutOptions.End,
                HorizontalOptions = LayoutOptions.Fill,
                Color             = Colors.AchievementHealthBackground,
                CornerRadius      = Sizes.CornerRadius,
                HeightRequest     = Sizes.CornerRadius * 2f,
                Margin            = new Thickness(0, 0, 0, -Sizes.CornerRadius),
            };

            var contentContainer = new ShapeView()
            {
                VerticalOptions   = LayoutOptions.Start,
                HorizontalOptions = LayoutOptions.Fill,
                BackgroundColor   = Colors.AchievementHealthBackground,
                Content           = content,
            };

            return(new Grid()
            {
                RowSpacing = 0,
                Children =
                {
                    roundedBottom,
                    contentContainer,
                    heartIcon,
                }
            });
        }
Ejemplo n.º 7
0
        private View DescriptionView()
        {
            var icon = new SvgCachedImage()
            {
                HeightRequest        = 130,
                Aspect               = Aspect.AspectFit,
                FadeAnimationEnabled = false,
            };

            icon.SetBinding(CachedImage.SourceProperty, nameof(ViewModel.Icon));
            icon.SetBinding(SvgCachedImage.ReplaceStringMapProperty, nameof(ViewModel.Tier),
                            converter: new TierToReplacementStringMapConverter());

            var lblCongratulations = new Label()
            {
                VerticalOptions         = LayoutOptions.Center,
                HorizontalOptions       = LayoutOptions.Center,
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                TextColor      = Colors.Text,
                FontSize       = Sizes.TextSmall,
                FontAttributes = FontAttributes.Bold,
                LineHeight     = 1.2,
                Text           = $"Gratulerer {Settings.UserName}!",
            };

            lblCongratulations.SetBinding(IsVisibleProperty, nameof(ViewModel.IsCompleted));

            var lblDescription = new Label()
            {
                VerticalOptions         = LayoutOptions.Center,
                HorizontalOptions       = LayoutOptions.Center,
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                TextColor  = Colors.Text,
                FontSize   = Sizes.TextSmall,
                LineHeight = 1.2,
            };

            lblDescription.SetBinding(Label.TextProperty, nameof(ViewModel.Description));
            lblDescription.SetBinding(IsVisibleProperty, nameof(ViewModel.IsCompleted),
                                      converter: new InvertedBooleanConverter());

            var lblDescriptionCompleted = new Label()
            {
                VerticalOptions         = LayoutOptions.Center,
                HorizontalOptions       = LayoutOptions.Center,
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                TextColor  = Colors.Text,
                FontSize   = Sizes.TextSmall,
                LineHeight = 1.2,
            };

            lblDescriptionCompleted.SetBinding(Label.TextProperty, nameof(ViewModel.CompletedDescription));
            lblDescriptionCompleted.SetBinding(IsVisibleProperty, nameof(ViewModel.IsCompleted));

            var lblContainer = new ShapeView()
            {
                CornerRadius = Sizes.CornerRadius,
                BorderWidth  = 1,
                BorderColor  = Colors.Border,
                Color        = Colors.AchievementDescriptionBackground,
                Content      = new StackLayout()
                {
                    Spacing  = 20,
                    Margin   = new Thickness(30, 70, 30, 50),
                    Children =
                    {
                        lblCongratulations,
                        lblDescription,
                        lblDescriptionCompleted,
                    }
                },
                Margin = new Thickness(10, 0),
            };

            return(new Grid()
            {
                RowSpacing = -50,
                RowDefinitions = new RowDefinitionCollection()
                {
                    new RowDefinition()
                    {
                        Height = GridLength.Auto
                    },
                    new RowDefinition()
                    {
                        Height = GridLength.Auto
                    },
                },
                Children =
                {
                    { lblContainer, 0, 1 },
                    { icon,         0, 0 },
                }
            });
        }
Ejemplo n.º 8
0
        private void InitializeComponent()
        {
            if (ResourceLoader.ResourceProvider != null && ResourceLoader.ResourceProvider(typeof(CarPage).GetTypeInfo().Assembly.GetName(), "Views/CarPage.xaml") != null)
            {
                this.__InitComponentRuntime();
                return;
            }
            if (XamlLoader.XamlFileProvider != null && XamlLoader.XamlFileProvider(base.GetType()) != null)
            {
                this.__InitComponentRuntime();
                return;
            }
            BindingExtension       bindingExtension       = new BindingExtension();
            RowDefinition          rowDefinition          = new RowDefinition();
            RowDefinition          rowDefinition2         = new RowDefinition();
            ColumnDefinition       columnDefinition       = new ColumnDefinition();
            ColumnDefinition       columnDefinition2      = new ColumnDefinition();
            BindingExtension       bindingExtension2      = new BindingExtension();
            TranslateExtension     translateExtension     = new TranslateExtension();
            BindingExtension       bindingExtension3      = new BindingExtension();
            BindingExtension       bindingExtension4      = new BindingExtension();
            EventToCommandBehavior eventToCommandBehavior = new EventToCommandBehavior();
            SearchBar            searchBar            = new SearchBar();
            BindingExtension     bindingExtension5    = new BindingExtension();
            BindingExtension     bindingExtension6    = new BindingExtension();
            TapGestureRecognizer tapGestureRecognizer = new TapGestureRecognizer();
            SvgCachedImage       svgCachedImage       = new SvgCachedImage();
            Grid                   grid = new Grid();
            BindingExtension       bindingExtension7       = new BindingExtension();
            BindingExtension       bindingExtension8       = new BindingExtension();
            EventToCommandBehavior eventToCommandBehavior2 = new EventToCommandBehavior();
            DataTemplate           dataTemplate            = new DataTemplate();
            ListView               listView           = new ListView();
            Grid                   grid2              = new Grid();
            BindingExtension       bindingExtension9  = new BindingExtension();
            BindingExtension       bindingExtension10 = new BindingExtension();
            ActivityIndicator      activityIndicator  = new ActivityIndicator();
            Grid                   grid3              = new Grid();
            NameScope              nameScope          = new NameScope();

            NameScope.SetNameScope(this, nameScope);
            NameScope.SetNameScope(grid3, nameScope);
            NameScope.SetNameScope(grid2, nameScope);
            NameScope.SetNameScope(rowDefinition, nameScope);
            NameScope.SetNameScope(rowDefinition2, nameScope);
            NameScope.SetNameScope(grid, nameScope);
            NameScope.SetNameScope(columnDefinition, nameScope);
            NameScope.SetNameScope(columnDefinition2, nameScope);
            NameScope.SetNameScope(searchBar, nameScope);
            NameScope.SetNameScope(eventToCommandBehavior, nameScope);
            NameScope.SetNameScope(svgCachedImage, nameScope);
            NameScope.SetNameScope(tapGestureRecognizer, nameScope);
            NameScope.SetNameScope(listView, nameScope);
            ((INameScope)nameScope).RegisterName("listview", listView);
            if (listView.StyleId == null)
            {
                listView.StyleId = "listview";
            }
            NameScope.SetNameScope(eventToCommandBehavior2, nameScope);
            NameScope.SetNameScope(activityIndicator, nameScope);
            this.listview = listView;
            this.SetValue(ViewModelLocator.AutowireViewModelProperty, new bool?(true));
            bindingExtension.Path = "Title";
            BindingBase binding = ((IMarkupExtension <BindingBase>)bindingExtension).ProvideValue(null);

            this.SetBinding(Page.TitleProperty, binding);
            rowDefinition.SetValue(RowDefinition.HeightProperty, new GridLengthTypeConverter().ConvertFromInvariantString("Auto"));
            grid2.GetValue(Grid.RowDefinitionsProperty).Add(rowDefinition);
            rowDefinition2.SetValue(RowDefinition.HeightProperty, new GridLengthTypeConverter().ConvertFromInvariantString("*"));
            grid2.GetValue(Grid.RowDefinitionsProperty).Add(rowDefinition2);
            grid.SetValue(Grid.RowProperty, 0);
            grid.SetValue(VisualElement.BackgroundColorProperty, Color.White);
            grid.SetValue(Xamarin.Forms.Layout.PaddingProperty, new Thickness(10.0));
            grid.SetValue(Grid.ColumnSpacingProperty, 10.0);
            columnDefinition.SetValue(ColumnDefinition.WidthProperty, new GridLengthTypeConverter().ConvertFromInvariantString("*"));
            grid.GetValue(Grid.ColumnDefinitionsProperty).Add(columnDefinition);
            columnDefinition2.SetValue(ColumnDefinition.WidthProperty, new GridLengthTypeConverter().ConvertFromInvariantString("24"));
            grid.GetValue(Grid.ColumnDefinitionsProperty).Add(columnDefinition2);
            searchBar.SetValue(Grid.ColumnProperty, 0);
            bindingExtension2.Path = "CarNo";
            BindingBase binding2 = ((IMarkupExtension <BindingBase>)bindingExtension2).ProvideValue(null);

            searchBar.SetBinding(SearchBar.TextProperty, binding2);
            translateExtension.Text = "search";
            IMarkupExtension    markupExtension     = translateExtension;
            XamlServiceProvider xamlServiceProvider = new XamlServiceProvider();
            Type typeFromHandle = typeof(IProvideValueTarget);

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

            xmlNamespaceResolver.Add("", "http://xamarin.com/schemas/2014/forms");
            xmlNamespaceResolver.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
            xmlNamespaceResolver.Add("prism", "clr-namespace:Prism.Mvvm;assembly=Prism.Forms");
            xmlNamespaceResolver.Add("local", "clr-namespace:RFID");
            xmlNamespaceResolver.Add("b", "clr-namespace:Prism.Behaviors;assembly=Prism.Forms");
            xmlNamespaceResolver.Add("svg", "clr-namespace:FFImageLoading.Svg.Forms;assembly=FFImageLoading.Svg.Forms");
            xamlServiceProvider.Add(typeFromHandle2, new XamlTypeResolver(xmlNamespaceResolver, typeof(CarPage).GetTypeInfo().Assembly));
            xamlServiceProvider.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(22, 60)));
            object placeholder = markupExtension.ProvideValue(xamlServiceProvider);

            searchBar.Placeholder = placeholder;
            searchBar.SetValue(SearchBar.TextColorProperty, new Color(0.501960813999176, 0.501960813999176, 0.501960813999176, 1.0));
            bindingExtension3.Path = "SearchCommand";
            BindingBase binding3 = ((IMarkupExtension <BindingBase>)bindingExtension3).ProvideValue(null);

            searchBar.SetBinding(SearchBar.SearchCommandProperty, binding3);
            searchBar.SetValue(VisualElement.BackgroundColorProperty, new Color(0.93725490570068359, 0.93725490570068359, 0.93725490570068359, 1.0));
            eventToCommandBehavior.SetValue(EventToCommandBehavior.EventNameProperty, "TextChanged");
            bindingExtension4.Path = "SearchCommand";
            BindingBase binding4 = ((IMarkupExtension <BindingBase>)bindingExtension4).ProvideValue(null);

            eventToCommandBehavior.SetBinding(EventToCommandBehavior.CommandProperty, binding4);
            ((ICollection <Behavior>)searchBar.GetValue(VisualElement.BehaviorsProperty)).Add(eventToCommandBehavior);
            grid.Children.Add(searchBar);
            svgCachedImage.SetValue(Grid.ColumnProperty, 1);
            svgCachedImage.SetValue(VisualElement.WidthRequestProperty, 24.0);
            bindingExtension5.Path = "IsException";
            BindingBase binding5 = ((IMarkupExtension <BindingBase>)bindingExtension5).ProvideValue(null);

            svgCachedImage.SetBinding(VisualElement.IsVisibleProperty, binding5);
            svgCachedImage.SetValue(VisualElement.HeightRequestProperty, 24.0);
            svgCachedImage.SetValue(CachedImage.SourceProperty, new FFImageLoading.Forms.ImageSourceConverter().ConvertFromInvariantString("plus.svg"));
            bindingExtension6.Path = "AddCommand";
            BindingBase binding6 = ((IMarkupExtension <BindingBase>)bindingExtension6).ProvideValue(null);

            tapGestureRecognizer.SetBinding(TapGestureRecognizer.CommandProperty, binding6);
            svgCachedImage.GestureRecognizers.Add(tapGestureRecognizer);
            grid.Children.Add(svgCachedImage);
            grid2.Children.Add(grid);
            listView.SetValue(Grid.RowProperty, 1);
            listView.SetValue(VisualElement.BackgroundColorProperty, new Color(0.98039215803146362, 0.98039215803146362, 0.98039215803146362, 1.0));
            bindingExtension7.Path = "CarSource";
            BindingBase binding7 = ((IMarkupExtension <BindingBase>)bindingExtension7).ProvideValue(null);

            listView.SetBinding(ItemsView <Cell> .ItemsSourceProperty, binding7);
            listView.ItemSelected += this.Handle_ItemSelected;
            eventToCommandBehavior2.SetValue(EventToCommandBehavior.EventNameProperty, "ItemTapped");
            bindingExtension8.Path = "SelectCommand";
            BindingBase binding8 = ((IMarkupExtension <BindingBase>)bindingExtension8).ProvideValue(null);

            eventToCommandBehavior2.SetBinding(EventToCommandBehavior.CommandProperty, binding8);
            eventToCommandBehavior2.SetValue(EventToCommandBehavior.EventArgsParameterPathProperty, "Item");
            ((ICollection <Behavior>)listView.GetValue(VisualElement.BehaviorsProperty)).Add(eventToCommandBehavior2);
            IDataTemplate dataTemplate2 = dataTemplate;

            CarPage.< InitializeComponent > _anonXamlCDataTemplate_4 <InitializeComponent> _anonXamlCDataTemplate_ = new CarPage.< InitializeComponent > _anonXamlCDataTemplate_4();
            object[]  array2 = new object[0 + 5];
            array2[0] = dataTemplate;
            array2[1] = listView;
            array2[2] = grid2;
            array2[3] = grid3;
            array2[4] = this;
Ejemplo n.º 9
0
        private View MessageView()
        {
            var loadingIndicator = new ActivityIndicator()
            {
                Color         = Colors.Text,
                IsRunning     = true,
                HeightRequest = Sizes.TextSmall,
                WidthRequest  = Sizes.TextSmall,
            };

            loadingIndicator.SetBinding(IsVisibleProperty, nameof(NotifyCenter.MessageDetails.Type),
                                        converter: new ObjectToBooleanConverter(NotifyCenter.InfoType.Loading));

            var infoIndicator = new SvgCachedImage()
            {
                IsVisible     = false,
                Source        = Images.HistoryInfo,
                HeightRequest = Sizes.TextSmall,
                WidthRequest  = Sizes.TextSmall,
            };

            infoIndicator.ReplaceColor(Colors.Text);
            infoIndicator.SetBinding(IsVisibleProperty, nameof(NotifyCenter.MessageDetails.Type),
                                     converter: new ObjectToBooleanConverter(NotifyCenter.InfoType.Info));

            var errorIndicator = new SvgCachedImage()
            {
                IsVisible     = false,
                Source        = Images.PopupCloseSmall,
                HeightRequest = Sizes.TextSmall,
                WidthRequest  = Sizes.TextSmall,
            };

            errorIndicator.ReplaceColor(Colors.Text);
            errorIndicator.SetBinding(IsVisibleProperty, nameof(NotifyCenter.MessageDetails.Type),
                                      converter: new ObjectToBooleanConverter(NotifyCenter.InfoType.Error));

            var warningIndicator = new Label()
            {
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center,
                IsVisible         = false,
                Text     = "\u26A0",
                FontSize = Sizes.TextMicro + 1,
            };

            warningIndicator.SetBinding(IsVisibleProperty, nameof(NotifyCenter.MessageDetails.Type),
                                        converter: new ObjectToBooleanConverter(NotifyCenter.InfoType.Warning));

            var lbl = new Label()
            {
                VerticalOptions         = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
                TextColor = Colors.Text,
                FontSize  = Sizes.TextMicro + 1,
            };

            lbl.SetBinding(Label.TextProperty, nameof(NotifyCenter.MessageDetails.Text));

            var layout = new ContentView()
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Fill,
                Content           = new StackLayout()
                {
                    HorizontalOptions = LayoutOptions.Center,
                    VerticalOptions   = LayoutOptions.Fill,
                    Orientation       = StackOrientation.Horizontal,
                    Padding           = new Thickness(0, 12),
                    Spacing           = 10,
                    Children          =
                    {
                        loadingIndicator,
                        infoIndicator,
                        errorIndicator,
                        warningIndicator,
                        lbl,
                    }
                }
            };

            layout.AddTouchCommand(new Binding(nameof(NotifyCenter.MessageDetails.ClickedCommand)));
            layout.SetBinding(BackgroundColorProperty, nameof(NotifyCenter.MessageDetails.Type),
                              converter: new InfoLevelToColorConverter());

            return(layout);
        }
Ejemplo n.º 10
0
        private View TabItem(string title, ImageSource iconActive, ImageSource iconInactive, HomeViewModel.View view)
        {
            var iconSize = Sizes.Title;

            var iconNotSelected = new SvgCachedImage
            {
                Scale  = Sizes.TabIconScale,
                Source = iconInactive,
                Aspect = Aspect.AspectFit,
            };

            Utils.Accessibility.Unused(iconNotSelected);
            iconNotSelected.SetBinding(IsVisibleProperty, nameof(ViewModel.CurrentView),
                                       converter: new ValueConverterGroup()
            {
                new ViewToBooleanConverter(view),
                new InvertedBooleanConverter(),
            });

            var iconSelected = new SvgCachedImage
            {
                Scale     = Sizes.TabIconScale,
                Source    = iconActive,
                Aspect    = Aspect.AspectFit,
                IsVisible = false,
            };

            Utils.Accessibility.Unused(iconSelected);
            iconSelected.SetBinding(IsVisibleProperty, nameof(ViewModel.CurrentView),
                                    converter: new ViewToBooleanConverter(view));

            var lblTab = new Label
            {
                HorizontalOptions = LayoutOptions.Center,
                FontSize          = Sizes.TextMicro,
                TextColor         = Colors.TabPanelForeground,
                Margin            = new Thickness(-20, 0),
                MaxLines          = 1,
                LineBreakMode     = LineBreakMode.NoWrap,
                Text = title,
            };

            Utils.Accessibility.Unused(lblTab);
            lblTab.SetBinding(Label.TextColorProperty, nameof(ViewModel.CurrentView),
                              converter: new ValueConverterGroup()
            {
                new ViewToBooleanConverter(view),
                new BooleanToColorConverter(Colors.TextSpecial, Colors.TabPanelForeground),
            });

            var layout = new Grid()
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Center,
                Padding           = new Thickness(0, 14f),
                RowSpacing        = 2f,
                RowDefinitions    = new RowDefinitionCollection()
                {
                    new RowDefinition()
                    {
                        Height = iconSize
                    },
                    new RowDefinition()
                    {
                        Height = GridLength.Auto
                    },
                },
                Children =
                {
                    { iconNotSelected, 0, 0 },
                    { iconSelected,    0, 0 },
                    { lblTab,          0, 1 },
                }
            };

            layout.AddTouchCommand(new Binding(nameof(HomeViewModel.ChangeView)), view);

            Utils.Accessibility.InUse(layout, title, $"Velger {title}");

            return(layout);
        }
Ejemplo n.º 11
0
        public OnboardingWelcomeView()
        {
            ScreenHeight = App.ScreenHeight;

            var icShoe = new SvgCachedImage()
            {
                HorizontalOptions = LayoutOptions.Start,
                VerticalOptions   = LayoutOptions.Center,
                Aspect            = Aspect.AspectFit,
                HeightRequest     = 64,
                Source            = Images.OnboardingShoe,
            };

            var lblWelcomeText = new Label()
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Center, FontSize = Sizes.Title,
                FormattedText     = new FormattedString()
                {
                    Spans =
                    {
                        new Span()
                        {
                            Text     = AppText.onboarding_first_title + "\n",
                            FontSize = Sizes.Title,
                        },
                        new Span()
                        {
                            Text           = AppText.onboarding_first_text,
                            FontAttributes = FontAttributes.Bold,
                            FontSize       = Sizes.TextLarge,
                        },
                    }
                },
            };

            var lblNameTitle = new Label()
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Center,
                FontAttributes    = FontAttributes.Bold,
                Text     = AppText.onboarding_entry_title,
                FontSize = Sizes.Title,
            };

            var entry = new Entry()
            {
                HorizontalOptions       = LayoutOptions.Fill,
                VerticalOptions         = LayoutOptions.Center,
                TextColor               = Colors.TextSpecial,
                FontAttributes          = FontAttributes.Bold,
                FontSize                = Sizes.TextLarge,
                Keyboard                = Keyboard.Text,
                IsTextPredictionEnabled = false,
                Margin = 0,
            };

            entry.SetBinding(Entry.TextProperty, nameof(ViewModel.UserName));
            entry.SetBinding(Entry.ReturnCommandProperty, nameof(ViewModel.NextClickedCommand));

            var nextArrow = new SvgCachedImage()
            {
                HorizontalOptions = LayoutOptions.End,
                VerticalOptions   = LayoutOptions.Center,
                HeightRequest     = Sizes.TextSmall - 2,
                Aspect            = Aspect.AspectFit,
                Source            = Images.ToolbarArrow,
                Margin            = new Thickness(-10f, -10f, 0, -10f),
            };

            nextArrow.ReplaceColor(Colors.TextSpecial);
            nextArrow.SetBinding(IsVisibleProperty, nameof(ViewModel.IsValid));
            nextArrow.AddTouchCommand(new Binding(nameof(ViewModel.NextClickedCommand)));

            var line = new BorderCanvasView()
            {
                Border           = new Thickness(0, 0, 0, 1),
                BorderColor      = Colors.LightBorderColor.MultiplyAlpha(0.5),
                InputTransparent = true,
            };

            var entryContainer = new Grid()
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Center,
                Margin            = new Thickness(0, 20),
                RowSpacing        = 10,
                RowDefinitions    = new RowDefinitionCollection()
                {
                    new RowDefinition()
                    {
                        Height = GridLength.Auto
                    },
                    new RowDefinition()
                    {
                        Height = GridLength.Auto
                    },
                },
                ColumnDefinitions = new ColumnDefinitionCollection()
                {
                    new ColumnDefinition()
                    {
                        Width = GridLength.Star
                    },
                    new ColumnDefinition()
                    {
                        Width = 40
                    },
                },
                Children =
                {
                    { line,         0, 2, 1, 2 },
                    { lblNameTitle, 0,0 },
                    { entry,        0,1 },
                    { nextArrow,    1,1 },
                }
            };

            entry.Focused += (sender, args) =>
            {
                icShoe.FadeTo(0);
                lblWelcomeText.FadeTo(0);
                entryContainer.TranslateTo(0, -120);
                entryContainer.RowSpacing = 40;
            };

            entry.Unfocused += (sender, args) =>
            {
                icShoe.FadeTo(1, 400, Easing.CubicIn);
                lblWelcomeText.FadeTo(1, 400, Easing.CubicIn);
                entryContainer.TranslateTo(0, 0);
                entryContainer.RowSpacing = 10;
            };

            Content.Spacing = 20;

            AddAnimatedView(icShoe);
            AddAnimatedView(lblWelcomeText);
            AddAnimatedView(entryContainer);
        }
Ejemplo n.º 12
0
        private void InitializeComponent()
        {
            if (ResourceLoader.ResourceProvider != null && ResourceLoader.ResourceProvider(typeof(MineCell).GetTypeInfo().Assembly.GetName(), "Layout/MineCell.xaml") != null)
            {
                this.__InitComponentRuntime();
                return;
            }
            if (XamlLoader.XamlFileProvider != null && XamlLoader.XamlFileProvider(base.GetType()) != null)
            {
                this.__InitComponentRuntime();
                return;
            }
            ColumnDefinition     columnDefinition     = new ColumnDefinition();
            ColumnDefinition     columnDefinition2    = new ColumnDefinition();
            ColumnDefinition     columnDefinition3    = new ColumnDefinition();
            BindingExtension     bindingExtension     = new BindingExtension();
            TapGestureRecognizer tapGestureRecognizer = new TapGestureRecognizer();
            BindingExtension     bindingExtension2    = new BindingExtension();
            SvgCachedImage       svgCachedImage       = new SvgCachedImage();
            BindingExtension     bindingExtension3    = new BindingExtension();
            Label          label           = new Label();
            SvgCachedImage svgCachedImage2 = new SvgCachedImage();
            Grid           grid            = new Grid();
            NameScope      nameScope       = new NameScope();

            NameScope.SetNameScope(this, nameScope);
            NameScope.SetNameScope(grid, nameScope);
            NameScope.SetNameScope(columnDefinition, nameScope);
            NameScope.SetNameScope(columnDefinition2, nameScope);
            NameScope.SetNameScope(columnDefinition3, nameScope);
            NameScope.SetNameScope(tapGestureRecognizer, nameScope);
            NameScope.SetNameScope(svgCachedImage, nameScope);
            ((INameScope)nameScope).RegisterName("icon", svgCachedImage);
            if (svgCachedImage.StyleId == null)
            {
                svgCachedImage.StyleId = "icon";
            }
            NameScope.SetNameScope(label, nameScope);
            ((INameScope)nameScope).RegisterName("label", label);
            if (label.StyleId == null)
            {
                label.StyleId = "label";
            }
            NameScope.SetNameScope(svgCachedImage2, nameScope);
            this.icon  = svgCachedImage;
            this.label = label;
            grid.SetValue(Grid.ColumnSpacingProperty, 10.0);
            grid.SetValue(Layout.PaddingProperty, new Thickness(20.0, 0.0, 15.0, 0.0));
            columnDefinition.SetValue(ColumnDefinition.WidthProperty, new GridLengthTypeConverter().ConvertFromInvariantString("24"));
            grid.GetValue(Grid.ColumnDefinitionsProperty).Add(columnDefinition);
            columnDefinition2.SetValue(ColumnDefinition.WidthProperty, new GridLengthTypeConverter().ConvertFromInvariantString("*"));
            grid.GetValue(Grid.ColumnDefinitionsProperty).Add(columnDefinition2);
            columnDefinition3.SetValue(ColumnDefinition.WidthProperty, new GridLengthTypeConverter().ConvertFromInvariantString("15"));
            grid.GetValue(Grid.ColumnDefinitionsProperty).Add(columnDefinition3);
            bindingExtension.Path = "SelectCommand";
            BindingBase binding = ((IMarkupExtension <BindingBase>)bindingExtension).ProvideValue(null);

            tapGestureRecognizer.SetBinding(TapGestureRecognizer.CommandProperty, binding);
            grid.GestureRecognizers.Add(tapGestureRecognizer);
            svgCachedImage.SetValue(Grid.ColumnProperty, 0);
            svgCachedImage.SetValue(VisualElement.WidthRequestProperty, 24.0);
            svgCachedImage.SetValue(VisualElement.HeightRequestProperty, 24.0);
            svgCachedImage.SetValue(CachedImage.AspectProperty, Aspect.AspectFit);
            bindingExtension2.Path = "Icon";
            BindingBase binding2 = ((IMarkupExtension <BindingBase>)bindingExtension2).ProvideValue(null);

            svgCachedImage.SetBinding(CachedImage.SourceProperty, binding2);
            svgCachedImage.SetValue(View.VerticalOptionsProperty, LayoutOptions.Center);
            grid.Children.Add(svgCachedImage);
            label.SetValue(Grid.ColumnProperty, 1);
            BindableObject         bindableObject        = label;
            BindableProperty       fontSizeProperty      = Label.FontSizeProperty;
            IExtendedTypeConverter extendedTypeConverter = new FontSizeConverter();
            string value = "Default";
            XamlServiceProvider xamlServiceProvider = new XamlServiceProvider();
            Type typeFromHandle = typeof(IProvideValueTarget);

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

            xmlNamespaceResolver.Add("", "http://xamarin.com/schemas/2014/forms");
            xmlNamespaceResolver.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
            xmlNamespaceResolver.Add("svg", "clr-namespace:FFImageLoading.Svg.Forms;assembly=FFImageLoading.Svg.Forms");
            xamlServiceProvider.Add(typeFromHandle2, new XamlTypeResolver(xmlNamespaceResolver, typeof(MineCell).GetTypeInfo().Assembly));
            xamlServiceProvider.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(14, 36)));
            bindableObject.SetValue(fontSizeProperty, extendedTypeConverter.ConvertFromInvariantString(value, xamlServiceProvider));
            label.SetValue(Label.TextColorProperty, Color.Black);
            bindingExtension3.Path = "Title";
            BindingBase binding3 = ((IMarkupExtension <BindingBase>)bindingExtension3).ProvideValue(null);

            label.SetBinding(Label.TextProperty, binding3);
            label.SetValue(View.VerticalOptionsProperty, LayoutOptions.Center);
            label.SetValue(Label.HorizontalTextAlignmentProperty, new TextAlignmentConverter().ConvertFromInvariantString("Start"));
            grid.Children.Add(label);
            svgCachedImage2.SetValue(Grid.ColumnProperty, 2);
            svgCachedImage2.SetValue(VisualElement.WidthRequestProperty, 15.0);
            svgCachedImage2.SetValue(VisualElement.HeightRequestProperty, 15.0);
            svgCachedImage2.SetValue(CachedImage.AspectProperty, Aspect.AspectFit);
            svgCachedImage2.SetValue(CachedImage.SourceProperty, new FFImageLoading.Forms.ImageSourceConverter().ConvertFromInvariantString("rightarrow.svg"));
            svgCachedImage2.SetValue(View.VerticalOptionsProperty, LayoutOptions.Center);
            grid.Children.Add(svgCachedImage2);
            this.View = grid;
        }
Ejemplo n.º 13
0
        private View ContentView()
        {
            var imgIcon = new SvgCachedImage()
            {
                HeightRequest = 140,
                WidthRequest  = 140,
                Aspect        = Aspect.AspectFit,
            };

            imgIcon.SetBinding(CachedImage.SourceProperty, nameof(Bulletin.Icon));
            imgIcon.SetBinding(SvgCachedImage.ReplaceStringMapProperty, nameof(Bulletin.Tier),
                               converter: new TierToReplacementStringMapConverter());
            imgIcon.SetBinding(IsVisibleProperty, nameof(Bulletin.Icon),
                               converter: new NullToBooleanConverter());

            var animationIcon = new AnimationView
            {
                HeightRequest = 140,
                WidthRequest  = 140,
                Loop          = false,
                IsPlaying     = true,
            };

            animationIcon.SetBinding(AnimationView.AnimationProperty, nameof(Bulletin.Animation));
            animationIcon.SetBinding(IsVisibleProperty, nameof(Bulletin.Animation),
                                     converter: new NullToBooleanConverter());

            var lblTitle = new Label()
            {
                HorizontalOptions       = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                TextColor      = Colors.TextSpecial,
                FontAttributes = FontAttributes.Bold,
                FontSize       = Sizes.TextLarge,
            };

            lblTitle.SetBinding(Label.TextProperty, nameof(Bulletin.Title));

            var lblText = new Label()
            {
                HorizontalOptions       = LayoutOptions.Fill,
                VerticalOptions         = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                TextColor  = Colors.InfoPopupText,
                FontSize   = Sizes.TextSmall,
                LineHeight = 1.2f,
            };

            lblText.SetBinding(Label.TextProperty, nameof(Bulletin.Description));

            var content = new StackLayout()
            {
                VerticalOptions = LayoutOptions.Center,
                Padding         = new Thickness(40),
                Spacing         = 20,
                Children        =
                {
                    imgIcon,
                    //animationIcon,
                    new StackLayout()
                    {
                        HorizontalOptions = LayoutOptions.Center,
                        Spacing           = 0,
                        Children          =
                        {
                            lblTitle,
                            DefaultView.UnderLine,
                        }
                    },
                    lblText,
                }
            };

            var cardView = new CardView(content)
            {
                TranslationY = 20,
                Scale        = 0.90f,
                //BindingContext = item,
                AnchorY = 1, // anchor to bottom
            };

            cardView.SetBinding(CardView.CloseButtonCommandProperty, nameof(Bulletin.CloseCommand));

            return(cardView);
        }
Ejemplo n.º 14
0
        public TierScrollViewCell()
        {
            var icon = new SvgCachedImage()
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Fill,
                Aspect            = Aspect.AspectFit,
                Margin            = 4,
            };

            icon.SetBinding(CachedImage.SourceProperty, nameof(ViewModel.Icon));
            icon.SetBinding(SvgCachedImage.ReplaceStringMapProperty, nameof(ViewModel.Tier),
                            converter: new TierToReplacementStringMapConverter());

            var lblTier = new Label()
            {
                HorizontalOptions       = LayoutOptions.Fill,
                VerticalOptions         = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
                FontSize  = Sizes.TextMicro,
                TextColor = Colors.Text,
            };

            lblTier.SetBinding(Label.TextProperty, nameof(ViewModel.Title));


            var receivedDateSpan = new Span()
            {
                TextColor  = Colors.TextFaded,
                FontSize   = Sizes.TextMicro - 2,
                FontFamily = Fonts.Normal,
            };

            receivedDateSpan.SetBinding(Span.TextProperty,
                                        nameof(ViewModel.DateCompleted),
                                        converter: new DateToStringConverter("dd.MM.yyyy"));

            var lblReceived = new Label()
            {
                HorizontalOptions       = LayoutOptions.Fill,
                VerticalOptions         = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
                FontSize      = Sizes.TextMicro - 2,
                TextColor     = Colors.TextFaded,
                FormattedText = new FormattedString()
                {
                    Spans =
                    {
                        new Span()
                        {
                            Text       = AppText.achievement_time_received + " ",
                            TextColor  = Colors.TextFaded,
                            FontSize   = Sizes.TextMicro - 2,
                            FontFamily = Fonts.Normal,
                        },
                        receivedDateSpan
                    }
                }
            };

            lblReceived.SetBinding(OpacityProperty, nameof(ViewModel.IsCompleted),
                                   converter: new BooleanToDoubleConverter(1f, 0f));

            var miniProgress = new ProgressBarCanvasView()
            {
                HorizontalOptions       = LayoutOptions.Center,
                VerticalOptions         = LayoutOptions.CenterAndExpand,
                HeightRequest           = 5,
                WidthRequest            = 64,
                ProgressBackgroundColor = Colors.ProgressWheelBackground,
                ProgressColor           = Colors.ProgressWheelForeground,
                Margin = new Thickness(0, 2f, 0, 0),
            };

            miniProgress.SetBinding(OpacityProperty, nameof(ViewModel.IsCompleted),
                                    converter: new BooleanToDoubleConverter(0f, 1f));
            //miniProgress.SetBinding(OpacityProperty, nameof(ViewModel.ProgressNormalized),
            //    converter: new ProgressToDoubleConverter(false, false));
            miniProgress.SetBinding(ProgressBarCanvasViewBase.ProgressProperty, nameof(ViewModel.ProgressNormalized));

            var progressContainer = new Grid()
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Fill,
                Children          =
                {
                    lblReceived,
                    miniProgress,
                }
            };

            progressContainer.SetBinding(OpacityProperty, nameof(ViewModel.IsLocked),
                                         converter: new BooleanToDoubleConverter(0f, 1f));

            Content = new Grid()
            {
                Margin         = 4,
                RowSpacing     = 2,
                RowDefinitions = new RowDefinitionCollection()
                {
                    new RowDefinition()
                    {
                        Height = GridLength.Star
                    },
                    new RowDefinition()
                    {
                        Height = Sizes.TextMicro + 2
                    },
                    new RowDefinition()
                    {
                        Height = Sizes.TextMicro + 2
                    },
                },
                Children =
                {
                    { icon,              0, 0 },
                    { lblTier,           0, 1 },
                    { progressContainer, 0, 2 },
                },
            };
        }