aspnetde / mvvmnano Goto Github PK
View Code? Open in Web Editor NEWThe small and smart MVVM framework made with ❤ for Xamarin.Forms.
License: MIT License
The small and smart MVVM framework made with ❤ for Xamarin.Forms.
License: MIT License
As well as setting up the start view model, setting up a custom presenter shouldn't need so much knowledge of the underlaying mechanics.
Hi,
I am developing a Xamarin.Forms application and for now I didn't use any Mvvm Framework in my project. However I use DryIOC as a standard container and for navigation I use the classic way by creating the VM with the IoC and I pass the model as a parameter in the constructor or use a Initialize method defined in the VM. However the methods are called manually in order to prevent some reflection which I don't see it necessary.
However, I evaluated the MvvmCross and FreshMvvM and I didn't use them yet because they are violating SOLID principles and they bring view functionalities to the VM (which is wrong in my oppinion).
I had a look to the MvvmNano and I don't think it breaks this rule and if you keep using this design, I would be happy to work with :) However, I didn't used it yet since it's using Ninject as a container which is very slow (you can see an updated comparison here http://www.palmmedia.de/blog/2011/8/30/ioc-container-benchmark-performance-comparison )
I opened this issue as a feature, and I think adding support for custom dependency injection would be useful
@aspnetde Some user requests here are pretty old and the MvvmNano library seems not finished because there are so many problems with it.
I don't get it...
Anyway, I moved to Prism
for a while now
Hi,
I am trying to install the library, but it seems that the PCL profile is quite limited. By default when you create a new project in VS 2015 is 259. According to this article http://danrigby.com/2014/04/16/xamarin-pcl-profile-notes/ , the 259 profile is supposed to replace the 78 profile which you are using.
Since the profile 259 it seems to be the most common now (I didn;t had any issues with any library until now), do you think it would be possible to switch the target ?
It's currently a lot of boiler-plate code necessary to set up the initial view model/view, that should become a bit easier like SetUpStartViewModel<IViewModel>
.
Are there any Xamarin Studio or Visual Studio project templates for MvvmNano?
I have a MainView.xaml
and MainView.cs
generated by the "Forms ContentPage Xaml" template.
I can't use the MvvmNanoContentPage<MainViewModel>
as base class:
public partial class MainView : MvvmNanoContentPage<MainViewModel>
{
public MainView ()
{
InitializeComponent ();
}
}
because of the generated partial class based on XAML:
MainView.xaml.cs(15,15): Error CS0260: Missing partial modifier on declaration of type 'MyApp.MainView'; another partial declaration of this type exists (CS0260)
I don't see a non-template MvvmNanoContentPage class which I could use.
I got the below error while writing unit testing with the help of Nunit. The below error occurred just after creating the instance of my derived class of MvvmNanoContentPage Class and assigning a ViewModel to it
Ninject.ActivationException : Error activating IPresenter
No matching bindings are available, and the type is not self-bindable.
Activation path:
Suggestions:
Any example of using it?
I have an XAML like the following
<?xml version="1.0" encoding="UTF-8"?>
<views:MvvmNanoTabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:mvvmNano="clr-namespace:MvvmNano.Forms"
xmlns:views="clr-namespace:TestXForms.Views"
xmlns:vm="clr-namespace:TestXForms.ViewModels"
x:TypeArguments="vm:MainViewModel"
x:Class="TestXForms.Views.MainPage">
<ContentPage Title="First Tab">
</ContentPage>
<ContentPage Title="Second Tab">
</ContentPage>
</views:MvvmNanoTabbedPage>
public partial class MainPage : MvvmNanoTabbedPage<MainViewModel>
{
public MainPage ()
{
InitializeComponent ();
}
}
and I am getting:
[MonoDroid] UNHANDLED EXCEPTION:
[MonoDroid] System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Ninject.ActivationException: Error activating IPresenter
[MonoDroid] No matching bindings are available, and the type is not self-bindable.
[MonoDroid] Activation path:
[MonoDroid] 1) Request for IPresenter
[MonoDroid] Suggestions:
[MonoDroid] 1) Ensure that you have defined a binding for IPresenter.
[MonoDroid] 2) If the binding was defined in a module, ensure that the module has been loaded into the kernel.
[MonoDroid] 3) Ensure you have not accidentally created more than one kernel.
[MonoDroid] 4) If you are using constructor arguments, ensure that the parameter name matches the constructors parameter name.
[MonoDroid] 5) If you are using automatic module loading, ensure the search path and filters are correct.
[MonoDroid] at Ninject.KernelBase.Resolve (IRequest request, Boolean handleMissingBindings) [0x00097] in <filename unknown>:0
[MonoDroid] at Ninject.KernelBase.Resolve (IRequest request) [0x00000] in <filename unknown>:0
[MonoDroid] at Ninject.ResolutionExtensions.GetResolutionIterator (IResolutionRoot root, System.Type service, System.Func`2 constraint, IEnumerable`1 parameters, Boolean isOptional, Boolean isUnique) [0x0002f] in <filename unknown>:0
[MonoDroid] at Ninject.ResolutionExtensions.Get[T] (IResolutionRoot root, Ninject.Parameters.IParameter[] parameters) [0x00000] in <filename unknown>:0
[MonoDroid] at MvvmNano.MvvmNanoIoC.Resolve[TInterface] () [0x00000] in <filename unknown>:0
[MonoDroid] at MvvmNano.MvvmNanoViewModelBase..ctor () [0x00006] in <filename unknown>:0
[MonoDroid] at MvvmNano.MvvmNanoViewModel..ctor () [0x00000] in <filename unknown>:0
[MonoDroid] at TestXForms.ViewModels.MainViewModel..ctor () [0x00000] in D:\Projects\TestXForms\TestXForms\ViewModels\MainViewModel.cs:8
[MonoDroid] at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
[MonoDroid] at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00002] in /Users/builder/data/lanes/3540/1cf254db/source/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:644
In order to use MvvmNano, it is required I believe to have the App derive from MvvmNanoApplication
Usually, global resources are defined in the <Application.Resources>
node
For example
<Application.Resources>
<ResourceDictionary>
<!-- Colors -->
<Color x:Key="WhiteColor">#ffffff</Color>
<Color x:Key="TransparentWhiteColor">#BFffffff</Color>
<Color x:Key="BlueColor">#3063f5</Color>
...
The problem that I have at the moment is that if I change the base class from Application
to MvvmNanoApplication
as required, those static resources are not available anymore in all other pages.
I get the following error when trying to use for example the WhiteColor
Static Resource not found for key WhiteColor
...
It all works fine again if my App
inherits from Application
again.
How is this suppose to work with MvvmNano?
SetUpMainPage
accepts only a MvvmNanoViewModel
view-model type.
If you have a MvvmNanoViewModel<T>
view-model, you can't use it with SetUpMainPage
.
Scenario: I have a login page and registration page. After use registered successfully, I want to navigate to login page and remove the registration page from back-stack.
For that I need to know in presenter whether the registration page should really be removed. So I was thinking to use an initialization parameter for the view-model which I can check in view-presenter and remove registration page from back-stack.
For this particular scenario where I need to remove page from back-stack (a logic for the view presenter), maybe a more correct approach would be to have a presentation parameter in NavigateTo
, similar to how MvvmCross has it, which can be used by presenter to do some specific things.
For now, not sure which is the best workaround..
=> App class is called again, so there needs to be at least ensured dependencies are not registered again.
=> Navigation stack is being destroyed, see https://forums.xamarin.com/discussion/21585/the-state-of-navigation-history-persistence - workaround?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.