I develop a Custom Plugin of MvvmCross for Windows Phone 8.1 and iOS
Its loading in iOS project but giving error in Windows Phone 8.1 at the manager.EnsurePlatformAdaptionLoaded();
public class PluginLoader : IMvxPluginLoader
{
public static readonly PluginLoader Instance = new PluginLoader();
public void EnsureLoaded()
{
var manager = Mvx.Resolve<IMvxPluginManager>();
manager.EnsurePlatformAdaptionLoaded<PluginLoader>();
}
}
Error is
An exception of type 'Cirrious.CrossCore.Exceptions.MvxException' occurred in Cirrious.CrossCore.DLL but was not handled in user code
Additional information: could not load plugin assembly for type Confiz.MvvmCross.Plugins.Timer.PluginLoader
I am loading my Plugin in Windows Phone 8.1 using the following code
public class TimerPluginBootstrap : MvxPluginBootstrapAction<Confiz.MvvmCross.Plugins.Timer.PluginLoader>
{
}
I am Using Windows Phone 8.1 and MvvmCross 3.2.1 and Following are the more info
Confiz.MvvmCross.Plugins.Timer(Portable)
ITimer.cs
public interface ITimer
{
void Start();
void Stop();
Action CallBackMethod { get; set; }
}
PluginLoader.cs
public class PluginLoader : IMvxPluginLoader
{
public static readonly PluginLoader Instance = new PluginLoader();
public void EnsureLoaded()
{
var manager = Mvx.Resolve<IMvxPluginManager>();
manager.EnsurePlatformAdaptionLoaded<PluginLoader>();
}
}
Confiz.MvvmCross.Plugins.Timer.WindowsPhone
MvxWindowsPhoneTimer.cs
public class MvxWindowsPhoneTimer : ITimer
{
private readonly DispatcherTimer timer;
public MvxWindowsPhoneTimer(double kronosApiRecallTimeInMinutes)
{
timer = new DispatcherTimer();
Timer.Interval = TimeSpan.FromSeconds(kronosApiRecallTimeInMinutes);
Timer.Tick += Timer_Tick;
}
void Timer_Tick(object sender, object e)
{
CallBackMethod.Invoke();
}
public DispatcherTimer Timer
{
get { return timer; }
}
public void Start()
{
Timer.Start();
}
public void Stop()
{
Timer.Stop();
}
public Action CallBackMethod { get; set; }
}
Plugin.cs
public class Plugin : IMvxPlugin
{
public void Load()
{
Mvx.RegisterSingleton<ITimer>(new MvxWindowsPhoneTimer(1));
}
}