public MainViewModel(IMultiMediaPickerService multiMediaPickerService)
        {
            _multiMediaPickerService = multiMediaPickerService;
            SelectImagesCommand      = new Command(async(obj) =>
            {
                var hasPermission = await CheckPermissionsAsync();
                if (hasPermission)
                {
                    Media = new ObservableCollection <MediaFile>();
                    await _multiMediaPickerService.PickPhotosAsync();
                }
            });

            SelectVideosCommand = new Command(async(obj) =>
            {
                var hasPermission = await CheckPermissionsAsync();
                if (hasPermission)
                {
                    Media = new ObservableCollection <MediaFile>();

                    await _multiMediaPickerService.PickVideosAsync();
                }
            });

            _multiMediaPickerService.OnMediaPicked += (s, a) =>
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    Media.Add(a);
                });
            };
        }
示例#2
0
        public PlayerDetailViewModel(Player player = null)
        {
            Title  = player?.FirstName + " Profil";
            Player = player;
            _multiMediaPickerService = DependencyService.Get <IMultiMediaPickerService>();

            SelectImagesCommand = new Command(async(obj) =>
            {
                var hasPermission = await CheckPermissionsAsync();
                if (hasPermission)
                {
                    Media          = new ObservableCollection <MediaFile>();
                    var mediaFiles = await _multiMediaPickerService.PickPhotosAsync();

                    foreach (var mediaFile in mediaFiles)
                    {
                        Media.Add(mediaFile);
                    }
                }
            });

            SelectVideosCommand = new Command(async(obj) =>
            {
                var hasPermission = await CheckPermissionsAsync();
                if (hasPermission)
                {
                    Media          = new ObservableCollection <MediaFile>();
                    var mediaFiles = await _multiMediaPickerService.PickVideosAsync();

                    foreach (var mediaFile in mediaFiles)
                    {
                        Media.Add(mediaFile);
                    }
                }
            });

            _multiMediaPickerService.OnMediaPicked += (s, a) =>
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    Media.Add(a);
                });
            };
        }
示例#3
0
        public BrowseMediaViewModel(INavigation navigation)
        {
            this.Navigation = navigation;

            _multiMediaPickerService = ServiceContainer.Resolve <IMultiMediaPickerService>();
            database = ServiceContainer.Resolve <IDatabase>();
            Media    = new ObservableCollection <MediaDetails>();

            Tags = new string[]
            {
                "Object 1",
                "Object 2",
                "Object 3",
                "Object 4"
            };

            SelectImagesCommand = new Command(async(obj) =>
            {
                popupDisplaying = true;
                Media           = new ObservableCollection <MediaDetails>();
                await _multiMediaPickerService.PickPhotosAsync();
                popupDisplaying = false;
            });

            SelectVideosCommand = new Command(async(obj) =>
            {
                popupDisplaying = true;
                Media           = new ObservableCollection <MediaDetails>();
                await _multiMediaPickerService.PickVideosAsync();
                popupDisplaying = false;
            });

            RemoveImageCommand = new Command <MediaDetails>((obj) =>
            {
                FileHelper.DeleteLocalFiles(obj);
                Media.Remove(obj);
            });

            CompleteCommand = new Command(async(obj) =>
            {
                if (popupDisplaying)
                {
                    return;
                }

                foreach (var item in Media)
                {
                    if (!string.IsNullOrEmpty(SelectedTag))
                    {
                        item.Tags = new Common.Models.TagArea[] { new Common.Models.TagArea()
                                                                  {
                                                                      Id = SelectedTag
                                                                  } }
                    }
                    ;                                                                                                                         // TEMP

                    item.Location = new GeoLocation(10, 10);
                    database.SaveItem(item);
                }
            });

            _multiMediaPickerService.OnMediaPicked += (s, a) =>
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    Media.Add(a);
                });
            };
        }
示例#4
0
        public MainViewModel(IMultiMediaPickerService multiMediaPickerService)
        {
            //Am nevoie de un singur element in lista, pentru

            numberOfHiddenPhotos = "+0";


            var aa = new FourMediaFileModel()
            {
                Path1        = "/data/user/0/com.crossgeeks.MultiMediaPickerSample/files/TmpMedia/IMG-20200725-WA0002_37.jpg",
                PreviewPath1 = "/data/user/0/com.crossgeeks.MultiMediaPickerSample/files/TmpMedia/IMG-20200725-WA0002-THUMBNAIL_37.jpg",

                Path2        = "/data/user/0/com.crossgeeks.MultiMediaPickerSample/files/TmpMedia/IMG-20200724-WA0004_2.jpg",
                PreviewPath2 = "/data/user/0/com.crossgeeks.MultiMediaPickerSample/files/TmpMedia/IMG-20200724-WA0004-THUMBNAIL_2.jpg",

                Path3        = "/data/user/0/com.crossgeeks.MultiMediaPickerSample/files/TmpMedia/20200718_104804_1.jpg",
                PreviewPath3 = "/data/user/0/com.crossgeeks.MultiMediaPickerSample/files/TmpMedia/20200718_104804-THUMBNAIL_1.jpg",

                Path4        = "/data/user/0/com.crossgeeks.MultiMediaPickerSample/files/TmpMedia/20200714_171640.jpg",
                PreviewPath4 = "/data/user/0/com.crossgeeks.MultiMediaPickerSample/files/TmpMedia/20200714_171640-THUMBNAIL.jpg"
            };


            MediaToBeGrouped.Add(aa);



            ShowFullImageCommand = new Command(ShowFullImage);


            _multiMediaPickerService = multiMediaPickerService;

            //PageAppearingCommand = new Command(PageAppearing);
            //PageDisappearingCommand = new Command(PageDisappearing);

            SelectImagesCommand = new Command(async(obj) =>
            {
                var hasPermission = await CheckPermissionsAsync();
                if (hasPermission)
                {
                    Media = new ObservableCollection <MediaFile>();
                    await _multiMediaPickerService.PickPhotosAsync();
                }
            });

            SelectVideosCommand = new Command(async(obj) =>
            {
                var hasPermission = await CheckPermissionsAsync();
                if (hasPermission)
                {
                    Media = new ObservableCollection <MediaFile>();

                    await _multiMediaPickerService.PickVideosAsync();
                }
            });

            _multiMediaPickerService.OnMediaPicked += (s, a) =>
            {
                //Device.BeginInvokeOnMainThread(() =>
                //{
                Media.Add(a);

                //});

                // MediaToBeGrouped.Add(a);
            };
        }