Josh Smith's MVVM Demo App: Add commands to MainWindowViewModel's command list - mvvm

I have a question concerning Josh Smith's famous demo app on MVVM.
I try building a "real" application around it to learn WPF.
He creates this CommandsList in the MainWindowViewModel containing 2 Commands (create new and view all customers). This list is readonly (why? any particular reason?).
I thougt it would be nice to add and remove some commands, depending on the workspace that is currently selected. Like edit or delete a customer when it has the focus and so on.
How would I accomplish this?! Can I just make it a normal list and add commands? Or bind the Commands-View to a commands list of the selected workspace instead of the MainWindow? How? Any other ways? Please share your ideas!
Thank you very much!

I write an article about defining the commands in the viewmodel and how you can then use all the possibilities of databinding to show your commands.
One of the possibilities mentioned was to
define a filtered version of the
command list “local menu commands” for
direct use in the view
Something similar is what I think you should do in your situation: write some filtered version of the command list and change it depending on your state.
The article also contains a link to a very simple demo application that shows only how this works so I think it could help you.

Take a look at this: http://fknet.wordpress.com/2011/08/16/porting-a-wpf-app-with-mvvm-design-pattern-to-silverlight-4-using-caliburn-fluentvalidation/
I use messages via Caliburn.

Related

How can I create my custom palette in AnyLogic

I'am starting a project on which we want to study the information process flow inside the company I work with. I have to create different agent-type that represents the different departments and the information exchanged between them.
To maintain the project ordered I would like to know if it is possible, and if yes how, creating palette that will host my agent-type. I would like to create a palette "departments" and "information".
Thanks Andrea
Please consider the AnyLogic help first. Open it (Help/AnyLogic Help/) and search for "Creating a library", all details are there for you.
To be able to export the library (for other users to use it), you will need the Prof license, though.

Is my thinking about mvvm right?

I'm having a little bit of a hard time getting into mvvm. I'm writing a simple app, Notebook. I have one viewmodel, it's name is actually ViewModel. It has an ObservableCollection of Notes inside and methods to save and load those from Isolated Storage. My only Model is Note.cs, it implements INotifyPropertyChanged and I'm of course RaisingPropertyChanged.
I've also got two view, both of them are user controls. One to display list of notes and one to edit the one chosen from the list.
My questions are:
Where do I create an instance of my vievmodel?
How should I implement going from the page with list of notes to the page with detailed view after choosing one Note to edit? At the
moment I'm saving the index of Note in App.xaml.cs, going to the next page and setting
the DetailedView DataContext to the right Note in OnNavigatedTo, but
I don't think it's actually the perfect solution.
Where should I save my Notes? I guess Application_Closing in App.xaml.cs is the right place to do it, but I'd have to have my viewmodel as a global object there, is this the right approach?
Additional question:
I have to add possibility to group notes. I guess that class Group with dictionary (GroupName, howManyNotes) is going to be allright since I don't have to be able to for example write all notes from selected group. Do you think there's a better approach I should think about?
Thanks for respones,
Michał.
I would suggest you take a look at Calibrun.Micro which is a great framework for MVVM. You can get some sample from the CodePlex.
I have used that in a bunch of Project, and will give you flexibility in case if your project grows in size.
Google for Caliburn.Micro sample and you will find a number of sample for all technologies like WPF, Silverlight, Windows Store, Windows Mobile.
Caliburn.Micro CodePlex

Is it possible to add a custom parameter in a Open Graph story with a common action?

We're working on a fitness application where people run and carry out a physical activity for the community as part of a workout.
For example, on Wednesday, Axel ran 5.6km and helped dig a wild flower garden.
We want to build an easy way for users to share these stories on their timelines in Facebook with a map of the course they ran and a sentance that describes the activity. We've opted to use the fitness.runs common action and can provide the course information easily enough, however it's not clear if or how we can add a custom parameter task in the sentence. Ideally the story (with accompanied map) would read:
*Axel* ran *5.6* km to *help dig a wild flower garden* with GoodGym.
Any advice on how to get that working would be greatly appreciated.
I do not think this is possible. Looking at both the run action and the course object you cannot add custom properties. For example, when you go to configure the run action you see the following message at the top "Common Action Type: Run You are viewing the configuration options for the common Action Type: Run. These are read only and are displayed for informational purposes only."
However you might want to consider using User Messages which "allow users to write a personalized message attached to this action." Then you could encourage users to write something about what they helped to do.

Using overlayButtons on FusionCharts with javascript links

I would like to use a javascript function link such as 'link:j-myJS-data' for drill down type charts. I have everything working great to drill down but cannot figure out how to incorporate the overlayButton through the configureLink when drilling down. At present, I can drill down but cannot go back. Can anyone provide a basic example of how I may go about this? Is it even possible?
I thought I could add my own "Back" button to hande this as one option. I do not want to use a jsonURL as there is a lot of data and many paramertes need to be passed resutling in a long links and a lot of extra data in the JSON.
Thanks in advance.
There are multiple options available to create a drill-down chart with FusionCharts XT. Here is a table which explains all of them, with each one's syntax.
The method that you've used is the JavaScript function link. Using this one, you won't get an overlay button to go back to the parent chart.
The overlay button is available only when a LinkedChart is created.
So there are 2 ways that you could go about:
You could change all your charts to use the LinkedCharts technique. Here is a blog post detailing how LinkedCharts can be created using PHP + MySQL. If you aren't using PHP, the general idea shown still applies to any server-side environment.
You could create a separate button sitting near the chart, and this button would re-create the parent chart for you.
The button (which we call "overlay-button") can be made automatically visible using LinkedCharts alone.
However the overlay-button can be internally invoked using the charts' private API. Since these APIs are private, it may change between implementations and may not work as desired under certain circumstances. I would not recommend you to use this. If you are still interested in knowing more on this API, put in a comment and I will update this post.

Multiple TTPickerTextField in TTMessageController

Is there some way to use multiple instances of TTPickerTextField in one TTMessageController? I am currently only using the default "To" field with a .datasource, but I am unsure of how to add the others to the main controller.
Thanks for any help.
There is now a Sample app at GitHub under the Samples that shows a way to handle this.
https://github.com/Three20/Samples/tree/master/MultiRecipients