0

I am using ELCImagepicker.dll to create gallery with multi image selection. Everything is working fine.

1- I want to change icon of Tick whenever user select. It's very old style 2- Change validation message of maximum selection. I want to use the word "select" instead of "send".

Here is the MediaService file. maxImage set validation of maximum images

public class MediaService : IMediaService
{
    public async Task OpenGallery(int maxImage)
    {
        var picker = ELCImagePickerViewController.Create(maxImage);
        picker.MaximumImagesCount = maxImage;

        var topController = UIApplication.SharedApplication.KeyWindow.RootViewController;
        while (topController.PresentedViewController != null)
        {

            topController = topController.PresentedViewController;
        }
        topController.PresentViewController(picker, true, null);
        List<string> images = new List<string>();
        await picker.Completion.ContinueWith(t =>
        {
            picker.BeginInvokeOnMainThread(() =>
            {
                //dismiss the picker
                picker.DismissViewController(true, null);

                if (t.IsCanceled || t.Exception != null)
                {
                }
                else
                {
                    //List<string> images = new List<string>();

                    var items = t.Result as List<AssetResult>;
                    foreach (var item in items)
                    {
                        var path = Save(item.Image, item.Name);
                        images.Add(path);
                        //CleanPath(path);
                    }


                }
            });
        });
        MessagingCenter.Send<App, List<string>>((App)Xamarin.Forms.Application.Current, "ImagesSelected", images);
    }

    string Save(UIImage image, string name)
    {
        var documentsDirectory = Environment.GetFolderPath
                              (Environment.SpecialFolder.Personal);
        string jpgFilename = System.IO.Path.Combine(documentsDirectory, name); // hardcoded filename, overwritten each time
        NSData imgData = image.AsJPEG();
        NSError err = null;
        if (imgData.Save(jpgFilename, false, out err))
        {
            return jpgFilename;
        }
        else
        {
            Console.WriteLine("NOT saved as " + jpgFilename + " because" + err.LocalizedDescription);
            return null;
        }
    }

    void IMediaService.ClearFiles(List<string> filePaths)
    {
        var documentsDirectory = Environment.GetFolderPath
                          (Environment.SpecialFolder.Personal);

        if (Directory.Exists(documentsDirectory))
        {
            foreach (var p in filePaths)
            {
                File.Delete(p);
            }
        }
    }
}

Please guide enter image description here

Ahmed Ashour
  • 5,179
  • 10
  • 35
  • 56
Nanji Mange
  • 2,155
  • 4
  • 29
  • 63

1 Answers1

0

Since the author hasn't expose the api that can change icon or text,so you have to change them inside the source code, and then create dll for using.

Alert text :here

Icon : here

Community
  • 1
  • 1
ColeX
  • 14,062
  • 5
  • 43
  • 240
  • Ah! Wonderful solution. Let me try and let you know the result – Nanji Mange Apr 13 '18 at 08:20
  • Hi, I have tried. It's project of XCode. How can I create dll of that project. I can open it in XCode but I don't way to create dll if possible. Please suggest – Nanji Mange Apr 13 '18 at 09:29
  • where did you get the dll above ?I thought you should be able to create dll. – ColeX Apr 13 '18 at 09:31
  • You need to create binding library for native ios ,refer to [here](https://learn.microsoft.com/en-us/xamarin/ios/platform/binding-objective-c/walkthrough?tabs=vsmac) – ColeX Apr 13 '18 at 09:39
  • `where did you get the dll above?`: Actually I got a project from internet having that DLL. – Nanji Mange Apr 13 '18 at 11:54
  • `You need to create binding library for native ios`: I am not getting much in this. Is there any other way? – Nanji Mange Apr 13 '18 at 11:55
  • I can create dll for you but i don't have the icon you want to replace, I suggest you follow the official link i provided above , it is not difficult, if you meet any problem please let me know. – ColeX Apr 16 '18 at 08:47
  • No, I haven't. I have given enough time for this but didn't get the result. I have hold it currently. I will check this in after few days. Please let me know if there is any easier way. – Nanji Mange May 02 '18 at 11:37
  • @NanjiMange okay,attach your icon ,I will do that later – ColeX May 04 '18 at 08:11
  • Thank you so much. Image1: `https://drive.google.com/file/d/1GjvfJ7zEYN_FY7IbPNsBNrlxKOBx4dGk/view?usp=sharing`, Image2(2x): `https://drive.google.com/file/d/12Exs2JH8JBtMijm0HeS_2VQEGrY7k81n/view?usp=sharing` – Nanji Mange May 04 '18 at 12:58
  • Sample here:https://github.com/ColeXm/ImagePickerSample DLL here: https://github.com/ColeXm/ImagePickerSample/blob/master/ImagePickerSample/ImagePickerSample/ImagePickerSample/ImagePicker.dll – ColeX May 09 '18 at 10:09