I am glad you made your code downloadable - it contains multiple problems that you need to fix to get it compiled:
Replace the following XAML in StringRes.xaml
xmlns:topicsmd="clr-namespace:SchoolPrism.Topics.Model"
xmlns:topicsvm="clr-namespace:SchoolPrism.Topics.ViewModel">
with
xmlns:topicsmd="clr-namespace:SchoolPrism.Topics.Model;assembly=Topics"
xmlns:topicsvm="clr-namespace:SchoolPrism.Topics.ViewModel;assembly=Topics">
This is actually what I tried to suggest in Solution 1 without seeing your code...
Make the classes
TopicsViewModel
and
TopicSchema
public since they will otherwise be invisible outside of their assembly.
I can compile and start your code when I make these changes. But then I get an unrelated PRISM Exception:
$exception {"Directory ../../SchoolPrismInfrastructure/Modules was not found."} System.InvalidOperationException
which I fixed further below for you.
Based on the questions you asked and the simplicity of the problems you cannot seem to recognize and fix I recommend you build your project without PRISM first - and then introduce PRISM when you have a working application - otherwise, you'll be trying to juggle more than one completely new topic at a time and some balls will smash into the ground (I am afraid)...
I hope this was helpful, though...
public class TopicSchema
{
public string Name {
get; set;
}
public int Week
{
get; set;
}
public Uri VidLink { get; set; }
public List<string> Instructions
{
get; set;
}
public string Code
{
get; set;
}
public string VidString
{
get { return VidString; }
set {
VidLink = new Uri("../../Topics/View/Assets/" + value, UriKind.Relative);
}
}
}
public class TopicsViewModel
{
public TopicSchema currentTopic
{
get; set;
}
public ObservableCollection<TopicSchema> getAllWeeks
{
get { return TopicsModel.GetAllWeeks(); }
set { }
}
public DelegateCommand<string> displayTopic
{
get { return new DelegateCommand<string>(DisplayTopic); }
set { }
}
public void DisplayTopic (string week) {
var query = from topic in getAllWeeks where topic.Week== int.Parse(week) select topic;
currentTopic = query.First();
IModule allModules = ServiceLocator.Current.GetInstance<ModuleCatalog>().Modules.Where((ModuleInfo m) => m.ModuleName.Equals("TopicsModule")).Cast<IModule>().First();
}
}
I played a little more with it and found a simple solution for the additional exception. Go into the Solution Exporer and:
1) add a Modules folder to the
SchoolPrism
project and
2) add a ReadMe.txt file into the modules folder
3) Right-Click on the ReadMe.txt file and select properties - select Build Action=Content and Copy to OutputDirectory = Always
Go into
BootStrapper.cs
class and edit the following lines:
protected override IModuleCatalog CreateModuleCatalog ( ) {
return new DirectoryModuleCatalog() {
ModulePath = @".\Modules\"
};
}
this should make sure that you always have a Modules directory and PRISM won't throw the above exception... The application starts up for me when I do this... don't forget to give the solution stars...