public OrderPageCode ()
		{
			Title = "Order Page - Code";
			var grid = new Grid {
				HorizontalOptions = LayoutOptions.FillAndExpand,
				VerticalOptions = LayoutOptions.FillAndExpand,
				Padding = new Thickness (15)
			};
			for (int x = 0; x < 7; x++) {
				grid.RowDefinitions.Add (new RowDefinition{ Height = new GridLength(50) });
			}
			grid.ColumnDefinitions.Add (new ColumnDefinition{ Width = new GridLength(90) });
			grid.ColumnDefinitions.Add (new ColumnDefinition{ Width = new GridLength (1, GridUnitType.Star) });

			grid.Children.Add (new Label { Text = "Purchaser's Name:" }, 0, 0);
			grid.Children.Add (new Label { Text = "Billing Address:" }, 0, 1);
			grid.Children.Add (new Label { Text = "Tip:", FontAttributes = FontAttributes.Bold }, 0, 2);
			grid.Children.Add (new Label { Text = "Phone Number:" }, 0, 3);
			grid.Children.Add (new Label { Text = "Comments:" }, 0, 4);
			grid.Children.Add (new Entry { Placeholder = "Full Name on Card" }, 1, 0);
			grid.Children.Add (new Editor (), 1, 1);
			grid.Children.Add (new Entry{ Keyboard = Keyboard.Numeric }, 1, 2);
			grid.Children.Add (new Entry { Keyboard = Keyboard.Telephone }, 1, 3);
			grid.Children.Add (new Editor (), 1, 4);

			var fstring = new FormattedString ();
			fstring.Spans.Add (new Span { Text = "Wait! ", ForegroundColor = Color.Red });
			fstring.Spans.Add (new Span { Text = "Please double check that everything is right." });
			grid.Children.Add (new Label { FormattedText = fstring }, 1, 5);
			grid.Children.Add (new Button { TextColor = Color.White, BackgroundColor = Color.Gray, Text = "Save" }, 1, 6);
			Content = grid;
		}
Exemplo n.º 2
0
        private static void OnItemsSourcePropertyChanged(BindableObject bindable, IEnumerable<ILabel> oldvalue,
            IEnumerable<ILabel> newvalue)
        {
            var control = bindable as Label;
            control.FormattedText = null;

            if (newvalue == null) return;

            var formattedString = new FormattedString();
            foreach (var label in newvalue)
            {
                var color = Color.FromHex(label.Color);

                formattedString.Spans.Add(new Span
                {
                    Text = $"\u00A0{label.Name}\u00A0",
                    ForegroundColor =
                        (Color)
                            Application.Current.Resources[
                                (color.Hue > 0 ? "PrimaryLightTextColor" : "PrimaryDarkTextColor")],
                    BackgroundColor = color
                });
                formattedString.Spans.Add(new Span
                {
                    Text = " "
                });
            }

            control.FormattedText = formattedString;
        }
        public VariableFormattedTextPage()
        {
            var formattedString = new FormattedString();

            formattedString.Spans.Add(new Span()
            {
                Text = "i"
            });

            formattedString.Spans.Add(new Span()
            {
                Text = "love",
                FontAttributes = FontAttributes.Bold,
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label))
            });

            formattedString.Spans.Add(new Span()
            {
                Text = "Xamarin.Forms!"
            });

            Content = new Label()
            {
                FormattedText = formattedString,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.Center,
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label))
            };
        }
Exemplo n.º 4
0
        public NamedFontSizes()
        {
            var formattedString = new FormattedString();
            NamedSize[] namedSizes =
            {
                NamedSize.Large, NamedSize.Default, NamedSize.Medium,
                NamedSize.Small, NamedSize.Micro,
            };

            foreach (var namedSize in namedSizes)
            {
                var fontSize = Device.GetNamedSize(namedSize, typeof (Label));

                formattedString.Spans.Add(new Span
                {
                    Text = $"Named Size = {namedSize} ({fontSize:F2})",
                    FontSize = fontSize
                });

                if (namedSize != namedSizes.Last())
                {
                    formattedString.Spans.Add(new Span
                    {
                        Text = "\n\n"
                    });
                }
            }

            Content = new Label
            {
                FormattedText = formattedString,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.Center
            };
        }
Exemplo n.º 5
0
 public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
 {
     List<MyChildRenderBlockItem> val = value as List<MyChildRenderBlockItem>;
     FormattedString fs = new FormattedString();
     val.FirstOrDefault((it) => { fs.Spans.Add(new Span() { Text = it.ItemText, ForegroundColor = new Color(it.Clr) }); return false; });
     return fs;
 }
		public LabelPageCode ()
		{
			var layout = new StackLayout{ Padding = new Thickness (5, 10) };
			this.Title = "Label Demo - Code";
			layout.Children.Add (new Label{ TextColor = Color.FromHex ("#77d065"), Text = "This is a green label." });
			layout.Children.Add (new Label{ Text = "This is a default, non-customized label." });
			layout.Children.Add (new Label{ Text = "This label has a font size of 30.", FontSize = 30 });
			layout.Children.Add (new Label{ Text = "This is bold text.", FontAttributes = FontAttributes.Bold });
			var fstring = new FormattedString ();
			fstring.Spans.Add (new Span{ Text = "Red bold ", ForegroundColor = Color.Red, FontAttributes = FontAttributes.Bold });
			fstring.Spans.Add (new Span { Text = "Default" });
			fstring.Spans.Add (new Span { Text = "italic small", FontAttributes = FontAttributes.Italic, FontSize =  Device.GetNamedSize(NamedSize.Small, typeof(Label)) });
			layout.Children.Add (new Label { FormattedText = fstring });
			this.Content = layout;
		}
Exemplo n.º 7
0
		public void TextAndAttributedTextMutuallyExclusive ()
		{
			var label = new Label ();
			Assert.IsNull (label.Text);
			Assert.IsNull (label.FormattedText);

			label.Text = "Foo";
			Assert.AreEqual ("Foo", label.Text);
			Assert.IsNull (label.FormattedText);

			var fs = new FormattedString ();
			label.FormattedText = fs;
			Assert.IsNull (label.Text);
			Assert.AreSame (fs, label.FormattedText);

			label.Text = "Foo";
			Assert.AreEqual ("Foo", label.Text);
			Assert.IsNull (label.FormattedText);
		}
        public NamedFontSizesPage()
        {
            FormattedString formattedString = new FormattedString();
            NamedSize[] namedSizes = 
            {
                NamedSize.Default, NamedSize.Micro, NamedSize.Small,
                NamedSize.Medium, NamedSize.Large
            };

            foreach (NamedSize namedSize in namedSizes)
            {
                double fontSize = Device.GetNamedSize(namedSize, typeof(Label));

                formattedString.Spans.Add(new Span
                    {
                        Text = String.Format("Named Size = {0} ({1:F2})",
                                             namedSize, fontSize),
                        FontSize = fontSize
                    });

                if (namedSize != namedSizes.Last())
                {
                    formattedString.Spans.Add(new Span
                        {
                            Text = "\n\n"
                        });
                }
            }

            Content = new Label
            {
                FormattedText = formattedString,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.Center
            };
        }
Exemplo n.º 9
0
        protected override void Build(StackLayout stackLayout)
        {
            base.Build(stackLayout);

#pragma warning disable 618
            var namedSizeMediumBoldContainer = new ViewContainer <Label> (Test.Label.FontAttibutesBold, new Label {
                Text = "Medium Bold Font", Font = Font.SystemFontOfSize(NamedSize.Medium, FontAttributes.Bold)
            });
#pragma warning restore 618

#pragma warning disable 618
            var namedSizeMediumItalicContainer = new ViewContainer <Label> (Test.Label.FontAttributesItalic, new Label {
                Text = "Medium Italic Font", Font = Font.SystemFontOfSize(NamedSize.Medium, FontAttributes.Italic)
            });
#pragma warning restore 618

#pragma warning disable 618
            var namedSizeMediumUnderlineContainer = new ViewContainer <Label>(Test.Label.TextDecorationUnderline, new Label {
                Text = "Medium Underlined Font", Font = Font.SystemFontOfSize(NamedSize.Medium), TextDecorations = TextDecorations.Underline
            });
#pragma warning restore 618

#pragma warning disable 618
            var namedSizeMediumStrikeContainer = new ViewContainer <Label>(Test.Label.TextDecorationStrike, new Label {
                Text = "Medium StrikeThrough Font", Font = Font.SystemFontOfSize(NamedSize.Medium), TextDecorations = TextDecorations.Strikethrough
            });
#pragma warning restore 618

#pragma warning disable 618
            var namedSizeLargeContainer = new ViewContainer <Label> (Test.Label.FontNamedSizeLarge, new Label {
                Text = "Large Font", Font = Font.SystemFontOfSize(NamedSize.Large)
            });
#pragma warning restore 618

#pragma warning disable 618
            var namedSizeMediumContainer = new ViewContainer <Label> (Test.Label.FontNamedSizeMedium, new Label {
                Text = "Medium Font", Font = Font.SystemFontOfSize(NamedSize.Medium)
            });
#pragma warning restore 618

#pragma warning disable 618
            var namedSizeMicroContainer = new ViewContainer <Label> (Test.Label.FontNamedSizeMicro, new Label {
                Text = "Micro Font", Font = Font.SystemFontOfSize(NamedSize.Micro)
            });
#pragma warning restore 618

#pragma warning disable 618
            var namedSizeSmallContainer = new ViewContainer <Label> (Test.Label.FontNamedSizeSmall, new Label {
                Text = "Small Font", Font = Font.SystemFontOfSize(NamedSize.Small)
            });
#pragma warning restore 618

            var formattedString = new FormattedString();
            formattedString.Spans.Add(new Span {
                BackgroundColor = Color.Red, TextColor = Color.Olive, Text = "Span 1 "
            });

            Span span = new Span {
                BackgroundColor = Color.Black, TextColor = Color.White, Text = "Span 2 (tap me) "
            };
            span.GestureRecognizers.Add(new TapGestureRecognizer {
                Command = new Command(() => DisplayAlert("Congratulations!", "This is a tapped span", "ok"))
            });
            formattedString.Spans.Add(span);

            formattedString.Spans.Add(new Span {
                BackgroundColor = Color.Pink, TextColor = Color.Purple, Text = "Span 3"
            });

            var formattedTextContainer = new ViewContainer <Label>(Test.Label.FormattedText, new Label {
                FormattedText = formattedString
            });

            const string longText = "Lorem ipsum dolor sit amet, cu mei malis petentium, dolor tempor delicata no qui, eos ex vitae utinam vituperata. Utroque habemus philosophia ut mei, doctus placerat eam cu. An inermis scaevola pro, quo legimus deleniti ei, equidem docendi urbanitas ea eum. Saepe doctus ut pri. Nec ex wisi dolorem. Duo dolor vituperatoribus ea. Id purto instructior per. Nec partem accusamus ne. Qui ad saepe accumsan appellantur, duis omnesque has et, vim nihil nemore scaevola ne. Ei populo appetere recteque cum, meliore splendide appellantur vix id.";
            var          lineBreakModeCharacterWrapContainer = new ViewContainer <Label> (Test.Label.LineBreakModeCharacterWrap, new Label {
                Text = longText, LineBreakMode = LineBreakMode.CharacterWrap
            });
            var lineBreakModeHeadTruncationContainer = new ViewContainer <Label> (Test.Label.LineBreakModeHeadTruncation, new Label {
                Text = longText, LineBreakMode = LineBreakMode.HeadTruncation
            });
            var lineBreakModeMiddleTruncationContainer = new ViewContainer <Label> (Test.Label.LineBreakModeMiddleTruncation, new Label {
                Text = longText, LineBreakMode = LineBreakMode.MiddleTruncation
            });
            var lineBreakModeNoWrapContainer = new ViewContainer <Label> (Test.Label.LineBreakModeNoWrap, new Label {
                Text = longText, LineBreakMode = LineBreakMode.NoWrap
            });
            var lineBreakModeTailTruncationContainer = new ViewContainer <Label> (Test.Label.LineBreakModeTailTruncation, new Label {
                Text = longText, LineBreakMode = LineBreakMode.TailTruncation
            });
            var lineBreakModeWordWrapContainer = new ViewContainer <Label> (Test.Label.LineBreakModeWordWrap, new Label {
                Text = longText, LineBreakMode = LineBreakMode.WordWrap
            });

            var textContainer = new ViewContainer <Label> (Test.Label.Text, new Label {
                Text = "I should have text"
            });
            var textColorContainer = new ViewContainer <Label> (Test.Label.TextColor, new Label {
                Text = "I should have lime text", TextColor = Color.Lime
            });

            const int alignmentTestsHeightRequest = 100;
            const int alignmentTestsWidthRequest  = 100;

            var xAlignCenterContainer = new ViewContainer <Label> (Test.Label.HorizontalTextAlignmentCenter,
                                                                   new Label {
                Text = "HorizontalTextAlignment Center",
                HorizontalTextAlignment = TextAlignment.Center,
                HeightRequest           = alignmentTestsHeightRequest,
                WidthRequest            = alignmentTestsWidthRequest
            }
                                                                   );

            var xAlignEndContainer = new ViewContainer <Label> (Test.Label.HorizontalTextAlignmentEnd,
                                                                new Label {
                Text = "HorizontalTextAlignment End",
                HorizontalTextAlignment = TextAlignment.End,
                HeightRequest           = alignmentTestsHeightRequest,
                WidthRequest            = alignmentTestsWidthRequest
            }
                                                                );

            var xAlignStartContainer = new ViewContainer <Label> (Test.Label.HorizontalTextAlignmentStart,
                                                                  new Label {
                Text = "HorizontalTextAlignment Start",
                HorizontalTextAlignment = TextAlignment.Start,
                HeightRequest           = alignmentTestsHeightRequest,
                WidthRequest            = alignmentTestsWidthRequest
            }
                                                                  );

            var yAlignCenterContainer = new ViewContainer <Label> (Test.Label.VerticalTextAlignmentCenter,
                                                                   new Label {
                Text = "VerticalTextAlignment Start",
                VerticalTextAlignment = TextAlignment.Center,
                HeightRequest         = alignmentTestsHeightRequest,
                WidthRequest          = alignmentTestsWidthRequest
            }
                                                                   );

            var yAlignEndContainer = new ViewContainer <Label> (Test.Label.VerticalTextAlignmentEnd,
                                                                new Label {
                Text = "VerticalTextAlignment End",
                VerticalTextAlignment = TextAlignment.End,
                HeightRequest         = alignmentTestsHeightRequest,
                WidthRequest          = alignmentTestsWidthRequest
            }
                                                                );

            var yAlignStartContainer = new ViewContainer <Label> (Test.Label.VerticalTextAlignmentStart,
                                                                  new Label {
                Text = "VerticalTextAlignment Start",
                VerticalTextAlignment = TextAlignment.Start,
                HeightRequest         = alignmentTestsHeightRequest,
                WidthRequest          = alignmentTestsWidthRequest
            }
                                                                  );

            var styleTitleContainer = new ViewContainer <Label> (Test.Device.Styles,
                                                                 new Label {
                Text  = "Device.Styles.TitleStyle",
                Style = Device.Styles.TitleStyle
            }
                                                                 );

            var styleSubtitleContainer = new ViewContainer <Label> (Test.Device.Styles,
                                                                    new Label {
                Text  = "Device.Styles.SubtitleStyle",
                Style = Device.Styles.SubtitleStyle
            }
                                                                    );

            var styleBodyContainer = new ViewContainer <Label> (Test.Device.Styles,
                                                                new Label {
                Text  = "Device.Styles.BodyStyle",
                Style = Device.Styles.BodyStyle
            }
                                                                );

            var styleCaptionContainer = new ViewContainer <Label> (Test.Device.Styles,
                                                                   new Label {
                Text  = "Device.Styles.CaptionStyle",
                Style = Device.Styles.CaptionStyle,
            }
                                                                   );

            Add(namedSizeMediumBoldContainer);
            Add(namedSizeMediumItalicContainer);
            Add(namedSizeMediumUnderlineContainer);
            Add(namedSizeMediumStrikeContainer);
            Add(namedSizeLargeContainer);
            Add(namedSizeMediumContainer);
            Add(namedSizeMicroContainer);
            Add(namedSizeSmallContainer);
            Add(formattedTextContainer);
            Add(lineBreakModeCharacterWrapContainer);
            Add(lineBreakModeHeadTruncationContainer);
            Add(lineBreakModeMiddleTruncationContainer);
            Add(lineBreakModeNoWrapContainer);
            Add(lineBreakModeTailTruncationContainer);
            Add(lineBreakModeWordWrapContainer);
            Add(textContainer);
            Add(textColorContainer);
            Add(xAlignCenterContainer);
            Add(xAlignEndContainer);
            Add(xAlignStartContainer);
            Add(yAlignCenterContainer);
            Add(yAlignEndContainer);
            Add(yAlignStartContainer);
            Add(styleTitleContainer);
            Add(styleSubtitleContainer);
            Add(styleBodyContainer);
            Add(styleCaptionContainer);
        }
        void OnLocationListViewItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            try
            {

                CustomListViewItem item = (CustomListViewItem)e.SelectedItem;

                locationInfo.Text = "";
                var s = new FormattedString();
                s.Spans.Add(new Span { Text = "   - at ", ForegroundColor = Color.Black });
                s.Spans.Add(new Span { Text = item.Name });
				currentAddress = item.Name;
                locationInfo.FormattedText = s;
                locLayout.IsVisible = true;
                View pickView = masterLayout.Children.FirstOrDefault(pick => pick.ClassId == "ePicker");
                masterLayout.Children.Remove(pickView);
                pickView = null;

            }
            catch (Exception ex)
            {
                var test = ex.Message;
            }
        }
Exemplo n.º 11
0
		async void answerClicked (object sender, EventArgs e)
		{
			Button rightChoice=new Button();
			for (int i = 0; i < 8; i++) {
				if (answers [i].Text == correct) {
					rightChoice = answers [i];
				}

			}
			rightChoice.TextColor=Color.White;
			rightChoice.BackgroundColor = Color.Green;
			if (((Button)sender).Text != correct) {
				if(Settings.sound)
					DependencyService.Get<IAudio>().PlayWavFile("Audio/Alert/error.wav");
				
				TestPage.timeList.Add (TestPage.timeList[currentIndex]);
				TestPage.timeMode.Add (TestPage.timeMode[currentIndex]);
				((Button)sender).TextColor = Color.White;
				((Button)sender).BackgroundColor = Color.Red;
				for (int i = 0; i < 8; i++) {
					answers [i].Clicked -= answerClicked;
				
				}
				Device.StartTimer (TimeSpan.FromMilliseconds(3000), () => {
					rightChoice.TextColor = Color.Blue;
					((Button)sender).TextColor = Color.Blue;
					/*for (int i = 0; i < 8; i++) {
						answers [i].Clicked += answerClicked;

					}*/
					nextScreen();
					return false;
				});
				wrongState = true;
			}
			else
			{
				if (wrongState == false) {
					rightCount++;
				}
				progress = (double)((double)rightCount / (double)initCount);
				progressBar.ProgressTo (progress, 250, Easing.Linear);
				for (int i = 0; i < 8; i++) {
					answers [i].Clicked -= answerClicked;

				}
				if(Settings.sound)
					//DependencyService.Get<IAudio>().PlayMp3File("Audio/Alert/success.mp3");
				
				Device.StartTimer (TimeSpan.FromMilliseconds(500), () => {
					nextScreen ();

					return false;
				});
			}
			for (int i = 0; i < 3; i++) {
				var fs = new FormattedString ();
				fs.Spans.Add (new Span {
					Text = correct,
					ForegroundColor = Color.Green,
					FontAttributes = FontAttributes.Bold,
					FontSize = 30
				});
			}
		
			progressLabel.Text = rightCount.ToString () + "/" + initCount.ToString();
		//	await labels[0].RotateTo(15, 1000, Easing.CubicInOut);
		}
