Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: WPF Programmer's Reference: Windows Presentation Foundation with C# 2010 and .NET 4
This is the forum to discuss the Wrox book WPF Programmer's Reference: Windows Presentation Foundation with C# 2010 and .NET 4 by ; ISBN: 9780470477229
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: WPF Programmer's Reference: Windows Presentation Foundation with C# 2010 and .NET 4 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old March 31st, 2014, 12:46 AM
Authorized User
Points: 96, Level: 1
Points: 96, Level: 1 Points: 96, Level: 1 Points: 96, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2013
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter18_Planets_ErrorMessage

Hi Rod
On opening your download CH18 “Planets” and “PlanetPanel”, I get an error message.
“The type 'local:Planet' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built”

Is there something that I have missed ?

Part code attached – “local:Planet” seems to be the problem.

[<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Planets"
x:Class="Planets.Window1"
x:Name="Window"
Title="Planets"
Width="600" Height="410">
<Window.Background>
<ImageBrush ImageSource="Stars.jpg"/>
</Window.Background>
<Window.Resources>
<x:Array x:Key="planets" Type="local:Planet">
<local:Planet Name="Mercury" Picture="Mercury.jpg" Stats="Distance: 0.39 AU, Radius: 0.38, Mass: 0.05, Day: 59 days, Year: 88 days"/>
<local:Planet Name="Venus" Picture="Venus.jpg" Stats="Distance: 0.72 AU, Radius: 0.95, Mass: 0.89, Day: 243 days, Year: 224 days"/>
<local:Planet Name="Earth" Picture="Earth.jpg" Stats="Distance: 1 AU, Radius: 1, Mass: 1, Day: 1 day, Year: 365 days"/>
<local:Planet Name="Mars" Picture="Mars.jpg" Stats="Distance: 1.5 AU, Radius: 0.53, Mass: 0.11, Day: 1.026 days, Year: 687 days"/>
<local:Planet Name="Jupiter" Picture="Jupiter.jpg" Stats="Distance: 5.2 AU, Radius: 11, Mass: 318, Day: 0.411 days, Year: 11.8 years"/>
<local:Planet Name="Saturn" Picture="Saturn.jpg" Stats="Distance: 9.5 AU, Radius: 9, Mass: 95, Day: 0.43 days, Year: 29.5 years"/>
<local:Planet Name="Uranus" Picture="Uranus.jpg" Stats="Distance: 19.2 AU, Radius: 4, Mass: 14, Day: 0.75 days, Year: 84 years"/>
<local:Planet Name="Neptune" Picture="Neptune.jpg" Stats="Distance: 30.1 AU, Radius: 3.8, Mass: 17, Day: 0.8 days, Year: 165 years"/>
<local:Planet Name="Pluto" Picture="Pluto.jpg" Stats="Distance: 39.5 AU, Radius: 0.18, Mass: 0.002, Day: 0.27 days, Year: 248 years"/>
</x:Array>
</Window.Resources>]

Thanks

Wendel
Reply With Quote
  #2 (permalink)  
Old March 31st, 2014, 07:27 PM
Rod Stephens's Avatar
Wrox Author
Points: 3,141, Level: 23
Points: 3,141, Level: 23 Points: 3,141, Level: 23 Points: 3,141, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2006
Location: , , .
Posts: 640
Thanks: 2
Thanked 96 Times in 95 Posts
Default

Hi Wendel,

I don't know of any special tricks for those programs, so I'll go with the easiest possibility: corrupted ZIP file.

I've attached a version of those programs that work for me. Give them a try and let me know if they work.
Attached Files
File Type: zip Planets And Panels.zip (665.2 KB, 2 views)
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
Reply With Quote
  #3 (permalink)  
Old March 31st, 2014, 09:37 PM
Authorized User
Points: 96, Level: 1
Points: 96, Level: 1 Points: 96, Level: 1 Points: 96, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2013
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default CH18_Planets_ErrorMessage

Hi Rod
Still get the same error messages including attached.
Maybe the planets have moved?

"Error 1 Unable to load the metadata for assembly 'Planets'. This assembly may have been downloaded from the web. See http://go.microsoft.com/fwlink/?LinkId=179545. The following error was encountered during load: Could not load file or assembly 'Planets' or one of its dependencies. The system cannot find the file specified. C:\Users\Wendel\Downloads\Planets And PanelsUnzipped\Planets\Planets\Window1.xaml 1 1 Planets"

Regards
Wendel
Reply With Quote
  #4 (permalink)  
Old March 31st, 2014, 10:00 PM
Rod Stephens's Avatar
Wrox Author
Points: 3,141, Level: 23
Points: 3,141, Level: 23 Points: 3,141, Level: 23 Points: 3,141, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2006
Location: , , .
Posts: 640
Thanks: 2
Thanked 96 Times in 95 Posts
Default

Huh. It could be that the ZIP files were blocked by Windows when you downloaded them for your protection. That would probably mess up Visual Studio, although I don't know why these particular programs are singled out.

Anyway, right-click on the ZIP file and select properties. On the General tab, look for text that says something like, "This file came from another computer and might be blocked to help protect this computer." Next to that there should be an Unblock button. Click that button and then click OK.

Then unzip the file. (If you unzip the file first, all of the unzipped files will inherit the block from the ZIP file. So unblock the zip file first.)

