Exemple #1
0
        private void SetupKinect()
        {
            this.context        = new xn.Context(SAMPLE_XML_FILE);
            this.sessionManager = new xnv.SessionManager(this.context, "Wave", "RaiseHand");

            this.pointControl = new xnv.PointControl();

            this.sessionManager.SessionStart += new xnv.SessionManager.SessionStartHandler(sessionManager_SessionStart);

            this.primaryHand = new xnv.HandPointContext();
            this.handPoints  = new List <xnv.HandPointContext> ();

            this.pointControl.PointDestroy += new xnv.PointControl.PointDestroyHandler(pointControl_PointDestroy);
            this.pointControl.PointUpdate  += new xnv.PointControl.PointUpdateHandler(pointControl_PointUpdate);
            this.pointControl.PointCreate  += new xnv.PointControl.PointCreateHandler(pointControl_PointCreate);

            this.pointControl.PrimaryPointCreate  += new xnv.PointControl.PrimaryPointCreateHandler(pointControl_PrimaryPointCreate);
            this.pointControl.PrimaryPointReplace += new xnv.PointControl.PrimaryPointReplaceHandler(pointControl_PrimaryPointReplace);
            this.pointControl.PrimaryPointDestroy += new xnv.PointControl.PrimaryPointDestroyHandler(pointControl_PrimaryPointDestroy);

            this.sessionManager.AddListener(this.pointControl);

            this.shouldRun    = true;
            this.readerThread = new Thread(ReaderThread);
            this.readerThread.Start();
        }
Exemple #2
0
        // アドインの開始時に呼ばれる
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            try {
                this.Application.SlideShowBegin += new Microsoft.Office.Interop.PowerPoint.EApplication_SlideShowBeginEventHandler(Application_SlideShowBegin);
                this.Application.SlideShowEnd   += new Microsoft.Office.Interop.PowerPoint.EApplication_SlideShowEndEventHandler(Application_SlideShowEnd);

                // OpenNIの初期設定
                context        = new xn.Context(CONFIG_XML_PATH);
                sessionManager = new xnv.SessionManager(context, "Click", "RaiseHand");

                waveDetector = new xnv.WaveDetector();
                pushDetector = new xnv.PushDetector();

                waveDetector.Wave += new xnv.WaveDetector.WaveHandler(waveDetector_Wave);
                pushDetector.Push += new xnv.PushDetector.PushHandler(pushDetector_Push);

                sessionManager.AddListener(waveDetector);
                sessionManager.AddListener(pushDetector);

                // データ更新のためのスレッドを生成
                UpdateThread = new Thread(() =>
                {
                    while (true)
                    {
                        context.WaitAndUpdateAll();
                        sessionManager.Update(context);
                        Thread.Sleep(1);
                    }
                });
                UpdateThread.Start();
            }
            catch (Exception ex) {
                MessageBox.Show("アドインの初期化に失敗しました\n" + ex.Message);
            }
        }
