Extreme newbie here trying to use the Sales Dashboard project (I have downloaded the source code) to help me build my own dashboard project.
I have basically created the "Shell" application, the "Common" application and one module (the ListBox used to select a salesperson) built. When I run the Shell project I get an error on the InitializeComponent call:
Set property 'Microsoft.Practices.Composite.Presentation.Regions.RegionManager.RegionName' threw an exception. [Line: 84 Position: 67]
Inner Exception:
{System.NullReferenceException: Object reference not set to an instance of an object." & vbCrLf & " at Microsoft.Practices.ServiceLocation.ServiceLocator.get_Current()" & vbCrLf & " at Microsoft.Practices.Composite.Presentation.Regions.RegionManager.CreateRegion(DependencyObject element)" & vbCrLf & " at Microsoft.Practices.Composite.Presentation.Regions.RegionManager.OnSetRegionNameCallback(DependencyObject element, DependencyPropertyChangedEventArgs args)" & vbCrLf & " at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object oldValue, Object newValue)" & vbCrLf & " at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)" & vbCrLf & " at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet)" & vbCrLf & " at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)" & vbCrLf & " at Microsoft.Practices.Composite.Presentation.Regions.RegionManager.SetRegionName(DependencyObject regionTarget, String regionName)}
Message: Object reference not set to an instance of an object.
I really don't even understand how these regions work but I have tried to follow the Sales Dashboard example as closely as I can and I don't see what I'm missing. Anyone have any ideas?
Thanks!!
12 Answers, 1 is accepted

private void Application_Startup(object sender, StartupEventArgs e)
{
new Bootstrapper().Run();
}
The problem is converting this line to vb.net, nothing I am trying seems to work.
Thanks again!

Dim lBootstrapper As New Bootstrapper
lBootstrapper.Run()
So now I believe I am getting somewhere...I'm not sure where but at least I have a different error now:
An exception occurred while initializing module 'ProvidersModule'. (Corresponds to RepresentativesModule)
- The exception message was: An exception has occurred while trying to add a view to region 'RepresentativesRegion'.
- The most likely causing exception was was: 'System.Windows.Markup.XamlParseException: No matching constructor found on type 'MyCompany.Silverlight.Controls.ProvidersViewModel'. [Line: 10]
So it is insisting upon having a parameterless constructor on the ProvidersViewModel'(Corresponds to RepresentativesViewModel in the example). Here is the code for the ProvidersViewModel:
#Region "Imports"
Imports
System.ComponentModel
Imports
Microsoft.Practices.Composite.Events
Imports
System.Collections.ObjectModel
#End Region
Public
Class
ProvidersViewModel
Implements
INotifyPropertyChanged
#Region "Private Fields"
Private
_tinNumber
As
String
=
String
.Empty
Private
_selectedProvider
As
IProvider
Private
_eventAggrigator
As
IEventAggregator
Private
_serviceProxy
As
IProviderDashboardServiceProxy
#End Region
#Region "Public Events"
Public
Event
PropertyChanged
As
PropertyChangedEventHandler
Implements
INotifyPropertyChanged.PropertyChanged
#End Region
#Region "Public Properties"
Public
Property
SelectedProvider
As
IProvider
Get
Return
_selectedProvider
End
Get
Set
(
ByVal
value
As
IProvider)
_selectedProvider = value
OnPropertyChanged(
"SelectedProvider"
)
_eventAggrigator.GetEvent(Of ProviderChangedEvent)().Publish(value)
End
Set
End
Property
#End Region
#Region "Constructor"
Public
Sub
New
(
ByVal
eventAggrigator
As
IEventAggregator,
ByVal
serviceProxy
As
IProviderDashboardServiceProxy)
_eventAggrigator = eventAggrigator
_serviceProxy = serviceProxy
Providers =
New
ObservableCollection(Of IProvider)
LoadProviders()
End
Sub
#End Region
#Region "Providers Data Retrieval Methods"
Private
Sub
LoadProviders()
Dim
lProviders
As
List(Of Dictionary(Of
String
,
String
))
Dim
lProvidersList
As
New
List(Of IProvider)
lProviders = _serviceProxy.GetSubTinsForTinNum(_tinNumber,
False
)
For
Each
lProvider
As
Dictionary(Of
String
,
String
)
In
lProviders
lProvidersList.Add(
New
IProvider
With
{.SubTinSequenceNumber=lProvider(
"SUB_TIN_SEQ_NUM"
).ToString.Trim, .Name=lProvider(
"NAME"
).ToString.Trim})
Next
For
Each
lProvider
As
IProvider
In
lProvidersList
Providers.Add(lProvider)
Next
SelectedProvider = Providers(0)
End
Sub
#End Region
#Region "INotifyPropertyChanged Implementation"
Protected
Overridable
Sub
OnPropertyChanged(
ByVal
propertyName
As
String
)
RaiseEvent
PropertyChanged(
Me
,
New
PropertyChangedEventArgs(propertyName))
End
Sub
Public
Property
Providers
As
ObservableCollection(Of IProvider)
#End Region
End
Class
The error is occurring in the App.xaml.vb code right after the lBootstrapper.Run() line. The code makes it all the way through the bootstrapper, but then throws this error.
Also i'm struggling to understand how in the Representatives module, in the RepresentativesView constructor, how the RepresentativesViewModel is being passed. If someone could help me understand that it would also be great.
Thank you in advance!!