Exemplo n.º 12
0
        private async Task <bool> GetOssData(int type = 0)
        {
            ButtonActive.IsEnabled  = false;
            ButtonArchive.IsEnabled = false;

            if (Xamarin.Essentials.Connectivity.NetworkAccess != Xamarin.Essentials.NetworkAccess.Internet)
            {
                Device.BeginInvokeOnMainThread(async() => await DisplayAlert(AppResources.ErrorTitle, AppResources.ErrorNoInternet, "OK"));
                return(false);
            }
            //получаем данные от сервера по ОСС
            var result = await rc.GetOss();

            //var result1 = await rc.GetOss(1);
            //var haveP =result.Data.Where(_ => _.HasProtocolFile).ToList();


            if (result.Error == null)
            {
                var dateNow = DateTime.Now;
                //Завершенные
                if (type == 0)
                {
                    var rr = result.Data.Where(_ => Convert.ToDateTime(_.DateEnd, new CultureInfo("ru-RU")) < dateNow).OrderByDescending(_ => _.DateEnd).ToList();
                    result.Data = rr;
                }
                //Активные
                if (type == 1)
                {
                    var rr = result.Data.Where(_ => Convert.ToDateTime(_.DateEnd, new CultureInfo("ru-RU")) > dateNow).OrderByDescending(_ => _.DateEnd).ToList();
                    result.Data = rr;
                }

                frames.Clear();
                arrows.Clear();

                OSSListContent.Children.Clear();

                bool isFirst = true;

                foreach (var oss in result.Data)
                {
                    Frame f = new Frame();
                    f.SetAppThemeColor(Frame.BorderColorProperty, (Color)Application.Current.Resources["MainColor"], Color.White);
                    f.MinimumHeightRequest = 50;
                    f.SetOnAppTheme(Frame.HasShadowProperty, false, true);
                    f.BackgroundColor = Color.White;

                    f.CornerRadius      = Device.RuntimePlatform == Device.iOS? 20: 40;
                    f.HorizontalOptions = LayoutOptions.FillAndExpand;
                    f.Margin            = new Thickness(0, 10);

                    //по нажатию обработка в раскрытие
                    TapGestureRecognizer tapGesture = new TapGestureRecognizer();
                    tapGesture.Tapped += async(s, e) =>
                    {
                        //делаем видимыми/невидимыми все доп.элементы

                        Device.BeginInvokeOnMainThread(async() =>
                        {
                            var frme = (Frame)s;
                            if (prevAddtionlExpanded != null)
                            {
                                if (prevAddtionlExpanded.Id != frme.Id)
                                {
                                    action(prevAddtionlExpanded, true);
                                }
                            }

                            action(frme);
                            prevAddtionlExpanded = frme;
                        });
                    };
                    f.GestureRecognizers.Add(tapGesture);

                    StackLayout rootStack = new StackLayout()
                    {
                        Orientation = StackOrientation.Vertical, VerticalOptions = LayoutOptions.FillAndExpand
                    };

                    //добавление краткой инфо о собраниях
                    StackLayout stack = new StackLayout()
                    {
                        Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand
                    };

                    IconView iconViewStatus = new IconView();
                    iconViewStatus.Source = "ic_OssCircleStatus";


                    int statusInt = 0;    //зеленый
                    if (Convert.ToDateTime(oss.DateEnd, new CultureInfo("ru-RU")) < DateTime.Now)
                    {
                        iconViewStatus.Foreground = Color.FromHex("#ed2e37");
                        statusInt = 3;     // красный, голосование окончено , статус "итоги голосования" и переход на эту страницу
                    }
                    if (Convert.ToDateTime(oss.DateStart, new CultureInfo("ru-RU")) < DateTime.Now && Convert.ToDateTime(oss.DateEnd, new CultureInfo("ru-RU")) > DateTime.Now)
                    {
                        //статус - идет голосование
                        if (oss.IsComplete)
                        {
                            // Ваш голос учтен - страница личных результатов голосования
                            statusInt = 2;    //желтый(стоит сейчас) или какой еще цвет?
                            iconViewStatus.Foreground = Color.FromHex("#50ac2f");
                        }
                        else
                        {
                            //если не все проголосовано, переходим на вопрос начиная с которго нет ответов, и продолжаем голосование
                            iconViewStatus.Foreground = Color.FromHex("#ff971c");
                            statusInt = 1;    //желтый
                        }
                    }
                    if (Convert.ToDateTime(oss.DateStart, new CultureInfo("ru-RU")) > DateTime.Now)
                    {
                        //зеленый, "Уведомление о проведении ОСС", statusInt = 0
                        iconViewStatus.Foreground = Color.FromHex("#50ac2f");
                    }


                    iconViewStatus.HeightRequest   = 15;
                    iconViewStatus.WidthRequest    = 15;
                    iconViewStatus.VerticalOptions = LayoutOptions.Center;
                    stack.Children.Add(iconViewStatus);

                    Label MeetingTitle = new Label()
                    {
                        Text = oss.MeetingTitle, FontSize = 18, TextColor = Color.Black, FontAttributes = FontAttributes.Bold, HorizontalOptions = LayoutOptions.FillAndExpand
                    };
                    stack.Children.Add(MeetingTitle);

                    IconView iconViewArrow = new IconView();
                    iconViewArrow.Source     = "ic_arrow_forward";
                    iconViewArrow.Foreground = colorFromMobileSettings;
                    await iconViewArrow.RotateTo(90);

                    iconViewArrow.HeightRequest     = 15;
                    iconViewArrow.WidthRequest      = 15;
                    iconViewArrow.VerticalOptions   = LayoutOptions.Center;
                    iconViewArrow.HorizontalOptions = LayoutOptions.End;

                    stack.Children.Add(iconViewArrow);

                    arrows.Add(f.Id, iconViewArrow.Id);

                    //добавляем видимю часть на старте
                    rootStack.Children.Add(stack);

                    //невидимые на старте элементы фрейма, кроме 1го фрейма
                    StackLayout additionslData = new StackLayout()
                    {
                        IsVisible = false, Orientation = StackOrientation.Vertical
                    };
                    if (isFirst)
                    {
                        prevAddtionlExpanded = f;
                        isFirst = false;
                    }

                    //добавляем в список связку стека с невидимыми плями и родительского фрейма
                    frames.Add(f.Id, additionslData.Id);

                    //инициатор
                    Label initiator = new Label()
                    {
                    };
                    FormattedString text = new FormattedString();
                    Span            t1   = new Span()
                    {
                        TextColor = Color.FromHex("#545454"), FontSize = 14, Text = $"{AppResources.OSSInfoInitiator}: "
                    };
                    text.Spans.Add(t1);
                    Span t2 = new Span()
                    {
                        TextColor = Color.Black, FontSize = 14, Text = oss.InitiatorNames
                    };
                    text.Spans.Add(t2);
                    initiator.FormattedText = text;

                    additionslData.Children.Add(initiator);
                    //дата собрания
                    Label date = new Label()
                    {
                    };
                    FormattedString datetext = new FormattedString();
                    Span            datet1   = new Span()
                    {
                        TextColor = Color.FromHex("#545454"), FontSize = 14, Text = $"{AppResources.OSSInfoDate}: "
                    };
                    datetext.Spans.Add(datet1);
                    Span datet2 = new Span()
                    {
                        TextColor = Color.Black, FontSize = 14, Text = $"{oss.DateStart} {AppResources.To} {oss.DateEnd}"
                    };
                    datetext.Spans.Add(datet2);
                    date.FormattedText = datetext;

                    additionslData.Children.Add(date);

                    //Адрес дома
                    Label adress = new Label()
                    {
                    };
                    FormattedString adresstext = new FormattedString();
                    Span            adresst1   = new Span()
                    {
                        TextColor = Color.FromHex("#545454"), FontSize = 14, Text = $"{AppResources.OSSInfoAdress}: "
                    };
                    adresstext.Spans.Add(adresst1);
                    Span adresst2 = new Span()
                    {
                        TextColor = Color.Black, FontSize = 14, Text = $"{oss.HouseAddress}"
                    };
                    adresstext.Spans.Add(adresst2);
                    adress.FormattedText = adresstext;

                    additionslData.Children.Add(adress);

                    //форма проведения
                    Label formAction = new Label()
                    {
                    };
                    FormattedString formActiontext = new FormattedString();
                    Span            formActiont1   = new Span()
                    {
                        TextColor = Color.FromHex("#545454"), FontSize = 14, Text = $"{AppResources.OSSInfoForm}: "
                    };
                    formActiontext.Spans.Add(formActiont1);
                    Span formActiont2 = new Span()
                    {
                        TextColor = Color.Black, FontSize = 14, Text = $"{oss.Form}"
                    };
                    formActiontext.Spans.Add(formActiont2);
                    formAction.FormattedText = formActiontext;

                    additionslData.Children.Add(formAction);

                    //разделитель
                    BoxView delim = new BoxView()
                    {
                        BackgroundColor   = Color.FromHex("#545454"),
                        HorizontalOptions = LayoutOptions.FillAndExpand, HeightRequest = 1, Margin = new Thickness(0, 10)
                    };
                    additionslData.Children.Add(delim);

                    //статус собрания:
                    StackLayout status = new StackLayout()
                    {
                        Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand
                    };

                    StackLayout statusNameIcon = new StackLayout()
                    {
                        Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.FillAndExpand
                    };

                    Label statusName = new Label()
                    {
                        Text = $"{AppResources.OSSInfoStatus} ", FontAttributes = FontAttributes.Bold, FontSize = 14, TextColor = Color.Black,
                        HorizontalOptions = LayoutOptions.Start
                    };

                    statusNameIcon.Children.Add(statusName);

                    StackLayout coloredStatus = new StackLayout()
                    {
                        HorizontalOptions = LayoutOptions.Start, Orientation = StackOrientation.Horizontal
                    };
                    IconView iconViewStatusNameIcon = new IconView();

                    string textStatius = "";
                    Color  ColorStatusTextString;
                    if (statusInt == 0)
                    {
                        iconViewStatusNameIcon.Source     = "ic_status_green";
                        iconViewStatusNameIcon.Foreground = Color.FromHex("#50ac2f");
                        ColorStatusTextString             = Color.FromHex("#50ac2f");
                        textStatius = AppResources.OSSInfoNotif;
                    }
                    else if (statusInt == 1)
                    {
                        iconViewStatusNameIcon.Source     = "ic_status_yellow";
                        iconViewStatusNameIcon.Foreground = Color.FromHex("#ff971c");
                        ColorStatusTextString             = Color.FromHex("#ff971c");
                        textStatius = AppResources.OSSInfoVoting;
                    }
                    else if (statusInt == 2)
                    {
                        iconViewStatusNameIcon.Source     = "ic_status_done";
                        iconViewStatusNameIcon.Foreground = Color.FromHex("#50ac2f");
                        ColorStatusTextString             = Color.FromHex("#50ac2f");
                        textStatius = AppResources.OSSVoteChecked;
                    }
                    else     //3
                    {
                        iconViewStatusNameIcon.Source     = "ic_status_red";
                        iconViewStatusNameIcon.Foreground = Color.FromHex("#ed2e37");
                        ColorStatusTextString             = Color.FromHex("#ed2e37");
                        textStatius = AppResources.OSSInfoPassed;
                    }
                    iconViewStatusNameIcon.HeightRequest     = 15;
                    iconViewStatusNameIcon.WidthRequest      = 15;
                    iconViewStatusNameIcon.VerticalOptions   = LayoutOptions.Center;
                    iconViewStatusNameIcon.HorizontalOptions = LayoutOptions.Start;

                    coloredStatus.Children.Add(iconViewStatusNameIcon);

                    Label statSting = new Label()
                    {
                        Text = textStatius, FontSize = 12, TextColor = ColorStatusTextString, HorizontalOptions = LayoutOptions.Start
                    };
                    coloredStatus.Children.Add(statSting);

                    statusNameIcon.Children.Add(coloredStatus);

                    status.Children.Add(statusNameIcon);

                    //кнопка раскрытия осс
                    Frame buttonFrame = new Frame()
                    {
                        HeightRequest = 40, WidthRequest = 40, BackgroundColor = colorFromMobileSettings, CornerRadius = 10, Padding = 0
                    };
                    IconView iconViewArrowButton = new IconView();
                    iconViewArrowButton.Source            = "ic_arrow_forward";
                    iconViewArrowButton.Foreground        = Color.White;
                    iconViewArrowButton.HeightRequest     = 15;
                    iconViewArrowButton.WidthRequest      = 15;
                    iconViewArrowButton.VerticalOptions   = LayoutOptions.Center;
                    iconViewArrowButton.HorizontalOptions = LayoutOptions.Center;
                    buttonFrame.SetOnAppTheme(Frame.HasShadowProperty, false, true);
                    buttonFrame.Content = iconViewArrowButton;

                    TapGestureRecognizer buttonFrametapGesture = new TapGestureRecognizer();
                    buttonFrametapGesture.Tapped += async(s, e) =>
                    {
                        OSS result = await rc.GetOssById(oss.ID.ToString());

                        switch (statusInt)
                        {
                        case 0:
                        case 1:
                            var setAcquintedResult = await rc.SetAcquainted(oss.ID);

                            if (string.IsNullOrWhiteSpace(setAcquintedResult.Error))
                            {
                                OpenPage(new OSSInfo(result));
                            }
                            else
                            {
                                await DisplayAlert(AppResources.ErrorTitle, AppResources.ErrorOSSMain, "OK");
                            }

                            break;

                        case 3:         //"Итоги голосования"/"завершено" - открываем форму общих результатов голосования
                            OpenPage(new OSSTotalVotingResult(result));

                            break;

                        case 2:         //"Ваш голос учтен"  - открываем форму личных результатов голосования
                            OpenPage(new OSSPersonalVotingResult(result));

                            break;

                        default: OpenPage(new OSSInfo(result));
                            return;
                        }
                        //await Navigation.PushAsync(new OSSInfo(oss));
                    };
                    buttonFrame.GestureRecognizers.Add(buttonFrametapGesture);

                    status.Children.Add(buttonFrame);
                    //Button bFrame = new Button() { ImageSource };


                    additionslData.Children.Add(status);

                    //добавляем "невидимую" часть
                    rootStack.Children.Add(additionslData);

                    f.Content = rootStack;


                    OSSListContent.Children.Add(f);
                }
                action(prevAddtionlExpanded);

                ButtonActive.IsEnabled  = true;
                ButtonArchive.IsEnabled = true;
                //});
                return(true);
            }
            else
            {
                await DisplayAlert(AppResources.ErrorTitle, AppResources.ErrorOSSMainInfo, "OK");

                return(false);
            }
        }
Exemplo n.º 13
0
 public void Write(FormattedString str)
 {
     _entries[_entries.Count - 1].Append(str);
 }
Exemplo n.º 14
0
		public void addHeadings()
		{
			if (mode == "Transcription Katakana") {
				int j = 0;
				string[] vowelRow = {"","A", "I", "U", "E", "O","","YU","YE"} ;
				foreach (string e in vowelRow) 
				{
					if (e.Length > 0) {
						grid.Children.Add (new LetterLabel {
							BackgroundColor = Color.FromHex ("639630"),
							Text = e,
							TextColor = Color.White,
						}, j, 0);
					}
					j++;
				}
				string[] consotantMonoCol = {"Kw", "S", "Z", "T","Ts","D","F","Y","W","V"} ;
				j = 0;
				foreach (string e in consotantMonoCol) {
					j++;
					Label monoLabel = new Label {
						BackgroundColor = Color.FromHex ("639630"),
						Text = e,
						TextColor = Color.White,
						XAlign = TextAlignment.Center,
						YAlign = TextAlignment.Center
					};
					grid.Children.Add (monoLabel, 0, j);
				}

			} else {
				if (monoMode) {
					var fs = new FormattedString ();
					fs.Spans.Add (new Span { Text = "Monographs", ForegroundColor = Color.White });
					if (mode == "Basic Hiragana" || mode == "Basic Katakana")
						fs.Spans.Add (new Span {
							Text = "\n(Gojūon)",
							ForegroundColor = Color.White,
							FontAttributes = FontAttributes.Italic
						});
					grid.Children.Add (new Label {
						BackgroundColor = Color.FromHex ("2B3359"),
						FormattedText = fs,
						TextColor = Color.White,
						XAlign = TextAlignment.Center,
						YAlign = TextAlignment.Center
					}, 1, 6, 0, 1);
							
					int i = 0;

					string[] vowelRow = { "", "A", "I", "U", "E", "O" };
					foreach (string e in vowelRow) {
						if (e != "") {
							grid.Children.Add (new LetterLabel {
								BackgroundColor = Color.FromHex ("639630"),
								Text = e,
								TextColor = Color.White,
							}, i, 1);

						}
						i++;
					}

					string[] consotantMonoCol = { "∅", "K", "S", "T", "N", "H", "M", "Y", "R", "W" };
					if (mode == "Dakuten Hiragana" || mode == "Dakuten Katakana") {
						consotantMonoCol = new string[]{ "G", "Z", "D", "B", "P" };
					}
						
					i = 1;
					foreach (string e in consotantMonoCol) {
						i++;
						Label monoLabel = new Label {
							BackgroundColor = Color.FromHex ("639630"),
							Text = e,
							TextColor = Color.White,
							XAlign = TextAlignment.Center,
							YAlign = TextAlignment.Center
						};

						grid.Children.Add (monoLabel, 0, i);
					}

				} else {
					var fs2 = new FormattedString ();
					fs2.Spans.Add (new Span { Text = "Digraphs", ForegroundColor = Color.White });
					if (mode == "Basic Hiragana" || mode == "Basic Katakana")
						fs2.Spans.Add (new Span { Text = "\n(Yōon)", ForegroundColor = Color.White, FontAttributes = FontAttributes.Italic });
					grid.Children.Add (new Label {
						BackgroundColor = Color.FromHex ("2B3359"),
						FormattedText = fs2,
						TextColor = Color.White,
						XAlign = TextAlignment.Center,
						YAlign = TextAlignment.Center
					}, 1, 4, 0, 1);
					int i = 0;
					string[] vowelRow = { "", "YA", "YU", "YO" };
					foreach (string e in vowelRow) {
						if (e != "") {
							grid.Children.Add (new LetterLabel {
								BackgroundColor = Color.FromHex ("639630"),
								Text = e,
								TextColor = Color.White,
							}, i, 1);

						}
						i++;
					}
					string[] consotantDiaCol = { "", "K", "S", "T", "N", "H", "M", "", "R" };
					if (mode == "Dakuten Hiragana" || mode == "Dakuten Katakana") {
						consotantDiaCol = new string[] { "", "G", "Z", "D", "B", "P" };
					}
					i = 0;
					int j = 0;
					foreach (string e in consotantDiaCol) {
						i++;
						LetterLabel diaLabel;
						if (e != "") {
							diaLabel = new LetterLabel {
								BackgroundColor = Color.FromHex ("639630"),
								Text = e,
								TextColor = Color.White,
							};

							grid.Children.Add (diaLabel, 0, i);
							j++;
						}

					}
				}
			}
		}
Exemplo n.º 15
0
        public Contact(CareerInfo careerInfo)
        {
            InitializeComponent();
            _careerInfo = careerInfo;
            var ftTitle            = new FormattedString();
            var ftTitle2           = new FormattedString();
            var ftFullname         = new FormattedString();
            var ftAddress1         = new FormattedString();
            var ftAddress2         = new FormattedString();
            var ftEmailLabel       = new FormattedString();
            var ftEmailAddress     = new FormattedString();
            var ftHomePhoneLabel   = new FormattedString();
            var ftHomePhone        = new FormattedString();
            var ftMobilePhoneLabel = new FormattedString();
            var ftMobilePhone      = new FormattedString();
            var ftMobileSMS        = new FormattedString();

            ftTitle.Spans.Add(new Span {
                Text = $"Contact Info", ForegroundColor = Color.FromHex("ffffff"), FontSize = 12, FontAttributes = FontAttributes.Bold, TextDecorations = TextDecorations.Underline
            });
            lblTitle.FormattedText = ftTitle;

            ftTitle2.Spans.Add(new Span {
                Text = $"Mailing Address:", ForegroundColor = Color.FromHex("ffffff"), FontSize = 9, FontAttributes = FontAttributes.Bold
            });
            lblTitle2.FormattedText = ftTitle2;

            ftFullname.Spans.Add(new Span {
                Text = $"{_careerInfo.FirstName} {_careerInfo.MiddleName} {_careerInfo.LastName}", ForegroundColor = Color.FromHex("ffffff"), FontSize = 9, FontAttributes = FontAttributes.Bold
            });
            lblFullname.FormattedText = ftFullname;

            ftAddress1.Spans.Add(new Span {
                Text = $"{_careerInfo.Address1}", ForegroundColor = Color.FromHex("ffffff"), FontSize = 9, FontAttributes = FontAttributes.Bold
            });
            lblAddress1.FormattedText = ftAddress1;

            ftAddress2.Spans.Add(new Span {
                Text = $"{ _careerInfo.City}, {_careerInfo.State} {_careerInfo.PostalCode}", ForegroundColor = Color.FromHex("ffffff"), FontSize = 9, FontAttributes = FontAttributes.Bold
            });
            lblAddress2.FormattedText = ftAddress2;

            ftEmailLabel.Spans.Add(new Span {
                Text = $"Email Address: ", ForegroundColor = Color.FromHex("ffffff"), FontSize = 9, FontAttributes = FontAttributes.Bold
            });
            lblEmailLabel.FormattedText = ftEmailLabel;

            ftEmailAddress.Spans.Add(new Span {
                Text = $"{_careerInfo.EmailAddress}", ForegroundColor = Color.FromHex("9ad9ea"), FontSize = 9, FontAttributes = FontAttributes.Bold, TextDecorations = TextDecorations.Underline
            });
            lblEmailAddress.FormattedText = ftEmailAddress;

            var tapGestureRecognizer = new TapGestureRecognizer();

            tapGestureRecognizer.Tapped += (s, e) => {
                Device.OpenUri(new Uri($"mailto:{_careerInfo.EmailAddress}"));
            };
            lblEmailAddress.GestureRecognizers.Add(tapGestureRecognizer);

            ftHomePhoneLabel.Spans.Add(new Span {
                Text = $"Home: ", ForegroundColor = Color.FromHex("ffffff"), FontSize = 9, FontAttributes = FontAttributes.Bold
            });
            lblHomePhoneLabel.FormattedText = ftHomePhoneLabel;

            ftHomePhone.Spans.Add(new Span {
                Text = $"{_careerInfo.Phone}", ForegroundColor = Color.Yellow, FontSize = 9, FontAttributes = FontAttributes.Bold, TextDecorations = TextDecorations.Underline
            });
            lblHomePhone.FormattedText = ftHomePhone;

            var tapGestureRecognizerTel = new TapGestureRecognizer();

            tapGestureRecognizerTel.Tapped += (s, e) => {
                Device.OpenUri(new Uri($"tel:{_careerInfo.Phone}"));
            };
            lblHomePhone.GestureRecognizers.Add(tapGestureRecognizerTel);

            ftMobilePhoneLabel.Spans.Add(new Span {
                Text = $"Mobile: ", ForegroundColor = Color.FromHex("ffffff"), FontSize = 9, FontAttributes = FontAttributes.Bold
            });
            lblMobilePhoneLabel.FormattedText = ftMobilePhoneLabel;

            ftMobilePhone.Spans.Add(new Span {
                Text = $"{_careerInfo.Mobile}", ForegroundColor = Color.Yellow, FontSize = 9, FontAttributes = FontAttributes.Bold, TextDecorations = TextDecorations.Underline
            });
            lblMobilePhone.FormattedText = ftMobilePhone;

            var tapGestureRecognizerMob = new TapGestureRecognizer();

            tapGestureRecognizerMob.Tapped += (s, e) => {
                Device.OpenUri(new Uri($"tel:{_careerInfo.Mobile}"));
            };
            lblMobilePhone.GestureRecognizers.Add(tapGestureRecognizerMob);

            ftMobileSMS.Spans.Add(new Span {
                Text = $"(Send SMS/Text Msg)", ForegroundColor = Color.FromHex("9ad9ea"), FontSize = 8, FontAttributes = FontAttributes.Bold, TextDecorations = TextDecorations.Underline
            });
            lblMobileSMS.FormattedText = ftMobileSMS;

            var tapGestureRecognizerSMS = new TapGestureRecognizer();

            tapGestureRecognizerSMS.Tapped += (s, e) => {
                Device.OpenUri(new Uri($"sms:{_careerInfo.Mobile}"));
            };
            lblMobileSMS.GestureRecognizers.Add(tapGestureRecognizerSMS);
        }
Exemplo n.º 16
0
 public static void SetFormattedSubtitle(BindableObject view, FormattedString value) =>
 view.SetValue(FormattedSubtitleProperty, value);
		public FontPageCs ()
		{
			var label = new Label {
				Text = "Hello, Xamarin.Forms!",
				FontFamily = Device.OnPlatform (
					"SF Hollywood Hills",
					null,
					@"\Assets\Fonts\SF Hollywood Hills.ttf#SF Hollywood Hills"
				), // set for iOS & Windows Phone (Android done in custom renderer)
				VerticalOptions = LayoutOptions.CenterAndExpand,
				HorizontalOptions = LayoutOptions.CenterAndExpand,

			};
			label.FontSize = Device.OnPlatform (
				24, 
				Device.GetNamedSize (NamedSize.Medium, label), 
				Device.GetNamedSize (NamedSize.Large, label)
			);

			var myLabel = new MyLabel {
				VerticalOptions = LayoutOptions.CenterAndExpand,
				HorizontalOptions = LayoutOptions.CenterAndExpand,
			};
            myLabel.Text = Device.OnPlatform(
                "MyLabel for iOS!",
                "MyLabel for Android!",
                "MyLabel for Windows Phone!"
            );
			myLabel.FontSize = Device.OnPlatform (
				Device.GetNamedSize (NamedSize.Small, myLabel),
				Device.GetNamedSize (NamedSize.Medium, myLabel), // will get overridden in custom Renderer
				Device.GetNamedSize (NamedSize.Large, myLabel)
			);

			var labelBold = new Label {
				Text = "Bold",
				FontSize = 14, 
				FontAttributes = FontAttributes.Bold,
				VerticalOptions = LayoutOptions.CenterAndExpand,
				HorizontalOptions = LayoutOptions.CenterAndExpand,
			};
			var labelItalic = new Label {
				Text = "Italic",
				FontSize = 14, 
				FontAttributes = FontAttributes.Italic,
				VerticalOptions = LayoutOptions.CenterAndExpand,
				HorizontalOptions = LayoutOptions.CenterAndExpand,
			};
			var labelBoldItalic = new Label {
				Text = "BoldItalic",
				FontSize = 14, 
				FontAttributes = FontAttributes.Bold | FontAttributes.Italic,
				VerticalOptions = LayoutOptions.CenterAndExpand,
				HorizontalOptions = LayoutOptions.CenterAndExpand,
			};


			// Span formatting support
			var labelFormatted = new Label ();
			var fs = new FormattedString ();
			fs.Spans.Add (new Span { Text="Red, ", ForegroundColor = Color.Red, FontSize = 20, FontAttributes = FontAttributes.Italic });
			fs.Spans.Add (new Span { Text=" blue, ", ForegroundColor = Color.Blue, FontSize = 32 });
			fs.Spans.Add (new Span { Text=" and green!", ForegroundColor = Color.Green, FontSize = 12 });
			labelFormatted.FormattedText = fs;


			Content = new StackLayout { 
				VerticalOptions = LayoutOptions.CenterAndExpand,
				HorizontalOptions = LayoutOptions.CenterAndExpand,
				Children = {
					label, myLabel, labelBold, labelItalic, labelBoldItalic, labelFormatted
				}
			};
		}
Exemplo n.º 18
0
        public LinkedInLoginView() : base()
        {
            LeftBorder = AppProvider.Screen.ConvertPixelsToDp(20);

            var layout = new StackLayout {
                BackgroundColor = Color.Transparent
            };

            BoxView transpSpace = new BoxView();

            transpSpace.Color         = Color.Transparent;
            transpSpace.WidthRequest  = 1;
            transpSpace.HeightRequest = AppProvider.Screen.ConvertPixelsToDp(AppProvider.Screen.Height / 4);

            layout.Children.Add(transpSpace);

            Image LinkedinLogo = new Image()
            {
                Source            = ImageLoader.Instance.GetImage(AppResources.LinkedinLogo, false),
                HeightRequest     = AppProvider.Screen.ConvertPixelsToDp(94),
                HorizontalOptions = LayoutOptions.Center
            };

            if (Device.OS == TargetPlatform.iOS)
            {
                LinkedinLogo.HeightRequest = AppProvider.Screen.ConvertPixelsToDp(AppProvider.Screen.Height / 8);
                LinkedinLogo.WidthRequest  = AppProvider.Screen.ConvertPixelsToDp((AppProvider.Screen.Width * 3) / 4);
            }
            layout.Children.Add(LinkedinLogo);

            var fs = new FormattedString();

            string firstPart  = "Para concluir o seu cadastro, por favor entre com uma senha ";
            string secondPart = "para o aplicativo Conarh 2016. ";
            string thirdPart  = "As outras informações do seu cadastro já foram importadas do Linkedin.";


            fs.Spans.Add(new Span {
                Text = firstPart, ForegroundColor = Color.Black, FontSize = 16
            });
            fs.Spans.Add(new Span {
                Text = secondPart, ForegroundColor = Color.Black, FontSize = 16
            });
            fs.Spans.Add(new Span {
                Text = thirdPart, ForegroundColor = Color.Black, FontSize = 16
            });

            var labelTerms = new Label
            {
                FormattedText = fs,
            };


            layout.Children.Add(LinkedinLogo);
            layout.Children.Add(new ContentView {
                Content = labelTerms, Padding = new Thickness(10, 5, 10, 5)
            });



            layout.Children.Add(GetEntry(Keyboard.Url, AppResources.LoginPasswordDefaultEntry, AppResources.LoginPasswordImage, 10, true, 10, out _passwordEntry));

            var loginBtn = new Button
            {
                BorderRadius    = 5,
                WidthRequest    = AppProvider.Screen.ConvertPixelsToDp((AppProvider.Screen.Width / 4) * 3),
                HeightRequest   = AppProvider.Screen.ConvertPixelsToDp(AppProvider.Screen.Height / 14),
                TextColor       = Color.White,
                BackgroundColor = AppResources.MenuColor,
                Text            = AppResources.Login,
                FontSize        = 16
            };

            loginBtn.Clicked += OnLoginClicked;
            layout.Children.Add(new ContentView {
                Padding = new Thickness(LeftBorder, 10, LeftBorder, 0), HorizontalOptions = LayoutOptions.Center, Content = loginBtn
            });


            BGLayoutView bgLayout = new BGLayoutView(AppResources.LoginBgImage, layout, true, true);

            Content = new ScrollView {
                Content = bgLayout
            };
        }
