// アドインの開始時に呼ばれる 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); } }