Exemple #3
0
        public Boxes()
        {
            InitializeComponent();

            this.context = new xn.Context(SAMPLE_XML_FILE);
            this.sessionManager = new xnv.SessionManager(this.context, "Wave", "RaiseHand");

            this.flowRouter = new xnv.FlowRouter();
            this.selectableSlider = new xnv.SelectableSlider1D(3, xnv.Axis.X);
            this.boxes = new MyBox[3];
            this.boxes[0] = new MyBox(this.Box1, "Box1");
            this.boxes[1] = new MyBox(this.Box2, "Box2");
            this.boxes[2] = new MyBox(this.Box3, "Box3");

            this.boxes[0].Leave += new MyBox.LeaveHandler(Boxes_Leave);
            this.boxes[1].Leave += new MyBox.LeaveHandler(Boxes_Leave);
            this.boxes[2].Leave += new MyBox.LeaveHandler(Boxes_Leave);

            this.selectableSlider.ItemHover += new xnv.SelectableSlider1D.ItemHoverHandler(selectableSlider_ItemHover);
            this.selectableSlider.ItemSelect += new xnv.SelectableSlider1D.ItemSelectHandler(selectableSlider_ItemSelect);
            this.selectableSlider.PrimaryPointCreate += new xnv.PointControl.PrimaryPointCreateHandler(selectableSlider_PrimaryPointCreate);
            this.selectableSlider.PrimaryPointDestroy += new xnv.PointControl.PrimaryPointDestroyHandler(selectableSlider_PrimaryPointDestroy);

            this.sessionManager.SessionStart += new xnv.SessionManager.SessionStartHandler(sessionManager_SessionStart);

            this.sessionManager.AddListener(this.flowRouter);

            this.shouldRun = true;
            this.readerThread = new Thread(ReaderThread);
            this.readerThread.Start();
        }
        // アドインの開始時に呼ばれる
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            try {
                this.Application.SlideShowBegin += new Microsoft.Office.Interop.PowerPoint.EApplication_SlideShowBeginEventHandler(Application_SlideShowBegin);
                this.Application.SlideShowEnd += new Microsoft.Office.Interop.PowerPoint.EApplication_SlideShowEndEventHandler(Application_SlideShowEnd);

                // OpenNIの初期設定
                context = new xn.Context(CONFIG_XML_PATH);
                sessionManager = new xnv.SessionManager(context, "Click", "RaiseHand");

                waveDetector = new xnv.WaveDetector();
                pushDetector = new xnv.PushDetector();

                waveDetector.Wave += new xnv.WaveDetector.WaveHandler(waveDetector_Wave);
                pushDetector.Push += new xnv.PushDetector.PushHandler(pushDetector_Push);

                sessionManager.AddListener(waveDetector);
                sessionManager.AddListener(pushDetector);

                // データ更新のためのスレッドを生成
                UpdateThread = new Thread(() =>
                {
                    while (true) {
                        context.WaitAndUpdateAll();
                        sessionManager.Update(context);
                        Thread.Sleep(1);
                    }
                });
                UpdateThread.Start();
            }
            catch (Exception ex) {
                MessageBox.Show("アドインの初期化に失敗しました\n" + ex.Message);
            }
        }
        static void Main(string[] args)
        {
            // 設定ファイルのパス(環境に合わせて変更してください)
            const string CONFIG_XML_PATH = @"../../../../../Data/SamplesConfig.xml";

            // コンテキスト、セッションマネージャー、マルチプロセスサーバの作成
            xn.Context context = new xn.Context(CONFIG_XML_PATH);

            xnv.SessionManager sessionManager = new xnv.SessionManager(context,
                                                    "Wave,Click", "RaiseHand");
        }
        static void Main(string[] args)
        {
            // 設定ファイルのパス(環境に合わせて変更してください)
            const string CONFIG_XML_PATH = @"../../../../../Data/SamplesConfig.xml";

            // コンテキスト、セッションマネージャー、マルチプロセスサーバの作成
            xn.Context context = new xn.Context(CONFIG_XML_PATH);

            xnv.SessionManager sessionManager = new xnv.SessionManager(context,
                                                                       "Wave,Click", "RaiseHand");
        }
Exemple #7
0
        private void SetupKinect()
        {
            this.context = new xn.Context (SAMPLE_XML_FILE);
            this.sessionManager = new xnv.SessionManager (this.context, "Wave", "RaiseHand");

            this.pointControl = new xnv.PointControl ();

            this.sessionManager.SessionStart += new xnv.SessionManager.SessionStartHandler (sessionManager_SessionStart);

            this.primaryHand = new xnv.HandPointContext ();
            this.handPoints = new List<xnv.HandPointContext> ();

            this.pointControl.PointDestroy += new xnv.PointControl.PointDestroyHandler (pointControl_PointDestroy);
            this.pointControl.PointUpdate += new xnv.PointControl.PointUpdateHandler (pointControl_PointUpdate);
            this.pointControl.PointCreate += new xnv.PointControl.PointCreateHandler (pointControl_PointCreate);

            this.pointControl.PrimaryPointCreate += new xnv.PointControl.PrimaryPointCreateHandler (pointControl_PrimaryPointCreate);
            this.pointControl.PrimaryPointReplace += new xnv.PointControl.PrimaryPointReplaceHandler (pointControl_PrimaryPointReplace);
            this.pointControl.PrimaryPointDestroy += new xnv.PointControl.PrimaryPointDestroyHandler (pointControl_PrimaryPointDestroy);

            this.sessionManager.AddListener (this.pointControl);

            this.shouldRun = true;
            this.readerThread = new Thread (ReaderThread);
            this.readerThread.Start ();
        }