public NoteEditViewModel(INavigationService navigationService, IPermissionService permissionService, IFileSystem fileService, IMediaService mediaService, IVideoService videoService, ICommandResolver commandResolver, IMultiMediaPickerService multiMediaPickerService, MediaHelper mediaHelper, TransformHelper transformHelper) : base(navigationService) { _permissionService = permissionService; _fileService = fileService; _mediaService = mediaService; _videoService = videoService; _multiMediaPickerService = multiMediaPickerService; _mediaHelper = mediaHelper; _transformHelper = transformHelper; AttachButtonImageSource = ConstantsHelper.AttachmentLightIcon; CameraButtonImageSource = ConstantsHelper.CameraIcon; VideoButtonImageSource = ConstantsHelper.VideoIcon; GalleryItemModels = new RangeObservableCollection <GalleryItemModel>(); DescriptionTextChanged = commandResolver.Command <string>(DescriptionChanged); TakePhotoCommand = commandResolver.AsyncCommand(TakePhoto); TakeVideoCommand = commandResolver.AsyncCommand(TakeVideo); PickMultipleMediaCommand = commandResolver.AsyncCommand(PickMultipleMedia); SaveNoteCommand = commandResolver.AsyncCommand <string>(SaveNote); DeleteNoteCommand = commandResolver.AsyncCommand(DeleteNote); SelectImageCommand = commandResolver.AsyncCommand <GalleryItemModel>(SelectImage); }
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); }); }; }
public App(IMultiMediaPickerService multiMediaPickerService) { InitializeComponent(); FlowListView.Init(); MainPage = new NavigationPage(new MainPage() { BindingContext = new MainViewModel(multiMediaPickerService) }); }
public App(IMultiMediaPickerService multiMediaPickerService) { Thread.CurrentThread.CurrentUICulture = CultureInfo.InstalledUICulture; InitializeComponent(); // FlowListView.Init(); MainPage = new NavigationPage(new MainPage()); }
public App(IMultiMediaPickerService multiMediaPickerService) { InitializeComponent(); Bootstrapper.RegisterServices(); InitRepositories(); MultiMediaPickerService = multiMediaPickerService; _navigationService = ComponentFactory.Resolve <INavigationService>(); _themeSwitchService = ComponentFactory.Resolve <ThemeSwitcher>(); _themeService = ComponentFactory.Resolve <IThemeService>(); bool.TryParse(Settings.UsePin, out var shouldUsePin); InitNavigation(shouldUsePin); }
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); }); }; }
public SampleImageEditPageModel(IMultiMediaPickerService multiMediaPickerService) { try { _multiMediaPickerService = multiMediaPickerService; SelectImagesCommand = new Command(async(obj) => { var hasPermission = await CheckPermissionsAsync(); if (hasPermission) { Media = new ObservableCollection <MediaFile>(); //await DependencyService.Get<IMultiMediaPickerService>().PickPhotosAsync(); await _multiMediaPickerService.PickPhotosAsync(); } }); //DependencyService.Get<IMultiMediaPickerService>().OnMediaPicked += (s, a) => _multiMediaPickerService.OnMediaPicked += (s, a) => { Device.BeginInvokeOnMainThread(() => { Media.Add(a); }); }; _multiMediaPickerService.OnMediaPickedCompleted += (s, a) => { Device.BeginInvokeOnMainThread(() => { }); }; } catch (Exception ex) { } }
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); }); }; }
public MainViewModel(IMultiMediaPickerService multiMediaPickerService) { 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); OpenCameraAndTakePictureCommand = new Command(OpenCameraAndTakePicture); _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); //}); // MediaToBeGrouped.Add(a); }; }