Esempio n. 1
0
        public TestingResultsViewCell()
        {
            _answer = new Label {
                TextColor       = Color.FromHex(Theme.Current.TestResultsAnswerTextColor),
                VerticalOptions = LayoutOptions.CenterAndExpand,
                Style           = AppStyles.GetLabelStyle()
            };

            _boxView = new BoxView {
                HorizontalOptions = LayoutOptions.EndAndExpand,
                HeightRequest     = _boxSize,
                WidthRequest      = _boxSize,
                CornerRadius      = _boxSize / 2,
                VerticalOptions   = LayoutOptions.CenterAndExpand
            };

            var frame = new Frame {
                BackgroundColor = Color.FromHex(Theme.Current.BaseBlockColor),
                HasShadow       = false,
                CornerRadius    = _frameRadius,
                Margin          = _frameMargin,
                Content         = new StackLayout {
                    Orientation = StackOrientation.Horizontal,
                    Children    =
                    {
                        _answer,
                        _boxView
                    }
                }
            };

            View = frame;
        }
Esempio n. 2
0
        public CalendarSubjectsViewCell()
        {
            var subjectColorView = new BoxView {
                Margin          = _boxViewMargin,
                HeightRequest   = _boxViewSize,
                WidthRequest    = _boxViewSize,
                CornerRadius    = _boxViewSize / 2,
                VerticalOptions = LayoutOptions.Center
            };

            subjectColorView.SetBinding(BoxView.ColorProperty, "Color", converter: new StringToColorConverter());

            var subject = new Label {
                TextColor       = Color.FromHex(Theme.Current.TodayCalendarSubjectTextColor),
                VerticalOptions = LayoutOptions.CenterAndExpand,
                Style           = AppStyles.GetLabelStyle()
            };

            subject.SetBinding(Label.TextProperty, "Subject");

            View = new StackLayout {
                BackgroundColor = Color.FromHex(Theme.Current.TodaySubjectBackgroundColor),
                Padding         = _padding,
                Orientation     = StackOrientation.Horizontal,
                Children        =
                {
                    subjectColorView,
                    subject
                }
            };
        }
        Label createRightLabelLayout(
            string title, string bindingProperty = null, NamedSize namedSize = NamedSize.Medium)
        {
            var color = Color.FromHex(Theme.Current.AboutTextColor);

            var leftSpan = new Span {
                Text            = title,
                ForegroundColor = color,
                FontAttributes  = FontAttributes.Bold,
                Style           = AppStyles.GetLabelStyle(namedSize, true)
            };

            var formattedString = new FormattedString {
                Spans =
                {
                    leftSpan
                }
            };

            if (bindingProperty != null)
            {
                var rightSpan = new Span {
                    ForegroundColor = color,
                    Style           = AppStyles.GetLabelStyle()
                };

                rightSpan.SetBinding(Span.TextProperty, bindingProperty);
                formattedString.Spans.Add(rightSpan);
            }

            return(new Label {
                FormattedText = formattedString
            });
        }
        Frame createSummary()
        {
            var summaryLabel = new Label {
                Style     = AppStyles.GetLabelStyle(NamedSize.Large),
                TextColor = Color.FromHex(Theme.Current.StatisticsDetailsTitleColor),
                Text      = _statsPageEnum == StatsPageEnum.LabsRating || _statsPageEnum == StatsPageEnum.PractiseMarks ?
                            CrossLocalization.Translate("stats_summary_rating") :
                            CrossLocalization.Translate("stats_summary_visiting")
            };

            var summaryDetailsLabel = new Label {
                HorizontalOptions = LayoutOptions.EndAndExpand,
                Style             = AppStyles.GetLabelStyle(NamedSize.Large),
                TextColor         = Color.FromHex(Theme.Current.StatisticsDetailsResultsColor)
            };

            summaryDetailsLabel.SetBinding(Label.TextProperty, "Summary");

            return(new Frame {
                HasShadow = false,
                Margin = _studentNameMargin,
                BackgroundColor = Color.FromHex(Theme.Current.BaseBlockColor),
                Content = new StackLayout {
                    Orientation = StackOrientation.Horizontal,
                    Children = { summaryLabel, summaryDetailsLabel }
                }
            });
        }
 Label createSubtitleLabel()
 {
     return(new Label {
         TextColor = Color.FromHex(Theme.Current.SettingsGroupUserColor),
         Style = AppStyles.GetLabelStyle()
     });
 }
