Beispiel #1
0
        private void TypePlaySongImage_Tapped(object sender, EventArgs e)
        {
            var viewModel = DataSource;

            switch (viewModel.TypePlayMusic)
            {
            case TYPE_PLAY_MUSIC.PLAY_REPEAT_ALL:
            {
                viewModel.TypePlayMusic  = TYPE_PLAY_MUSIC.PLAY_REPEAT_ONE;
                TypePlaySongImage.Source = SvgImageSource.FromResource("NuMusic.Resources.Svg.icon_play_repeat1.svg");
                break;
            }

            case TYPE_PLAY_MUSIC.PLAY_REPEAT_ONE:
            {
                viewModel.TypePlayMusic  = TYPE_PLAY_MUSIC.PLAY_RANDOM;
                TypePlaySongImage.Source = SvgImageSource.FromResource("NuMusic.Resources.Svg.icon_play_random.svg");
                break;
            }

            case TYPE_PLAY_MUSIC.PLAY_RANDOM:
            {
                viewModel.TypePlayMusic  = TYPE_PLAY_MUSIC.PLAY_REPEAT_ALL;
                TypePlaySongImage.Source = SvgImageSource.FromResource("NuMusic.Resources.Svg.icon_play_repeat.svg");
                break;
            }
            }
        }
Beispiel #2
0
        private static void IconPropertyChanged(BindableObject bindable, object oldValue, object newValue)
        {
            var control = (CustomEntry)bindable;

            iconPath            = newValue.ToString();
            control.Icon.Source = SvgImageSource.FromResource(newValue.ToString());
        }
Beispiel #3
0
 public virtual SvgCachedImage Svg(string ressourceId)
 {
     return new SvgCachedImage {
         Source = SvgImageSource.FromResource(ressourceId, FindCallingAssembly())
         //WidthRequest = 100,
         //HeightRequest = 100,
     };
 }
Beispiel #4
0
        private void OnSvgPathChanged()
        {
            if (SvgPath == null)
            {
                return;
            }

            var assemblyName      = GetType().Assembly.GetName().Name;
            var svgPathNormalized = SvgPath.Replace("/", ".");
            var svgFullPath       = $"{assemblyName}.{svgPathNormalized}";

            Source = SvgImageSource.FromResource(svgFullPath);
        }
Beispiel #5
0
        private void PlaySongImage_Tapped(object sender, EventArgs e)
        {
            var viewModel = DataSource;
            var isPlaying = viewModel.IsPlayingMusic;

            viewModel.IsPlayingMusic = !isPlaying;
            if (viewModel.IsPlayingMusic)
            {
                _animation.Start();
                PlaySongImage.Source = SvgImageSource.FromResource("NuMusic.Resources.Svg.icon_play.svg");
            }
            else
            {
                _animation.Stop();
                PlaySongImage.Source = SvgImageSource.FromResource("NuMusic.Resources.Svg.icon_pause.svg");
            }
        }
Beispiel #6
0
        public SvgReplacePageModel()
        {
            ReplaceCommand = new BaseCommand((arg) =>
            {
                var r = _random.Next(256);
                var g = _random.Next(256);
                var b = _random.Next(256);

                ReplaceMap = new Dictionary <string, string>()
                {
                    { "#TEXT", Guid.NewGuid().ToString() },
                    { "#FILLCOLOR", $"#{r:X2}{g:X2}{b:X2}" }
                };

                ImageSource = SvgImageSource.FromResource("FFImageLoading.Forms.Sample.Resources.replace.svg",
                                                          replaceStringMap: ReplaceMap);
            });

            ReplaceCommand.Execute(null);
        }
Beispiel #7
0
        public SvgImageSource GetSVGImageResource(string img)
        {
            var res = FetchResource(img);

            return(SvgImageSource.FromResource(res.Item1, res.Item2));
        }
Beispiel #8
0
        private static void UpdateSvg(BindableObject bindable, object oldVal, object newVal)
        {
            var _instance = bindable as TintedCachedImage;

            _instance.Source = SvgImageSource.FromResource((string)newVal);
        }