Click here to Skip to main content

VS 2012/2013 & .NET 4.5.1

 
QuestionC++Cx / WinRT: Parameterized constructor (and operator overloading) for 'public value struct' PinmemberSuper Lloyd20-Dec-12 3:08 
AnswerRe: C++Cx / WinRT: Parameterized constructor (and operator overloading) for 'public value struct' PinmemberSuper Lloyd20-Dec-12 19:50 
Questionvc++ Pinmembersrinivasankrishnaa14-Dec-12 7:37 
AnswerRe: vc++ PinmemberSuper Lloyd14-Dec-12 21:11 
GeneralRe: vc++ Pinmembersrinivasankrishnaa17-Dec-12 5:22 
AnswerRe: vc++ PinmemberProgramFOX23-Dec-12 5:04 
AnswerRe: vc++ PinmemberEdo Tzumer3-Feb-13 0:12 
QuestionWInRT component and event grief PinmemberSuper Lloyd11-Dec-12 5:51 
I have a WinRT C++ component which work fine when use in C#.
(implementation below)
 
However, when I tried to use it in a Direct3D C++ WinRT app it crashes in the constructor, while calling
ref new PerformanceTimer()
-> Reset()
-> OnPropertyChanged("Total")
-> PropertyChanged(this, ....)
 
I got a "Platform::WrongThreadException ^"
 
What can I do?
I need those event to notify about some important change (this Total property is not important, but others are)
 
[Windows::UI::Xaml::Data::Bindable]
[Windows::Foundation::Metadata::WebHostHidden]
public ref class PerformanceTimer sealed :  Windows::UI::Xaml::Data::INotifyPropertyChanged
{
public:
	PerformanceTimer()
	{
		Reset();
	}
	
	void Reset()
	{
		m_total = 0.0f;
		OnPropertyChanged("Total");
	}
 
	property float Total { float get() { return m_total; } }
	
 
#pragma region INotifyPropertyChanged
    private:
        void OnPropertyChanged(Platform::String^ propertyName)
        {
			PropertyChanged(this, ref new Windows::UI::Xaml::Data::PropertyChangedEventArgs(propertyName));
        }
 
		event Windows::UI::Xaml::Data::PropertyChangedEventHandler^ _pChanged;
    public:
		virtual event Windows::UI::Xaml::Data::PropertyChangedEventHandler^ PropertyChanged
		{
			Windows::Foundation::EventRegistrationToken add(Windows::UI::Xaml::Data::PropertyChangedEventHandler^ value)
			{
				return _pChanged::add(value);
			}
			void remove(Windows::Foundation::EventRegistrationToken token)
			{
				_pChanged::remove(token);
			}
		internal:
			void raise(Object^ sender, Windows::UI::Xaml::Data::PropertyChangedEventArgs^ e)
			{
				_pChanged::raise(sender, e);
			}
		}
#pragma endregion	
 
private:
	LARGE_INTEGER m_frequency;
 
	float m_total;
};
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.

AnswerRe: WInRT component and event grief PinprotectorPete O'Hanlon11-Dec-12 7:23 
GeneralRe: WInRT component and event grief PinmemberSuper Lloyd12-Dec-12 4:14 
GeneralRe: WInRT component and event grief PinprotectorPete O'Hanlon12-Dec-12 4:19 
GeneralRe: WInRT component and event grief PinmemberSuper Lloyd12-Dec-12 12:25 
GeneralRe: WInRT component and event grief PinprotectorPete O'Hanlon12-Dec-12 13:02 
GeneralRe: WInRT component and event grief PinmemberSuper Lloyd13-Dec-12 0:45 
GeneralRe: WInRT component and event grief PinmemberSuper Lloyd14-Dec-12 21:09 
GeneralRe: WInRT component and event grief PinprotectorPete O'Hanlon14-Dec-12 23:50 
GeneralRe: WInRT component and event grief PinmemberSuper Lloyd15-Dec-12 2:57 
GeneralRe: WInRT component and event grief PinprotectorPete O'Hanlon15-Dec-12 11:34 
GeneralRe: WInRT component and event grief PinmemberSuper Lloyd15-Dec-12 19:26 
GeneralRe: WInRT component and event grief PinmemberSuper Lloyd15-Dec-12 19:30 
QuestionWinRT: C++ C# interop grief PinmemberSuper Lloyd5-Dec-12 5:37 
AnswerRe: WinRT: C++ C# interop grief PinmemberSuper Lloyd5-Dec-12 6:20 
GeneralRe: WinRT: C++ C# interop grief PinmemberFrankLavigne3-Jan-13 6:14 
QuestionHow to throw a usable error from a WinRT C++ component to a C# code PinmemberSuper Lloyd5-Dec-12 4:59 
AnswerRe: How to throw a usable error from a WinRT C++ component to a C# code PinmemberSuper Lloyd5-Dec-12 5:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 26 Nov 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid