I developed a media center application that works perfectly. However, I needed to change the assembly name and namespace. Rather than doing a find/replace I just decided to create a brand new project and recreate it all from scratch. What's weird is that the new app will not build as I am getting a "Unable to find type" error. The old project builds and runs flawlessly. Can't seem to figure it out. Been researching and playing with it for weeks now. I have a feeling that it has to do with the GAC utility or something along those lines. I really need help with this as I am running short on time. Here is some snippits of code and the errors:
The Error:
Error 3 Unable to find type 'DeviceItem'. C:\Users\Matt\My Projects\Homeboy Software\Apps\Homeboy WMC\Markup\AddDevice.mcml 95 1 HomeboyWMC
The MCML:
<Mcml xmlns="http://schemas.microsoft.com/2008/mcml"
xmlns:cor="assembly://MsCorLib/System"
xmlns:a="assembly://HomeboyWMC/HomeboyWMC"
xmlns:c="resx://HomeboyWMC/HomeboyWMC.Resources/Controls"
xmlns:host="assembly://Microsoft.MediaCenter/Microsoft.MediaCenter.Hosting"
xmlns:me="Me">
<UI Name="AddDevice">
<Properties>
<a:Application Name="Application" Application="$Required"/>
<host:PageSession Name="Session" PageSession="$Required"/>
</Properties>
<Locals>
<a:AddDeviceScreen Name="AddDeviceScreen"/>
</Locals>
<Content>
<Panel Layout="Form">
<Children>
<c:HeaderText Text="Add Device">
<LayoutInput>
<FormLayoutInput Right="Parent,1,-100"
Top="Parent,0, 50"/>
</LayoutInput>
</c:HeaderText>
<!--
<me:ActionsMenu Application="[Application]">
<LayoutInput>
<FormLayoutInput Left="Parent,.10"
Top="Parent, .25"/>
</LayoutInput>
</me:ActionsMenu>
-->
<me:ScreenForm Application="[Application]" AddDeviceScreen="[AddDeviceScreen]">
<LayoutInput>
<FormLayoutInput Left="Parent,.40"
Top="Parent, .25"/>
</LayoutInput>
</me:ScreenForm>
<me:Navigation Application="[Application]" Session="[Session]" AddDeviceScreen="[AddDeviceScreen]">
<LayoutInput>
<FormLayoutInput Right="Parent,.90"
Bottom="Parent, .90"/>
</LayoutInput>
</me:Navigation>
</Children>
</Panel>
</Content>
</UI>
<UI Name="ActionsMenu">
<Properties>
<a:Application Name="Application" Application="$Required"/>
</Properties>
<Locals>
<Command Name="SaveCommand" />
<Command Name="CancelCommand" />
</Locals>
<Rules>
<Changed Source="[SaveCommand.Invoked]">
<Actions>
<Invoke Target="[Application.SaveModem]"/>
</Actions>
</Changed>
</Rules>
<Content>
<Panel Layout="VerticalFlow">
<Children>
<Text Name="Title" Color="Aqua" Content="ACTIONS" Margins="0,0,0,5" Font="Calibri, 24"></Text>
<c:SimpleButton Name="SaveButton" Size="250,51" Command="[SaveCommand]" Text="Save"/>
<c:SimpleButton Name="CancelButton" Size="250,51" Command="[CancelCommand]" Text="Cancel"/>
</Children>
</Panel>
</Content>
</UI>
<UI Name="ScreenForm">
<Properties>
<a:Application Name="Application" Application="$Required"/>
<a:AddDeviceScreen Name="AddDeviceScreen" AddDeviceScreen="$Required"/>
<a:DeviceItem Name="DeviceItem"/>
</Properties>
<Locals>
<EditableText Name="DeviceName" Value=""/>
<EditableText Name="DeviceAddress" Value=""/>
</Locals>
<Rules>
<Binding Source="[NameEditbox.EditableText.Value]" Target="[AddDeviceScreen.Name]" />
<Binding Source="[AddressEditbox.EditableText.Value]" Target="[AddDeviceScreen.Address]" />
<Binding Source="[DeviceTypeSpinner.Selected]" Target="[AddDeviceScreen.Type]" />
</Rules>
<Content>
<Panel Layout="VerticalFlow">
<Layout>
<FlowLayout Orientation="Vertical"
Spacing="10,0"/>
</Layout>
<Children>
<Text Name="NameLabel" Color="White" Content="Provide a unique name for this device (e.g. Living Room Light):" Font="Calibri, 18" MaximumSize="500,100" WordWrap="true"></Text>
<c:SimpleEditbox Name="NameEditbox" EditableText="[DeviceName]" Size="350,45" FocusOrder="1" />
<ColorFill Content="AliceBlue" MinimumSize="600,2" MaximumSize="600,2" Alpha=".5" />
<Text Name="AddressLabel" Color="White" Content="An Insteon address for your device is provided by the manufacturer (e.g. A1A1A1). Enter the address below:" Font="Calibri, 18" MaximumSize="500,100" WordWrap="true"></Text>
<c:SimpleEditbox Name="AddressEditbox" EditableText="[DeviceAddress]" Size="130,45"/>
<ColorFill Content="AliceBlue" MinimumSize="600,2" MaximumSize="600,2" Alpha=".5" />
<Text Name="TypeLabel" Color="White" Content="Select the type of device:" Font="Calibri, 18"></Text>
<c:SimpleSpinner Name="DeviceTypeSpinner" Model="[DeviceItem.DeviceTypes]"/>
</Children>
</Panel>
</Content>
</UI>
<UI Name="Navigation">
<Properties>
<a:Application Name="Application" Application="$Required"/>
<a:AddDeviceScreen Name="AddDeviceScreen" AddDeviceScreen="$Required"/>
<host:PageSession Name="Session" PageSession="$Required"/>
</Properties>
<Locals>
<Command Name="CancelCommand"/>
<Command Name="NextCommand"/>
</Locals>
<Rules>
<Changed Source="[CancelCommand.Invoked]">
<Actions>
<!--<Invoke Target="[Application.DialogTest]" strClickedText="Cancel"/>-->
<Invoke Target="[Session!host:HistoryOrientedPageSession.BackPage]"/>
</Actions>
</Changed>
<Changed Source="[NextCommand.Invoked]">
<Actions>
<!--<Invoke Target="[Application.DialogTest]" strClickedText="Next"/>-->
<Invoke Target="[AddDeviceScreen.Next]" app="[Application]" />
</Actions>
</Changed>
</Rules>
<Content>
<Panel Layout="HorizontalFlow">
<Children>
<c:SimpleButton Name="CancelButton" Size="110,51" Command="[CancelCommand]" Text="Cancel" />
<c:SimpleButton Name="NextButton" Size="86,51" Command="[NextCommand]" Text="Next" />
</Children>
</Panel>
</Content>
</UI>
</Mcml>
The DeviceItem Class:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.MediaCenter.UI;
using Homeboy.Devices;
using Homeboy.Protocols;
using Microsoft.MediaCenter.Hosting;
using Microsoft.MediaCenter;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
namespace HomeboyWMC
{
[Serializable]
public class DeviceItem : ModelItem, ISerializable
{
private Device.DeviceType _type;
private string _name;
private InsteonAddress _address;
private Application _app;
public DeviceItem() { }
public DeviceItem(SerializationInfo info, StreamingContext ctxt)
{
Type = (string)info.GetValue("Type", typeof(string));
Name = (string)info.GetValue("Name", typeof(string));
Address = (string)info.GetValue("Address", (typeof(string)));
}
public virtual void GetObjectData(SerializationInfo info, StreamingContext ctxt)
{
info.AddValue("Type", Type);
info.AddValue("Name", Name);
info.AddValue("Address", Address);
}
public string Type
{
get { return _type.ToString(); }
set { _type = (Device.DeviceType)Enum.Parse(typeof(Device.DeviceType), value); }
}
public string Name
{
get { return _name; }
set { _name = value; }
}
public string Address
{
get { return _address.ToString(); }
set { _address = new InsteonAddress(value); }
}
public Choice DeviceTypes
{
get
{
Choice options = new Choice();
List<string> stringItems = new List<string>();
stringItems.Add("Light");
stringItems.Add("Dimmable Light");
stringItems.Add("Computer Bridge");
options.Options = stringItems;
return options;
}
}
}
}