Esempio n. 6
0
        public CalendarCarouselViewCell()
        {
            addResources();

            var collection = new CollectionView {
                ItemsLayout   = new GridItemsLayout(_daysOfWeekNumber, ItemsLayoutOrientation.Vertical),
                ItemTemplate  = new DataTemplate(() => new CalendarCollectionViewCell(_dataBindingDay, true)),
                SelectionMode = SelectionMode.Single
            };

            collection.SetBinding(ItemsView.ItemsSourceProperty, "Days");
            collection.SetBinding(SelectableItemsView.SelectedItemProperty, "CalendarSelectedItem");
            collection.SetBinding(
                SelectableItemsView.SelectionChangedCommandProperty, "CalendarSelectionChangedCommand");

            var monthYearLabel = new Label {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                TextColor         = Color.FromHex(Theme.Current.TodayCalendarBaseTextColor),
                Style             = AppStyles.GetLabelStyle()
            };

            monthYearLabel.SetBinding(Label.TextProperty, "MonthYear");

            Content = new StackLayout {
                Padding           = _padding,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          =
                {
                    collection, monthYearLabel
                }
            };
        }
Esempio n. 7
0
        public EemcPageViewCell()
        {
            _icon = new CachedImage {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                HeightRequest     = _iconHeight
            };

            var title = new Label {
                TextColor               = Color.FromHex(Theme.Current.EemcItemTitleColor),
                HorizontalOptions       = LayoutOptions.CenterAndExpand,
                HorizontalTextAlignment = TextAlignment.Center,
                Style = AppStyles.GetLabelStyle()
            };

            title.SetBinding(Label.TextProperty, "Name");

            Content = new StackLayout {
                Margin   = _margin,
                Children =
                {
                    _icon,
                    title
                }
            };
        }
        public TestMultipleAnswerViewCell()
        {
            _boxView = new BoxView {
                HeightRequest   = _boxSize,
                WidthRequest    = _boxSize,
                Color           = Color.FromHex(Theme.Current.AppBackgroundColor),
                VerticalOptions = LayoutOptions.CenterAndExpand
            };

            _answer = new Label {
                TextColor       = Color.FromHex(Theme.Current.TestPassingAnswerColor),
                VerticalOptions = LayoutOptions.CenterAndExpand,
                Style           = AppStyles.GetLabelStyle()
            };

            _answer.SetBinding(Label.TextProperty, "Content");

            View = new Frame {
                BackgroundColor = Color.FromHex(Theme.Current.BaseBlockColor),
                HasShadow       = false,
                Margin          = _frameMargin,
                CornerRadius    = _frameRadius,
                Content         = new StackLayout {
                    Orientation = StackOrientation.Horizontal,
                    Children    =
                    {
                        _boxView,
                        _answer
                    }
                }
            };
        }
Esempio n. 9
0
 /// <summary>
 /// Create description label.
 /// </summary>
 /// <param name="description">Frame description.</param>
 /// <returns>Description label.</returns>
 Label createDescriptionLabel(string description)
 {
     return(new Label {
         Text = description,
         TextColor = Color.FromHex(Theme.Current.SwitchFrameDescriptionColor),
         Style = AppStyles.GetLabelStyle(NamedSize.Small)
     });
 }
Esempio n. 10
0
 /// <summary>
 /// Create title label.
 /// </summary>
 /// <param name="title">Frame title.</param>
 /// <returns>Title label.</returns>
 Label createTitleLabel(string title)
 {
     return(new Label {
         TextColor = Color.FromHex(Theme.Current.SwitchFrameTextColor),
         Text = title,
         Style = AppStyles.GetLabelStyle()
     });
 }
Esempio n. 11
0
 Label createExpandLabel(string expandTextString)
 {
     return(new Label {
         Text = expandTextString,
         HorizontalTextAlignment = TextAlignment.Center,
         Style = AppStyles.GetLabelStyle(NamedSize.Small),
         TextColor = Color.FromHex(Theme.Current.StatisticsExpandableTextColor)
     });
 }
