2

in Xamarin Media Plugin when I take a picture I have two options, save or discard the photo. But i want to add a popup question asking if the user really want to discard the photo. I already downloaded the package from github https://github.com/jamesmontemagno/MediaPlugin and made some changes where I think I have to change. I made the change only for Android, so in src/Media.Plugin.Android/MediaImplementation.cs I changed the line that set null to media picker when user press Cancel Button.

To make the changes I opened src/Media.sln solution on Visual Studio. Is that right or I have to do something else?

Anyway, my question for now is not actually what to change, i'll try to figure out what if my changes is wrong, what I want to know is how I can test that change? Do I have to create my own Nuget Package? How I do this? When i type Nuget Spec no Package Manager Console it's not being recognized, so I'm kind of stuck on this.

chr0m1ng
  • 199
  • 2
  • 12

1 Answers1

3

You have several options here, I will explain them briefly.

  • Fork the repository, make your changes, compile it and reference the DLL
  • Fork the repository, change the code, submit a PR and hope James will accept it
  • Fork it, make your changes and release a NuGet

I think the first one makes the most sense. It is a very specific requirement you have, one that most people probably won't have. Therefore, I do not believe James will be eager to accept an PR which adds this kind of behaviour. Also, releasing a separate, very similar NuGet will only cause confusion; people will look for the original one, but will download yours. And again; this change is very specific to you.

My bet would be to fork the repository, do your changes and just link the DLL directly, or if the code is portable, take it into your project as a whole. Lastly what you could do, is create an account at MyGet.org and create your own private NuGet feed and put it on there. This functionality is also available now from VSTS, if that is what you are using.

Gerald Versluis
  • 30,492
  • 6
  • 73
  • 100
  • Thanks for the answer. I'll do the first one, I already cloned the rep and made my own modifications After that I builded the solution in release mode and I don't know what to do now. So, how do I reference the DLL? I don't know how to do this, or I don't get what is reference the DLL, can you give me an example? I have a PCL code. I have to import the entire Media.sln to my solution? – chr0m1ng Mar 21 '17 at 00:15
  • The downside to this method is that you need to add the dll to your project and commit it to your repository. It's not pretty. Build your dll, add it to your project, in a folder of you want to, then right-click the references node in your project, browse to the dll and add a reference there. Also please accept this as an answer if it has helped you. – Gerald Versluis Mar 21 '17 at 05:16
  • hey guys, which DLL do you reference to which project(PCL?Android?iOS?)? I have done the modification on Plugin.Connectivitiy as well and created TestApp (PCL) in the same solution, now the reference part seem vague to me. Tried referencing few of the matches and kept on getting `Exception NotImplementedInReferenceAssembly() ` Some help is greatly appreciated! – Luminous_Dev Apr 09 '18 at 01:55
  • It seems you have referenced only the PCL DLL. Did you reference the platform-specific implementation in your platform project? – Gerald Versluis Apr 09 '18 at 06:03