Exemple #1
0
    void UpdateUi(cxEditor view)
    {
        try{
            if (!string.IsNullOrEmpty(view.FontFamily))
            {
                string filename = view.FontFamily;

                if (filename.LastIndexOf(".", System.StringComparison.Ordinal) != filename.Length - 4)
                {
                    filename = string.Format("{0}.ttf", filename);
                }

                Control.Typeface = TrySetFont(filename);
            }

            if (view.FontSize > 0)
            {
                Control.TextSize = (float)view.FontSize;
            }

            if (view.TextColor != Xamarin.Forms.Color.Default)
            {
                Control.SetTextColor(view.TextColor.ToAndroid());
            }

            switch (view.Alignment)
            {
            case Xamarin.Forms.TextAlignment.Center:
                Control.Gravity = GravityFlags.CenterHorizontal;
                break;

            case Xamarin.Forms.TextAlignment.End:
                Control.Gravity = GravityFlags.End;
                break;

            case Xamarin.Forms.TextAlignment.Start:
                Control.Gravity = GravityFlags.Start;
                break;
            }
        }
        catch (System.Exception ex)
        {
            Insights.Send("UpdateUi", ex);
        }
    }
Exemple #2
0
    private void UpdateUi(cxEditor view)
    {
        try{
            if (view.FontSize > 0)
            {
                this.Control.Font = UIFont.FromName(this.Control.Font.Name, (float)view.FontSize);
            }

            if (!string.IsNullOrEmpty(view.FontFamily))
            {
                var fontName = Path.GetFileNameWithoutExtension(view.FontFamily);

                var font = UIFont.FromName(fontName, this.Control.Font.PointSize);

                if (font != null)
                {
                    this.Control.Font = font;
                }
            }

            if (view.TextColor != Xamarin.Forms.Color.Default)
            {
                Control.TextColor = view.TextColor.ToUIColor();
            }

            switch (view.Alignment)
            {
            case TextAlignment.Center:
                Control.TextAlignment = UITextAlignment.Center;
                break;

            case TextAlignment.End:
                Control.TextAlignment = UITextAlignment.Right;
                break;

            case TextAlignment.Start:
                Control.TextAlignment = UITextAlignment.Left;
                break;
            }
        }
        catch (System.Exception ex)
        {
            Insights.Send("UpdateUi", ex);
        }
    }
Exemple #3
0
    private void SetView(cxEditor view)
    {
        try{
            if (view == null)
            {
                return;
            }

            if (view != null)
            {
                this.UpdateUi(view);
                LayoutSubviews();
                return;
            }
            LayoutSubviews();
        }
        catch (System.Exception ex)
        {
            Insights.Send("SetView", ex);
        }
    }