Esempio n. 12
0
 Label createContributorLabel(string localizedKey, bool bold = false)
 {
     return(new Label {
         Style = AppStyles.GetLabelStyle(bold: bold),
         HorizontalTextAlignment = TextAlignment.Center,
         Text = CrossLocalization.Translate(localizedKey),
         TextColor = Color.FromHex(Theme.Current.AboutTextColor)
     });
 }
        Label createQuestionLabel()
        {
            var questionLabel = new Label {
                TextColor = Color.FromHex(Theme.Current.TestPassingQuestionColor),
                Style     = AppStyles.GetLabelStyle(NamedSize.Large)
            };

            questionLabel.SetBinding(Label.TextProperty, "Question");
            return(questionLabel);
        }
 Label createTimePassedLabel()
 {
     return(new Label {
         HorizontalTextAlignment = TextAlignment.Center,
         HorizontalOptions = LayoutOptions.CenterAndExpand,
         Style = AppStyles.GetLabelStyle(NamedSize.Medium),
         TextColor = Color.FromHex(Theme.Current.TestResultsRatingColor),
         Text = $"{CrossLocalization.Translate("test_results_time")} {_timePassed}"
     });
 }
Esempio n. 15
0
        /// <summary>
        /// Create description label.
        /// </summary>
        /// <returns>Description label.</returns>
        Label createDescription()
        {
            var description = new Label {
                TextColor = Color.FromHex(Theme.Current.CheckboxDescriptionColor),
                Style     = AppStyles.GetLabelStyle(NamedSize.Small)
            };

            description.SetBinding(Label.TextProperty, "Description");
            return(description);
        }
 Label createRatingTitleLabel()
 {
     return(new Label {
         TextColor = Color.FromHex(Theme.Current.BaseSectionTextColor),
         HorizontalTextAlignment = TextAlignment.Center,
         HorizontalOptions = LayoutOptions.CenterAndExpand,
         Text = CrossLocalization.Translate("test_results_label"),
         Style = AppStyles.GetLabelStyle()
     });
 }
Esempio n. 17
0
 Label createChooseLabel()
 {
     return(new Label {
         Margin = _chooseLabelMargin,
         FontAttributes = FontAttributes.Bold,
         TextColor = Color.FromHex(Theme.Current.BaseSectionTextColor),
         Text = CrossLocalization.Translate("settings_theme_choose"),
         Style = AppStyles.GetLabelStyle(NamedSize.Large, true)
     });
 }
        Label createUserLabel()
        {
            var userLabel = new Label {
                TextColor       = Color.FromHex(Theme.Current.SettingsTitleColor),
                VerticalOptions = LayoutOptions.CenterAndExpand,
                Style           = AppStyles.GetLabelStyle()
            };

            userLabel.SetBinding(Label.TextProperty, "Username");
            return(userLabel);
        }
Esempio n. 19
0
 Label createSubjectsLabel()
 {
     return(new Label {
         BackgroundColor = Color.FromHex(Theme.Current.AppBackgroundColor),
         Padding = _subjectsLabelMargin,
         FontAttributes = FontAttributes.Bold,
         TextColor = Color.FromHex(Theme.Current.BaseSectionTextColor),
         Text = CrossLocalization.Translate("today_subjects"),
         Style = AppStyles.GetLabelStyle(NamedSize.Large, true)
     });
 }
        Label createAnswerLabel()
        {
            var answer = new Label {
                TextColor       = Color.FromHex(Theme.Current.TestPassingAnswerColor),
                VerticalOptions = LayoutOptions.CenterAndExpand,
                Style           = AppStyles.GetLabelStyle()
            };

            answer.SetBinding(Label.TextProperty, "Content");
            return(answer);
        }
        Label createDescriptionLabel()
        {
            var descriptionLabel = new Label {
                TextColor = Color.FromHex(Theme.Current.TestPassingQuestionColor),
                TextType  = TextType.Html,
                Style     = AppStyles.GetLabelStyle()
            };

            descriptionLabel.SetBinding(Label.TextProperty, "Description");
            return(descriptionLabel);
        }
 Label createStudentNameLabel(string name)
 {
     return(new Label {
         Text = name,
         Margin = _studentNameMargin,
         TextColor = Color.FromHex(Theme.Current.StatisticsDetailsNameColor),
         HorizontalOptions = LayoutOptions.CenterAndExpand,
         HorizontalTextAlignment = TextAlignment.Center,
         Style = AppStyles.GetLabelStyle(NamedSize.Large)
     });
 }
