Thanks again for your response. I've set up my extensions dll with a header so that I can reference it from my game. The Noesis resource builder parses it fine and generates the resources, but when I call
NsRegisterReflection(NsGetKernel()->GetComponentFactory(), true);
in my game I get the following exception from line 148 in ComponentFactoryImpl.cpp:
"Component 'Converter<Bool> (TypeConverter)' already registered"
It is very possible I have set up something incorrectly within my extensions dll. Here is the relevant code from within that project:
GuiExtensions.h (included by my game):
#include "stdafx.h"
#include <NsGui/UserControl.h>
#include <NsCore/TypeId.h>
extern "C" NS_DLL_EXPORT
void NsRegisterReflection(Noesis::Core::ComponentFactory* factory, NsBool registerComponents);
GuiExtensions.cpp
#include "stdafx.h"
#include <NsGui/UserControl.h>
#include <NsCore/TypeId.h>
#include "NumericUpDown.h"
extern "C" NS_DLL_EXPORT
void NsRegisterReflection(Noesis::Core::ComponentFactory* factory, NsBool registerComponents)
{
NS_REGISTER_COMPONENT(NumericUpDown)
};
NumericUpDown.h
#include "stdafx.h"
#pragma warning(disable: 4275)
#pragma warning(disable: 4251)
#include <Noesis.h>
#include <NsGui/UserControl.h>
#include <NsGui/UIElementData.h>
#include <NsGui/FrameworkPropertyMetaData.h>
#include <NsGui/RoutedEvent.h>
#include <NsCore/ReflectionImplement.h>
#include <NsCore/TypeId.h>
#include <NsCore/Package.h>
using namespace Noesis;
using namespace Noesis::Core;
using namespace Noesis::Gui;
////////////////////////////////////////////////////////////////////////////////////////////////////
class NumericUpDown: public UserControl
{
public:
/// Gets or sets numeric spinner value
//@{
NsInt32 GetValue() const;
void SetValue(NsInt32 value);
//@}
public:
static const DependencyProperty* ValueProperty;
static const RoutedEvent* ValueChangedEvent;
protected:
virtual void OnValueChanged(const RoutedPropertyChangedEventArgs<NsInt32>& args);
/// From DependencyObject
//@{
NsBool OnPropertyChanged(const Gui::DependencyPropertyChangedEventArgs& args);
//@}
private:
void UpButton_Click(BaseComponent* sender, const Gui::RoutedEventArgs& e);
void DownButton_Click(BaseComponent* sender, const Gui::RoutedEventArgs& e);
NS_IMPLEMENT_INLINE_REFLECTION(NumericUpDown, UserControl)
{
NsMeta<TypeId>("NumericUpDown");
NsProp("Value", &NumericUpDown::GetValue, &NumericUpDown::SetValue);
NsFunc("UpButton_Click", &NumericUpDown::UpButton_Click);
NsFunc("DownButton_Click", &NumericUpDown::DownButton_Click);
NsString source = "Gui/WKDX/numeric_up_down.xaml";
Ptr<UIElementData> data = NsMeta<UIElementData>(TypeOf<SelfClass>());
data->RegisterProperty<NsInt32>(ValueProperty, "Value",
FrameworkPropertyMetadata::Create(NsInt32(0), FrameworkOptions_None));
data->OverrideMetadata<NsString>(UserControl::SourceProperty, "Source",
FrameworkPropertyMetadata::Create(source, FrameworkOptions_None));
data->RegisterEvent(ValueChangedEvent, "ValueChanged", RoutingStrategy_Bubbling);
}
};
NumericUpDown.cpp
#include "stdafx.h"
#pragma warning(disable: 4275)
#pragma warning(disable: 4251)
#include "NumericUpDown.h"
#include <Noesis.h>
#include <NsGui/UserControl.h>
#include <NsGui/UIElementData.h>
#include <NsGui/FrameworkPropertyMetaData.h>
#include <NsGui/RoutedEvent.h>
#include <NsCore/ReflectionImplement.h>
#include <NsCore/TypeId.h>
#include <NsCore/Package.h>
using namespace Noesis;
using namespace Noesis::Core;
using namespace Noesis::Gui;
const DependencyProperty* NumericUpDown::ValueProperty;
const RoutedEvent* NumericUpDown::ValueChangedEvent;
NsInt32 NumericUpDown::GetValue() const
{
return DependencyObject::GetValue<NsInt32>(ValueProperty);
}
void NumericUpDown::SetValue(NsInt32 value)
{
DependencyObject::SetValue<NsInt32>(ValueProperty, value);
}
void NumericUpDown::OnValueChanged(const RoutedPropertyChangedEventArgs<NsInt32>& args)
{
RaiseEvent(args);
}
NsBool NumericUpDown::OnPropertyChanged(const Gui::DependencyPropertyChangedEventArgs& args)
{
NsBool handled = ParentClass::OnPropertyChanged(args);
if (!handled)
{
if (args.prop == ValueProperty)
{
NsInt32 oldValue = *static_cast<const NsInt32*>(args.oldValue);
NsInt32 newValue = *static_cast<const NsInt32*>(args.newValue);
RoutedPropertyChangedEventArgs<NsInt32> e(this, ValueChangedEvent,
oldValue, newValue);
OnValueChanged(e);
return true;
}
}
return handled;
}
void NumericUpDown::UpButton_Click(BaseComponent* sender, const Gui::RoutedEventArgs& e)
{
SetValue(GetValue() + 1);
}
void NumericUpDown::DownButton_Click(BaseComponent* sender, const Gui::RoutedEventArgs& e)
{
SetValue(GetValue() - 1);
}
//extern "C" NS_DLL_EXPORT
//void NsRegisterReflection(Noesis::Core::ComponentFactory* factory, NsBool registerComponents)
//{
// NS_REGISTER_COMPONENT(NumericUpDown)
//};
Do you notice any errors with how I have this set up?
Thanks for you help.