Open afbase opened 6 years ago
Hello @afbase, thanks for your detailed description. most likely I did not correctly make a nuget for PCL. I will fix it) You are already using .net standard?
@KSemenenko I am using .NET Portable PCL 4.5 - Profile111, not .net standard.
@afbase, why do you need DI? For Xamarin.Forms you need only
await CrossColorThief.Current.GetPalette(sourceImage);
or you want to use new method like FromUrl?
@KSemenenko
For Xamarin.Forms you need only
await CrossColorThief.Current.GetPalette(sourceImage);
If I write this line of code in my PCL project, I get a
System.NotImplementedException
error. The error message for me is not clear. If I write this line of code in my PCL project, do I need to add a colorthief package to my iOS project and android projects as well?or you want to use new method like FromUrl?
I'd rather try to write all of this in a PCL project but I'm beginning to think this is not possible.
I think where this issue is coming up is ColorThief reference/object confusion between PCL and platform projects.
I think what we want in the PCL project is using ColorThiefDotNet.Forms;
:
using ColorThiefDotNet.Forms;
...
public interface IColorThiefHelper
{
List<QuantizedColor> GetPalette(string sourceImage, int colorCount);
QuantizedColor GetColor(string sourceImage);
}
instead of what I originally had here:
using ColorThiefDotNet;
...
public interface IColorThiefHelper
{
List<QuantizedColor> GetPalette(string sourceImage, int colorCount);
QuantizedColor GetColor(string sourceImage);
}
If I try using ColorThiefDotNet.Forms;
, I get an error stating that QuantizedColor could not be found. I think this is where quantizedcolor should be instead of just the ColorThiefDotNet
namespace. If that is the case I think that resolves the problem. I just forked over the repo, I may try to play with it a bit and see if it works this weekend.
@afbase I think I found a problem, it's still in the structure of the project. apparently I need to do the refactoring
@ksemenenko
I may follow up on this later in my development near the end of March as I have reprioritized my development as this became a bit of a blocker. I am working on other features but what I am now thinking is to refactor the Shared library's implementation to a dependency service onto interfaces implemented in the various platform libraries.
Hi @KSemenenko
I'm trying to follow your suggestion in the prior issue:
In my PCL Xamarin project I have an interface and added reference to
ksesmenenko.ColorThief.Forms
v1.0.0.4:and then also in my PCL Xamarin project call it using dependency service:
Finally in my iOS project I have added reference to
ksesmenenko.ColorThief.Forms
v1.0.0.4 again and then made the dependency service implementation like so:And here I get the error on the
ColorThiefHelper
class :The bug is strange as there is no
Version=1.1.0.1
of ColorThief.Forms in nuget.Do you know what might be the problem?