WiimoteLib - problemy

Witam. Mam do napisania aplikację w windows Forms C++/CLI i po przebijaniu się przez problemy natknąłem się na jeden z nich (wcześniejszy rozwiązany na innym forum)

mój kod programu

#pragma once

namespace formatka {

        using namespace System;

        using namespace System::ComponentModel;

        using namespace System::Collections;

        using namespace System::Windows::Forms;

        using namespace System::Data;

        using namespace System::Drawing;

        using namespace WiimoteLib;

        /// 

        /// Summary for Form1

        /// 

        public ref class Form1 : public System::Windows::Forms::Form

        {                

        public:

                Wiimote ^wm;

                WiimoteCollection ^mWC;

                Form1(void)

                {

                        InitializeComponent();

                        //

                        //TODO: Add the constructor code here

                        wm = gcnew Wiimote();

                        mWC = gcnew WiimoteCollection();

                        //

                }


        protected:

                /// 

                /// Clean up any resources being used.

                /// 

                ~Form1()

                {

                        if (components)

                        {

                                delete components;

                        }

                }

        private: System::Windows::Forms::CheckBox^ checkBox1;

        private: System::Windows::Forms::TextBox^ textBox1;

        protected: 


        private:

                /// 

                /// Required designer variable.


                /// 

                System::ComponentModel::Container ^components;


#pragma region Windows Form Designer generated code

                /// 

                /// Required method for Designer support - do not modify

                /// the contents of this method with the code editor.

                /// 

                void InitializeComponent(void)

                {

                        this->checkBox1 = (gcnew System::Windows::Forms::CheckBox());

                        this->textBox1 = (gcnew System::Windows::Forms::TextBox());

                        this->SuspendLayout();

                        // 

                        // checkBox1

                        // 

                        this->checkBox1->AutoSize = true;

                        this->checkBox1->Location = System::Drawing::Point(113, 76);

                        this->checkBox1->Name = L"checkBox1";

                        this->checkBox1->Size = System::Drawing::Size(80, 17);

                        this->checkBox1->TabIndex = 0;

                        this->checkBox1->Text = L"checkBox1";

                        this->checkBox1->UseVisualStyleBackColor = true;

                        // 

                        // textBox1

                        // 

                        this->textBox1->Location = System::Drawing::Point(36, 13);

                        this->textBox1->Name = L"textBox1";

                        this->textBox1->Size = System::Drawing::Size(100, 20);

                        this->textBox1->TabIndex = 1;

                        this->textBox1->TextChanged += gcnew System::EventHandler(this, &Form1::textBox1_TextChanged);

                        // 

                        // Form1

                        // 

                        this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);

                        this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;

                        this->ClientSize = System::Drawing::Size(410, 262);

                        this->Controls->Add(this->textBox1);

                        this->Controls->Add(this->checkBox1);

                        this->Margin = System::Windows::Forms::Padding(1, 3, 1, 3);

                        this->Name = L"Form1";

                        this->Text = L"Form1";

                        this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);

                        this->ResumeLayout(false);

                        this->PerformLayout();


                }

#pragma endregion

        private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) 

                         { 


                        wm->WiimoteChanged += gcnew WiimoteChangedEventHandler(this, &Form1::wm_WiimoteChanged); /////// Wspomniany error d:\documents\visual studio 2010\projects\formatka\formatka\Form1.h(98): error C2061: syntax error : identifier 'WiimoteChangedEventHandler'

1> Generating Code...

                        wm->Connect();


                         }

        private: void button1_Click(System::Object^ sender, System::EventArgs^ e) 

        {

            wm->SetLEDs(1);

            checkBox1->Checked = wm->WiimoteState->ButtonState.A;

        }


         void wm_WiimoteChanged(System::Object^ sender, WiimoteChangedEventArgs^ args)

                         {

                                 //current state information

                                 WiimoteState ^ws= args->WiimoteState;


                         }

        private: System::Void textBox1_TextChanged(System::Object^ sender, System::EventArgs^ e) {

                         }

        };

}

tak jak widać pojawia się error d:\documents\visual studio 2010\projects\formatka\formatka\Form1.h(98): error C2061: syntax error : identifier ‘WiimoteChangedEventHandler’ 1> Generating Code… takie uzycie funkcji wm->WiimoteChanged += gcnew WiimoteChangedEventHandler(this, &Form1::wm_WiimoteChanged); zaproponowano mi gdzie indziej jednakże nie działa ono prawidłowo co ciekawe analizujac tutorial do tej biblioteki w C# jest inne uzycie

// setup the event to handle state changes

    wm.WiimoteChanged += wm_WiimoteChanged;

a funkcja jest zdefniowana następująco void wm_WiimoteChanged(object sender, WiimoteChangedEventArgs args)

{

    // current state information

    WiimoteState ws = args.WiimoteState;


    // write out the state of the A button    

    Debug.WriteLine(ws.ButtonState.A);

}

jesli ktos to dobrze ogarnia prosilbym o jakas wskazowke

WiimoteChangedEventHandler nie jest zwyczajną metodą, jest delegatem.

Powinieneś zapoznać się z tym terminem, a także ze sposobem używania eventów i delegatów jeśli chcesz to dobrze ogarniać,

a na początek może przeanalizować ten artykuł i sposób w jaki tam zostaje używany WiimoteChangedEventHandler

http://www.codeproject.com/Articles/230 … dia-Player

a zatem pomogło takie wykorzystanie eventa

wm->WiimoteChanged += gcnew System::EventHandler(this, &Form1::wm_WiimoteChanged);

zaś sama funkcja wm_WiimoteChanged została tak zmieniona

private: System::Void wm_WiimoteChanged(System::Object^ sender, WiimoteChangedEventArgs^ args)