0
votes

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));
        }
    }
1
Can you update the question with any more trace, or any more info on what you've named your plugin assemblies? Also, can you clarify whether you mean Silverlight WinPhone 8.1 or Jupiter/Xaml WinPhone 8.1 (blame MS for the naming confusion!)Stuart
@Stuart If i not used TimerPluginBootsrap for Plugin Loading and Just resolve the Mvx.RegisterSingleton<ITimer>(new MvxWindowsPhoneTimer(1)); in my WindowsPhone 8.1 setup.cs class it will works fineWaqas Idrees
Can you clarify whether you mean Silverlight WinPhone 8.1 or Jupiter/Xaml WinPhone 8.1 (blame MS for the naming confusion!)Stuart
Its WinPhone 8.1 its not Sliverlight WinPhone 8.1Waqas Idrees

1 Answers

1
votes

The plugin extension name for Silverlight is WindowsPhone

For Jupiter Xaml Windows Phone apps, the extension name is WindowsCommon (if shared with Win81) and WindowsPhoneStore for Store only.


So Confiz.MvvmCross.Plugins.Timer.WindowsPhone.dll is for Silverlight

And Confiz.MvvmCross.Plugins.Timer.WindowsPhoneStore.dll is for Jupiter Xaml apps