We are developing a Metro-style app in C++ and JavaScript. The C++ side provides us with IObservableVector<T> instances. The JavaScript side uses the WinJS.UI.ListView control.
List views are normally hooked up to WinJS.UI.IListDataSource instances. Most typically, one takes a WinJS.Binding.List and uses its dataSource property.
However, it seems very natural to want to hook up an IObservableVector<T> to the list view. Is there any way to do this? For example, is there any adapter for turning IObservableVector<T>s into Lists or IListDataSources?
One route we could go down is to write our own custom WinJS.UI.IListDataAdapter implementation that hooks up to an IObservableVector<T>, then go through the whole game with the poorly-documented WinJS.UI.VirtualizedDataSource and so on. But, has anyone done this already? It seems like it should be in the framework.
WinJS 1.0 doesn't support the WinRT change notification interfaces (INotifyPropertyChanged, IObservableVector). If you want to hook them together, you'll need to write an adapter/data source.
Based on #Chris Tavares's helpful, if discouraging, response, I wrote such an adapter:
https://github.com/NobleJS/WinningJS/blob/master/lib/ObservableVectorDataSource.js
It is currently read-only (so you cannot update the data source and expect changes to propagate to the observable vector), but works great in our app.
Related
I am new to Xamarin. I have done a couple of smaller projects (2-3 pages, one table). I have a new project that is a great candidate for a shell app. It will have 20 pages, will consume data from a transactional database (cloud hosted) but also have an offline datastore (SQLite). Right now, I just want to get the local version up and running. The template for Shell App generates an IDataService and a MockDataStore. That is a great place to start - but how do I have more than one table? I am a little confused how I would use that. What I would love to see is a template generated shell app that just adds another table (and corresponding list,detail views along with view models. For example, the simple "todo" sample but add a contact table to assign todo tasks to would be perfect. Thanks in advance for your help.
I hope this helps others new to Xamarin. When starting a new project and choosing anything other than the "blank template", the template generates a model (Item) and a services folder containing an Interface (IDataStore) and a MockDataStore. Being new to XAML in general, I spent a lot of time working on getting the UI to look like what I wanted it, learning about Shell navigation and similar topics. Finally it was time to include the data part of my project. Where I got stuck was trying to make sense of the boilerplate code. My understanding of DependencyService was for platform specific code (e.g. Android, iOS) and NOT data service dependency. Further, the templated code is a typed interface (IDataStore). The solution was fundamental - all that interface does is insure CRUD operations are available in whatever you use in a datastore. For me, simply changing IDataStore to not be typed as an Item, solved everything. It allowed me to keep the database layer abstracted away. In my little project, I completed my "MockDataStore" adding additional CRUD operations until I was ready for my real data operations. NOTE: if you generate the WEB API project from the template, it will make more sense - you can flip between your MockDataStore and actual data store.
I am developing a flex application for collaborative data analysis. To present the data my application uses standard and custom components (grids, charts etc.).
I want to deliver the feature that allows users making notes over the GUI of my application. So, other users will see they notes late on.
At the moment my question is: How can be implemented mechanism that allows making notes over the GUI? All suggestions and examples are welcome?
There are a lot of ways to approach this. ( Check out Buzzword, MS Word, and Acrobat all for slightly different approaches of note taking on a document--I assume an application GUI could use any of the same approaches ).
I'd start by saying that the click event bubbles:
http://livedocs.adobe.com/flex/3/langref/flash/display/InteractiveObject.html#event:click
So, listen for the click event on every child of your main application file. When you receive that click event you can provide some business logic as to whether or not you want to add a comment /note on the component that was clicked. Then you just some "note" component for collecting and displaying the note data. You an position them based on the x, y values of the click event.
So, actually my problem is much easier then I expected (thank for great design of Flex).
I decided to utilize PopUpManager functionality for my task. It does everything I need at the moment.
I am currently trying to use the "Invocation tags" of Mate to call my web services and delegate the WS-responses to my fault/result handlers.
I want to use the generated proxies, provided by the Flex Builder, and not the plain <WebService> or <WebServiceInvoker> tags.
I actually failed using several techniques:
<WebServiceInvoker> does not work with the generated proxies.
<AsyncMethodInvoker> needs some complicated successType that I could not get to work with the WS-calls. And defining the events seems redundant to me. I want it simple and easy to read, the code will be touched by other people than me!
<MethodInvoker> can't use instances, and it also can't handle the proxies' AsyncToken
<DelegateInvoker> Looked fine at first. It calls the service but doesn't fire valid result events (infinite busy cursor). Even though i can successfully bind to the XYZ_lastResult of the WS-proxies, and a WS-call results in getting valid data from the WS-backend, the <faultHandlers> and <resulthandlers> are not executed. There is some solution for the DelegateInvoker that changes code in the generated proxies, which i definately do not want to do!
So here is my question: Is there a simple(!) way of using default Flexbuilder generated proxies with the Mate Invocation tags?
It appears that your request is not that uncommon to Mate. Check out this couple of threads in their forum:
http://mate.asfusion.com/forums/topic.php?id=424
http://mate.asfusion.com/forums/topic.php?id=421
The solution is to modify some bits of the auto-generated code... which in a way ruins the whole point of using code generation.
Up until now I've only been using orchestrations in my BizTalk application and it's been working fine so far. But now I want to convert some of the unnecessary orchestrations to pure message routing instead in order to get better performance.
I've got a WCF service with only one method and that works fine because I can set the BtsActionMapping to only that single method. But the second WCF service I've got has two methods and now BizTalk doesn't know how to route my message. I've read everywhere that you need to set BTS.Operation in a custom pipeline to get it to work. But I've searched all over the place for a tutorial or example on how to do this.
I've been trying to implement the IBaseComponent, IComponentUI, IComponent and IPersistPropertyBag interfaces to do this. Am I going in the right direction or I'm I way off? Can anyone point me to an example or better yet show me how to do this?
The easiest way to get started writing a custom pipeline component is to use the BizTalk Server Pipeline Component Wizard; it will generate all the boilerplate for you. I've also got several custom pipeline components you can use as an example, a few that are very close to what you need (i.e. a component that just sets a custom message property) can be seen here.
As for setting the property, all you need to do is call message.Context.Write/Promote and pass in the namespace and name of the property, in this case those would be "http://schemas.microsoft.com/BizTalk/2003/system-properties" and "Operation" respectively.
It is very simple to retrieve data from a database and display it inside a DataGrid. However, what are the current practices to push the changes in the DataGrid back to the database? One can achieve this by inserting a lot of meta information, however, it is very tedious and not reusable.
There are libraries for persisting data across tiers, but as you say it isn't a simple task. LiveCycle DS ships with this capability when used in conjunction with Hibernate on the server. GraniteDS and Tide can perform a similar function, but for the most part you are left rolling your own. If you are using one of the many MVC frameworks available (I use PureMVC) it isn't difficult to create this type of functionality. Kind of tedious, but not difficult.
Which server side technology would you be using? You need to use HttpServer, WebService or RemoteObject's in Flex to push data to this server side app and that would then update the database.
Unless of course we're talking about a Flex/AIR Desktop App where connecting to databases directly is possible.
You can use RemoteObject, if you have a Java class on the server side that takes care of database connection and provides method to update database.
Just Create an ArrayCollection object from modified datagrid and pass it while doing a method call.
I think making changes to the database is the easiest part of this whole thing. The hardest part is making the DataGrid know exactly from which database table each cell comes from. If you're the one writing the query, then you can probably return a lot of meta-data, such as the private key and table name for each cell.