I got around the previous issue by declaring the DataContext in the xaml. Now I am getting stuck on the service proxies.
In the file RepresentativesViewModel.cs, in order to load the employees this line of code is used (within the LoadRegions method):
this
.serviceProxy.GetRepresentatives(regions, LoadEmployees);
The LoadEmployees method looks like this:
private
void
LoadEmployees(List<IEmployee> reps)
{
foreach
(IEmployee rep
in
reps)
{
this
.RepresentativesStorage.Add(rep);
// On first load display all reps
Representatives.Add(rep);
}
// On first load select the first rep in the list
this
.SelectedRepresentative =
this
.Representatives[0];
}
There are a couple things I don't understand here:
1) The LoadEmployees method takes a parameter, reps which is a List(Of IEmployee), but it isn't being passed...how? When I do the same code in VB I get an error telling me that "Argument not specified..."
2) In VB, the LoadEmployees method must be a function or I get the error "Expression does not produce a value"
I feel like I am getting closer, but still not quite there because I just don't understand how some of these things are working. Once again, any help is appreciated.
Thanks!
Sorry for the delayed reply. Are you trying to port the SalesDashboard to VB? Currently we don't offer a VB version of the SalesDashboard. I'd advice you to either use our VB Converter or try InstantVB. Let me know how it goes.
Greetings,Kiril Stanoev
the Telerik team

I'm trying to use it as an example while creating my own dashboard in vb.net. I have used your code converter heavily but some things just don't translate correctly. In any case I have gotten around this issue and am now struggling with how to pass parameters from one control to the other (for instance if the sales dashboard was tied into a website where different companies logged in, the company ID would need to be passed to the application from the .aspx page which in turn would need to pass it to the salesperson selector). I can get it in from the .aspx page no problem but then passing it on to the control where the salespeople are selected is where i'm running into a wall.
Let me give you a quick advice while you're still in a beginning stage. The Sales Dashboard demo is pretty old and was built around the time when the transition between Silverlight 2 and 3 happened. The ideas and approaches in this demo are quite outdated and many workarounds were used to bring it to the current state. That's why I don't think that the Sales Dashboard demos is the most appropriate resource to learn from. In addition, with our official Q2 2011 release (scheduled for the second half of July) we will drop the support for it. Since Sales Dashboard's last update there have been many improvements in the Silverlight plugin as well as in our controls.
My advice is to take a look at our brand new dashboard demo - Telerik Executive Dashboard. This demo was built with all the best practices in mind and it is the perfect resource to learn from. I'd recommend you use the Executive Dashboard demo as a reference before you dig any deeper in the Sales Dashboard. It will save you both time and effort.
You can download the source code of the Telerik Executive Dashboard from you Telerik account. Have a look at it and contact us as soon as possible. We'd be glad to further assist you with any inquires you might have.
Greetings,
Kiril Stanoev
the Telerik team

I'll take a look and reply back.
Thanks again!

All I really need to figure out now is how to capture the event of the salesperson changed in the other controls (modules). When I convert the code to VB, it doesn't work. If someone could simply give me an example of how when the salesperson is changed that event gets caught by the other modules that need the salesperson ID in VB.net that would be a huge help and I THINK the last major hurdle I need to get over. I don't need the entire project converted, I just need to know how to make the event handling work in VB.net.
Thanks again!

So my question now is simply how do I apply the formatting to the MainPage.xaml so that the nice labels and background for each region is displayed?
Thanks!
At this point I fear the conversation is becoming too abstract. Could you please send us your project so we can have a look and provide you with the help you need.
Thanks in advance.
Greetings,
Kalin Milanov
the Telerik team