Exemplo n.º 19
0
        public static void criarConteudo(StackLayout layout, List <string> listaDeConteudo)
        {
            FontAttributes atributoDaFonte = FontAttributes.None;
            double         tamanhoDaFonte  = Device.GetNamedSize(NamedSize.Medium, typeof(Label));

            foreach (string linha in listaDeConteudo)
            {
                if (linha.Equals("[botao]"))
                {
                    StyledButton button = new StyledButton
                    {
                        Text           = "Áudio Demonstrativo",
                        FontSize       = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                        Style          = (Style)Application.Current.Resources["buttonStyle1"],
                        FontAttributes = FontAttributes.Bold
                    };

                    button.Clicked += TocarAudio;
                    layout.Children.Add(button);
                }
                else if (linha.Contains("[link]"))
                {
                    string linhaLink = linha;
                    linhaLink = linhaLink.Replace("[link]", "");
                    linhaLink = linhaLink.Replace("[/link]", "");

                    var label = new Label()
                    {
                        Text           = linhaLink,
                        FontSize       = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                        FontAttributes = FontAttributes.Bold,
                        TextColor      = Color.FromHex("#2D12DB") //8E97E1
                    };

                    string enderecoSite = label.Text.Trim();

                    if (!(enderecoSite.Substring(0, 4).Equals("http")))
                    {
                        enderecoSite = enderecoSite.Insert(0, "http://");
                    }

                    var tapGestureRecognizer = new TapGestureRecognizer();
                    tapGestureRecognizer.Tapped += (s, e) => {
                        try
                        {
                            Device.OpenUri(new Uri(enderecoSite));
                        }
                        catch (Exception exc)
                        {
                            System.Diagnostics.Debug.WriteLine("ERRO: " + exc.Message);
                        }
                    };
                    label.GestureRecognizers.Add(tapGestureRecognizer);

                    layout.Children.Add(label);
                }
                else
                {
                    var label = new StyledLabel()
                    {
                        Style = (Style)Application.Current.Resources["labelStyle1"]
                    };
                    var s = new FormattedString();
                    if (linha.Contains("[b]") || linha.Contains("[i]") || linha.Contains("[small]") || linha.Contains("[large]"))
                    {
                        string linhaComAtributos = linha;
                        while (linhaComAtributos.Contains("[b]") || linhaComAtributos.Contains("[i]") || linhaComAtributos.Contains("[small]") || linhaComAtributos.Contains("[/b]") || linhaComAtributos.Contains("[/i]") || linhaComAtributos.Contains("[/small]") || linhaComAtributos.Contains("[large]") || linhaComAtributos.Contains("[/large]"))
                        {
                            string trecho = "";

                            int posicaoAtributoMaisProximo = linhaComAtributos.IndexOf('[');

                            if (posicaoAtributoMaisProximo != 0)
                            {
                                trecho            = linhaComAtributos.Substring(0, posicaoAtributoMaisProximo);
                                linhaComAtributos = linhaComAtributos.Substring(posicaoAtributoMaisProximo);
                            }
                            else
                            {
                                if (linhaComAtributos.Substring(0, 3).Equals("[b]"))
                                {
                                    atributoDaFonte   = FontAttributes.Bold;
                                    linhaComAtributos = linhaComAtributos.Substring(3);
                                }
                                else if (linhaComAtributos.Substring(0, 3).Equals("[i]"))
                                {
                                    atributoDaFonte   = FontAttributes.Italic;
                                    linhaComAtributos = linhaComAtributos.Substring(3);
                                }
                                else if (linhaComAtributos.Substring(0, 4).Equals("[/b]"))
                                {
                                    atributoDaFonte   = FontAttributes.None;
                                    linhaComAtributos = linhaComAtributos.Substring(4);
                                }
                                else if (linhaComAtributos.Substring(0, 4).Equals("[/i]"))
                                {
                                    atributoDaFonte   = FontAttributes.None;
                                    linhaComAtributos = linhaComAtributos.Substring(4);
                                }
                                else if (linhaComAtributos.Contains("[small]") || linhaComAtributos.Contains("[/small]"))
                                {
                                    if (linhaComAtributos.Substring(0, 7).Equals("[small]"))
                                    {
                                        tamanhoDaFonte    = Device.GetNamedSize(NamedSize.Small, typeof(Label));
                                        linhaComAtributos = linhaComAtributos.Substring(7);
                                    }
                                    if (linhaComAtributos.Substring(0, 8).Equals("[/small]"))
                                    {
                                        tamanhoDaFonte    = Device.GetNamedSize(NamedSize.Medium, typeof(Label));
                                        linhaComAtributos = linhaComAtributos.Substring(8);
                                    }
                                }
                                else if (linhaComAtributos.Contains("[large]") || linhaComAtributos.Contains("[/large]"))
                                {
                                    if (linhaComAtributos.Substring(0, 7).Equals("[large]"))
                                    {
                                        tamanhoDaFonte    = Device.GetNamedSize(NamedSize.Large, typeof(Label));
                                        linhaComAtributos = linhaComAtributos.Substring(7);
                                    }
                                    if (linhaComAtributos.Substring(0, 8).Equals("[/large]"))
                                    {
                                        tamanhoDaFonte    = Device.GetNamedSize(NamedSize.Medium, typeof(Label));
                                        linhaComAtributos = linhaComAtributos.Substring(8);
                                    }
                                }
                                else
                                {
                                    trecho            = "[";
                                    linhaComAtributos = linhaComAtributos.Substring(1);
                                }
                            }

                            s.Spans.Add(new Span {
                                Text = trecho + "", FontSize = tamanhoDaFonte, FontAttributes = atributoDaFonte
                            });
                        }
                        s.Spans.Add(new Span {
                            Text = linhaComAtributos, FontSize = tamanhoDaFonte, FontAttributes = atributoDaFonte
                        });
                    }
                    else
                    {
                        s.Spans.Add(new Span {
                            Text = linha, FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label))
                        });
                    }
                    label.FormattedText = s;
                    layout.Children.Add(label);
                }
            }
        }
 public EmployeeCardViewModel(Employee employee, FormattedString phoneFormattedString, FormattedString nameFormattedString)
 {
     Employee          = employee;
     FormattedPhone    = phoneFormattedString ?? Employee.Phone;
     FormattedFullName = nameFormattedString ?? Employee.FullName;
 }
Exemplo n.º 21
0
 public void WriteLine(FormattedString str)
 {
     Write(str);
     _entries.Add(new FormattedString());
 }
Exemplo n.º 22
0
        public App()
        {
            //Determine the width of Editor field
            int editorwith;
            if (ScreenWidth > ScreenHeight)
                editorwith = ScreenHeight;
            else editorwith = ScreenWidth;
            //

            //Procent of tip
            double tip = 17;
            double tipAmount = 0;
            double totalAmount = 0;
            //

            Editor editor = new Editor()
            {
                BackgroundColor = Color.FromHex("CEC8C8"),
                WidthRequest = editorwith / 2 * 0.8,
                HeightRequest = 40,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.Start,
                //   TranslationY = 75,
                Keyboard = Keyboard.Numeric
            };

            Button btn = new Button()
            {
                BackgroundColor = Color.Gray,
                WidthRequest = 200,
                Text = "Calculate Tip",
                HeightRequest = 50,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.Start,
                //  TranslationY = 150,
                BorderColor = Color.Black,
                FontSize = 25
            };

            editor.Focused += (sender, e) =>
            {
                (sender as Editor).BackgroundColor = Color.FromHex("CBCBD3");
            };
            editor.Unfocused += (sender, e) =>
            {
                (sender as Editor).BackgroundColor = Color.FromHex("CEC8C8");
            };

            Label labelTipPercentage = new Label()
            {
                Text = "Tip percentage\t" + tip + "%",
                //TranslationY = 200,
                HorizontalOptions = LayoutOptions.Center,
                TextColor = Color.Black,
                FontSize = 25
            };

            Label labelTipAmount = new Label()
            {
                Text = "Tip Amount\t$" + tipAmount,
                //   TranslationY = 250,
                HorizontalOptions = LayoutOptions.Center,
                TextColor = Color.Black,
                FontSize = 25
            };

            Label lableTotalAmount = new Label()
            {
                Text = "Total amount\t$" + totalAmount,
                TextColor = Color.Green,
                //TranslationY = 300,
                HorizontalOptions = LayoutOptions.Center,
                FontSize = 27
            };

            btn.Clicked += (sender, e) =>
             {
                 if (editor.Text != "")
                 {
                     tipAmount = Convert.ToDouble(editor.Text) / 100 * tip;
                     totalAmount = Convert.ToDouble(editor.Text) + tipAmount;
                     labelTipAmount.Text = "Tip Amount\t$" + tipAmount.ToString();
                     lableTotalAmount.Text = "Total amount\t$" + totalAmount.ToString();

                 }
             };

            var editorfont = new FormattedString();
            editorfont.Spans.Add(new Span { ForegroundColor = Color.Black, FontSize = 25, FontAttributes = FontAttributes.Bold });

            // The root page of your application
            MainPage = new ContentPage
            {
                Content = new StackLayout
                {
                    BackgroundColor = Color.White,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions = LayoutOptions.FillAndExpand,
                    Padding = 10,
                    Children = {
                        editor, btn,
                        labelTipPercentage,
                        labelTipAmount,
                        lableTotalAmount
                    }
                }

            };
        }
Exemplo n.º 23
0
 void SetupFormattedText(UILabel label, FormattedString formattedString, string defaulTitle)
 {
     label.AttributedText = formattedString.ToAttributed(Font.Default, Xamarin.Forms.Color.Default);
     label.SetNeedsDisplay();
 }
Exemplo n.º 24
0
        public FontPageCs()
        {
            var label = new Label
            {
                Text              = "Hello, Xamarin.Forms!",
                FontFamily        = "Lobster-Regular",
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand
            };

            label.FontSize = Device.RuntimePlatform == Device.iOS ? 24 :
                             Device.RuntimePlatform == Device.Android ? Device.GetNamedSize(NamedSize.Medium, label) : Device.GetNamedSize(NamedSize.Large, label);

            var labelBold = new Label
            {
                Text              = "Bold",
                FontSize          = 14,
                FontAttributes    = FontAttributes.Bold,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
            };
            var labelItalic = new Label
            {
                Text              = "Italic",
                FontSize          = 14,
                FontAttributes    = FontAttributes.Italic,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
            };
            var labelBoldItalic = new Label
            {
                Text              = "BoldItalic",
                FontSize          = 14,
                FontAttributes    = FontAttributes.Bold | FontAttributes.Italic,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
            };

            // Span formatting support
            var labelFormatted = new Label();
            var fs             = new FormattedString();

            fs.Spans.Add(new Span {
                Text = "Red, ", ForegroundColor = Color.Red, FontSize = 20, FontAttributes = FontAttributes.Italic
            });
            fs.Spans.Add(new Span {
                Text = " blue, ", ForegroundColor = Color.Blue, FontSize = 32
            });
            fs.Spans.Add(new Span {
                Text = " and green!", ForegroundColor = Color.Green, FontSize = 12
            });
            labelFormatted.FormattedText = fs;

            Content = new StackLayout
            {
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Children          =
                {
                    label, labelBold, labelItalic, labelBoldItalic, labelFormatted
                }
            };
        }
Exemplo n.º 25
0
		public UnvoicedHira (string romajiMode)
		{
			drillCount = 0;
			rowCount = 0;
			NavigationPage.SetBackButtonTitle (this, "Table");
			//kana variables
			this.romajiM=romajiMode;
			double fontSize=new LetterLabel().FontSize;
			if (romajiMode == "Hide Romaji") {
				nullMonoRow = uvRowData [0];
				kRow = uvRowData [1];
				sRow = uvRowData [2];
				tRow = uvRowData [3];
				nRow = uvRowData [4];
				hRow = uvRowData [5];
				mRow = uvRowData [6];
				yRow = uvRowData [7];
				rRow = uvRowData [8];
				wRow = uvRowData [9];
			} else {
				if (Device.Idiom == TargetIdiom.Tablet)
					fontSize = fontSize * 2;
			}

			//Study Button
			ToolbarItem itemStudy = new ToolbarItem {
				Text = "Study",
				Order = ToolbarItemOrder.Primary,
				Command = new Command (() => showStudyPage("Basic Hiragana"))
			};
			ToolbarItems.Add(itemStudy);
			ToolbarItem itemCollapse;
			if (romajiMode == "Hide Romaji") {
				itemCollapse = new ToolbarItem {
					
					Icon = "collapse.png",
					Order = ToolbarItemOrder.Primary,
					Command = new Command (() => switchMode(romajiMode))
				};
				ToolbarItems.Add(itemCollapse);
			}
			else if (romajiMode == "Show Romaji") {
				itemCollapse = new ToolbarItem {
					
					Icon = "uncollapse.png",
					Order = ToolbarItemOrder.Primary,
					Command = new Command (() => switchMode(romajiMode)),

				};
				ToolbarItems.Add(itemCollapse);

			}

			if (romajiMode == "Show Romaji") {
				grid = new Grid {
					VerticalOptions = LayoutOptions.Fill,
					RowDefinitions = {
						new RowDefinition { Height = GridLength.Auto },
						new RowDefinition { Height = GridLength.Auto },
						new RowDefinition { Height = GridLength.Auto  },
						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 (2, GridUnitType.Star) },
						new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) },
						new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) },
						new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) },
						new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) },
						new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) },
						new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) },
						new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) },
						new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) },
						new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) },

					}
				};
			} else {
				if (Device.Idiom == TargetIdiom.Tablet) {
					grid = new Grid {
						VerticalOptions = LayoutOptions.Fill,
						RowDefinitions = {
							new RowDefinition { Height = GridLength.Auto },
							new RowDefinition { Height = GridLength.Auto },
							new RowDefinition { Height = GridLength.Auto  },
							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 (2, GridUnitType.Star) },
							new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) },
							new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) },
							new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) },
							new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) },
							new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) },
							new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) },
							new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) },
							new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) },
							new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) },

						}
					};
				} else {
					grid = new Grid {
						VerticalOptions = LayoutOptions.Fill,
						RowDefinitions = {
							new RowDefinition { Height = GridLength.Auto },
							new RowDefinition { Height = GridLength.Auto },
							new RowDefinition { Height = GridLength.Auto },
							new RowDefinition { Height = GridLength.Auto },
							new RowDefinition { Height = GridLength.Auto },
							new RowDefinition { Height = GridLength.Auto },
							new RowDefinition { Height = GridLength.Auto },
							new RowDefinition { Height = GridLength.Auto },
							new RowDefinition { Height = GridLength.Auto },
							new RowDefinition { Height = GridLength.Auto },
							new RowDefinition { Height = GridLength.Auto },
							new RowDefinition { Height = GridLength.Auto },
							new RowDefinition { Height = GridLength.Auto },
							new RowDefinition { Height = GridLength.Auto },
						},
						ColumnDefinitions = {
							new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) },
							new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) },
							new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) },
							new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) },
							new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) },
							new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) },
							new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) },
							new ColumnDefinition { Width = new GridLength (4, GridUnitType.Star) },
							new ColumnDefinition { Width = new GridLength (4, GridUnitType.Star) },
							new ColumnDefinition { Width = new GridLength (4, GridUnitType.Star) },
						}
					};
				}
			}

			// Tap recognizers for letters
			var letterTapRecognizer = new TapGestureRecognizer();
			//Display study page for each kana
			letterTapRecognizer.Tapped += (s, e) => {
				
				string kana=((Label)s).Text;
				if(kana==null)
					kana=((Label)s).FormattedText.ToString();
				Navigation.PushAsync (new Study (Character.cData[Character.kana_lookup(kana.Split('\n')[0])],this,0,1){ });
			};

			var monoColTapRecognizer = new TapGestureRecognizer();
			monoColTapRecognizer.Tapped += (s, e) => {
				StudyCarousel studyPage = new StudyCarousel (((Label)s).Text+" Row");
				rowCount=rowList[((Label)s).Text];
				drillCount=rowCount*4;

				addDrill();
				addRow (studyPage);
				studyPage.Children.Add(drillList[0]);
				drillList.RemoveAt(0);
				Navigation.PushAsync (studyPage);
			};
			var diaColTapRecognizer = new TapGestureRecognizer();
			diaColTapRecognizer.Tapped += (s, e) => {
				StudyCarousel studyPage = new StudyCarousel (((Label)s).Text+" Row");
				rowCount=rowList[((Label)s).Text+"2"];
				drillCount=rowCount*4;
				addDrill();
				addRow (studyPage);

				studyPage.Children.Add(drillList[0]);
				drillList.RemoveAt(0);
				Navigation.PushAsync (studyPage);
			};
	
			grid.ColumnSpacing = 1;
			grid.RowSpacing = 1;

			var fs = new FormattedString ();
			fs.Spans.Add (new Span { Text="Monographs\n", ForegroundColor = Color.White });
			fs.Spans.Add (new Span { Text="(Gojūon)", ForegroundColor = Color.White, FontAttributes = FontAttributes.Italic });
			Label headerLabel = new Label () {
				Text = "\u2022Tap \"Study\" to begin\n\u2022Tap consonants to select specific rows to study\n\u2022Tap kana to study specific characters\n\u2022Gray font indicates obsolete or seldom used kana\n",
				TextColor = Color.Gray,
				XAlign = TextAlignment.Start,
				FontSize=12,
			};
			grid.Children.Add (headerLabel, 0, 10, 0, 1);

			grid.Children.Add(new Label {
				BackgroundColor = Color.FromHex("2B3359"),
				FormattedText = fs,
				TextColor=Color.White,
				XAlign = TextAlignment.Center,
				YAlign = TextAlignment.Center
				}, 1,6,1,2);

			var fs2 = new FormattedString ();
			fs2.Spans.Add (new Span { Text="Digraphs\n", ForegroundColor = Color.White });
			fs2.Spans.Add (new Span { Text="(Yōon)", ForegroundColor = Color.White, FontAttributes = FontAttributes.Italic });
			grid.Children.Add(new Label {
				BackgroundColor = Color.FromHex("2B3359"),
				FormattedText = fs2,
				TextColor=Color.White,
				XAlign = TextAlignment.Center,
				YAlign = TextAlignment.Center
				}, 7,10,1,2);
			int i = 0;

			string[] vowelRow = {"","A", "I", "U", "E", "O","","YA","YU","YO"} ;
			foreach (string e in vowelRow) {
				if (e != "") {
					grid.Children.Add (new LetterLabel {
						BackgroundColor = Color.FromHex ("639630"),
						Text = e,
						TextColor = Color.White,
					}, i, 2);

				}
				i++;
			}
			string[] consotantMonoCol = {"∅", "K", "S", "T", "N","H","M","Y","R","W"} ;
			i = 2;
			foreach (string e in consotantMonoCol) {
				i++;
				Label monoLabel = new Label {
					BackgroundColor = Color.FromHex ("639630"),
					Text = e,
					TextColor = Color.White,
					XAlign = TextAlignment.Center,
					YAlign = TextAlignment.Center
				};
				monoLabel.GestureRecognizers.Add (monoColTapRecognizer);
				grid.Children.Add (monoLabel, 0, i);
				rowList.Add (e, i - 3);
				
			}
			string[] consotantDiaCol = {"", "K", "S", "T", "N","H","M","","R",""} ;
			i = 2;
			int j = 0;
			foreach (string e in consotantDiaCol) {
				i++;
				LetterLabel diaLabel;
				if (e != "") {
					diaLabel = new LetterLabel {
						BackgroundColor = Color.FromHex ("639630"),
						Text = e,
						TextColor = Color.White,
					};
					diaLabel.GestureRecognizers.Add (diaColTapRecognizer);
					grid.Children.Add (diaLabel, 6, i);
					rowList.Add (e+"2", j+11);
					j++;
				}

			}

			i = 0;
			foreach(string e in nullMonoRow)
			{
				i++;
				LetterLabel letter= new LetterLabel {
					Text = e,
					FontSize=fontSize
				};
				if (e != "") {
					letter.GestureRecognizers.Add (letterTapRecognizer);
					grid.Children.Add (letter, i, 3);
				}
			}
			for(i=7;i<10;i++)
			{
				grid.Children.Add(new BoxView {
					Color=Color.FromHex("BFBFBF")
				}, i,3);
			}

			//K row

			i = 0;

			foreach(string e in kRow)
			{
				i++;
				if (e != "") {
					LetterLabel letter= new LetterLabel {
						Text = e,
						FontSize=fontSize
					};
					letter.GestureRecognizers.Add (letterTapRecognizer);
					grid.Children.Add (letter, i, 4);
				}
			}
			//S row

			i = 0;
			foreach(string e in sRow)
			{
				i++;
				if (e != "") {
					LetterLabel letter= new LetterLabel {
						Text = e,
						FontSize=fontSize
					};
					letter.GestureRecognizers.Add (letterTapRecognizer);
					grid.Children.Add (letter, i, 5);
				}
			}

			//T row

			i = 0;
			foreach(string e in tRow)
			{
				i++;
				if (e != "") {
					LetterLabel letter= new LetterLabel {
						Text = e,
						FontSize=fontSize
					};
					letter.GestureRecognizers.Add (letterTapRecognizer);
					grid.Children.Add (letter, i, 6);
				}
			}
			//N row

			i = 0;
			foreach(string e in nRow)
			{
				i++;
				if (e != "") {
					LetterLabel letter= new LetterLabel {
						Text = e,
						FontSize=fontSize
					};
					letter.GestureRecognizers.Add (letterTapRecognizer);
					grid.Children.Add (letter, i, 7);
				}
			}
			//H row

			i = 0;
			foreach(string e in hRow)
			{
				i++;
				if (e != "") {
					LetterLabel letter= new LetterLabel {
						Text = e,
						FontSize=fontSize
					};
					letter.GestureRecognizers.Add (letterTapRecognizer);
					grid.Children.Add (letter, i, 8);
				}
			}
			//M row

			i = 0;
			foreach(string e in mRow)
			{
				i++;
				if (e != "") {
					
					LetterLabel letter= new LetterLabel {
						Text = e,
						FontSize=fontSize
					};
					letter.GestureRecognizers.Add (letterTapRecognizer);
					if (i == 8) {
						letter.TextColor = Color.Gray;
						letter.IsEnabled = false;
						letter.GestureRecognizers.Remove (letterTapRecognizer);
					}

					grid.Children.Add (letter, i, 9);
				}
			}
			//Y row

			i = 0;
			foreach(string e in yRow)
			{
				i++;
				if (e != "" && e!="b") {
					LetterLabel letter= new LetterLabel {
						Text = e,
						FontSize=fontSize
					};
					letter.GestureRecognizers.Add (letterTapRecognizer);
					grid.Children.Add (letter, i, 10);
				}
				if (e == "b") {
					grid.Children.Add (new BoxView {
						Color = Color.FromHex("BFBFBF")
					}, i, 10);
				}
			}

			//R row

			i = 0;
			foreach(string e in rRow)
			{
				i++;
				if (e != "") {
					LetterLabel letter= new LetterLabel {
						Text = e,
						FontSize=fontSize
					};

					letter.GestureRecognizers.Add (letterTapRecognizer);
					grid.Children.Add (letter, i, 11);
				}
			}

			//W row

			i = 0;
			foreach(string e in wRow)
			{
				i++;
				if (e != "" && e!="b") {
					LetterLabel letter= new LetterLabel {
						
					};
					if(i==5)
					{
						char[] splitters = new char[]{ '/', '\n'};
						string [] strArray=e.Split (splitters);
						FormattedString fs3=new FormattedString();
						fs3.Spans.Add (new Span { Text = strArray [0],FontSize=fontSize});
						if(strArray.Length>1)
							fs3.Spans.Add (new Span { Text ="\n"+strArray [1], FontSize = fontSize-4 });
						letter.FormattedText=fs3;
					}
					else
					{
						letter.Text=e;
						letter.FontSize = fontSize;
					}
					letter.GestureRecognizers.Add (letterTapRecognizer);
					if (i == 2 || i == 4) {
						letter.TextColor = Color.Gray;
						letter.IsEnabled = false;
						letter.GestureRecognizers.Remove (letterTapRecognizer);
					}
					grid.Children.Add (letter, i, 12);
				}
				if (e == "b") {
					grid.Children.Add (new BoxView {
						Color = Color.FromHex("BFBFBF")
					}, i, 12);
				}
			}

			string nText="ん\nn";
			if (romajiMode == "Show Romaji")
				nText = "ん";
			LetterLabel nletter=new LetterLabel (){Text=nText,HorizontalOptions=LayoutOptions.FillAndExpand,FontSize=fontSize};
			nletter.GestureRecognizers.Add (letterTapRecognizer);
			grid.Children.Add (nletter, 0, 1, 13, 14);
			//Accomodate iPhone status bar.
			//this.Padding = new Thickness(5, Device.OnPlatform(0, 0, 0), 5, 0);

			//Build the page.
			//grid.BackgroundColor=Device.OnPlatform(Color.Black,Color.White,Color.White);
			this.Content = new ScrollView{Content=grid};
			this.Title = "Basic Hiragana";

		}
