Ejemplo n.º 1
0
        /// <summary>
        /// 初始化VR的按钮,一旦没有连接成功硬件和Steam的话,程序会自动退出
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void InitVRButton_Click(object sender, RoutedEventArgs e)
        {
            var result = MessageBox.Show("即将初始化VR,请确认VR硬件已经连接,Steam已经打开。否则程序会自动退出" +
                                         "\n选择\"是\"来继续,\"否\"来返回", "VR连接提示", MessageBoxButton.YesNo, MessageBoxImage.Information);

            if (result == MessageBoxResult.Yes)
            {
                try
                {
                    bridge         = new BridgeClass();
                    VRThread       = new Thread(bridge.Run);
                    listenVRThread = new Thread(ListenVRThread);
                    startStopVRButton.IsEnabled   = true;
                    showVRDevicesButton.IsEnabled = true;
                    setDataZeroButton.IsEnabled   = true;
                }
                catch (System.Exception ex) //这里可能开启失败,但是不知道CLR怎么把错误throw回来,于是只好这样
                {
                    MessageBox.Show("Error:" + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
            }
            else if (result == MessageBoxResult.No)
            {
                return;
            }
        }
Ejemplo n.º 2
0
        public int GetNum(int num)
        {
            BridgeClass bridge = new BridgeClass();

            return(bridge.GetNumBridge(num));
        }