I'm developing a test application in which I need to:
a) Draw some paths from downloaded data. I have a REST/JSON server whith these data and my little app can consume it without any problem. The paths are downloaded once and that's all.
b) Draw pushpins, circles, whatever at some locations BUT their locations can change in real-time. The Silverlight app must ask the REST server for updates in these points in order to update the shapes in the map. The REST provides the "last know position" by default, so this location is what I want to display dynamically.
My question is: which is the simplest way to achieve b)? I'm quite a rookie at Silverlight, so I don´t know if it has some 'automatic-obvious' way to do this automatic update. Do I need some 'timer' to consume the service, a local list of locations and bindings between shapes and these locations?
Thank you in advance!
I would say you're on the right track.
I would create an ObservableCollection of a data model that represents the locations, and bind that to the Bing MapControl. Then create a DataTemplate (probably based on PushPin) that will visually represent how you want the data point to look on the map. The paths can be created with MapPolyLines
Since you're communicating with a REST server, I think your best option for updating the points to have a Timer object like you mentioned, and perform a call to update the ObservableCollection every time that fires.
Hope this helps!
Related
It seems I cannot figure out this problem on the internet well so I am asking you guys. I would like to know what is the difference between using ItemsContainerGenerator inside it's custom Panel's measure method with and without calling the Recycle on containers.
My guess is that generator creates new containers and connects them to data items once the method GenerateNext is called but does generator always connects item to their containers in GenerateNext method? With always connecting containers to items I mean, does it links containers that have been already generated/realized over again to their data items?
What will happen if I start recycling containers by calling the recycle() method. Would the generator then still always link containers to items?
I am asking this because the scrolling performance depends usuall on this. If the generator always connects items to containers that would mean it refreshes DataContext/Binding and scrolling would lag little bit. Though if by using recycle method the generator stops refreshing Bindings the scrolling would run pretty smoothly.
When you are using the Recycling virtualization mode, containers are reused, so they are nor necessairly connected to their origin data objects. So if your container template contains elements that will rebuild their visual tree on data (or its type or properties) change - they will. To improve performance I can suggest you to create as independent from data change template, as it possible, minimize visual tree. Also you can modify your ClearContainer method to prevent resetting some global values that are not depending from data: it can be a reference to some big parent control, settings - anything that usually constant but affects visual tree on change.
I noticed that salesforce doesn't allow to override control function for all objects.
Say if you want to do something whenever objects get saved there is no way to attach the action
unless you create a custom page and include either standard controller or extension. Or if you want
to add the same meta-tag on all pages I run into this limitation. Is there better way to do this?
Generally - no. Roughly speaking if Salesforce doesn't allow you to do something it usually means there's pretty good hint you're doing in it wrong. I realize it sounds like I'm a fanboy but in reality - can you expand your question with concrete example why would you want to do something like that? For example governor limits are evil, annoying etc. - but they force you to write effective code that doesn't strain the database too much.
if you want to do something whenever objects get saved
That's what triggers are for. Ask yourself a question if the "action" you need to make should happen only from web UI or also when performed from API (mass data load, a smartphone application etc).
if you want to add the same meta-tag on all pages
You could maybe pull off similar result by adding a component to the sidebar. It won't cover all cases (like accessing Reports/Dashboards) but it's hard to say more without knowing what you're really after. Then again - custom VF page overrides won't help you when it comes to Reports either.
I wanted to add this as a comment, but was unable to.
Anyways, For the example that you mentioned in the comment, You can add that jQuery plugin in the Home page side bar component and activate the plugin only on those custom objects where you wnat to run this plugin. You might already know that we can deduce which object a record belongs to by looking at the 1st 3 letter of the record Id, using this logic, check if the record belongs to the custom object you want your plugin to act on and run the plugin.
But As eyescream has pointed out adding script in side bar has its own limitations: you cannot use the global variables , side bar components are not loaded on the reports and dashboard tabs etc.
-ಸಮಿರ್
I'm using Siaqodb for my client side database engine in a Sync Framework silverlight project. I've switched to siaqodb because microsofts client side solution loads the entire database into memory at once and, as such, has a hard time handling large data.
I've bound a list of SiaqodbOfflineEntity objects to a silverlight datagrid in order to create an editable datagrid. Unlike microsofts solution, you can't bind the database entries directly to the datagrid. You have to query the database and bind a list of in memory objects to the datagrid. This causes a problem in that the database isn't immediatly updated when the datagrid cell is changed. I'm trying to find the best way to handle updates to the database after a change in the cell. I can't just update each item to the database because the siaqodb engine will mark the item as dirty even if no change was made to the object. This will cause conflicts when trying to sync. holding a cached version of the original list and then comparing each property of each object to find which ones have changed seems like it would work, but seems to be a bit cumbersome. I've also tried looking at some of the datagrids events but RowEditEnded doesn't appear to fire when a cell is edited and CurrentCellChanged seems to fire whenever I switch rows (odd).
There's got to be a better solution to this. Anyone have any ideas?
So I've gotten this to work by changing my offline entity classes to implement iNotifyPropertyChange and I think this is a reasonable solution. I set the PropertyChanged event to a function that saves the object to the database. There is a VS package called notifypropertyweaver that will inject this code at compile time, reducing the amount of work needed to be done on auto-generated entity code.
Here's the story: I've been working on putting together an app in VS10 using Windows Forms in C++. This is my first experience with winforms, although I have a fair amount of experience with C++ and have worked with MFC a bit. The program needs to aquire data input from a hardware measurement system and the backend for that is mostly worked out. What I've been a bit stuck on is how to easily work with displaying this data in forms with the DataGridView and Chart objects. I'd also like to be able to save various sets of data and the programs current settings to disk that can be easily recalled and displayed in the program at a later point.
The solution I've been attempting so far has been to create a DataSet object for a certain program instance which holds some DataTables for the data and current settings. This is easily saved and read to XML files using the DataSet methods, which is nice. The tricky part for me using this method has been trying to sync up the program's display data and settings in the DataGridViews and Charts. It seems like these controls are really meant to be designed through the GUI. Maybe I'm just a noob, but I couldn't figure out how to get the DataSet I designed to link with my Charts using the "Add Project data source" dialog, so instead I set up a bindingSource and then proceeded to set Chart settings manually in the code. That's been getting hairy pretty quickly.
What would you have done to implement this, and how would you advise proceeding? I'm sure there has to be a much simpler way of doing this.
I've used Microsoft Chart Controls to display data from hardware measurement systems before with good results.
We store our data separately in arrays and when we want to display something, just call the AddXY function on the items to add a point. Configuring the graph in the first place is more easily done in designer though. Have a look at the samples for more info.
I created a gwt app with a gxt combobox. I have it where it pulls data (a list of names apprx 5000) from the database places it in an array which in turns places it in a store. That is then placed in the combobox using set store, so when a user starts typing in the combo it searches through the store for the name. My question: is this the best way to do this or is there another method.
How is the performance loading that list of 5000 names? Does it take a long time to load your page? You may want to think about loading them as you need them so that the gui loads faster.
This article suggest 'lazy loading' gui components
http://googlewebtoolkit.blogspot.com/2008/11/improving-performance-with-on-demand.html
How have you pulled down the list? I assume is via RPC, have you used a Data Transfer Object?, XML?
This link talks about options for serialization http://code.google.com/webtoolkit/doc/latest/DevGuideServerCommunication.html#DevGuideSerializableTypes
Michael