Exemplo n.º 26
0
        internal static SpannableString ToSpannableStringNewWay(
            this FormattedString formattedString,
            IFontManager fontManager,
            Context?context = null,
            double defaultCharacterSpacing           = 0d,
            TextAlignment defaultHorizontalAlignment = TextAlignment.Start,
            Font?defaultFont                       = null,
            Graphics.Color?defaultColor            = null,
            TextTransform defaultTextTransform     = TextTransform.Default,
            TextDecorations defaultTextDecorations = TextDecorations.None)
        {
            if (formattedString == null)
            {
                return(new SpannableString(string.Empty));
            }

            var defaultFontSize = defaultFont?.Size ?? fontManager.DefaultFontSize;

            var builder = new StringBuilder();

            for (int i = 0; i < formattedString.Spans.Count; i++)
            {
                Span span = formattedString.Spans[i];

                var transform = span.TextTransform != TextTransform.Default ? span.TextTransform : defaultTextTransform;

                var text = TextTransformUtilites.GetTransformedText(span.Text, transform);
                if (text == null)
                {
                    continue;
                }

                builder.Append(text);
            }

            var spannable = new SpannableString(builder.ToString());

            var c = 0;

            for (int i = 0; i < formattedString.Spans.Count; i++)
            {
                Span span = formattedString.Spans[i];
                var  text = span.Text;
                if (text == null)
                {
                    continue;
                }

                int start = c;
                int end   = start + text.Length;
                c = end;

                // TextColor
                var textColor = span.TextColor ?? defaultColor;
                if (textColor is not null)
                {
                    spannable.SetSpan(new ForegroundColorSpan(textColor.ToPlatform()), start, end, SpanTypes.InclusiveExclusive);
                }

                // BackgroundColor
                if (span.BackgroundColor is not null)
                {
                    spannable.SetSpan(new BackgroundColorSpan(span.BackgroundColor.ToPlatform()), start, end, SpanTypes.InclusiveExclusive);
                }

                // LineHeight
                if (span.LineHeight >= 0)
                {
                    spannable.SetSpan(new LineHeightSpan(span.LineHeight), start, end, SpanTypes.InclusiveExclusive);
                }

                // CharacterSpacing
                var characterSpacing = span.CharacterSpacing >= 0
                                        ? span.CharacterSpacing
                                        : defaultCharacterSpacing;
                if (characterSpacing >= 0)
                {
                    spannable.SetSpan(new LetterSpacingSpan(characterSpacing.ToEm()), start, end, SpanTypes.InclusiveInclusive);
                }

                // Font
                var font = span.ToFont(defaultFontSize);
                if (font.IsDefault && defaultFont.HasValue)
                {
                    font = defaultFont.Value;
                }
                if (!font.IsDefault)
                {
                    spannable.SetSpan(new FontSpan(font, fontManager, context), start, end, SpanTypes.InclusiveInclusive);
                }

                // TextDecorations
                var textDecorations = span.IsSet(Span.TextDecorationsProperty)
                                        ? span.TextDecorations
                                        : defaultTextDecorations;
                if (textDecorations.HasFlag(TextDecorations.Strikethrough))
                {
                    spannable.SetSpan(new StrikethroughSpan(), start, end, SpanTypes.InclusiveInclusive);
                }
                if (textDecorations.HasFlag(TextDecorations.Underline))
                {
                    spannable.SetSpan(new UnderlineSpan(), start, end, SpanTypes.InclusiveInclusive);
                }
            }

            return(spannable);
        }
Exemplo n.º 27
0
        public Preguntas(MasterDetailPage masterDetail, Usuario tusuario)
        {
            master = masterDetail;

            var guardaritem = new ToolbarItem {
                Text = "Continuar"
            };
            guardaritem.Clicked += (object sender, System.EventArgs e) =>
            {
                continuar();
            };

            //ToolbarItems.Add(new ToolbarItem(){Icon="pazosicon.png"});
            ToolbarItems.Add(guardaritem);
            this.Title = "¿Qué vas a hacer con tus ahorros?";

            tusuario = usuario;

            var imgBackground = new Image () {
                Source = ImageSource.FromResource ("PaZos.Resources.FondoLogin.png"),
                Aspect = Aspect.AspectFill
            };

            RelativeLayout layoutcontent = new RelativeLayout ();

            layoutcontent.Children.Add (imgBackground,
                Constraint.Constant (0),
                Constraint.Constant (0),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Height;
                }));

            int y=30;
            int altura = 60;

            BoxView boxViewnegro = new BoxView {

                Color = Color.Black

            };

            layoutcontent.Children.Add (boxViewnegro,
                Constraint.Constant (19),
                Constraint.Constant (y-11),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width-38;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return altura*5+22;
                }));
            BoxView boxView = new BoxView {

                Color = Color.White

            };

            layoutcontent.Children.Add (boxView,
                Constraint.Constant (20),
                Constraint.Constant (y-10),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width-40;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return altura*5+20;
                }));

            Label A1 = new Label () {
                Text = "1.",
                TextColor = Color.Red,
                FontFamily = "MyriadPro-Bold",
                FontSize=26
            };
            layoutcontent.Children.Add (A1,
                Constraint.Constant (30),
                Constraint.Constant (y),
                Constraint.RelativeToParent ((Parent) => {
                    return 30;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 30;
                }));
            Label B1 = new Label () {
                HorizontalOptions = LayoutOptions.StartAndExpand
            };
            var B1fs = new FormattedString ();
            Span B1sp = new Span () {
                Text = "¿Tienes una cuenta de ahorros?",
                FontFamily = "MyriadPro-Regular",
                FontSize=18
            };
            B1fs.Spans.Add (B1sp);
            B1.FormattedText = B1fs;

            layoutcontent.Children.Add (B1,
                Constraint.Constant (60),
                Constraint.Constant (y),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width-60-30-60;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return altura;
                }));
            C1 = new Switch () {

            };
            layoutcontent.Children.Add (C1,
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width-60-30;
                }),
                Constraint.Constant (y),
                Constraint.RelativeToParent ((Parent) => {
                    return 30;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 30;
                }));

            y = y + 60;

            Label A2 = new Label () {
                Text = "2.",
                TextColor = Color.Red,
                FontFamily = "MyriadPro-Bold",
                FontSize=26
            };
            layoutcontent.Children.Add (A2,
                Constraint.Constant (30),
                Constraint.Constant (y),
                Constraint.RelativeToParent ((Parent) => {
                    return 30;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 30;
                }));
            Label B2 = new Label () {
                HorizontalOptions = LayoutOptions.StartAndExpand
            };
            var B2fs = new FormattedString ();
            Span B2sp = new Span () {
                Text = "¿Sabés que es un CDT?",
                FontFamily = "MyriadPro-Regular",
                FontSize=18
            };
            B2fs.Spans.Add (B2sp);
            B2.FormattedText = B2fs;

            layoutcontent.Children.Add (B2,
                Constraint.Constant (60),
                Constraint.Constant (y),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width-60-30-60;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return altura;
                }));
            C2 = new Switch () {

            };
            layoutcontent.Children.Add (C2,
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width-60-30;
                }),
                Constraint.Constant (y),
                Constraint.RelativeToParent ((Parent) => {
                    return 30;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 30;
                }));

            y = y + 60;

            Label A3 = new Label () {
                Text = "3.",
                TextColor = Color.Red,
                FontFamily = "MyriadPro-Bold",
                FontSize=26
            };
            layoutcontent.Children.Add (A3,
                Constraint.Constant (30),
                Constraint.Constant (y),
                Constraint.RelativeToParent ((Parent) => {
                    return 30;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 30;
                }));
            Label B3 = new Label () {
                HorizontalOptions = LayoutOptions.StartAndExpand
            };
            var B3fs = new FormattedString ();
            Span B3sp = new Span () {
                Text = "¿Estás ahorrando las utilidades de tu negocio en un banco?",
                FontFamily = "MyriadPro-Regular",
                FontSize=18
            };
            B3fs.Spans.Add (B3sp);
            B3.FormattedText = B3fs;

            layoutcontent.Children.Add (B3,
                Constraint.Constant (60),
                Constraint.Constant (y),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width-60-30-60;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return altura;
                }));
            C3 = new Switch () {

            };
            layoutcontent.Children.Add (C3,
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width-60-30;
                }),
                Constraint.Constant (y),
                Constraint.RelativeToParent ((Parent) => {
                    return 30;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 30;
                }));

            y = y + 60;

            Label A4 = new Label () {
                Text = "4.",
                TextColor = Color.Red,
                FontFamily = "MyriadPro-Bold",
                FontSize=26
            };
            layoutcontent.Children.Add (A4,
                Constraint.Constant (30),
                Constraint.Constant (y),
                Constraint.RelativeToParent ((Parent) => {
                    return 30;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 30;
                }));
            Label B4 = new Label () {
                HorizontalOptions = LayoutOptions.StartAndExpand
            };
            var B4fs = new FormattedString ();
            Span B4sp = new Span () {
                Text = "¿Irías a un banco para pedir información sobre cómo ahorrar?",
                FontFamily = "MyriadPro-Regular",
                FontSize=18
            };
            B4fs.Spans.Add (B4sp);
            B4.FormattedText = B4fs;

            layoutcontent.Children.Add (B4,
                Constraint.Constant (60),
                Constraint.Constant (y),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width-60-30-60;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return altura;
                }));
            C4 = new Switch () {

            };
            layoutcontent.Children.Add (C4,
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width-60-30;
                }),
                Constraint.Constant (y),
                Constraint.RelativeToParent ((Parent) => {
                    return 30;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 30;
                }));

            y = y + 60;

            Label A5 = new Label () {
                Text = "5.",
                TextColor = Color.Red,
                FontFamily = "MyriadPro-Bold",
                FontSize=26
            };
            layoutcontent.Children.Add (A5,
                Constraint.Constant (30),
                Constraint.Constant (y),
                Constraint.RelativeToParent ((Parent) => {
                    return 30;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 30;
                }));
            Label B5 = new Label () {
                HorizontalOptions = LayoutOptions.StartAndExpand
            };
            var B5fs = new FormattedString ();
            Span B5sp = new Span () {
                Text = "¿Conoces los servicios virtuales de tu banco?",
                FontFamily = "MyriadPro-Regular",
                FontSize=18
            };
            B5fs.Spans.Add (B5sp);
            B5.FormattedText = B5fs;

            layoutcontent.Children.Add (B5,
                Constraint.Constant (60),
                Constraint.Constant (y),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width-60-30-60;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return altura;
                }));
            C5 = new Switch () {

            };
            layoutcontent.Children.Add (C5,
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width-60-30;
                }),
                Constraint.Constant (y),
                Constraint.RelativeToParent ((Parent) => {
                    return 30;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 30;
                }));

                        // Build the page.
            Content = layoutcontent;
        }
Exemplo n.º 28
0
        //Update the total item count
        private async Task UpdateTotalItemsCount(List <TableFeeds> LoadTableFeeds, List <TableItems> LoadTableItems, bool Silent, bool EnableUI)
        {
            try
            {
                //Set the total item count
                AppVariables.CurrentTotalItemsCount = await ProcessItemLoad.DatabaseToCount(LoadTableFeeds, LoadTableItems, Silent, EnableUI);

                if (AppVariables.CurrentTotalItemsCount > 0)
                {
                    txt_AppInfo.Text             = ApiMessageError + AppVariables.CurrentTotalItemsCount + " items";
                    txt_NewsScrollInfo.IsVisible = false;

                    button_StatusCurrentItem.IsVisible = true;
                }
                else
                {
                    txt_AppInfo.Text = "No results";

                    Span text1 = new Span {
                        Text = "No search results could be found for "
                    };
                    Span text2 = new Span {
                        Text = vSearchTerm
                    };
                    text2.SetDynamicResource(Span.TextColorProperty, "ApplicationAccentLightColor");
                    Span text3 = new Span {
                        Text = " in "
                    };
                    Span text4 = new Span {
                        Text = vSearchFeedTitle
                    };
                    text4.SetDynamicResource(Span.TextColorProperty, "ApplicationAccentLightColor");

                    FormattedString formattedString = new FormattedString();
                    formattedString.Spans.Add(text1);
                    formattedString.Spans.Add(text2);
                    formattedString.Spans.Add(text3);
                    formattedString.Spans.Add(text4);
                    txt_NewsScrollInfo.FormattedText = formattedString;
                    txt_NewsScrollInfo.IsVisible     = true;

                    button_StatusCurrentItem.IsVisible = false;

                    //Focus on the text box to open keyboard
                    txtbox_Search.IsEnabled = false;
                    txtbox_Search.IsEnabled = true;
                    txtbox_Search.Focus();
                }

                //Update the current item count
                if (stackpanel_Header.IsVisible || AppVariables.CurrentTotalItemsCount == 0)
                {
                    label_StatusCurrentItem.Text = AppVariables.CurrentViewItemsCount.ToString();
                }
                else
                {
                    label_StatusCurrentItem.Text = AppVariables.CurrentViewItemsCount + "/" + AppVariables.CurrentTotalItemsCount;
                }
            }
            catch { }
        }
Exemplo n.º 29
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     List<string> val = value as List<string>;
     FormattedString fs = new FormattedString();
     fs.Spans.Add(new Span { Text = val[0] });//, FontFamily = new FontFamily(AppSettings.strOtherSelectedFont), FontSize = AppSettings.dOtherFontSize });
     if (val.Count > 1)
     {
         fs.Spans.Add(new Span { Text = "(" + val[1] + ")", FontAttributes = FontAttributes.Bold });//, FlowDirection = FlowDirection.RightToLeft, FontFamily = new FontFamily(AppSettings.strSelectedFont), FontSize = AppSettings.dFontSize });
         fs.Spans.Add(new Span { Text = val[2] });//, FontFamily = new FontFamily(AppSettings.strOtherSelectedFont), FontSize = AppSettings.dOtherFontSize });
     }
     return fs;
 }
Exemplo n.º 30
0
        public LoginPage(ViewModelBase viewModel)
            : base(viewModel)
        {
            BackgroundColor = Styling.BackgroundYellow;
            var fs = new FormattedString () {
                Spans = {
                    new Span{ Text = "Shared", FontSize = 32, FontAttributes = FontAttributes.None },
                    new Span{ Text = "Squawk", FontSize = 32, FontAttributes = FontAttributes.Bold },
                }
            };

            var header = new SquawkLabel
            {
                FormattedText = fs,
                HorizontalOptions = LayoutOptions.Center,
                TextColor = Styling.BlackText
            };

            var loginButton = new Button();
            loginButton.Text = "Login";
            loginButton.SetBinding(IsEnabledProperty, new Binding("IsBusy", converter: new InverterConverter()));
            loginButton.SetBinding(Button.CommandProperty, new Binding("LoginCommand"));
            loginButton.FontSize = 24;

            var registerButton = new Button();
            registerButton.FontAttributes = FontAttributes.Italic;
            registerButton.Text = "Don't have an account?";
            registerButton.SetBinding(Button.CommandProperty, new Binding("RegisterCommand"));
            registerButton.FontSize = 12;

            var nameEntry = new SquawkEntry
            {
                Keyboard = Keyboard.Text,
                Placeholder = "Username",
            };
            nameEntry.SetBinding(Entry.TextProperty, new Binding("Name", BindingMode.TwoWay));

            var passwordEntry = new SquawkEntry
            {
                Keyboard = Keyboard.Text,
                IsPassword = true,
                Placeholder = "Password",
            };
            passwordEntry.SetBinding(Entry.TextProperty, new Binding("Password", BindingMode.TwoWay));

            // Accomodate iPhone status bar.
            Padding = new Thickness(10, Device.OnPlatform(iOS: 20, Android: 0, WinPhone: 0), 10, 100);

            var loadingIndicator = new ActivityIndicator ();
            loadingIndicator.SetBinding(ActivityIndicator.IsRunningProperty, new Binding("IsBusy"));
            loadingIndicator.SetBinding(ActivityIndicator.IsVisibleProperty, new Binding("IsBusy"));

            Content = new StackLayout
            {
                Children =
                {
                    header,
                    new StackLayout
                    {
                        Children =
                        {
                            nameEntry,
                            passwordEntry
                        }
                    },
                    loadingIndicator,
                    loginButton,
                    registerButton
                },
                VerticalOptions = LayoutOptions.Center,
                Spacing = 30,
                Padding = new Thickness(25, 80, 25, 0)
            };
        }
 /// <summary>
 /// Creates an instance of an Audit Event to be recorded
 /// </summary>
 /// <param name="actor">The subject responsible for the event</param>
 /// <param name="action">Action being performed</param>
 /// <param name="resource">Resource the action is being applied to</param>
 /// <param name="description">Description of the event</param>
 public AuditEventArguments(ResourceActor actor, string action, AuditableResource resource, FormattedString description)
 {
     Actor       = actor;
     Action      = action;
     Resource    = resource;
     Description = description;
 }
Exemplo n.º 32
0
        public HoleMapPage(int hole, List <SimpleCoordinates> coords, List <TeeCommonInfoes> teeInfoes)
        {
            InitializeComponent();
            CurrentHole = hole;
            Coordinates = coords;
            TeeInfo     = teeInfoes;

            // to set bolf font partially
            var fs = new FormattedString();

            fs.Spans.Add(new Span {
                Text = ", Bold", ForegroundColor = Color.Gray, FontSize = 20, FontAttributes = FontAttributes.Bold
            });

            // to build arrPositions for later use (1-18 holes)
            arrLat          = coords.Where(c => c.Theme == "CenterLat").FirstOrDefault().TransposeCoordinates();
            arrLon          = coords.Where(c => c.Theme == "CenterLon").FirstOrDefault().TransposeCoordinates();
            arrCenterGreens = new Position[18];
            if (arrLat != null && arrLon != null)
            {
                for (int i = 0; i < 18; i++)
                {
                    arrCenterGreens[i] = new Position(arrLat[i], arrLon[i]);
                }
            }

            arrPar      = teeInfoes.Where(t => t.Theme == "Par").FirstOrDefault().TransposeTeeInfoes();
            arrHandicap = teeInfoes.Where(t => t.Theme == "Handicap").FirstOrDefault().TransposeTeeInfoes();
            arrDistance = teeInfoes.Where(t => t.Theme == "Distance").FirstOrDefault().TransposeTeeInfoes();

            labelHole.Text           = "Hole # " + CurrentHole;
            labelHole.FontAttributes = FontAttributes.Bold;


            myCurrentPosition = pTeeGround;
            // enable this when AD-HOC
            // because this is not in async, it doesnt' work
            //myCurrentPosition = GetMyCurrentPosition().Result;

            // try to fix back to Rome issue
            MapSpan ms = null;

            try
            {
                ms = MapSpan.FromCenterAndRadius(myCurrentPosition, new Distance(1000));
            }
            catch (Exception e)
            {
                string mm = e.Message;
            }

            InitRegion = ms;
            InitMoveToRegion();

            buttonNext.Clicked += async(sender, e) =>
            {
                CurrentHole = CurrentHole % 18 + 1;
                await EighteenHoles();
            };

            buttonPrev.Clicked += async(sender, e) =>
            {
                CurrentHole = CurrentHole == 1 ? 18 : CurrentHole == 18 ? 17 : CurrentHole - 1;
                await EighteenHoles();
            };


            map.MapClicked += (sender, e) =>
            {
                double distance1; // me to the point
                double distance2; // the point to the green

                Position thePoint = new Position(e.Point.Latitude, e.Point.Longitude);

                distance1 = CalculateDistance(myCurrentPosition, thePoint);
                distance2 = CalculateDistance(thePoint, arrCenterGreens[CurrentHole - 1]);

                labelDistance.Text = "To this : " + distance1.KmToYard().ToString("#.#") + ", To Green : " + distance2.KmToYard().ToString("#.#");

                Pin objectTarget = new Pin()
                {
                    Icon        = BitmapDescriptorFactory.DefaultMarker(Color.DodgerBlue),
                    Type        = PinType.Place,
                    Label       = "To this : " + distance1.KmToYard().ToString("#.#") + ", To Green : " + distance2.KmToYard().ToString("#.#"),
                    Address     = "Target",
                    Position    = thePoint,
                    Tag         = " ",
                    IsDraggable = true
                };
                map.Pins.Add(objectTarget);
            };

            map.PinDragEnd += (sender, e) =>
            {
                double distance3; // me to the point
                double distance4; // the point to the green

                Position thePoint3 = e.Pin.Position;

                distance3 = CalculateDistance(myCurrentPosition, thePoint3);
                distance4 = CalculateDistance(thePoint3, arrCenterGreens[CurrentHole - 1]);

                e.Pin.Label   = "To this : " + distance3.KmToYard().ToString("#.#") + ", To Green : " + distance4.KmToYard().ToString("#.#");
                e.Pin.Address = "Target";

                labelDistance.Text = "To this : " + distance3.KmToYard().ToString("#.#") + ", To Green : " + distance3.KmToYard().ToString("#.#");
            };


            buttonHole1.Clicked += async(sender, e) =>
            {
                await EighteenHoles();
            };

            buttonScore.Clicked += (sender, e) => Navigation.PushAsync(new ScoreInputPage(CurrentHole));


            map.Padding = new Thickness(0, 0, 0, 0);
        }
Exemplo n.º 33
0
		public FontPageCs()
		{
			var label = new Label
			{
				Text = "Hello, Xamarin.Forms!",
				FontFamily = Device.OnPlatform(
					"Lobster-Regular", // iOS
					"Lobster-Regular.ttf#Lobster-Regular", // Android
					@"\Assets\Fonts\Lobster-Regular.ttf#Lobster-Regular" // WinPhone
				),
				VerticalOptions = LayoutOptions.CenterAndExpand,
				HorizontalOptions = LayoutOptions.CenterAndExpand,

			};
			label.FontSize = Device.OnPlatform(
				24,
				Device.GetNamedSize(NamedSize.Medium, label),
				Device.GetNamedSize(NamedSize.Large, label)
			);

			var labelBold = new Label
			{
				Text = "Bold",
				FontSize = 14,
				FontAttributes = FontAttributes.Bold,
				VerticalOptions = LayoutOptions.CenterAndExpand,
				HorizontalOptions = LayoutOptions.CenterAndExpand,
			};
			var labelItalic = new Label
			{
				Text = "Italic",
				FontSize = 14,
				FontAttributes = FontAttributes.Italic,
				VerticalOptions = LayoutOptions.CenterAndExpand,
				HorizontalOptions = LayoutOptions.CenterAndExpand,
			};
			var labelBoldItalic = new Label
			{
				Text = "BoldItalic",
				FontSize = 14,
				FontAttributes = FontAttributes.Bold | FontAttributes.Italic,
				VerticalOptions = LayoutOptions.CenterAndExpand,
				HorizontalOptions = LayoutOptions.CenterAndExpand,
			};

			// Span formatting support
			var labelFormatted = new Label();
			var fs = new FormattedString();
			fs.Spans.Add(new Span { Text = "Red, ", ForegroundColor = Color.Red, FontSize = 20, FontAttributes = FontAttributes.Italic });
			fs.Spans.Add(new Span { Text = " blue, ", ForegroundColor = Color.Blue, FontSize = 32 });
			fs.Spans.Add(new Span { Text = " and green!", ForegroundColor = Color.Green, FontSize = 12 });
			labelFormatted.FormattedText = fs;

			Content = new StackLayout
			{
				VerticalOptions = LayoutOptions.CenterAndExpand,
				HorizontalOptions = LayoutOptions.CenterAndExpand,
				Children = {
					label, labelBold, labelItalic, labelBoldItalic, labelFormatted
				}
			};
		}