Esempio n. 23
0
 Label createHeaderLabel()
 {
     return(new Label {
         Padding = _headerPadding,
         FontAttributes = FontAttributes.Bold,
         Text = CrossLocalization.Translate("files_header"),
         TextColor = Color.FromHex(Theme.Current.BaseSectionTextColor),
         BackgroundColor = Color.FromHex(Theme.Current.AppBackgroundColor),
         Style = AppStyles.GetLabelStyle(NamedSize.Large, true)
     });
 }
        /// <summary>
        /// Create subject label.
        /// </summary>
        /// <returns>Subject label.</returns>
        Label createSubjectLabel()
        {
            var subject = new Label {
                TextColor = Color.FromHex(Theme.Current.BasePickerTextColor),
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalOptions         = LayoutOptions.CenterAndExpand,
                Style = AppStyles.GetLabelStyle()
            };

            subject.SetBinding(Label.TextProperty, ChosenSubjectProperty);
            return(subject);
        }
        Label createNewsTitle()
        {
            var newsTitleLabel = new Label {
                Padding                 = _newsTitlePadding,
                TextColor               = Color.FromHex(Theme.Current.NewsTextColor),
                HorizontalOptions       = LayoutOptions.CenterAndExpand,
                HorizontalTextAlignment = TextAlignment.Center,
                Style = AppStyles.GetLabelStyle(NamedSize.Large)
            };

            newsTitleLabel.SetBinding(Label.TextProperty, "NewsTitle");
            return(newsTitleLabel);
        }
        Label createRatingLabel()
        {
            var mark = new Label {
                FontAttributes          = FontAttributes.Bold,
                HorizontalTextAlignment = TextAlignment.Center,
                HorizontalOptions       = LayoutOptions.CenterAndExpand,
                TextColor = Color.FromHex(Theme.Current.TestResultsRatingColor),
                Style     = AppStyles.GetLabelStyle(NamedSize.Large, true)
            };

            mark.SetBinding(Label.TextProperty, "Mark");
            return(mark);
        }
Esempio n. 27
0
 Frame createEmptyView()
 {
     return(new Frame {
         HasShadow = false,
         Margin = _emptyViewMargin,
         BackgroundColor = Color.FromHex(Theme.Current.BaseBlockColor),
         Content = new Label {
             Style = AppStyles.GetLabelStyle(),
             HorizontalTextAlignment = TextAlignment.Center,
             HorizontalOptions = LayoutOptions.CenterAndExpand,
             Text = CrossLocalization.Translate("base_no_data"),
             TextColor = Color.FromHex(Theme.Current.BaseNoDataTextColor)
         }
     });
 }
Esempio n. 28
0
        /// <summary>
        /// Create title label.
        /// </summary>
        /// <returns>Title label.</returns>
        Label createTitle(bool isCustomFont)
        {
            var title = new Label {
                TextColor = Color.FromHex(Theme.Current.SettingsTitleColor),
                Style     = AppStyles.GetLabelStyle()
            };

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

            if (isCustomFont)
            {
                title.SetBinding(Label.FontFamilyProperty, "FontFamily");
            }

            return(title);
        }
 /// <summary>
 /// Create empty view.
 /// </summary>
 /// <returns>Empty view layout.</returns>
 StackLayout createEmptyView()
 {
     return(new StackLayout {
         Spacing = _spacing,
         BackgroundColor = Color.FromHex(Theme.Current.RoundedListViewBackgroundColor),
         Children =
         {
             new Label {
                 Style = AppStyles.GetLabelStyle(),
                 HorizontalTextAlignment = TextAlignment.Center,
                 HorizontalOptions = LayoutOptions.CenterAndExpand,
                 Text = CrossLocalization.Translate("base_no_data"),
                 TextColor = Color.FromHex(Theme.Current.BaseNoDataTextColor)
             }
         }
     });
 }
Esempio n. 30
0
        Label createStatisticsLabel(string text, bool isCenteredHorizontally = false)
        {
            var statsLabel = new Label {
                TextColor       = Color.FromHex(Theme.Current.StatisticsBaseRatingTextColor),
                Style           = AppStyles.GetLabelStyle(NamedSize.Small),
                VerticalOptions = LayoutOptions.CenterAndExpand,
                Text            = text
            };

            if (isCenteredHorizontally)
            {
                statsLabel.HorizontalOptions       = LayoutOptions.CenterAndExpand;
                statsLabel.HorizontalTextAlignment = TextAlignment.Center;
            }

            return(statsLabel);
        }