Since the first release of FreshMvvm it’s been a wild ride, the up take of FreshMvvm has been very impressive it’s really good to see others having success using FreshMvvm. While I’ve been using and loving FreshMvvm for a long long time, even since before it was called FreshMvvm, it’s great to see others also enjoying the Framework.
Since this release has a few large features and breaking changes I’ve decided bump the version up to 1.0 preview. Please see below of a description of the features.
Multiple Navigation Services
It’s always been possible to do any type of navigation in FreshMvvm, with custom or advanced scenarios were done by implementing a custom navigation service. Even with this ability people found it a little hard to do advanced navigation scenarios in FreshMvvm. After I reviewed all the support questions that came in for FreshMvvm I found that the basic issue people had was they wanted to be able to use our built in navigation containers multiple times, two primary examples are 1) within a master detail having a navigation stack in a master and another in the detail 2) The ability to push modally with a new navigation container. In order to support both these scenarios I concluded that the FreshMvvm required the ability to have named NavigationServices so that we could support multiple NavigationService’s.
Using multiple navigation containers
Below we’re running two navigation stacks, in a single MasterDetail.
C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
varmasterDetailsMultiple=newMasterDetailPage();//generic master detail page
//we setup the first navigation container with ContactList
varcontactListPage=FreshPageModelResolver.ResolvePageModel<ContactListPageModel>();
contactListPage.Title=“Contact List”;
//we setup the first navigation container with name MasterPageArea
varmasterPageArea=newFreshNavigationContainer(contactListPage,“MasterPageArea”);
masterPageArea.Title=“Menu”;
masterDetailsMultiple.Master=masterPageArea;//set the first navigation container to the Master
//we setup the second navigation container with the QuoteList
varquoteListPage=FreshPageModelResolver.ResolvePageModel<QuoteListPageModel>();
quoteListPage.Title=“Quote List”;
//we setup the second navigation container with name DetailPageArea
vardetailPageArea=newFreshNavigationContainer(quoteListPage,“DetailPageArea”);
masterDetailsMultiple.Detail=detailPageArea;//set the second navigation container to the Detail
MainPage=masterDetailsMultiple;
|
PushModally with new navigation stack
C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
//push a basic page Modally
varpage=FreshPageModelResolver.ResolvePageModel<MainMenuPageModel>();
varbasicNavContainer=newFreshNavigationContainer(page,“secondNavPage”);
awaitCoreMethods.PushNewNavigationServiceModal(basicNavContainer,newFreshBasePageModel[]{page.GetModel()});
//push a tabbed page Modally
vartabbedNavigation=newFreshTabbedNavigationContainer(“secondNavPage”);
tabbedNavigation.AddTab<ContactListPageModel>(“Contacts”,“contacts.png”,null);
tabbedNavigation.AddTab<QuoteListPageModel>(“Quotes”,“document.png”,null);
awaitCoreMethods.PushNewNavigationServiceModal(tabbedNavigation);
//push a master detail page Modally
varmasterDetailNav=newFreshMasterDetailNavigationContainer(“secondNavPage”);
masterDetailNav.Init(“Menu”,“Menu.png”);
masterDetailNav.AddPage<ContactListPageModel>(“Contacts”,null);
masterDetailNav.AddPage<QuoteListPageModel>(“Quotes”,null);
awaitCoreMethods.PushNewNavigationServiceModal(masterDetailNav);
|
Custom IOC Container
The second major request for FreshMvvm 1.0 was to allow custom IOC containers. In the case that your application already has a container that you want to leverage.
Using a custom IOC container is very simple in that you only need to implement a single interface.
C#
1
2
3
4
5
6
7
8
9
10
11
|
publicinterfaceIFreshIOC
{
objectResolve(Type resolveType);
voidRegister<RegisterType>(RegisterType instance)where RegisterType:class;
voidRegister<RegisterType>(RegisterType instance,stringname)where RegisterType:class;
ResolveType Resolve<ResolveType>()where ResolveType:class;
ResolveType Resolve<ResolveType>(stringname)where ResolveType:class;
voidRegister<RegisterType,RegisterImplementation>()
where RegisterType:class
where RegisterImplementation:class,RegisterType;
}
|
And then set the IOC container in the System.
C#
1
|
FreshIOC.OverrideContainer(myContainer);
|
Breaking Changes
Please remember whenever you register a IFreshNavigationService it now has to have a name.
C#
1
|
FreshIOC.Container.Register<IFreshNavigationService>(this,Constants.DefaultNavigationServiceName);
|
Please find this pre-release in nuget. – https://www.nuget.org/packages/FreshMvvm/1.0.0-pre1
FYI – This nuget is a pre-release nuget and you’ll need to have the ‘pre-release’ option selected on nuget.
The main repo for FreshMvvm can be found on github – https://github.com/rid00z/FreshMvvm.
Please post any issues on the github repository.
Thanks
Michael