Exemplo n.º 34
0
 public Label(short x, short y, short height, int z, FormattedString text)
     : base(x, y, (short)text.Length, height, z)
 {
     _text = text;
 }
 public static FormattedString Spans(this FormattedString formattedString, IEnumerable <Span> spans)
 {
     spans.ForEach(x => formattedString.Spans.Add(x));
     return(formattedString);
 }
 public static FormattedString Spans(this FormattedString formattedString, params Span[] spans)
 {
     spans.ForEach(x => formattedString.Spans.Add(x));
     return(formattedString);
 }
Exemplo n.º 37
0
        public Animo(MasterDetailPage masterDetail, Usuario tusuario)
        {
            usuario = tusuario;

            var guardaritem = new ToolbarItem {
                Text = "Continuar"
            };
            guardaritem.Clicked += (object sender, System.EventArgs e) =>
            {
                continuar();
            };

            //ToolbarItems.Add(new ToolbarItem(){Icon="pazosicon.png"});
            ToolbarItems.Add(guardaritem);
            this.Title = "Acciones ahorradoras";

            master = masterDetail;

            RelativeLayout layout = new RelativeLayout ();

            //Colocar background
            var imgBackground = new Image () {
                Source = ImageSource.FromResource ("PaZos.Resources.FondoLogin.png"),
                Aspect = Aspect.AspectFill
            };

            layout.Children.Add (imgBackground,
                Constraint.Constant (0),
                Constraint.Constant (0),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Height;
                }));
            //Fin Colocar background
            var imgmensaje = new Image () {
                Source = ImageSource.FromResource ("PaZos.Resources.Animo.png"),
                Aspect = Aspect.AspectFit
            };

            layout.Children.Add (imgmensaje,
                Constraint.Constant (0),
                Constraint.Constant (0),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Height;
                }));

            int y = 75;
            int factor = 375;

            Label lbtextotitulo = new Label ();
            lbtextotitulo.HorizontalOptions = LayoutOptions.CenterAndExpand;
            lbtextotitulo.XAlign = TextAlignment.Center;
            lbtextotitulo.TextColor = Color.Red;

            var fstitulo = new FormattedString ();

            Span sptitulo = new Span () {
                Text = "¡Ánimo!",
                FontFamily = "Noteworthy-Bold",
                FontSize=28

            };
            fstitulo.Spans.Add (sptitulo);

            lbtextotitulo.FormattedText = fstitulo;

            layout.Children.Add (lbtextotitulo,
                Constraint.Constant (50),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width*75/factor;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width-100;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 40;
                }));

            Label lbtexto = new Label ();
            lbtexto.HorizontalOptions = LayoutOptions.CenterAndExpand;
            lbtexto.XAlign = TextAlignment.Center;

            var fs = new FormattedString ();

            Span sp3 = new Span () {
                Text = "Revisa tus acciones, mañana tienes otra oportunidad de ahorrar más.",
                FontFamily = "MyriadPro-Bold",
                FontSize=16
            };
            fs.Spans.Add (sp3);

            lbtexto.FormattedText = fs;

            layout.Children.Add (lbtexto,
                Constraint.Constant (50),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width*125/factor;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width-100;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 80;
                }));

            Content = layout;
        }
 public static FormattedString Spans(this FormattedString formattedString, Func <IList <Span> > spans)
 {
     spans.Invoke().ForEach(x => formattedString.Spans.Add(x));
     return(formattedString);
 }
Exemplo n.º 39
0
        public Cumplio(MasterDetailPage masterDetail, Usuario tusuario)
        {
            usuario = tusuario;

            var guardaritem = new ToolbarItem {
                Text = "Continuar"
            };
            guardaritem.Clicked += (object sender, System.EventArgs e) =>
            {
                continuar();
            };

            //ToolbarItems.Add(new ToolbarItem(){Icon="pazosicon.png"});
            ToolbarItems.Add(guardaritem);
            this.Title = "Acciones ahorradoras";

            master = masterDetail;

            RelativeLayout layout = new RelativeLayout ();

            //Colocar background
            var imgBackground = new Image () {
                Source = ImageSource.FromResource ("PaZos.Resources.FondoLogin.png"),
                Aspect = Aspect.AspectFill
            };

            layout.Children.Add (imgBackground,
                Constraint.Constant (0),
                Constraint.Constant (0),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Height;
                }));
            //Fin Colocar background
            var imgmensaje = new Image () {
                Source = ImageSource.FromResource ("PaZos.Resources.cumplio.png"),
                Aspect = Aspect.AspectFit
            };

            layout.Children.Add (imgmensaje,
                Constraint.Constant (0),
                Constraint.Constant (0),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Height;
                }));

            Label lbtexto = new Label ();
            lbtexto.HorizontalOptions = LayoutOptions.CenterAndExpand;
            lbtexto.XAlign = TextAlignment.Center;

            var fs = new FormattedString ();

            int y = 75;
            int factor = 375;

            Span sp2 = new Span () {
                Text = "¿Cumpliste con tus acciones ahorradoras?",
                FontFamily = "MyriadPro-Bold",
                FontSize=16
            };
            fs.Spans.Add (sp2);
            lbtexto.FormattedText = fs;

            layout.Children.Add (lbtexto,
                Constraint.Constant (45),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width*75/factor;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width-90;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 40;
                }));

            y = y + 60;

            slino = new Switch () {

            };

            layout.Children.Add (slino,
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width/2-15;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width*135/factor;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 60;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 60;
                }));

            Label lblno = new Label () {
                Text="No",
                Font = Font.OfSize("TwCenMT-Condensed",18)
            };
            layout.Children.Add (lblno,
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width/2-60;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width*140/factor;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 60;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 60;
                }));

            Label lblsi = new Label () {
                Text="Si",
                Font = Font.OfSize("TwCenMT-Condensed",18)
            };
            layout.Children.Add (lblsi,
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width/2+60;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width*140/factor;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 60;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 60;
                }));

            y = y + 100;

            Label lbtexto3 = new Label ();
            lbtexto3.HorizontalOptions = LayoutOptions.CenterAndExpand;
            lbtexto3.XAlign = TextAlignment.Center;

            var fs3 = new FormattedString ();

            Span sp3 = new Span () {
                Text = "Guarda y protege tu dinero en un lugar seguro, ¿estás ahorrando en un banco?",
                FontFamily = "MyriadPro-Regular",
                FontSize=16
            };
            fs3.Spans.Add (sp3);

            lbtexto3.FormattedText = fs3;

            layout.Children.Add (lbtexto3,
                Constraint.Constant (40),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width*250/factor;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width-80;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 80;
                }));

            Content = layout;
        }
Exemplo n.º 40
0
        public async Task <OutputDto> Upload(LocalIncident report)
        {
            OutputDto output         = null;
            var       uploadedImages = await UploadPictures(report);

            if (!report.IsCreated)
            {
                var incident = CreateData(report, uploadedImages);
                await Task.Delay(300);

                using (await MaterialDialog.Instance.LoadingDialogAsync(message: "UploadingIncident".Translate()))
                {
                    await WebRequestExecuter.Execute(async() =>
                    {
                        output = await _incidentsAppService.Create(incident);
                    }, () => Task.CompletedTask, exception =>
                    {
                        UserDialogs.Instance.Toast("IncidentUploadError".Translate());
                        return(Task.CompletedTask);
                    });
                }
            }
            else
            {
                var incident = EditData(report, uploadedImages);

                await WebRequestExecuter.Execute(async() =>
                {
                    using (await MaterialDialog.Instance.LoadingDialogAsync(message: "UploadingIncident".Translate()))
                    {
                        output = await _incidentsAppService.Update(incident);
                    }
                }, () => Task.CompletedTask);
            }

            if (output != null && output.Success)
            {
                try
                {
                    report.IsUploaded = true;
                    report.IsCreated  = true;
                    report.IncidentId = output.Id;
                    DbService.UpdateItem(report);
                    Analytics.TrackEvent("IncidentUploaded");
                    var formattedString = new FormattedString();

                    formattedString.Spans.Add(new Span
                    {
                        Text     = "UploadMessage1".Translate(),
                        FontSize = 20
                    });

                    formattedString.Spans.Add(new Span
                    {
                        Text = Environment.NewLine
                    });
                    formattedString.Spans.Add(new Span
                    {
                        Text     = "UploadMessage2".Translate(),
                        FontSize = 20,
                    });
                    formattedString.Spans.Add(new Span
                    {
                        Text = Environment.NewLine
                    });

                    formattedString.Spans.Add(new Span
                    {
                        Text     = "UploadMessage3".Translate(),
                        FontSize = 20
                    });


                    var popup = new LottieLoader(formattedString, "success.json", false);
                    //using (new LottieLoader(formattedString, "success.json"))
                    //{
                    //    await Task.Delay(5000);
                    //}
                    //UserDialogs.Instance.Toast("UploadedSuccessfully".Translate());
                }
                catch (Exception e)
                {
                    Crashes.TrackError(e);
                }
            }
            else if (output != null && output.Message == "AlreadyCreated")
            {
                try
                {
                    report.IsUploaded = true;
                    report.IsCreated  = true;
                    report.IncidentId = output.Id;
                    DbService.UpdateItem(report);
                    UserDialogs.Instance.Toast("AlreadyCreated".Translate());
                }
                catch (Exception e)
                {
                    Crashes.TrackError(e);
                }
            }
            else
            {
                UserDialogs.Instance.Toast("IncidentUploadError".Translate());
            }

            return(output);
        }
        private void OnContactsPickerItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            try
            {

                var obj = e.SelectedItem as CustomListViewItem;
                string name = (e.SelectedItem as CustomListViewItem).Name;
                if (!string.IsNullOrEmpty(name))
                {
                    string preText = "   - with ";
                    selectedContact = name;

                    var s = new FormattedString();

                    if (contactInfo.FormattedText == null)
                    {
                        contactInfo.Text = preText;
                        s.Spans.Add(new Span { Text = preText, ForegroundColor = Color.Black });
                    }

                    if (contactInfo.FormattedText != null && contactInfo.FormattedText.Spans.Count > 1)
                    {
                        string spanContact = "";
                        if (contactInfo.FormattedText != null && contactInfo.FormattedText.Spans.Count > 1)
                        {
                            spanContact = contactInfo.FormattedText.Spans[1].Text + " , " + selectedContact; ;
                        }
                        s.Spans.Add(new Span { Text = preText, ForegroundColor = Color.Black });
                        s.Spans.Add(new Span { Text = spanContact });
                    }
                    else
                    {

                        string spanContact = "";
                        if (contactInfo.FormattedText != null && contactInfo.FormattedText.Spans.Count > 1)
                        {
                            spanContact = contactInfo.FormattedText.Spans[1].Text;
                        }
                        else
                        {
                            spanContact = selectedContact;
                            s.Spans.Add(new Span { Text = selectedContact });
                        }

                    }


                    contactInfo.FormattedText = s;

                    if (contactInfo.FormattedText != null && contactInfo.FormattedText.Spans.Count > 1)
                    {
                        if (contactInfo.FormattedText.Spans[1].Text.Length > 40)
                        {
                            string trimmedContacts = contactInfo.FormattedText.Spans[1].Text;
                            trimmedContacts = trimmedContacts.Substring(0, 40);
                            trimmedContacts += "...";

                            contactInfo.FormattedText.Spans[1].Text = trimmedContacts;
                        }

                    }



                    contactInfo.IsVisible = true;
                    App.ContactsArray.Add(name);

                }

                View pickView = masterLayout.Children.FirstOrDefault(pick => pick.ClassId == "ePicker");
                masterLayout.Children.Remove(pickView);
                pickView = null;

            }
            catch (Exception ex)
            {
                var test = ex.Message;
            }
        }
Exemplo n.º 42
0
        public static SpannableString ToAttributed(this FormattedString formattedString, Font defaultFont, Color defaultForegroundColor, TextView view)
        {
            if (formattedString == null)
            {
                return(null);
            }

            var builder = new StringBuilder();

            for (int i = 0; i < formattedString.Spans.Count; i++)
            {
                Span span = formattedString.Spans[i];
                var  text = span.Text;
                if (text == null)
                {
                    continue;
                }

                builder.Append(text);
            }

            var spannable = new SpannableString(builder.ToString());

            var c = 0;

            for (int i = 0; i < formattedString.Spans.Count; i++)
            {
                Span span = formattedString.Spans[i];
                var  text = span.Text;
                if (text == null)
                {
                    continue;
                }

                int start = c;
                int end   = start + text.Length;
                c = end;

                if (span.TextColor != Color.Default)
                {
                    spannable.SetSpan(new ForegroundColorSpan(span.TextColor.ToAndroid()), start, end, SpanTypes.InclusiveExclusive);
                }
                else if (defaultForegroundColor != Color.Default)
                {
                    spannable.SetSpan(new ForegroundColorSpan(defaultForegroundColor.ToAndroid()), start, end, SpanTypes.InclusiveExclusive);
                }

                if (span.BackgroundColor != Color.Default)
                {
                    spannable.SetSpan(new BackgroundColorSpan(span.BackgroundColor.ToAndroid()), start, end, SpanTypes.InclusiveExclusive);
                }
                if (span.LineHeight >= 0)
                {
                    spannable.SetSpan(new LineHeightSpan(view, span.LineHeight), start, end, SpanTypes.InclusiveExclusive);
                }
                if (!span.IsDefault())
                {
                    var spanFont = Font.OfSize(span.FontFamily, span.FontSize).WithAttributes(span.FontAttributes);
                    spannable.SetSpan(new FontSpan(spanFont, view, span.CharacterSpacing.ToEm()), start, end, SpanTypes.InclusiveInclusive);
                }
                else
                {
                    spannable.SetSpan(new FontSpan(defaultFont, view, span.CharacterSpacing.ToEm()), start, end, SpanTypes.InclusiveInclusive);
                }
                if (span.IsSet(Span.TextDecorationsProperty))
                {
                    spannable.SetSpan(new TextDecorationSpan(span), start, end, SpanTypes.InclusiveInclusive);
                }
            }
            return(spannable);
        }
Exemplo n.º 43
0
		void answerClicked (object sender, EventArgs e)
		{
			for (int i = 0; i < 8; i++) {
				if (answers [i].Text == correct) {
					
					answers [i].BackgroundColor = Color.Green;
					answers [i].TextColor = Color.White;
				}
				answers [i].Clicked -= answerClicked;
			}
			if (((Button)sender).Text != correct) {
				if(Settings.sound)
					DependencyService.Get<IAudio>().PlayWavFile("Audio/Alert/error.wav");
				((Button)sender).TextColor = Color.White;
				((Button)sender).BackgroundColor = Color.Red;
				TestPage.fillList.Add (TestPage.fillList[currentIndex]);
			}
			else
			{
				rightCount++;
				progress = (double)((double)rightCount / (double)initCount);
				progressBar.ProgressTo (progress, 250, Easing.Linear);
				//if(Settings.sound)
				//DependencyService.Get<IAudio>().PlayMp3File("Audio/Alert/success.mp3");
			}

			for (int i = 0; i < 3; i++) {

				string[] parts=kanaLabels [i].Text.Split ('_');
				//string newPart=answerData [i].Substring (parts [0].Length, kanaLabels [i].Text.Length - parts [0].Length - parts [1].Length);
				var fs = new FormattedString ();
				fs.Spans.Add (new Span { Text=parts[0],FontSize=30});
				fs.Spans.Add (new Span { Text=correct, ForegroundColor = Color.Green, FontAttributes = FontAttributes.Bold,FontSize=30 });
				fs.Spans.Add (new Span { Text=parts[1],FontSize=30});
				Debug.WriteLine ("Parts Length" + parts.Length);
				if (parts.Length == 3) {
					fs.Spans.Add (new Span { Text=correct, ForegroundColor = Color.Green, FontAttributes = FontAttributes.Bold,FontSize=30 });
					fs.Spans.Add (new Span { Text = parts [2], FontSize = 30 });
				}
				kanaLabels [i].FormattedText = fs;
			}
			itemNext.IsVisible = true;

			progressLabel.Text = rightCount.ToString () + "/" + initCount.ToString();

		//	await labels[0].RotateTo(15, 1000, Easing.CubicInOut);
		}
        public TuesdayPage()
        {
            InitializeComponent();
            this.BindingContext = new TuesdayViewModel();
            Title = "Tuesday";

            //Percent 80 string
            var percent80format = new FormattedString();

            percent80format.Spans.Add(new Span {
                Text = Convert.ToString(HomePage.percent80), FontSize = 20, TextColor = Color.FromHex("#2196F3")
            });
            percent80format.Spans.Add(new Span {
                Text = ", ", FontSize = 20
            });
            percent80format.Spans.Add(new Span {
                Text = "Plates:", FontSize = 20
            });
            percent80format.Spans.Add(new Span {
                Text = " ", FontSize = 20
            });
            percent80format.Spans.Add(new Span {
                Text = Convert.ToString(HomePage.plates80), FontSize = 20, TextColor = Color.FromHex("#2196F3")
            });
            percent80format.Spans.Add(new Span {
                Text = " + ", FontSize = 20
            });
            percent80format.Spans.Add(new Span {
                Text = Convert.ToString(HomePage.side80), FontSize = 20, TextColor = Color.FromHex("#2196F3")
            });
            percent80format.Spans.Add(new Span {
                Text = " lbs\n", FontSize = 20
            });

            //Percent 85 String
            var percent85format = new FormattedString();

            percent85format.Spans.Add(new Span {
                Text = Convert.ToString(HomePage.percent85), FontSize = 20, TextColor = Color.FromHex("#2196F3")
            });
            percent85format.Spans.Add(new Span {
                Text = ", ", FontSize = 20
            });
            percent85format.Spans.Add(new Span {
                Text = "Plates:", FontSize = 20
            });
            percent85format.Spans.Add(new Span {
                Text = " ", FontSize = 20
            });
            percent85format.Spans.Add(new Span {
                Text = Convert.ToString(HomePage.plates85), FontSize = 20, TextColor = Color.FromHex("#2196F3")
            });
            percent85format.Spans.Add(new Span {
                Text = " + ", FontSize = 20
            });
            percent85format.Spans.Add(new Span {
                Text = Convert.ToString(HomePage.side85), FontSize = 20, TextColor = Color.FromHex("#2196F3")
            });
            percent85format.Spans.Add(new Span {
                Text = " lbs\n", FontSize = 20
            });

            //Percent 90 String
            var percent90format = new FormattedString();

            percent90format.Spans.Add(new Span {
                Text = Convert.ToString(HomePage.percent90), FontSize = 20, TextColor = Color.FromHex("#2196F3")
            });
            percent90format.Spans.Add(new Span {
                Text = ", ", FontSize = 20
            });
            percent90format.Spans.Add(new Span {
                Text = "Plates:", FontSize = 20
            });
            percent90format.Spans.Add(new Span {
                Text = " ", FontSize = 20
            });
            percent90format.Spans.Add(new Span {
                Text = Convert.ToString(HomePage.plates90), FontSize = 20, TextColor = Color.FromHex("#2196F3")
            });
            percent90format.Spans.Add(new Span {
                Text = " + ", FontSize = 20
            });
            percent90format.Spans.Add(new Span {
                Text = Convert.ToString(HomePage.side90), FontSize = 20, TextColor = Color.FromHex("#2196F3")
            });
            percent90format.Spans.Add(new Span {
                Text = " lbs\n", FontSize = 20
            });

            //Percent 95 String
            var percent95format = new FormattedString();

            percent95format.Spans.Add(new Span {
                Text = Convert.ToString(HomePage.percent95), FontSize = 20, TextColor = Color.FromHex("#2196F3")
            });
            percent95format.Spans.Add(new Span {
                Text = ", ", FontSize = 20
            });
            percent95format.Spans.Add(new Span {
                Text = "Plates:", FontSize = 20
            });
            percent95format.Spans.Add(new Span {
                Text = " ", FontSize = 20
            });
            percent95format.Spans.Add(new Span {
                Text = Convert.ToString(HomePage.plates95), FontSize = 20, TextColor = Color.FromHex("#2196F3")
            });
            percent95format.Spans.Add(new Span {
                Text = " + ", FontSize = 20
            });
            percent95format.Spans.Add(new Span {
                Text = Convert.ToString(HomePage.side95), FontSize = 20, TextColor = Color.FromHex("#2196F3")
            });
            percent95format.Spans.Add(new Span {
                Text = " lbs\n", FontSize = 20
            });

            //Percent 100 String
            var percent100format = new FormattedString();

            percent100format.Spans.Add(new Span {
                Text = Convert.ToString(HomePage.percent100), FontSize = 20, TextColor = Color.FromHex("#2196F3")
            });
            percent100format.Spans.Add(new Span {
                Text = ", ", FontSize = 20
            });
            percent100format.Spans.Add(new Span {
                Text = "Plates:", FontSize = 20
            });
            percent100format.Spans.Add(new Span {
                Text = " ", FontSize = 20
            });
            percent100format.Spans.Add(new Span {
                Text = Convert.ToString(HomePage.plates100), FontSize = 20, TextColor = Color.FromHex("#2196F3")
            });
            percent100format.Spans.Add(new Span {
                Text = " + ", FontSize = 20
            });
            percent100format.Spans.Add(new Span {
                Text = Convert.ToString(HomePage.side100), FontSize = 20, TextColor = Color.FromHex("#2196F3")
            });
            percent100format.Spans.Add(new Span {
                Text = " lbs\n", FontSize = 20
            });


            Content = new StackLayout
            {
                Margin   = new Thickness(20),
                Children =
                {
                    new Label {
                        Text = "80%", FontSize = 35
                    },
                    new Label {
                        FormattedText = percent80format
                    },
                    new Label {
                        Text = "85%", FontSize = 35
                    },
                    new Label {
                        FormattedText = percent85format
                    },
                    new Label {
                        Text = "90%", FontSize = 35
                    },
                    new Label {
                        FormattedText = percent90format
                    },
                    new Label {
                        Text = "95%", FontSize = 35
                    },
                    new Label {
                        FormattedText = percent95format
                    },
                    new Label {
                        Text = "100%", FontSize = 35
                    },
                    new Label {
                        FormattedText = percent100format
                    },
                }
            };
        }
