async void AddPhoto_Clicked(object sender, EventArgs e)
        {
            var image = await MediaPlugin.AddPhoto();

            if (image != null)
            {
                image.HeightRequest = 160;
                image.WidthRequest  = 120;
            }
        }
示例#2
0
        public DescriptionParser ParseBody()
        {
            this.inlines.Clear();
            var index = 0;

            while (index < this.lines.Length && string.IsNullOrWhiteSpace(this.lines[index]))
            {
                index++;
            }
            var uriParser = new Parsers.UriParser();

            for (var i = index; i < this.lines.Length; i++)
            {
                var line = this.lines[i];
                if (string.IsNullOrWhiteSpace(line))
                {
                    this.AddLineBreak();
                }
                else
                {
                    this.isLastLineBreak = false;
                    var range = line.AsRange();
                    var trim  = range.Trim();
                    if (trim.All(z => z == '-'))
                    {
                        this.inlines.Add(this.Line());
                    }
                    else if (trim.StartsWith('#'))
                    {
                        var count = trim.TakeWhile(z => z == '#').Count();
                        count = Math.Min(6, count);
                        this.AddHeader(count, trim.SubRange(count).ToString());
                    }
                    else if (trim.StartsWith("{{") && trim.EndsWith("}}"))
                    {
                        var header = trim.SubRange(2, trim.Length - 4).ToString();
                        var plugin = GalleryPlugin.TryCreate(header) ?? MediaPlugin.TryCreate(header);
                        if (plugin != null)
                        {
                            var end = i + 1;
                            for (; end < this.lines.Length; end++)
                            {
                                if (this.lines[end].AsRange().Trim() == "{{}}")
                                {
                                    break;
                                }
                            }
                            this.inlines.AddRange(plugin.ParseLine(this.lines.Skip(i + 1).Take(end - i - 1).ToArray()));
                            i = end;
                            this.AddLineBreak();
                        }
                    }
                    else
                    {
                        var uri = uriParser.TryParse(trim.ToString());
                        if (uri != null)
                        {
                            this.inlines.Add(this.Hyperlink(uri.Uri, uri.Name));
                        }
                        else
                        {
                            this.inlines.Add(new Run(trim.InsertToEnd(' ').GetString()));
                        }
                    }
                }
            }

            return(this);
        }
示例#3
0
 public SongTitleSet(MediaPlugin mediaPlugin)
 {
     Plugin = mediaPlugin;
 }
示例#4
0
 public SongAlbumSet(MediaPlugin mediaPlugin)
 {
     Plugin = mediaPlugin;
 }
示例#5
0
 public MusicAdapter(MediaPlugin mediaPlugin)
 {
     MediaPlugin = mediaPlugin;
 }
 public SongGenreSet(MediaPlugin mediaPlugin)
 {
     Plugin = mediaPlugin;
 }
示例#7
0
 public VideoTitleSet(MediaPlugin mediaPlugin)
 {
     Plugin = mediaPlugin;
 }
示例#8
0
 public SongArtistSet(MediaPlugin mediaPlugin)
 {
     Plugin = mediaPlugin;
 }
示例#9
0
 public VideoAdapter(MediaPlugin mediaPlugin)
 {
     _mediaPlugin = mediaPlugin;
 }