Ejemplo n.º 1
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            global::Xamarin.Forms.Forms.Init();

            Xamarin.FormsMaps.Init();

            var multiMediaPickerService = new MultiMediaPickerService();

            CachedImageRenderer.Init();
            CachedImageRenderer.InitImageSourceHandler();


            var config = new FFImageLoading.Config.Configuration()
            {
                VerboseLogging                 = false,
                VerbosePerformanceLogging      = false,
                VerboseMemoryCacheLogging      = false,
                VerboseLoadingCancelledLogging = false,
                //Logger = new CustomLogger(),
            };

            ImageService.Instance.Initialize(config);

            LoadApplication(new App(multiMediaPickerService));

            return(base.FinishedLaunching(app, options));
        }
Ejemplo n.º 2
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            global::Xamarin.Forms.Forms.Init();

            var multiMediaPickerService = new MultiMediaPickerService();

            FFImageLoading.Forms.Platform.CachedImageRenderer.Init();
            LoadApplication(new App(multiMediaPickerService));

            return(base.FinishedLaunching(app, options));
        }
Ejemplo n.º 3
0
        public FlujoViewModel(User usuario)
        {
            Globals.FlujoViewModelInstance = this;
            Usuario = usuario;
            MultiMediaPickerService = Globals.MultiMediaPickerService;
            RepositoryService       = Globals.RepositoryService;

            AddPhotoCommand = new Command((obj) =>
            {
                Plugin.Media.Abstractions.MediaFile mediaFile = obj as Plugin.Media.Abstractions.MediaFile;
                if (mediaFile == null)
                {
                    return;
                }

                if (Media == null)
                {
                    Media = new ObservableCollection <XGaleryPhotos.Models.MediaFile>();
                }

                Media.Add(new MediaFile()
                {
                    Id          = Guid.NewGuid().ToString(),
                    Type        = MediaFileType.Image,
                    Path        = mediaFile.Path,
                    PreviewPath = mediaFile.Path
                }
                          );
            });

            BuscarFlujoCommand = new Command((obj) =>
            {
                string flujoNro = obj as string;
                Flujo           = RepositoryService.GetFlujoByNro(flujoNro);
            });

            EnviarOnBaseCommand = new Command((obj) =>
            {
                Globals.RepositoryService.UpdateFotos(Flujo, Usuario.UserName);
            });

            PhotoTappedCommand = new Command((obj) =>
            {
                var mediaSelected = obj as XGaleryPhotos.Models.MediaFile;
                Globals.RepositoryService.AddMediaFile(mediaSelected);
                Globals.PhotoDisplayPageInstance.ResetSource();
                Globals.NavegacionPageInstance.PushAsync(Globals.PhotoDisplayPageInstance);
            });

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

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