Exemplo n.º 45
0
		public Study (string mode,StudyCard root,int rowIndex=0,int singlemode=0)
		{
			collapseMode = false;
			mRowIndex = rowIndex;
			kanaExamples=new List<View>();
			var rowTapRecognizer = new TapGestureRecognizer();
			romaziExamples=new List<View>();
			labelFormatted = new Label (){Text="\t"};
			notesLabel = new Label (){XAlign = TextAlignment.Start,
				YAlign = TextAlignment.Center,
				BackgroundColor = Color.Gray,
				TextColor=Color.White,
				Text="Notes"
			};
			mRoot = root;

			if (collapseMode == true) {
				
				itemCollapse = new ToolbarItem {
					Icon = "collapse.png",
					Order = ToolbarItemOrder.Primary,
					Command = new Command (() => collapse ())
						
				};
				labelFormatted.IsVisible = true;
				notesLabel.IsVisible = true;
			}
			else if (collapseMode == false) {
				itemCollapse = new ToolbarItem {
					Icon = "uncollapse.png",
					Order = ToolbarItemOrder.Primary,
					Command = new Command (() => collapse ())
				};
				labelFormatted.IsVisible = false;
				notesLabel.IsVisible = false;
			}
			Debug.WriteLine (collapseMode);
			romaziLabel= new Label {
				
				XAlign = TextAlignment.Center,
				YAlign = TextAlignment.Center,
				FontAttributes=FontAttributes.Bold,
				FontSize = 30,
				TextColor = Color.FromHex("8B0000")
			};
				
			Button prevButton = new Button {
				HorizontalOptions = LayoutOptions.StartAndExpand,
				Text = "<",
				FontSize=30,
				TextColor= Color.FromHex("2B3359")
			};

			Button nextButton = new Button {
				HorizontalOptions = LayoutOptions.EndAndExpand,
				Text = ">",
				FontSize=30,
				TextColor= Color.FromHex("2B3359")
			};

			prevButton.Clicked += PrevButton_Clicked;
			nextButton.Clicked += NextButton_Clicked;
			if (mode == "row") {
				grid = new Grid {
					
					RowDefinitions = {
						new RowDefinition {Height = new GridLength (1, GridUnitType.Star)},
						new RowDefinition  {Height = new GridLength (1, GridUnitType.Star)},
						new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }
					},

				};
				Dictionary<string,string> dic = new Dictionary<string,string> ();
				foreach (string e in RowData.rowData[rowIndex]) {
					if (e.Length > 0 && e != "b") {
						string a = e.Split ('\n') [0].Replace ('/', '\n');
						string b = e.Split ('\n') [1].Replace ('/', '\n');
						dic.Add (a,b);
						grid.ColumnDefinitions.Add (new ColumnDefinition ());
					}
				}

				int i = 0;
				string[] romanArray = new string[dic.Count];
				string[] japanArray = new string[dic.Count];
				dic.Keys.CopyTo (romanArray, 0);
				dic.Values.CopyTo (japanArray, 0);
				int fontSize1=20,fontSize2=20;

				if (Device.Idiom == TargetIdiom.Tablet) {
					fontSize1 = 45;
					fontSize2 = 35;
				} else {
					if (romanArray.Length >= 6)
						fontSize1 = 15;
				}
				foreach (string e in romanArray) {
					grid.Children.Add (new Label {
						Text = e,
						VerticalOptions = LayoutOptions.Fill,
						HorizontalOptions = LayoutOptions.CenterAndExpand,

						FontSize = fontSize1,

						XAlign=TextAlignment.Center,
						YAlign=TextAlignment.Start,
					}, i, 1);
					i++;
				}
				i = 0;
				foreach (string e in japanArray) {
					grid.Children.Add (new Label {
						Text = e,
						VerticalOptions = LayoutOptions.Fill,
						XAlign=TextAlignment.Center,
						YAlign=TextAlignment.Start,
						FontSize=fontSize2
					}, i, 2);
					i++;
				}
				grid.Children.Add (new Label {
					Text = "Take a moment to familiarize yourself with this row of characters, then proceed to the individual review cards.",
					TextColor = Color.Gray,
					XAlign=TextAlignment.Center,
					YAlign=TextAlignment.Center,
				}, 0, dic.Count, 0, 1);

				grid.Padding = new Thickness (10, Device.OnPlatform (20, 0, 0), 10, 10);

			} else {
				ToolbarItems.Add(itemCollapse);
				grid = new Grid {
					
					RowDefinitions = {
						new RowDefinition { Height = GridLength.Auto },
						new RowDefinition { Height = GridLength.Auto },
						new RowDefinition { Height = 30 },
						new RowDefinition { Height = GridLength.Auto },
						new RowDefinition { Height = GridLength.Auto },
						new RowDefinition { Height = GridLength.Auto },

					},
					ColumnDefinitions = {
						new ColumnDefinition { Width = new GridLength (1, GridUnitType.Star) },
						new ColumnDefinition { Width = new GridLength (5, GridUnitType.Star) },
						new ColumnDefinition { Width = new GridLength (1, GridUnitType.Star) },
					}
				};

				if (mode.Length > 0) {
					 strArray = mode.Split ('/');
					//Big letter 
					int fontSize=80-strArray[0].Length*5;
					grid.Children.Add (new Label {
						Text = strArray [0],
						XAlign = TextAlignment.Center,
						YAlign = TextAlignment.Center,
						FontSize=fontSize
					}, 1, 1);
					//Kana
					this.Title = strArray [0];

					mPronun = strArray [1];
					romaziLabel.Text = mPronun;

					grid.Children.Add (romaziLabel,1,2);

					// handwriting icon

					Image handwriting=new Image(){Source=ImageSource.FromResource("KeystotheKana.Resources.favicon.writing.png"),Aspect=Aspect.AspectFit};

					grid.Children.Add (handwriting, 0, 2);

					var handwritingTapRecognizer = new TapGestureRecognizer ();
					//Display study page for each kana
					handwritingTapRecognizer.Tapped += (s, e) => {
						Navigation.PushAsync (new DrawPage (strArray [0]){ });
					};

					handwriting.GestureRecognizers.Add (handwritingTapRecognizer);
				
					if (strArray [2].Length > 0) {
						
						grid.Children.Add (notesLabel, 0, 3, 3, 4);
						//Generating Italic text
						string[] italicArray = strArray [2].Split ('<');
						int j = 0;
						var fs = new FormattedString ();
						foreach (string e in italicArray) {
							if (j % 2 == 0) {
								fs.Spans.Add (new Span { Text = e, FontSize = 20 });
							} else {
								fs.Spans.Add (new Span {
									Text = e,
									ForegroundColor = Color.Gray,
									FontSize = 20,
									FontAttributes = FontAttributes.Italic,
								});

							}
							j++;
						}
							
						labelFormatted.FormattedText = fs;
						grid.Children.Add (labelFormatted, 0, 3, 4, 5);
					}
					// Examples Section
					if (strArray [3].Length > 0) {
						Grid subgrid = new Grid {
							BackgroundColor=Color.Gray,
							RowSpacing=1,
							VerticalOptions=LayoutOptions.CenterAndExpand,
						};
						int rowCount = 0;
						for (int i = 0; i < 6; i++) {
							if (strArray [i * 2 + 3].Length > 0) 
								rowCount++;
						}
						if (rowCount == 1) {
							subgrid.RowDefinitions.Add (new RowDefinition { Height = GridLength.Auto });
							subgrid.RowDefinitions.Add (new RowDefinition { Height =90});

						}
						else {
							for (int i = 0; i < rowCount; i++)
								subgrid.RowDefinitions.Add (new RowDefinition { Height = GridLength.Auto });
						}
						Debug.WriteLine ("RowCount="+subgrid.RowDefinitions.Count);
						subgrid.Children.Add (new Label {

							Text = "Examples",
							XAlign = TextAlignment.Start,

							BackgroundColor = Color.Gray,
							TextColor=Color.White

						}, 0, 3, 0, 1);

						StackLayout kanalayout=null;
						for (int i = 0; i < rowCount; i++) {
							
							int rowFontSize=20;
							if (strArray [i * 2 + 3].Length > 0) {

								string kanaPart = strArray [i * 2 + 3].Split (' ') [0];
								string romajiPart = strArray [i * 2 + 3].Substring(strArray [i * 2 + 3].Split (' ') [0].Length);
								Label kanaLabel = new Label (){ Text = kanaPart, FontSize = rowFontSize };
								Label romajiLabel=new Label(){Text=romajiPart,TextColor=Color.FromHex("8B0000"), FontAttributes = FontAttributes.Bold,FontSize=rowFontSize};
								kanalayout=new StackLayout (){ Children = {kanaLabel , romajiLabel},Orientation=StackOrientation.Horizontal};	
							
								kanaLabel.GestureRecognizers.Add (rowTapRecognizer);
								kanaExamples.Add (romajiLabel);
							}
							if (strArray [i * 2 + 4].Length > 0) {
								var fs = new FormattedString ();

								fs.Spans.Add (new Span { Text = strArray [i * 2 + 4], FontSize = 20 });
								Label romaziExample = new Label {
									FormattedText = fs,

									BackgroundColor = Color.White,
									VerticalOptions = LayoutOptions.Start
								};

								if (strArray [i * 2 + 4] == "giga- (109)") {
									StackLayout sublayout=new StackLayout (){ Children = { new Label(){Text="giga- (10"}, new Label(){Text="9",VerticalOptions=LayoutOptions.Start,FontSize=8},new Label(){Text=")"}},Orientation=StackOrientation.Horizontal};
									subgrid.Children.Add (new StackLayout (){ Children = { kanalayout, sublayout }, BackgroundColor = Color.White }, 0, 3, i+1, i + 2);
									romaziExamples.Add (sublayout);
								}
								else if (strArray [i * 2 + 4] == "hecto- (102)") {
									StackLayout sublayout=new StackLayout (){ Children = { new Label(){Text="hecto- (10"}, new Label(){Text="2",VerticalOptions=LayoutOptions.Start,FontSize=8},new Label(){Text=")"}},Orientation=StackOrientation.Horizontal};
									subgrid.Children.Add (new StackLayout (){ Children = { kanalayout, sublayout }, BackgroundColor = Color.White }, 0, 3, i+1, i + 2);
									romaziExamples.Add (sublayout);
								}
								else if (strArray [i * 2 + 4] == "mega- (106)") {
									StackLayout sublayout=new StackLayout (){ Children = { new Label(){Text="mega- (10"}, new Label(){Text="6",VerticalOptions=LayoutOptions.Start,FontSize=8},new Label(){Text=")"}},Orientation=StackOrientation.Horizontal};
									subgrid.Children.Add (new StackLayout (){ Children = { kanalayout, sublayout }, BackgroundColor = Color.White }, 0, 3, i+1, i + 2);
									romaziExamples.Add (sublayout);
								}
								else {
									subgrid.Children.Add (new StackLayout (){ Children = { kanalayout, romaziExample }, BackgroundColor = Color.White }, 0, 3, i+1, i + 2);
									romaziExamples.Add (romaziExample);
								}
									
							}
							
						}
						//subgrid.Padding = new Thickness (0, 0, 0, 2);
						foreach (View e in romaziExamples)
							e.IsVisible = collapseMode;
						foreach (View e in kanaExamples)
							e.IsVisible = collapseMode;
						grid.Children.Add (new ScrollView(){Content=subgrid}, 0, 3, 5, 6);
					}

				}
					
				rowTapRecognizer.Tapped += (s, e) => {

					string kana=((Label)s).Text.ToString().Split(' ')[0];
					if(Settings.voice)
						DependencyService.Get<IAudio>().PlayMp3File("Audio/Examples/"+kana+".mp3");
				};
				//collapseMode = false;

				grid.Padding = new Thickness (10, Device.OnPlatform (20, 0, 0), 10, 10);

			}
			bottomBar = new StackLayout {
				
				VerticalOptions = LayoutOptions.EndAndExpand,
				Orientation = StackOrientation.Horizontal,
				BackgroundColor=Color.FromHex("649cef"),
				Children = {
					prevButton,
					nextButton
				},

			};
			
			StackLayout contentLayout = new StackLayout {
				Orientation = StackOrientation.Vertical,
				Children = {
					new ScrollView{ Content = grid },
				}
			};

			if (singlemode == 0)
				contentLayout.Children.Add (bottomBar);
			Content = contentLayout;
		}
Exemplo n.º 46
0
        public ViewPicPage(String itemTitle, String img, String author,
                           String Score, String created_date, String subreddit,
                           String numCom, String numCP, String urlstr)
        {
            ////////INITIALIZE THE ELEMENTS

            //Format created date
            FormattedString created = new FormattedString
            {
                Spans =
                {
                    new Span {
                        Text           = "Created: ",
                        FontAttributes = FontAttributes.Bold,
                        TextColor      = Color.FromRgb(216, 79, 0),
                        FontSize       = 16
                    },

                    new Span {
                        Text      = created_date,
                        TextColor = Color.FromRgb(0, 0, 0),
                        FontSize  = 16
                    }
                }
            };

            Label createdinfo = new Label
            {
                FormattedText     = created,
                LineBreakMode     = LineBreakMode.WordWrap,
                HorizontalOptions = LayoutOptions.StartAndExpand,
                VerticalOptions   = LayoutOptions.Start,
                //BackgroundColor = Color.FromRgb(255,255,255),
                TextColor      = Color.FromRgb(200, 200, 200),
                FontSize       = 16,
                FontAttributes = FontAttributes.Italic
            };


            //Create a button with link to open in browser
            String url = urlstr;

            Button urlButton = new Button
            {
                HorizontalOptions = LayoutOptions.End,
                VerticalOptions   = LayoutOptions.Start,
                Text            = " View in Browser ",
                TextColor       = Color.FromRgb(255, 255, 255),
                BackgroundColor = Color.FromRgb(90, 79, 135),
                BorderColor     = Color.FromRgb(0, 0, 50),
                //Margin = 5,
                WidthRequest = 125,
                FontSize     = 16,
            };

            //Put the button and created date on the same line
            StackLayout header = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Children    =
                {
                    createdinfo,
                    urlButton
                }

                //BackgroundColor = Color.FromRgb(50,50,50)
            };

            //Set image string to image object
            Image image = new Image
            {
                Source = img
            };


            //Format Title
            FormattedString title = new FormattedString
            {
                Spans =
                {
                    new Span {
                        Text           = "Title: ",
                        FontAttributes = FontAttributes.Bold,
                        TextColor      = Color.FromRgb(216, 79, 0),
                        FontSize       = 22
                    },

                    new Span {
                        Text      = itemTitle,
                        TextColor = Color.FromRgb(0, 0, 0),
                        FontSize  = 22
                    }
                }
            };

            Label titleinfo = new Label
            {
                FormattedText = title,
                LineBreakMode = LineBreakMode.WordWrap
            };

            //Format Author
            FormattedString auth = new FormattedString
            {
                Spans =
                {
                    new Span {
                        Text           = "Author: ",
                        FontAttributes = FontAttributes.Bold,
                        TextColor      = Color.FromRgb(25, 77, 209),
                        FontSize       = 16
                    },

                    new Span {
                        Text      = author,
                        TextColor = Color.FromRgb(0, 0, 0),
                        FontSize  = 16
                    }
                }
            };

            Label authorInfo = new Label
            {
                FormattedText = auth,
                LineBreakMode = LineBreakMode.WordWrap
            };


            //Format Score
            FormattedString scr = new FormattedString
            {
                Spans =
                {
                    new Span {
                        Text           = "Score: ",
                        FontAttributes = FontAttributes.Bold,
                        TextColor      = Color.FromRgb(25, 77, 209),
                        FontSize       = 16
                    },

                    new Span {
                        Text      = Score,
                        TextColor = Color.FromRgb(0, 0, 0),
                        FontSize  = 16
                    }
                }
            };

            Label scoreInfo = new Label
            {
                FormattedText = scr,
                LineBreakMode = LineBreakMode.WordWrap
            };

            //Format Subreddit
            FormattedString sr = new FormattedString
            {
                Spans =
                {
                    new Span {
                        Text           = "Subreddit: ",
                        FontAttributes = FontAttributes.Bold,
                        TextColor      = Color.FromRgb(25, 77, 209),
                        FontSize       = 16
                    },

                    new Span {
                        Text      = subreddit,
                        TextColor = Color.FromRgb(0, 0, 0),
                        FontSize  = 16
                    }
                }
            };

            Label srInfo = new Label
            {
                FormattedText = sr,
                LineBreakMode = LineBreakMode.WordWrap
            };

            //Format comment count
            FormattedString cc = new FormattedString
            {
                Spans =
                {
                    new Span {
                        Text           = "Number of Comments: ",
                        FontAttributes = FontAttributes.Bold,
                        TextColor      = Color.FromRgb(25, 77, 209),
                        FontSize       = 16
                    },

                    new Span {
                        Text      = numCom,
                        TextColor = Color.FromRgb(0, 0, 0),
                        FontSize  = 16
                    }
                }
            };

            Label numCominfo = new Label
            {
                FormattedText = cc,
                LineBreakMode = LineBreakMode.WordWrap
            };

            //Format crossposts count
            FormattedString crossposts = new FormattedString
            {
                Spans =
                {
                    new Span {
                        Text           = "Number of Crossposts: ",
                        FontAttributes = FontAttributes.Bold,
                        TextColor      = Color.FromRgb(25, 77, 209),
                        FontSize       = 16
                    },

                    new Span {
                        Text      = numCP,
                        TextColor = Color.FromRgb(0, 0, 0),
                        FontSize  = 16
                    }
                }
            };

            Label numCPinfo = new Label
            {
                FormattedText = crossposts,
                LineBreakMode = LineBreakMode.WordWrap
            };

            //////INITIALIZE STRUCTURE AND STORE THE ELEMENTS

            var scroll = new ScrollView();

            Content = scroll;

            var elements = new StackLayout
            {
                Children =
                {
                    //urlButton,
                    //createdLabel,
                    header,
                    image,
                    titleinfo,
                    authorInfo,
                    srInfo,
                    scoreInfo,
                    numCominfo,
                    numCPinfo
                },
                Padding = 5,
                Margin  = 5
            };

            scroll.Content = elements;
        }
Exemplo n.º 47
0
        public FinalInformate(MasterDetailPage masterDetail)
        {
            ToolbarItems.Add(new ToolbarItem(){Icon="pazosicon.png"});
            this.Title = "Acciones ahorradoras";

            master = masterDetail;

            RelativeLayout layout = new RelativeLayout ();

            //Colocar background
            var imgBackground = new Image () {
                Source = ImageSource.FromResource ("PaZos.Resources.FondoLogin.png"),
                Aspect = Aspect.AspectFill
            };

            layout.Children.Add (imgBackground,
                Constraint.Constant (0),
                Constraint.Constant (0),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Height;
                }));
            //Fin Colocar background
            var imgmensaje = new Image () {
                Source = ImageSource.FromResource ("PaZos.Resources.FinalInformate.png"),
                Aspect = Aspect.AspectFill
            };

            layout.Children.Add (imgmensaje,
                Constraint.Constant (0),
                Constraint.Constant (0),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Height;
                }));

            int y = 75;
            int factor = 375;

            Label lbtextotitulo = new Label ();
            lbtextotitulo.HorizontalOptions = LayoutOptions.CenterAndExpand;
            lbtextotitulo.XAlign = TextAlignment.Center;
            lbtextotitulo.TextColor = Color.Red;

            var fstitulo = new FormattedString ();

            Span sptitulo = new Span () {
                Text = "¡Infórmate!",
                FontFamily = "Noteworthy-Bold",
                FontSize=28

            };
            fstitulo.Spans.Add (sptitulo);

            lbtextotitulo.FormattedText = fstitulo;

            layout.Children.Add (lbtextotitulo,
                Constraint.Constant (50),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width*75/factor;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width-100;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 40;
                }));

            Label lbtexto = new Label ();
            lbtexto.HorizontalOptions = LayoutOptions.CenterAndExpand;
            lbtexto.XAlign = TextAlignment.Center;

            var fs = new FormattedString ();

            Span sp2 = new Span () {
                Text = "Organiza tus finanzas personales y las de tu negocio y protege tus ahorros en un banco.",
                FontFamily = "MyriadPro-Bold",
                FontSize=16
            };
            fs.Spans.Add (sp2);

            lbtexto.FormattedText = fs;

            layout.Children.Add (lbtexto,
                Constraint.Constant (50),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width*125/factor;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width-100;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 80;
                }));

            Content = layout;
        }
Exemplo n.º 48
0
 /// <summary>
 /// Creates class instance
 /// </summary>
 public ConsoleLogWriter(string format)
 {
     _format = format == null ? null : FormattedString.Parse(format, null);
 }
Exemplo n.º 49
0
		public ConfusionCard (int index,string mode)
		{
			mIndex = index;
			mMode = mode;
			Grid grid;
			int colCount = 2;
			grid = new Grid () {
				RowDefinitions = {
					new RowDefinition { Height = new GridLength (2, GridUnitType.Star) },
					new RowDefinition { Height = new GridLength (2, GridUnitType.Star) },
					new RowDefinition { Height = new GridLength (1, GridUnitType.Star) },
					new RowDefinition { Height = GridLength.Auto},
					new RowDefinition { Height = new GridLength (1, GridUnitType.Star) },
					new RowDefinition { Height = new GridLength (2, GridUnitType.Star) },
					new RowDefinition { Height = new GridLength (2, GridUnitType.Star) },
				}
			};
			string[] dataArray;
			if(mode=="Hiragana")
				dataArray= ConfusedData.hData[index].Split ('\t');
			else
				dataArray= ConfusedData.kData[index].Split ('\t');
			if (dataArray [10].Length > 0) {
				colCount = 3;
				for (int i = 0; i < colCount; i++) {
					grid.ColumnDefinitions.Add (new ColumnDefinition{ Width = new GridLength (1, GridUnitType.Star) });
				}
			}
			int kanaSize, romajiSize,fontSize;
			if (Device.Idiom == TargetIdiom.Tablet) {
				kanaSize = 70;
				romajiSize = 50;
				fontSize = 30;
			} else {
				kanaSize = 50;
				romajiSize = 30;
				fontSize=15;
			}
			grid.Children.Add (new Label (){ Text = dataArray [6], FontSize = kanaSize,XAlign=TextAlignment.Center,YAlign=TextAlignment.Center }, 0, 0);
			grid.Children.Add (new Label (){ Text = dataArray [8], FontSize = kanaSize ,XAlign=TextAlignment.Center,YAlign=TextAlignment.Center }, 1, 0);
			if(dataArray[10].Length>0)
				grid.Children.Add (new Label (){ Text = dataArray [10], FontSize = kanaSize ,XAlign=TextAlignment.Center,YAlign=TextAlignment.Center }, 2, 0);
			grid.Children.Add (new Label (){ Text = dataArray [7], FontSize = romajiSize, XAlign=TextAlignment.Center,YAlign=TextAlignment.Center,TextColor= Color.Maroon}, 0, 1);
			grid.Children.Add (new Label (){ Text = dataArray [9], FontSize = romajiSize, XAlign=TextAlignment.Center,YAlign=TextAlignment.Center,TextColor=Color.Maroon  }, 1, 1);
			if(dataArray[10].Length>0)
				grid.Children.Add (new Label (){ Text = dataArray [11], FontSize = romajiSize ,XAlign=TextAlignment.Center,YAlign=TextAlignment.Center,TextColor=Color.Maroon }, 2, 1);

			//Adding Memory Aid Label
			grid.Children.Add (new Label (){ Text = "Memory Aid", XAlign=TextAlignment.Center,YAlign=TextAlignment.End}, 0, colCount,2,3);

			string formattedText = dataArray [12];
			var textFS = new FormattedString ();

			string[] strArray=formattedText.Split(new char[]{'<','@'});
			int count = 1;
			for (int i = 0; i < strArray.Length; i++) {
				count += strArray[i].Length+1;
				if(count>formattedText.Length)
				{
					count = formattedText.Length;
				}
				if(i%2==1)
				{
				if(formattedText[count-2] == '<')
					textFS.Spans.Add(new Span(){Text=strArray[i],ForegroundColor=Color.Maroon,FontAttributes=FontAttributes.Bold,FontSize=fontSize});
				else if (formattedText[count-2] == '@')
					textFS.Spans.Add(new Span(){Text=strArray[i],FontAttributes=FontAttributes.Bold,FontSize=fontSize});
				}
				else
					textFS.Spans.Add(new Span(){Text=strArray[i],FontSize=fontSize});
			}

			grid.Children.Add (new Label (){ FormattedText=textFS,XAlign=TextAlignment.Center,YAlign=TextAlignment.Center }, 0, colCount,3,4);

			//Adding "Examples:" Label
			grid.Children.Add (new Label (){ Text = "Examples:", XAlign=TextAlignment.Center,YAlign=TextAlignment.End  }, 0, colCount,4,5);

			var fs=new FormattedString();
			int length1 = 0, length2 = 0;
			for (int i = 0; i < 3; i++) {
				length1 += convertDipthong (dataArray [i]).Length;
				length2 += convertDipthong (dataArray [i+3]).Length;
			}
				
			fs.Spans.Add(new Span(){Text=convertDipthong(dataArray[0])+" ",FontSize=fontSize});
			fs.Spans.Add(new Span(){Text=convertDipthong(dataArray[1])+" ",ForegroundColor=Color.Maroon,FontAttributes=FontAttributes.Bold,FontSize=fontSize});
			fs.Spans.Add(new Span(){Text=convertDipthong(dataArray[2]),FontSize=fontSize});
			grid.Children.Add (new Label (){FormattedText=fs,XAlign=TextAlignment.Center,YAlign=TextAlignment.Center }, 0, colCount,5,6);

			var fs2=new FormattedString();
			fs2.Spans.Add(new Span(){Text=convertDipthong(dataArray[3])+" ",FontSize=fontSize});
			fs2.Spans.Add(new Span(){Text=convertDipthong(dataArray[4])+" ",ForegroundColor=Color.Maroon,FontAttributes=FontAttributes.Bold,FontSize=fontSize});
			fs2.Spans.Add(new Span(){Text=convertDipthong(dataArray[5]),FontSize=fontSize});
			grid.Children.Add (new Label (){FormattedText=fs2,XAlign=TextAlignment.Center,YAlign=TextAlignment.Center }, 0, colCount,6,7);
			grid.Padding = new Thickness (5, 10, 10, 5);
			Button prevButton = new Button {
				Text = "<",
				HorizontalOptions=LayoutOptions.StartAndExpand,
				FontSize=30,
				TextColor= Color.FromHex("2B3359")
			};

			Button nextButton=new Button {
				Text = ">",
				HorizontalOptions=LayoutOptions.EndAndExpand,
				FontSize=30,
				TextColor= Color.FromHex("2B3359"),
			};
			if (index == 0)
				prevButton.IsVisible = false;
			if ((mode == "Hiragana" && index == ConfusedData.hData.Length - 1) || (mode == "Katakana" && index == ConfusedData.kData.Length - 1))
				nextButton.IsVisible = false;
			prevButton.Clicked += PrevButton_Clicked;
			nextButton.Clicked+= NextButton_Clicked;
			StackLayout bottomBar = new StackLayout{VerticalOptions=LayoutOptions.EndAndExpand, Orientation = StackOrientation.Horizontal, Children = {prevButton,nextButton },BackgroundColor=Color.FromHex("649cef")};
			Content = new StackLayout{Orientation = StackOrientation.Vertical, Children = {grid,bottomBar}};
		}
