I'm working for the first time in Silverlight (after a long wait we finally decided to give it a try in our apps!).
My goal is to create some dashboards for our ASP.Net Ajax VB application home page.
I must have a dashboard for each of the main roles available in our app: trainee, trainer, coordinator and manager.
For most of the users, who have only one of these roles, the silverlight app must start by choosing the correct dashboard and load it.
As some users may have more than one role, I thought of having a combo with the possible dashboards a user can see, so that he can change the dashboard he wants to check in each moment.
I have downloaded the CRM demo (amazing work!) and I am using it as my roadmap, with special attention to the dashboardModule.
Despite not having the concept of navigation between modules like the CRM dashboard, I'm considering to use the same approach with Prism and MEF, as our roles combobox will allow the user to change the currently loaded module (traineedashboard, trainerdashboard, coordinatordashboard, managerdashboard
). That means that I'm creating a main silverlight project "Dashboard" (with all the logic of CRM, CRM.Infrastructure, CRM.Theme, etc, for simplicity) and, just like the demo, I' m creating also a specific project for each role dashboard.
I started by the MainMenuView and HeaderView controls.
In the first one, I removed all the radiobuttons except the Dashboard one, renaming the text to 'refresh'. I successfully added some hyperlinkbutton to navigate away from the default.aspx to some of the most used aspx pages in the app, using a URLConverter. I will then add the roles combobox I mentioned before to switch the loaded module.
In the second one, I wanted to show the photo, name and company of the currentUser, instead of fixed data
This brings up some issues:
Do you happen to have a vb version of the source code? I'm using Telerik Converter, but some of the code doesn't get correctly converted (eventhandles, Do functions and some other details).
- Concerning the data layer, the web app references a dll from another project, with linq dbml files with all the database objects. So for me it would be great to use this files. What's the best approach to get data from within the Silverlight dashboards? What I did was to create a Silverlight enabled WCF service in the web project, set up a [OperationContrat]GetUserPhoto method with the appropriate linq queries, add a Service Reference in the main silverlight app and then invoke the service in HeaderView constructor (as show in this example)
- Other issue is the file system access. In my GetUserPhoto method, I return http://" + url.Context_URL + "/_Controls/Thumbnail.ashx?img=" + user.Photo.Substring(1) + "&w=71&h=82 and in the HeaderView I set this.imgCurrentUser.Source = new BitmapImage(new Uri(e.Result, UriKind.Absolute));, which works great! But my app has a virtual directory /Files set up in the root, so how could I define a Relative URI? user.Photo has the relative path: "~/Files/Users/userGuid/myPhoto.jpg"
- So finally now to get the name and company, I set up two new methods GetUserName and GetUserCompany and it is also working. But it would be better to have a unique method getUserData to get the photo, name and company and then use one of two strategies, I suppose: set the name and company TextBlock's text properties in the HeaderView constructor, as I did for the image source or use declarative binding in the xaml. What do you recommend?
After creating the silverlight Dahsboard and CoordinatorDashboard projects with all the "minimum" logic replicated from the CRM demo and converted to VB, I was getting manifest errors (perhaps due to namespace changes). So for now I'm working in C# directly in the CRM and after build I'm copying the xap to my web app ClientBin directory (the deadline for the first prototype is approaching!)
Attached I send a picture of the current status. I will now move on to the DashboardView!
I'm looking forward to get more familiar with this whole new world :)
Thanks in advance for your guidance!