Let me know if that helps. (I hope it does because I'm running out of easy possibilities.)
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
Reply With Quote
  #5 (permalink)  
Old March 31st, 2014, 10:39 PM
Authorized User
Points: 96, Level: 1
Points: 96, Level: 1 Points: 96, Level: 1 Points: 96, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2013
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ch18_Planets_ErrorMessage

Hi Rod
Still no go. But,
I tried to open the following in Internet Explorer "without the xmlns bit"
[xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml]
and received the following error message:
“The resource you are looking for has been removed, had its name changed, or is temporarily unavailable”
Maybe that the hassle.

Anyway, I might just let the planets go for a while; mayne they will realign themselves.
Regards
Wendel
Reply With Quote
  #6 (permalink)  
Old April 2nd, 2014, 01:40 AM
Authorized User
Points: 96, Level: 1
Points: 96, Level: 1 Points: 96, Level: 1 Points: 96, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2013
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ch18_ErrorMessage_*.cs files

Hi Rod
I have narrowed down the files that I can’t open and their similarities.
OrgChartMasterDetails, OrgChartTreeView, OrgChartXaml, Planets, PlanetPanel, PersonList.

Files in Ch18 that have *.cs files listed in App.xaml are the ones that create an error message. All the others I can open OK.

i.e. Ch18_PersonsList has two files listed under App.xaml , Person.cs and Person2.cs
On opening I get the following error message: Error 1 to 15 – only 15 and 1 are attached

(Error 15 The type 'local:Person2' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. C:\Users\Wendel\Desktop\WPF_C#\Ch18\PersonList\Per sonList\Window1.xaml 33 14 PersonList
Error 1 Unable to load the metadata for assembly 'PersonList'. This assembly may have been downloaded from the web. See http://go.microsoft.com/fwlink/?LinkId=179545. The following error was encountered during load: Could not load file or assembly 'PersonList' or one of its dependencies. The system cannot find the file specified. C:\Users\Wendel\Desktop\WPF_C#\Ch18\PersonList\Per sonList\Window1.xaml 1 1 PersonList)

Hope this helps.
Regards
Wendel
Reply With Quote
  #7 (permalink)  
Old April 2nd, 2014, 10:55 AM
Rod Stephens's Avatar
Wrox Author
Points: 3,141, Level: 23
Points: 3,141, Level: 23 Points: 3,141, Level: 23 Points: 3,141, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2006
Location: , , .
Posts: 640
Thanks: 2
Thanked 96 Times in 95 Posts
Default

How are you opening the files? You should be using Visual Studio to open the project. It sounds like you might be trying to open things in a browser?
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
Reply With Quote
  #8 (permalink)  
Old April 3rd, 2014, 12:59 AM
Authorized User
Points: 96, Level: 1
Points: 96, Level: 1 Points: 96, Level: 1 Points: 96, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2013
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ch18_ErrorMessage_*.cs files

Hi Rod
1) Open MS Visual Studio C# 210 Express
2) File / Open Project
3) Find the project and double click “Microsoft Visual Studio Solution” file eg PersonList.sln
XAML then highlights/complains about local:Person and local:Person2.
I am able to open all your other files using above method.
Regards
Wendel
Reply With Quote
  #9 (permalink)  
Old April 3rd, 2014, 01:20 AM
Rod Stephens's Avatar
Wrox Author
Points: 3,141, Level: 23
Points: 3,141, Level: 23 Points: 3,141, Level: 23 Points: 3,141, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2006
Location: , , .
Posts: 640
Thanks: 2
Thanked 96 Times in 95 Posts
Default

Sorry, I'm at a loss. I can open the PersonList project and the Planets projects.

Looking more closely at the project and your earlier messages. It seems like it doesn't like the projects that have defined classes for some reason.

When you look at the directory for the Planets project, does it look like this:
Planets.suo
Planets.sln
/Planets
Window1.xaml
Planets.csproj
Planet.cs
... lots of other files...
In particular, is the Planets.cs file in the Planets subdirectory?

Does Planets.cs look normal in Solution Explorer? And can you double-click to open it? Or is the whole file missing or messed up somehow?

All in all, I'm baffled about why it shouldn't like the classes.
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
Reply With Quote
  #10 (permalink)  
Old April 3rd, 2014, 02:53 AM
Authorized User
Points: 96, Level: 1
Points: 96, Level: 1 Points: 96, Level: 1 Points: 96, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2013
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ch18_ErrorMessage_*.cs files

Hi Rod
All the files in Solution Explorer: - using MS Visual Studio C# 210 Express:

Solution ‘Planets’ (1 project)
Properties
AssemblyInfo.cs
References
PresentationCore
PresentationFramework
System
System.Core
System.Data
System.Xaml
System.xml
WindowsBase
bin
Debug
obj
Debug
App.xaml
App.xaml.cs
Application.ico
Earth…Venus.jpg i.e. lots of *.jpg files
Planet.cs
Windows1.xaml
Windows1.xaml.cs

I can open all the *.cs files ok.
I can also open Windows1.xaml.cs, but that is when I get the error message – “Problem Loading”. I can see the xaml code.

Planet.cs looks ok – copy attached
(using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Windows.Media;

namespace Planets
{
class Planet
{
private string m_Name = "";
public string Name
{
get { return m_Name; }
set { m_Name = value; }
}

private string m_Stats = "";
public string Stats
{
get { return m_Stats; }
set { m_Stats = value; }
}

private ImageSource m_Picture = null;
public ImageSource Picture
{
get { return m_Picture; }
set { m_Picture = value; }
}
}
})

Using Windows Explorer – the following files are listed in the Planets folder:
_UpgradeReport_Files = folder
Planets = folder
Planet.cs
Planet =project file
Window1.xaml
Lots of other files
Planets =MS Visual Studio Solution
Planets.sln.cache
UpgradeLog =XML Document

I can’t see:
Planets.suo
/PlanetsWindow1.xaml
Planets.csproj

Thanks for your help on this one.
Regards
Wendel
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off



All times are GMT -4. The time now is 12:25 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.