Exemplo n.º 50
0
        protected override async void OnBindingContextChanged()
        {
            base.OnBindingContextChanged();

            if (BindingContext != null)
            {
                var fs = 15;
                if (Xamarin.Essentials.DeviceDisplay.MainDisplayInfo.Width < 700)
                {
                    fs = 12;
                }

                FormattedString formattedIdent = new FormattedString();
                DateIdent = FirstLetterToUpper(DateIdent);

                DateTime dtView;
                string   spanTextField;
                //var dateToView1 = DateTime.ParseExact(DateIdent.Replace("г.", " ").Trim(), "MMMM yyyy", new CultureInfo("ru-RU"));
                var dateCorrect = DateTime.TryParseExact(DateIdent.Replace("г.", " ").Trim(), "MMMM yyyy", new CultureInfo("ru-RU"), DateTimeStyles.None, out dtView);
                if (dateCorrect)
                {
                    spanTextField = dtView.ToString("MMMM yyyy") + (CultureInfo.CurrentCulture.Name.Contains("en") ? string.Empty : " г.");
                }
                else
                {
                    spanTextField = DateIdent;
                }
                //.ToString("MMMM yyyy");
                //+ (CultureInfo.CurrentCulture.Name.Contains("en") ? string.Empty : " г.").ToString();

                formattedIdent.Spans.Add(new Span
                {
                    //Text = DateTime.ParseExact(DateIdent.Replace("г."," ").Trim(), "MMMM yyyy", new CultureInfo("ru-RU")).ToString("MMMM yyyy") +
                    //        (CultureInfo.CurrentCulture.Name.Contains("en") ? string.Empty : " г.").ToString(),
                    Text      = spanTextField,
                    TextColor = Color.Black,
                    FontSize  = fs
                });
                formattedIdent.Spans.Add(new Span
                {
                    Text      = $"\n{AppResources.Acc} ",
                    TextColor = Color.Gray,
                    FontSize  = fs
                });
                formattedIdent.Spans.Add(new Span
                {
                    Text           = " " + Ident,
                    TextColor      = Color.Black,
                    FontAttributes = FontAttributes.Bold,
                    FontSize       = fs
                });
                identDate.FormattedText = formattedIdent;

                formattedIdent = new FormattedString();

                double sum2;
                var    parseSumpayOk = Double.TryParse(SumPay, NumberStyles.Float, new CultureInfo("ru-RU"), out sum2);
                if (parseSumpayOk)
                {
                    formattedIdent.Spans.Add(new Span
                    {
                        Text           = $"{sum2:0.00}".Replace(',', '.'),
                        TextColor      = Color.Black,
                        FontAttributes = FontAttributes.Bold,
                        FontSize       = fs
                    });
                    formattedIdent.Spans.Add(new Span
                    {
                        Text      = $"\n{AppResources.Currency}",
                        TextColor = Color.Gray,
                        FontSize  = fs - 2
                    });
                }
                else
                {
                    formattedIdent.Spans.Add(new Span
                    {
                        Text           = $"{SumPay}".Replace(',', '.'),
                        TextColor      = Color.Black,
                        FontAttributes = FontAttributes.Bold,
                        FontSize       = fs
                    });
                    formattedIdent.Spans.Add(new Span
                    {
                        Text      = $"\n{AppResources.Currency}",
                        TextColor = Color.Gray,
                        FontSize  = fs - 2
                    });
                }


                sum.FormattedText = formattedIdent;
                if (!HasImage)
                {
                    file.IsVisible = false;
                }
            }
        }
Exemplo n.º 51
0
		public VoicedHira (string romajiMode)
		{
			drillCount = 68;
			rowCount = 18;
			NavigationPage.SetBackButtonTitle (this, "Table");
			//kana variables
			this.romajiM=romajiMode;
			double fontSize=new LetterLabel().FontSize;
			if (romajiMode == "Hide Romaji") {
				gRow = vRowData[0];
				zRow = vRowData[1];
				dRow = vRowData[2];
				bRow = vRowData[3];
				pRow = vRowData[4];
			}
			else {
				if (Device.Idiom == TargetIdiom.Tablet)
					fontSize = fontSize * 2;
			}
			//Study Button
			ToolbarItem itemStudy = new ToolbarItem {
				Text = "Study",
				Order = ToolbarItemOrder.Primary,
				Command = new Command (() => showStudyPage("Dakuten Hiragana"))
			};
			ToolbarItems.Add(itemStudy);
			ToolbarItem itemCollapse;
			if (romajiMode == "Hide Romaji") {
				itemCollapse = new ToolbarItem {
					Icon = "collapse.png",
					Order = ToolbarItemOrder.Primary,
					Command = new Command (() => switchMode(romajiMode))
				};
				ToolbarItems.Add(itemCollapse);
			}
			else if (romajiMode == "Show Romaji") {
				itemCollapse = new ToolbarItem {
					Icon = "uncollapse.png",
					Order = ToolbarItemOrder.Primary,
					Command = new Command (() => switchMode(romajiMode))
				};
				ToolbarItems.Add(itemCollapse);
			}
				
			grid = new Grid {
				VerticalOptions = LayoutOptions.Fill,
				RowDefinitions = {
					new RowDefinition { Height = GridLength.Auto },
					new RowDefinition { Height = GridLength.Auto },
					new RowDefinition { Height = GridLength.Auto  },
					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 (2, GridUnitType.Star) },
					new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) },
					new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) },
					new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) },
					new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) },
					new ColumnDefinition { Width = new GridLength (1, GridUnitType.Star) },
					new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) },
					new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) },
					new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) },

				}
			};
			 

			// Tap recognizers for letters
			var letterTapRecognizer = new TapGestureRecognizer();
			//Display study page for each kana
			letterTapRecognizer.Tapped += (s, e) => {

				string kana;
				if(string.IsNullOrEmpty (((Label)s).Text))
					kana=((Label)s).FormattedText.ToString();

				else
					kana=((Label)s).Text;
				Navigation.PushAsync (new Study (Character.cData[Character.kana_lookup(kana.Split('\n')[0])],this,0,1){ });
			};


			var monoColTapRecognizer = new TapGestureRecognizer();
			monoColTapRecognizer.Tapped += (s, e) => {
				StudyCarousel studyPage = new StudyCarousel (((Label)s).Text+" Row");
				rowCount=rowList[((Label)s).Text]+17;
				drillCount=rowCount*4;
				addDrill();
				addRow (studyPage);
				studyPage.Children.Add(drillList[0]);
				drillList.RemoveAt(0);
				Navigation.PushAsync (studyPage);
			};
			var diaColTapRecognizer = new TapGestureRecognizer();
			diaColTapRecognizer.Tapped += (s, e) => {
				StudyCarousel studyPage = new StudyCarousel (((Label)s).Text+" Row");
				rowCount=rowList[((Label)s).Text+"2"]+17;
				drillCount=rowCount*4;
				addDrill();
				addRow (studyPage);

				studyPage.Children.Add(drillList[0]);
				drillList.RemoveAt(0);
				Navigation.PushAsync (studyPage);
			};
	
			grid.ColumnSpacing = 1;
			grid.RowSpacing = 1;

			var fs = new FormattedString ();
			fs.Spans.Add (new Span { Text="Monographs", ForegroundColor = Color.White });

			grid.Children.Add (new Label () {
				Text = "\u2022Tap \"Study\" to begin\n\u2022Tap consonants to select specific rows to study\n\u2022Tap kana to study specific characters\n\u2022Use bracketed romaji for keyboard input\n\u2022Gray font indicates obsolete or seldom used kana\n",
				TextColor = Color.Gray,
				XAlign=TextAlignment.Start,
				FontSize=12,
					
			}, 0, 10, 0, 1);
			grid.Children.Add(new Label {
				BackgroundColor = Color.FromHex("2B3359"),
				FormattedText = fs,
				TextColor=Color.White,
				XAlign = TextAlignment.Center,
				YAlign = TextAlignment.Center
				}, 1,6,1,2);

			var fs2 = new FormattedString ();
			fs2.Spans.Add (new Span { Text="Digraphs", ForegroundColor = Color.White });

			grid.Children.Add(new Label {
				BackgroundColor = Color.FromHex("2B3359"),
				FormattedText = fs2,
				TextColor=Color.White,
				XAlign = TextAlignment.Center,
				YAlign = TextAlignment.Center
				}, 7,10,1,2);
			int i = 0;

			string[] vowelRow = {"","A", "I", "U", "E", "O","","YA","YU","YO"} ;
			foreach (string e in vowelRow) {
				if (e != "") {
					grid.Children.Add (new LetterLabel {
						BackgroundColor = Color.FromHex ("639630"),
						Text = e,
						TextColor = Color.White,
					}, i, 2);

				}
				i++;
			}
			string[] consotantMonoCol = {"G", "Z", "D", "B","P"} ;
			i = 2;
			foreach (string e in consotantMonoCol) {
				i++;
				Label monoLabel = new Label {
					BackgroundColor = Color.FromHex ("639630"),
					Text = e,
					TextColor = Color.White,
					XAlign = TextAlignment.Center,
					YAlign = TextAlignment.Center
				};
				monoLabel.GestureRecognizers.Add (monoColTapRecognizer);
				grid.Children.Add (monoLabel, 0, i);
				rowList.Add (e, i - 2);
				
			}
			string[] consotantDiaCol = {"G", "Z", "D", "B","P"} ;
			i = 2;
			int j = 0;
			foreach (string e in consotantDiaCol) {
				i++;
				LetterLabel diaLabel;
				diaLabel = new LetterLabel {
					BackgroundColor = Color.FromHex ("639630"),
					Text = e,
					TextColor = Color.White,
				};
				grid.Children.Add (diaLabel, 6, i);
				if(i!=5)
				{
					diaLabel.GestureRecognizers.Add (diaColTapRecognizer);
					rowList.Add (e+"2", j+6);
					j++;
				}
			}

			i = 0;
			foreach(string e in gRow)
			{
				i++;
				LetterLabel letter= new LetterLabel {
					Text = e,
					FontSize=fontSize
				};
				if (e != "") {
					letter.GestureRecognizers.Add (letterTapRecognizer);
					grid.Children.Add (letter, i, 3);
				}
			}


			//K row

			i = 0;
			foreach(string e in zRow)
			{
				i++;
				if (e != "") {
					LetterLabel letter= new LetterLabel {
						Text = e,
						FontSize=fontSize
					};
					letter.GestureRecognizers.Add (letterTapRecognizer);
					grid.Children.Add (letter, i, 4);
				}
			}
			//S row

			i = 0;
			foreach(string e in dRow)
			{	
				i++;
				if (e != "") {
					string[]strArray=e.Split('/');
					FormattedString fs3=new FormattedString();
					fs3.Spans.Add(new Span(){Text=strArray[0],FontSize=fontSize});
					if(strArray.Length>1)
						fs3.Spans.Add(new Span(){Text="\n"+strArray[1],FontSize=fontSize-5});
					LetterLabel letter = new LetterLabel {
						FormattedText=fs3

					};
					if (i < 7) {
						letter.GestureRecognizers.Add (letterTapRecognizer);
					} else {
						letter.IsEnabled = false;
						letter.TextColor = Color.Gray;
					}
					grid.Children.Add (letter, i, 5);
				}
			}

			//T row

			i = 0;
			foreach(string e in bRow)
			{
				i++;
				if (e != "") {
					LetterLabel letter= new LetterLabel {
						Text = e,
						FontSize=fontSize
					};
					letter.GestureRecognizers.Add (letterTapRecognizer);
					grid.Children.Add (letter, i, 6);
				}
			}
			//N row

			i = 0;
			foreach(string e in pRow)
			{
				i++;
				if (e != "") {
					LetterLabel letter= new LetterLabel {
						Text = e,
						FontSize=fontSize
					};
					letter.GestureRecognizers.Add (letterTapRecognizer);
					grid.Children.Add (letter, i, 7);
				}
			}
			//H row


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

			//Build the page.
			//grid.BackgroundColor=Device.OnPlatform(Color.Black,Color.White,Color.White);
			this.Content = new ScrollView{Content=grid};
			this.Title = "Dakuten Hiragana";

		}
Exemplo n.º 52
0
        private void LoadData()
        {
            StackLayout all = new StackLayout();

            //for title
            all.Children.Add(new Label()
            {
                Text = $"LESSON {lesson.Index}",
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                FontAttributes    = FontAttributes.Bold
            });

            if (!string.IsNullOrWhiteSpace(lesson.ReviewNote))
            {
                all.Children.Add(new Label()
                {
                    Text              = lesson.ReviewNote.ToUpper(),
                    FontAttributes    = FontAttributes.Bold,
                    HorizontalOptions = LayoutOptions.CenterAndExpand
                });
            }

            if (lesson.IsReview)
            {
                contenter.Children.Add(all);
                return;
            }

            StackLayout header1 = new StackLayout()
            {
                Orientation = StackOrientation.Horizontal
            };
            StackLayout header2 = new StackLayout()
            {
                Orientation     = StackOrientation.Vertical,
                WidthRequest    = 60,
                VerticalOptions = LayoutOptions.CenterAndExpand
            };

            header2.Children.Add(new Label()
            {
                Text = "TOPIC:"
            });
            header2.Children.Add(new Label()
            {
                Text = "TEXT:"
            });
            header2.Children.Add(new Label()
            {
                Text = "AIM:"
            });
            header1.Children.Add(header2);

            StackLayout header3 = new StackLayout()
            {
                Orientation     = StackOrientation.Vertical,
                VerticalOptions = LayoutOptions.CenterAndExpand
            };

            header3.Children.Add(new Label()
            {
                Text = lesson.Topic.ToUpper(), FontAttributes = FontAttributes.Bold
            });
            header3.Children.Add(new Label()
            {
                Text = lesson.Text
            });
            header3.Children.Add(new Label()
            {
                Text = lesson.Aim
            });
            header1.Children.Add(header3);

            all.Children.Add(header1);

            //Introduction
            FormattedString intro_format = new FormattedString()
            {
            };

            intro_format.Spans.Add(new Span()
            {
                FontAttributes = FontAttributes.Bold, Text = "INTRODUCTION: \t"
            });
            intro_format.Spans.Add(new Span()
            {
                Text = lesson.Introduction.Paragraphs[0]
            });
            if (lesson.Introduction.Paragraphs.Count() > 1)
            {
                for (int i = 1; i < lesson.Introduction.Paragraphs.Count(); i++)
                {
                    intro_format.Spans.Add(new Span()
                    {
                        Text = $"{Environment.NewLine} \t{lesson.Introduction.Paragraphs[i]}"
                    });
                }
            }
            all.Children.Add(new Label()
            {
                FormattedText = intro_format
            });

            //Lessons
            if (lesson.Sections != null)
            {
                foreach (Section section in lesson.Sections)
                {
                    all.Children.Add(new Label()
                    {
                        Text           = $"{section.Alphabeth}.\t{section.Title} {section.BibleVerse ?? string.Empty}",
                        FontAttributes = FontAttributes.Bold
                    });
                    all.Children.Add(new Label()
                    {
                        Text = section.Body,
                    });

                    if (section.SubSections != null)
                    {
                        foreach (SubSection subsession in section.SubSections)
                        {
                            StackLayout sub_stack = new StackLayout()
                            {
                                Orientation = StackOrientation.Horizontal
                            };
                            sub_stack.Children.Add(new Label()
                            {
                                Text = $"{subsession.Index} \t"
                            });

                            FormattedString sub_session_format = new FormattedString()
                            {
                            };

                            if (!string.IsNullOrWhiteSpace(subsession.Title))
                            {
                                sub_session_format.Spans.Add(new Span()
                                {
                                    FontAttributes = FontAttributes.Italic, Text = $"{subsession.Title} "
                                });
                            }

                            if (!string.IsNullOrWhiteSpace(subsession.MemoryVerse))
                            {
                                sub_session_format.Spans.Add(new Span()
                                {
                                    Text = $"{subsession.MemoryVerse} "
                                });
                            }

                            if (!string.IsNullOrWhiteSpace(subsession.Body))
                            {
                                sub_session_format.Spans.Add(new Span()
                                {
                                    Text = subsession.Body
                                });
                            }

                            sub_stack.Children.Add(new Label()
                            {
                                FormattedText     = sub_session_format,
                                HorizontalOptions = LayoutOptions.StartAndExpand
                            });
                            all.Children.Add(sub_stack);

                            //for RomanSubsession
                            if (subsession.RomanSubSections != null)
                            {
                                foreach (RomanSubSection roman_subsession in subsession.RomanSubSections)
                                {
                                    StackLayout roman_sub_stack = new StackLayout()
                                    {
                                        Orientation = StackOrientation.Horizontal
                                    };
                                    roman_sub_stack.Children.Add(new Label()
                                    {
                                        Text = $"{roman_subsession.RomanIndex} \t"
                                    });
                                    FormattedString roman_sub_session_format = new FormattedString();
                                    if (!string.IsNullOrWhiteSpace(roman_subsession.Title))
                                    {
                                        roman_sub_session_format.Spans.Add(new Span()
                                        {
                                            FontAttributes = FontAttributes.Bold, Text = roman_subsession.Title
                                        });
                                    }

                                    if (!string.IsNullOrWhiteSpace(roman_subsession.BibleVerse))
                                    {
                                        roman_sub_session_format.Spans.Add(new Span()
                                        {
                                            Text = roman_subsession.BibleVerse
                                        });
                                    }

                                    if (!string.IsNullOrWhiteSpace(roman_subsession.Body))
                                    {
                                        roman_sub_session_format.Spans.Add(new Span()
                                        {
                                            Text = roman_subsession.Body
                                        });
                                    }

                                    roman_sub_stack.Children.Add(new Label()
                                    {
                                        FormattedText           = roman_sub_session_format,
                                        HorizontalTextAlignment = TextAlignment.Start,
                                        HorizontalOptions       = LayoutOptions.StartAndExpand
                                    });

                                    all.Children.Add(roman_sub_stack);
                                }
                            }
                        }
                    }
                }
            }

            //Extras

            if (!string.IsNullOrWhiteSpace(lesson.Conclusion))
            {
                FormattedString conclusion_formatted = new FormattedString();

                conclusion_formatted.Spans.Add(new Span()
                {
                    Text           = "CONCLUSION: \t",
                    FontAttributes = FontAttributes.Bold
                });
                conclusion_formatted.Spans.Add(new Span()
                {
                    Text = lesson.Conclusion,
                });
                all.Children.Add(new Label()
                {
                    FormattedText = conclusion_formatted
                });
            }

            if (!string.IsNullOrWhiteSpace(lesson.ClosingRemarks))
            {
                FormattedString closing_formatted = new FormattedString();
                closing_formatted.Spans.Add(new Span()
                {
                    Text           = "CLOSING REMARKS: \t",
                    FontAttributes = FontAttributes.Bold
                });
                closing_formatted.Spans.Add(new Span()
                {
                    Text = lesson.ClosingRemarks,
                });
                all.Children.Add(new Label()
                {
                    FormattedText = closing_formatted
                });
            }
            if (!string.IsNullOrWhiteSpace(lesson.MemoryVerse))
            {
                FormattedString memory_formatted = new FormattedString();
                memory_formatted.Spans.Add(new Span()
                {
                    Text           = "MEMORY VERSE: \t",
                    FontAttributes = FontAttributes.Bold
                });
                memory_formatted.Spans.Add(new Span()
                {
                    Text = lesson.MemoryVerse,
                });
                all.Children.Add(new Label()
                {
                    FormattedText = memory_formatted
                });
            }
            if (!string.IsNullOrWhiteSpace(lesson.Challenge))
            {
                FormattedString challenge_formatted = new FormattedString();
                challenge_formatted.Spans.Add(new Span()
                {
                    Text           = "CHALLENGE: \t",
                    FontAttributes = FontAttributes.Bold
                });
                challenge_formatted.Spans.Add(new Span()
                {
                    Text = lesson.Challenge,
                });
                all.Children.Add(new Label()
                {
                    FormattedText = challenge_formatted
                });
            }

            contenter.Children.Add(all);
        }
Exemplo n.º 53
0
		void showToolBar()
		{
			int fontSize;

			addHeadings();
			int k=0, r=2;
			if (mode == "Transcription Katakana") 
			{
				int[] tfontSize = new int[]{15,10,13,9};

				if (Device.Idiom == TargetIdiom.Tablet) {
					tfontSize = new int[]{30,20,25,18};
				}
				r = 1;
				fontSize = 15;
				if (romajiMode == false) {
					char[] splitters = new char[]{ '/', '\n'};
					foreach (string[]rows in rowArray) {
						k = 1;
						foreach (string e in rows) {
							if (!string.IsNullOrEmpty (e)) {
								if (e.Length > 0 && e != "b") {
									string[] strArray = e.Split (splitters);
									FormattedString fs = new FormattedString ();
									for (int l = 0; l < strArray.Length; l++) {
										fs.Spans.Add (new Span { Text = strArray [l] + "\n", FontSize = tfontSize [l] });
									}
									LetterLabel letter = new LetterLabel {
										FontSize = fontSize,
										FormattedText = fs,
									};
									grid.Children.Add (letter, k, r);
								}
							}
							k++;
						}
						r++;
					}
				} else {
					foreach (string[]rows in kanaArray) {
						k = 1;
						foreach (string e in rows) {
							
							if (!string.IsNullOrEmpty (e)) {
								if (e.Length > 0 && e != "b") {
									string[] strArray = e.Split ('\n');
									FormattedString fs = new FormattedString ();
									for (int l = 0; l < strArray.Length; l++) {
										fs.Spans.Add (new Span { Text = strArray [l] + "\n", FontSize = tfontSize [l] });
									}
									LetterLabel letter = new LetterLabel {
										FontSize = fontSize,
										FormattedText = fs,
									};
									grid.Children.Add (letter, k, r);
								}
							}
							k++;
						}
						r++;
					}
				}
			} else {
				if (romajiMode == false) {
					fontSize = 15;
					foreach (string[]rows in rowArray) {
						k = 1;
						foreach (string e in rows) {

							LetterLabel letter = new LetterLabel {
								FontSize = fontSize,
								Text = e,
							};

							if (e != "" && e != "b") {
								if (r == rowArray.Count + 1 && monoMode == true && (mode == "Basic Hiragana" || mode == "Basic Katakana"))
									grid.Children.Add (letter, 0, 1, r, r + 1);
								else
									grid.Children.Add (letter, k, r);
							}
							k++;
						}
						r++;
					}
				} else if (romajiMode == true) {
				
					fontSize = 30;
					foreach (string[]rows in kanaArray) {
						k = 1;
						foreach (string e in rows) {
							LetterLabel letter = new LetterLabel {
								Text = e,
								FontSize = fontSize
							};

							if (e != "" && e != "b") {
								if (r == kanaArray.Count + 1 && monoMode == true && (mode == "Basic Hiragana" || mode == "Basic Katakana"))
									grid.Children.Add (letter, 0, 1, r, r + 1);
								else
									grid.Children.Add (letter, k, r);
							}
							k++;
						}
						r++;
					}
				}
			}
		}
Exemplo n.º 54
0
        protected override void Init()
        {
            var formattedString = new FormattedString();

            formattedString.Spans.Add(new Span {
                Text = "RTL formatted text"
            });

            Content = new StackLayout()
            {
                Margin = 20,

                Children =
                {
                    new Label()
                    {
                        AutomationId            = "Issue3311Label",
                        Text                    = "This test passes if all proceeding labels are properly right-aligned",
                        HorizontalTextAlignment = TextAlignment.Center,
                        FontSize                = 20
                    },
                    new Label()
                    {
                        AutomationId  = "Issue3311NormalTextLabel",
                        Text          = "RTL normal text",
                        FlowDirection = FlowDirection.RightToLeft,

                        BackgroundColor         = Colors.Red,
                        HeightRequest           = 100,
                        LineBreakMode           = LineBreakMode.WordWrap,
                        Margin                  = 20,
                        MaxLines                = 1,
                        Opacity                 = 50,
                        Padding                 = 5,
                        TextDecorations         = TextDecorations.Underline,
                        VerticalTextAlignment   = TextAlignment.Center,
                        FontAttributes          = FontAttributes.Bold,
                        FontSize                = 20,
                        LineHeight              = 3,
                        TextColor               = Colors.Blue,
                        TextTransform           = TextTransform.Uppercase,
                        TextType                = TextType.Html,
                        HorizontalTextAlignment = TextAlignment.Start
                    },
                    new Label()
                    {
                        AutomationId  = "Issue3311FormattedTextLabel",
                        FormattedText = formattedString,
                        FlowDirection = FlowDirection.RightToLeft,

                        BackgroundColor         = Colors.Yellow,
                        HeightRequest           = 100,
                        LineBreakMode           = LineBreakMode.WordWrap,
                        Margin                  = 20,
                        MaxLines                = 1,
                        Opacity                 = 50,
                        Padding                 = 5,
                        TextDecorations         = TextDecorations.Underline,
                        VerticalTextAlignment   = TextAlignment.Center,
                        FontAttributes          = FontAttributes.Bold,
                        FontSize                = 20,
                        LineHeight              = 3,
                        TextColor               = Colors.Blue,
                        TextTransform           = TextTransform.Uppercase,
                        HorizontalTextAlignment = TextAlignment.Start
                    }
                }
            };
        }
