Partial viewmodel in Prism - windows-runtime

I'm trying out Prism for WP 8.1 Runtime (Microsoft.Practices.Prism.Mvvm.Store). Is there any way to implement partial viewmodel? For example, I would like to implement different VM for each item in Pivot control.
P.S. This can be done in Caliburn.Micro using Conductor class.

Well you could do Lazy/AsnycLazy where T is your sub-viewmodel. Then just bind the selected page, and load the subVMs when required. Currently PRISM doesn't offer any built-in solutions for this.

Related

Custom controls in WP8

i would like to know if it's possible to define a new user control on the basis of the pre-defined ones in WP8. For example, if i wished to define a custom Application Bar (like the one in the Windows Phone Store) starting from the standard one, or a custom Context Menu, would it be possible?
Thanks
The simple answer is "yes." For instance, a vast majority of the controls in the Windows Phone Toolkit are derived from their base-level analogs, such as the most obvious example of PhoneTextBox.
Regarding ApplicationBar specifically, you will note the class is sealed and cannot be inherited, but you can create predefined templates in XAML for application bar configurations you wish to reuse. As a custom control, that specific construct does not make sense as it is a baked-in OS element. Instead, depending on your use case, it may be better to completely disable the ApplicationBar and create an entirely new control that implements the custom functionality you desire.
The controls are skinned using a convention in Windows Phone development by generating a Generic.xaml file in the Themes folder that is compiled as a library resource. One such example can be found at the link inside the Windows Phone Toolkit's WP8 library.

Can I code in both LUA and Java in Cocos2d-x?

Right now I'm using Corona SDK so I have experience with LUA but I need to implement some features in Java but I would still like to use LUA as the "main" language. Is this possible in Cocos2d-x?
Another question is if native objects will always be on top as in Corona SDK? Maybe this is not a Corona specific problem, but maybe a thing with the devices?
there is a javascript binding and Lua binding but no java check alternative game engine for java like Slick2D

winrt application framework

What is the better framework for development Windows Store application?
I have used http://metroprism.codeplex.com/ but now I want to use Caliburn.Micro or MVVM light for another project.
I have looked through several application examples for these frameworks but they were not complicated enough for me to estimate usage in bigger projects.
These two ones are completely documented but the problem I think is that documentation for winrt mixed with WP7, Silverlight and WPF and I doubt a bit in supporting all features and practices of using exactly for Windows Store application.
Could you give me advice what is the better one? Or what are the good practices in development for Winrt with modularity supporting like in Prism for WPF and Silverlight.
Thanks.
MVVM Light and Caliburn.Micro basically do the same thing but they do it using opposing "philosophies of development" in MVVM.
MVVM Light is a "view first" approach. In this approach the ViewModel is instantiated in by the View. In MVVM Light this is done via something called the ViewModelLocator, a static class that binds a public property directly to the DataContext of the View.
Caliburn.Micro is a "viewmodel first" approach. Here you find that the viewmodel and view are created by an IOC mechanism that binds the two together. You navigate from viewmodel to viewmodel, with the views being generated in response to the navigation to a ViewModel.
They both have different features:
MVVM Light has a really nice messaging system for allowing view models to communicate with each other in a loosely-coupled way.
MVVM Light has a really simple mechanism for injecting design-time data into your views. Basically it swaps out your runtime services with design-time services that feed data to your viewmodels and, in turn your view. This makes design time data really easy to use.
Caliburn.Micro has an amazing data-binding setup, where it handles most of your databinding scaffolding for you. Basically, it maps the names of methods and properties to the names of controls in the view and autowires them. This saves lots of code and is a really, really nice feature.
Caliburn.Micro uses a "Convention over Configuration" mechanism to map views to viewmodels. MainView maps to MainViewModel, etc. This means you've got no configuration, you just need to make sure that you've got your naming conventions sorted out.
I've used both frameworks (Caliburn.Micro for WP7 and MVVM Light for Windows 8 Store Apps) and like them both for different reasons. MVVM Light is easier to start using but Caliburn.Micro is probably more powerful. I've found them both more than adequate for writing moderately complex applications quickly.
Caliburn.Micro gives you clean XAML at the cost of some magic. MVVM Light is a clean and simple framework that is easy to understand and works well. Prism seems to be a bit heavier than MVVM Light and more business app oriented - it does more than just MVVM. There are many things to consider. Choosing what you already know will let you focus on adding features, but learning a new framework can certainly be a good learning experience helpful in future choices - so you could pick something you haven't used before if you want to learn. You could also write your own framework and only include what you need. I usually go somewhere between roll your own and MVVM Light because that is what I know, though if I were to build a bigger enterprise app - Prism might be better suited for the task. I haven't used Caliburn.Micro because the novelty of different MVVM approaches wore off for me and I just want to create apps. With WinRT a roll-your-own-framework approach is easier than with any platform before because the basic project templates already give you some foundations as I wrote in my Minimalistic MVVM blog post. I would recommend that approach if you already tried MVVM and want to use only the pieces you need - the framework will grow with your app. You can just grab pieces of code from other frameworks if you need them or write your own implementations of the patterns you need.
To summarize
If you want to learn - try something you haven't tried before or write your own framework
If you want to create an app quickly and it is not a huge app - use what you know or go minimalistic and don't use anything but what you get from the templates
If you are building a big app with lots of features - consider Prism or rather first think whether Windows Store is the right target platform for you since it seems to be focusing more on simple in and out tablet apps

Can I add winRT project reference to classic class library project?

VS gives me errors when I try to do it. Yet, it displays such projects as available to reference. Is it possible to add winRT project reference to the classic class library project somehow?
If not, how to bridge both worlds, so common logic can be stored in one place?
The short answer is yes. The long answer is that it's not supported and comes with some caveats that you need to understand.
See my answer here:
Using Custom Windows Runtime Components in Non-Metro Applications
VS2012 adds a "Portable Class Library" project type that allows you to select multiple targets, including the ability to target WinRT and full .Net 4.5 from one assembly.
See http://msdn.microsoft.com/en-us/library/gg597391.aspx.

How to integrate JayData with Knockout

I'm evaluating Knockout to use with JayData to create a standalone web application.
Following this tutorial (http://jaydata.org/tutorials/creating-a-stand-alone-web-application) it seems that I will be able to store my data on iPhone, Android and in HTML5 browsers...
I'm not sure how can I use JavaScript Query Language with Knockout. I've seen they will have some support it, but I probably you have an idea how can I do it myself.
I'm not sure if Knockout is the appropriate UI library for hybrid applications, hopefully you can share some know-how.
Thank you!
UPDATE:
From version 1.1.0 JayData has knockoutjs integration module. Include "jaydatamodules/knockout.js" in your html page, and have JayData provide Knockout observables with entity.asKoObservable(). With this module queryable.toArray() accepts ko.ObservableArrays as targets populating it with kendo observable entities.
Custom Bindings is just the way for the integration you are after. You have to connect the knockoutjs way of interacting with the JavaScript objects with the JayData entity metadata functions and its propertyChanged / propertyChanging events.
It shouldn't be difficult a task to do, as JayData supports simple property notation (object.property) and async property accessor pattern (get_property(cb), set_property(cb)) as well.
You can integrate Knockout with jQuery by way of Custom Bindings. That answers your question about integration. Custom bindings allow you to integrate with any JavaScript UI library, not just jQuery.
In regards to your second question... Knockout really isn't a UI library. It's more of a framework to facilitate data-binding between DOM objects and JavaScript objects. It is used to design web applications following the MVVM design paradigm.
Here is an example It is integrated in recent release probably