Exemplo n.º 55
0
        public layoutminicomentario()
        {
            string foto = new Fotos ().fotoaleatoria();

            this.BackgroundColor = Color.FromRgb (190, 190, 190);

            this.Padding = new Thickness (3, 3, 3, 3);
            var imgfoto = new Image () {
                Source = ImageSource.FromResource (foto),
                Aspect = Aspect.AspectFill
            };

            this.Children.Add (imgfoto,
                Constraint.Constant (2),
                Constraint.Constant (2),
                Constraint.RelativeToParent ((Parent) => {
                    return 50;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 50;
                }));

            StackLayout labeltit = new StackLayout ();

            Label label = new Label () {
                FontSize=12
            };
            label.HorizontalOptions = LayoutOptions.FillAndExpand;
            label.XAlign = TextAlignment.Start;

            var fs = new FormattedString ();

            Span sp1 = new Span () {
                Text = "#ShielEnsony",
                FontAttributes = FontAttributes.Bold,
                FontSize=12
            };
            fs.Spans.Add (sp1);
            Span sp2 = new Span () {
                Text = "\n bit.ly ",
                FontSize=12
            };
            fs.Spans.Add (sp2);
            Span sp3 = new Span () {
                Text = "\nEl nuevo inhumano se enamor...",
                FontSize=12
            };
            fs.Spans.Add (sp3);
            label.FormattedText = fs;

            labeltit.Children.Add (label);

            Label tiempo = new Label () {
                Text = "El 2 de noviembre a las 8:33 p.m.",
                TextColor = Color.Gray,
                FontSize=8
            };
            labeltit.Children.Add (tiempo);

            this.Children.Add (labeltit,
                Constraint.Constant (57),
                Constraint.Constant (2),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width - 57;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 60;
                }));
        }
Exemplo n.º 56
0
        public void Init()
        {
            var enabledFs  = new FormattedString();
            var statusSpan = new Span {
                Text = string.Concat(AppResources.Status, " ")
            };

            enabledFs.Spans.Add(statusSpan);
            enabledFs.Spans.Add(new Span
            {
                Text            = AppResources.Enabled,
                ForegroundColor = Color.Green,
                FontAttributes  = FontAttributes.Bold,
                FontSize        = Device.GetNamedSize(NamedSize.Medium, typeof(Label))
            });

            var statusEnabledLabel = new Label
            {
                FormattedText           = enabledFs,
                HorizontalTextAlignment = TextAlignment.Center,
                LineBreakMode           = LineBreakMode.WordWrap,
                FontSize        = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                TextColor       = Color.Black,
                VerticalOptions = LayoutOptions.CenterAndExpand
            };

            var disabledFs = new FormattedString();

            disabledFs.Spans.Add(statusSpan);
            disabledFs.Spans.Add(new Span
            {
                Text            = AppResources.Disabled,
                ForegroundColor = Color.FromHex("c62929"),
                FontAttributes  = FontAttributes.Bold,
                FontSize        = Device.GetNamedSize(NamedSize.Medium, typeof(Label))
            });

            var statusDisabledLabel = new Label
            {
                FormattedText           = disabledFs,
                HorizontalTextAlignment = TextAlignment.Center,
                LineBreakMode           = LineBreakMode.WordWrap,
                FontSize  = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                TextColor = Color.Black
            };

            var enableImage = new CachedImage
            {
                Source            = "autofill_enable.png",
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                WidthRequest      = 300,
                HeightRequest     = 118
            };

            var useImage = new CachedImage
            {
                Source            = "autofill_use.png",
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                WidthRequest      = 300,
                HeightRequest     = 128
            };

            var goButton = new ExtendedButton
            {
                Text    = AppResources.BitwardenAutofillServiceOpenAutofillSettings,
                Command = new Command(() =>
                {
                    _googleAnalyticsService.TrackAppEvent("OpenAutofillSettings");
                    _deviceActionService.OpenAutofillSettings();
                }),
                VerticalOptions   = LayoutOptions.End,
                HorizontalOptions = LayoutOptions.Fill,
                Style             = (Style)Application.Current.Resources["btn-primary"]
            };

            DisabledStackLayout = new StackLayout
            {
                Children        = { BuildServiceLabel(), statusDisabledLabel, enableImage, goButton },
                Orientation     = StackOrientation.Vertical,
                Spacing         = 20,
                Padding         = new Thickness(20, 30),
                VerticalOptions = LayoutOptions.FillAndExpand
            };

            EnabledStackLayout = new StackLayout
            {
                Children        = { BuildServiceLabel(), statusEnabledLabel, useImage },
                Orientation     = StackOrientation.Vertical,
                Spacing         = 20,
                Padding         = new Thickness(20, 30),
                VerticalOptions = LayoutOptions.FillAndExpand
            };

            ScrollView = new ScrollView {
                Content = DisabledStackLayout
            };
            Title   = AppResources.AutofillService;
            Content = ScrollView;
        }
Exemplo n.º 57
0
        public LayoutAmigos()
        {
            this.BackgroundColor = Color.White;
            this.Padding = new Thickness (3, 3, 3, 3);

            string foto = new Fotos ().fotoaleatoria();

            var imgfoto = new Image () {
                Source = ImageSource.FromResource (foto),
                Aspect = Aspect.AspectFill
            };

            this.Children.Add (imgfoto,
                Constraint.Constant (0),
                Constraint.Constant (2),
                Constraint.RelativeToParent ((Parent) => {
                    return 50;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 50;
                }));

            StackLayout labeltit = new StackLayout ();

            Label label = new Label () {
                FontSize=12
            };
            label.HorizontalOptions = LayoutOptions.FillAndExpand;
            label.XAlign = TextAlignment.Start;

            var fs = new FormattedString ();

            Span sp1 = new Span () {
                Text = "Jonatahan Ivan Vargas Gómez",
                FontAttributes = FontAttributes.Bold,
                FontSize=12
            };
            fs.Spans.Add (sp1);
            label.FormattedText = fs;
            labeltit.Children.Add (label);

            this.Children.Add (labeltit,
                Constraint.Constant (55),
                Constraint.Constant (2),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width - 55;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 50;
                }));

            ExtendedButton btnconfirmar = new ExtendedButton () {
                Text = "Confirmar",
                TextColor = Color.White,
                BackgroundColor = Color.FromRgb(96, 178, 54)
            };

            this.Children.Add (btnconfirmar,
                Constraint.Constant (55),
                Constraint.Constant (20),
                Constraint.RelativeToParent ((Parent) => {
                    return (Parent.Width - 55)/2-10;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 30;
                }));

            ExtendedButton btneliminar = new ExtendedButton () {
                Text = "Eliminar",
                TextColor = Color.White,
                BackgroundColor = Color.FromRgb(96, 178, 54)
            };

            this.Children.Add (btneliminar,
                Constraint.RelativeToParent ((Parent) => {
                    return (Parent.Width - 55)/2+55;
                }),
                Constraint.Constant (20),
                Constraint.RelativeToParent ((Parent) => {
                    return (Parent.Width - 55)/2-10;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 30;
                }));
        }
Exemplo n.º 58
0
        public void ShowComments()
        {
            try
            {
                comments = new List <Comment>();
                //comments = CommentsService.GetAll(relatedId);
                comments = CommentsService.client.ListByObjectUserComments(relatedId, modelProperties: new ProjectInsight.Models.Base.ModelProperties("default,UserCreated;User:FirstName,LastName,Name,CreatedDateTimeUTC,PhotoUrl,AvatarHtml"));
                if (comments.Count == 0)
                {
                    return;
                }
                if (comments.Count > 4)
                {
                    btnSeeAll.IsVisible = true;
                }
                else
                {
                    btnSeeAll.IsVisible = false;
                }

                viewModel.Comments = new ObservableCollection <Comment>(comments.Take(4));

                if (slComments.Children.Count > 0)
                {
                    slComments.Children.Clear();
                }


                foreach (Comment item in viewModel.Comments)
                {
                    string body = item.CommentBody;
                    body = item.CommentBodyRendered;
                    while (body.Contains("display:none"))
                    {
                        int from = body.Substring(0, body.IndexOf("display:none")).LastIndexOf("<");
                        int to   = body.IndexOf(">", body.IndexOf("display:none;\">") + 15) + 1;
                        body = body.Substring(0, from) + body.Substring(to);
                    }
                    string commentBody = Regex.Replace(body, "<.*?>", String.Empty);
                    commentBody = commentBody.Replace("&nbsp;", " ");
                    bool isCommentCut = false;
                    if (commentBody.Length > 100)
                    {
                        commentBody  = commentBody.Substring(0, 100) + "...";
                        isCommentCut = true;
                    }

                    var grid = new Grid();
                    grid.RowDefinitions.Add(new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    });
                    grid.ColumnDefinitions.Add(new ColumnDefinition {
                        Width = new GridLength(50)
                    });
                    grid.ColumnDefinitions.Add(new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    });
                    grid.Margin = new Thickness(0, 4, 0, 4);

                    StackLayout slImage = new StackLayout();
                    slImage.Margin            = 0;
                    slImage.Spacing           = 0;
                    slImage.Padding           = 0;
                    slImage.VerticalOptions   = LayoutOptions.Start;
                    slImage.HorizontalOptions = LayoutOptions.Start;

                    Label lblUserId = new Label();
                    lblUserId.IsVisible = false;
                    lblUserId.Text      = item.UserCreated.Id.ToString();
                    lblUserId.Margin    = 0;
                    slImage.Children.Add(lblUserId);
                    var imageGestureRecognizer = new TapGestureRecognizer();
                    imageGestureRecognizer.Tapped += (s, e) =>
                    {
                        StackLayout sl  = (StackLayout)s;
                        Label       lbl = (Label)sl.Children[0];
                        Navigation.PushAsync(new UserProfile(new Guid(lbl.Text)));
                    };
                    slImage.GestureRecognizers.Add(imageGestureRecognizer);

                    if (!string.IsNullOrEmpty(item.UserCreated.PhotoUrl))
                    {
                        Image photo = new Image();
                        photo.Source            = ImageSource.FromUri(new Uri(Common.CurrentWorkspace.WorkspaceURL + item.UserCreated.PhotoUrl));
                        photo.HeightRequest     = 50;
                        photo.WidthRequest      = 50;
                        photo.HorizontalOptions = LayoutOptions.Start;
                        photo.VerticalOptions   = LayoutOptions.Start;



                        slImage.Children.Add(photo);
                        grid.Children.Add(slImage, 0, 0);
                    }
                    else
                    {
                        if (item.UserCreated.AvatarHtml != String.Empty)
                        {
                            //userHTML = "<style>.user-avatar {font-family: 'Open Sans',segoe ui,verdana,helvetica;width: 60px!important;height: 60px!important;border-radius: 2px;line-height: 60px!important;font-size: 32px!important;color: #fff;text-align: center;margin: 0 !important;vertical-align: middle;overflow: hidden;cursor: pointer;display: inline-block;}</style>";
                            //userHTML += item.UserCreated.AvatarHtml;


                            string       myDiv = item.UserCreated.AvatarHtml;
                            HtmlDocument doc   = new HtmlDocument();
                            doc.LoadHtml(myDiv);
                            HtmlNode node           = doc.DocumentNode.SelectSingleNode("div");
                            string   AvatarInitials = "PI";
                            string   AvatarColor    = "#fff";
                            string   PhotoURL       = string.Empty;

                            if (node != null)
                            {
                                AvatarInitials = (node.ChildNodes[0]).OuterHtml;
                                foreach (HtmlAttribute attr in node.Attributes)
                                {
                                    if (attr.Name.ToLower() == "style")
                                    {
                                        string[] parts = attr.Value.Split('#');
                                        if (parts != null && parts.Length > 1)
                                        {
                                            AvatarColor = parts[1];
                                        }
                                    }
                                }
                            }


                            slImage.BackgroundColor = Color.FromHex(AvatarColor);

                            Label lbInitials = new Label();
                            lbInitials.HeightRequest     = 50;
                            lbInitials.WidthRequest      = 50;
                            lbInitials.HorizontalOptions = LayoutOptions.CenterAndExpand;

                            lbInitials.HorizontalTextAlignment = TextAlignment.Center;
                            lbInitials.VerticalTextAlignment   = TextAlignment.Center;
                            lbInitials.TextColor     = Color.White;
                            lbInitials.Text          = AvatarInitials;
                            lbInitials.FontSize      = 26;
                            lbInitials.LineBreakMode = LineBreakMode.NoWrap;
                            if (Device.RuntimePlatform.ToLower() == "android")
                            {
                                lbInitials.FontFamily = "OpenSans-SemiBold.ttf#Open Sans";
                            }
                            else
                            {
                                lbInitials.FontFamily = "OpenSans-SemiBold";
                            }
                            slImage.Children.Add(lbInitials);

                            grid.Children.Add(slImage, 0, 0);
                        }
                    }

                    Frame frmBody = new Frame()
                    {
                        HasShadow         = false,
                        Padding           = 5,
                        Margin            = new Thickness(0, 0, 0, 0),
                        CornerRadius      = 5,
                        BackgroundColor   = (Color)Application.Current.Resources["LightBackgroundColor"],
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        VerticalOptions   = LayoutOptions.FillAndExpand
                    };



                    StackLayout slBody = new StackLayout();
                    slBody.VerticalOptions   = LayoutOptions.FillAndExpand;
                    slBody.HorizontalOptions = LayoutOptions.FillAndExpand;
                    slBody.Orientation       = StackOrientation.Vertical;
                    slBody.Margin            = 0;
                    slBody.Spacing           = 0;
                    slBody.Padding           = 0;


                    Label lblId = new Label();
                    lblId.IsVisible = false;
                    lblId.Text      = item.Id.ToString();
                    lblId.Margin    = 0;


                    var tapGestureRecognizer = new TapGestureRecognizer();
                    tapGestureRecognizer.Tapped += (s, e) =>
                    {
                        StackLayout sl  = (StackLayout)s;
                        Label       lbl = (Label)sl.Children[0];
                        OpenAllComments(lbl.Text);
                    };
                    slBody.GestureRecognizers.Add(tapGestureRecognizer);


                    Label lblName = new Label();
                    lblName.FontSize = 16;
                    lblName.HorizontalTextAlignment = TextAlignment.Start;
                    lblName.HorizontalOptions       = LayoutOptions.FillAndExpand;
                    lblName.VerticalTextAlignment   = TextAlignment.Start;
                    lblName.TextColor      = (Color)Application.Current.Resources["BlackTextColor"];
                    lblName.FontAttributes = FontAttributes.Bold;
                    lblName.LineBreakMode  = LineBreakMode.NoWrap;
                    lblName.Margin         = 0;
                    lblName.Text           = item.UserCreated.Name;
                    if (Device.RuntimePlatform.ToLower() == "android")
                    {
                        lblName.FontFamily = "OpenSans-SemiBold.ttf#Open Sans";
                    }
                    else
                    {
                        lblName.FontFamily = "OpenSans-SemiBold";
                    }



                    Label lblBody = new Label();
                    lblBody.FontSize = 14;
                    lblBody.HorizontalTextAlignment = TextAlignment.Start;
                    lblBody.VerticalOptions         = LayoutOptions.FillAndExpand;
                    lblBody.HorizontalOptions       = LayoutOptions.FillAndExpand;
                    lblBody.VerticalTextAlignment   = TextAlignment.Start;

                    lblBody.LineBreakMode = LineBreakMode.WordWrap;
                    lblBody.Margin        = 0;
                    if (Device.RuntimePlatform.ToLower() == "android")
                    {
                        lblBody.FontFamily = "OpenSans-Regular.ttf#Open Sans";
                    }
                    else
                    {
                        lblBody.FontFamily = "OpenSans-Regular";
                    }

                    FormattedString fs = new FormattedString();

                    Span spBody = new Span();
                    spBody.TextColor = (Color)Application.Current.Resources["BlackTextColor"];
                    spBody.Text      = commentBody;
                    fs.Spans.Add(spBody);

                    if (isCommentCut)
                    {
                        Span spSeeMore = new Span();
                        spSeeMore.Text      = " See More";
                        spSeeMore.TextColor = (Color)Application.Current.Resources["DarkGrayTextColor"];
                        fs.Spans.Add(spSeeMore);
                    }
                    lblBody.FormattedText = fs;


                    if (Device.RuntimePlatform.ToLower() == "android")
                    {
                        lblBody.FontFamily = "OpenSans-Regular.ttf#Open Sans";
                    }
                    else
                    {
                        lblBody.FontFamily = "OpenSans-Regular";
                    }

                    slComments.Children.Add(grid);
                    grid.Children.Add(frmBody, 1, 0);
                    frmBody.Content = slBody;
                    slBody.Children.Add(lblId);
                    slBody.Children.Add(lblName);
                    slBody.Children.Add(lblBody);
                }
            }
            catch (Exception ex)
            {
                //return null;
            }
        }
Exemplo n.º 59
0
		public TranKata (string romajiMode)
		{
			rowArray=new List<string[]>();
			drillCount = 212;
			rowCount = 54;
			NavigationPage.SetBackButtonTitle (this, "Table");
			//kana variables
			this.romajiM=romajiMode;

			int i=0;
			foreach(string[] e in rowData)
			{
				if (romajiMode == "Show Romaji") {
					rowData [i] = vRowData [i];
				}
				rowArray.Add (rowData [i]);
				i++;
				
			}

			//Study Button
			ToolbarItem itemStudy = new ToolbarItem {
				Text = "Study",
				Order = ToolbarItemOrder.Primary,
				Command = new Command (() => showStudyPage("Transcr. Katakana"))
			};
			ToolbarItems.Add(itemStudy);
			ToolbarItem itemCollapse;
			if (romajiMode == "Hide Romaji") {
				itemCollapse = new ToolbarItem {
					Icon = "uncollapse.png",
					Order = ToolbarItemOrder.Primary,
					Command = new Command (() => switchMode(romajiMode))
				};
				ToolbarItems.Add(itemCollapse);
			}
			else{
				itemCollapse = new ToolbarItem {
					Icon = "collapse.png",
					Order = ToolbarItemOrder.Primary,
					Command = new Command (() => switchMode(romajiMode))
				};
				ToolbarItems.Add(itemCollapse);
			}
				
			grid = new Grid {
				VerticalOptions = LayoutOptions.Fill,
				HorizontalOptions=LayoutOptions.Fill,
				RowDefinitions = {
					new RowDefinition { Height = GridLength.Auto },
					new RowDefinition { Height = GridLength.Auto },
					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 (3, GridUnitType.Star) },
					new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) },
					new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) },
					new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) },
					new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) },
					new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) },
					new ColumnDefinition { Width = new GridLength (1, GridUnitType.Star) },
					new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) },
					new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) },
				}
			};
			 

			// Tap recognizers for letters
			var letterTapRecognizer = new TapGestureRecognizer();
			//Display study page for each kana
			letterTapRecognizer.Tapped += (s, e) => {
				string kana=((Label)s).FormattedText.ToString();
				Navigation.PushAsync (new Study (Character.cData[Character.kana_lookup(kana.Split('\n')[0])],this,0,1){ });
			};

			var monoColTapRecognizer = new TapGestureRecognizer();
			monoColTapRecognizer.Tapped += (s, e) => {
				StudyCarousel studyPage = new StudyCarousel (((Label)s).Text+" Row");
				rowCount=rowList[((Label)s).Text];
				drillCount=rowCount*4;
				addDrill();
				addRow (studyPage);
				studyPage.Children.Add(drillList[0]);
				drillList.RemoveAt(0);
				Navigation.PushAsync (studyPage);
			};
				
			grid.ColumnSpacing = 1;
			grid.RowSpacing = 1;
			Label headerLabel = new Label () {
				Text = "\u2022Tap \"Study\" to begin\n\u2022Tap consonants to select specific rows to study\n\u2022Tap kana to study specific characters\n\u2022Use bracketed romaji for keyboard input\n\u2022Alternative kana spellings in parentheses\n",
				TextColor = Color.Gray,
				XAlign = TextAlignment.Start,
				FontSize=12,
			};
			grid.Children.Add (headerLabel, 0, 9, 0, 1);
			int j = 0;
			string[] vowelRow = {"","A", "I", "U", "E", "O","","YU","YE"} ;
			foreach (string e in vowelRow) 
			{
				if (e.Length > 0) {
					grid.Children.Add (new LetterLabel {
						BackgroundColor = Color.FromHex ("639630"),
						Text = e,
						TextColor = Color.White,
					}, j, 1);
				}
				j++;
			}
			string[] consotantMonoCol = {"Kw", "S", "Z", "T","Ts","D","F","Y","W","V"} ;
			j = 1;
			foreach (string e in consotantMonoCol) {
				j++;
				Label monoLabel = new Label {
					BackgroundColor = Color.FromHex ("639630"),
					Text = e,
					TextColor = Color.White,
					XAlign = TextAlignment.Center,
					YAlign = TextAlignment.Center
				};
				monoLabel.GestureRecognizers.Add (monoColTapRecognizer);
				grid.Children.Add (monoLabel, 0, j);
				rowList.Add (e, j +52);
				
			}

			int r = 2;
			int[] fontSize = new int[]{15,10,13,9};

			if (Device.Idiom == TargetIdiom.Tablet) {
				 fontSize = new int[]{30,20,25,18};
			}
			foreach(string[]rows in rowArray)
			{
				j = 0;
				foreach(string e in rows)
				{
					j++;
					char[] splitters = new char[]{ '/', '\n'};
				//	string replacement =e.Replace('/','\n');
					string [] strArray=e.Split (splitters);
					FormattedString fs=new FormattedString();
					for (int k = 0; k < strArray.Length; k++) {
						fs.Spans.Add (new Span { Text = strArray [k]+"\n", FontSize = fontSize[k] });
						
					}

					Label letter= new LetterLabel {
						FormattedText=fs,
					};
					if (e != "") {
						letter.GestureRecognizers.Add (letterTapRecognizer);
						grid.Children.Add (letter, j, r);
					}
				}
				r++;
			}
			//Accomodate iPhone status bar.
			this.Padding = new Thickness(5, Device.OnPlatform(0, 0, 0), 5, 0);
			this.Content = new ScrollView{Content=grid};
			this.Title = "Transcr. Katakana";

		}
Exemplo n.º 60
0
        public static SpannableString ToSpannableString(this FormattedString formattedString, IFontManager fontManager, TextPaint?textPaint = null, Context?context = null, double defaultLineHeight = 0d, TextAlignment defaultHorizontalAlignment = TextAlignment.Start, Font?defaultFont = null, Graphics.Color?defaultColor = null, TextTransform defaultTextTransform = TextTransform.Default)
        {
            if (formattedString == null)
            {
                return(new SpannableString(string.Empty));
            }

            var defaultFontSize = defaultFont?.Size ?? fontManager.DefaultFontSize;

            var builder = new StringBuilder();

            for (int i = 0; i < formattedString.Spans.Count; i++)
            {
                Span span = formattedString.Spans[i];

                var transform = span.TextTransform != TextTransform.Default ? span.TextTransform : defaultTextTransform;

                var text = TextTransformUtilites.GetTransformedText(span.Text, transform);
                if (text == null)
                {
                    continue;
                }

                builder.Append(text);
            }

            var spannable = new SpannableString(builder.ToString());

            var c = 0;

            for (int i = 0; i < formattedString.Spans.Count; i++)
            {
                Span span = formattedString.Spans[i];
                var  text = span.Text;
                if (text == null)
                {
                    continue;
                }

                int start = c;
                int end   = start + text.Length;
                c = end;

                var fgcolor = span.TextColor ?? defaultColor;
                if (fgcolor != null)
                {
                    spannable.SetSpan(new ForegroundColorSpan(fgcolor.ToPlatform()), start, end, SpanTypes.InclusiveExclusive);
                }

                if (span.BackgroundColor != null)
                {
                    spannable.SetSpan(new BackgroundColorSpan(span.BackgroundColor.ToPlatform()), start, end, SpanTypes.InclusiveExclusive);
                }

                var lineHeight = span.LineHeight >= 0
                                        ? span.LineHeight
                                        : defaultLineHeight;

                if (lineHeight >= 0)
                {
                    spannable.SetSpan(new LineHeightSpan(textPaint, lineHeight), start, end, SpanTypes.InclusiveExclusive);
                }

                var font = span.ToFont(defaultFontSize);
                if (font.IsDefault && defaultFont.HasValue)
                {
                    font = defaultFont.Value;
                }

                if (!font.IsDefault)
                {
                    spannable.SetSpan(
                        new FontSpan(font, context, span.CharacterSpacing.ToEm(), defaultHorizontalAlignment, fontManager),
                        start,
                        end,
                        SpanTypes.InclusiveInclusive);
                }

                if (span.IsSet(Span.TextDecorationsProperty))
                {
                    spannable.SetSpan(new TextDecorationSpan(span), start, end, SpanTypes.InclusiveInclusive);
                }
            }
            return(spannable);
        }