Ejemplo n.º 1
0
 public ExternalFunctions()
 {
     infos        = new float[GetInfosSize()];
     isdeviced    = ExternalFunctions.InitEnveriments();
     isreinitlibs = 0;
     iswarned     = 0;
     isreinitlibs = 0;
 }
 private void m_BtnActivateSideMonitor_Click(object sender, RoutedEventArgs e)
 {
     if (m_BtnActivateSideMonitor.Content.ToString().Trim() == "启动侧身监测")
     {
         ExternalFunctions.ConfigEnable(4);
         m_BtnActivateSideMonitor.Content = "暂停侧身监测";
     }
     else
     {
         ExternalFunctions.ConfigDisable(4);
         m_BtnActivateSideMonitor.Content = "启动侧身监测";
     }
 }
 private void m_BtnHidePage_Click(object sender, RoutedEventArgs e)
 {
     if (m_BtnHidePage.Content.ToString().Trim() == "隐藏画面")
     {
         ExternalFunctions.ConfigDisable(3);
         m_BtnHidePage.Content = "显示画面";
     }
     else
     {
         ExternalFunctions.ConfigEnable(3);
         m_BtnHidePage.Content = "隐藏画面";
     }
 }
Ejemplo n.º 4
0
        public Media()
        {
            InitializeComponent();

            ExternalFunctions.ConfigDisable(3);

            tmrProgress = new DispatcherTimer();
            //设置计时器的时间间隔为1秒
            tmrProgress.Interval = new TimeSpan(0, 0, 1);
            //计时器触发事件处理
            tmrProgress.Tick += SetDisplayMessage;
            SetImageForMediaElement();
        }
 private void timer_Tick(object sender, EventArgs e)
 {
     if (OnCountDown())
     {
         HourArea.Text   = processCount.GetHour();
         MinuteArea.Text = processCount.GetMinute();
         SecondArea.Text = processCount.GetSecond();
     }
     else
     {
         using (SoundPlayer player = new SoundPlayer())
         {
             player.SoundLocation = System.Environment.CurrentDirectory + "//Notify_Timeup.wav";
             player.Play();
         }
         countDownTimer.Stop();
         ExternalFunctions.OnKeyDown((uint)asciiEncoding.GetBytes("S")[0]);
         MessageBox.Show("时间到了,请起身休息一下:)");
     }
 }
        public MainWindow()
        {
            InitializeComponent();
            thislock = new object();
            config   = new double[ExternalFunctions.GetConfigSize()];
            ExternalFunctions.GetConfig(config);
            WrongTime = new double[ExternalFunctions.GetMaxTimeSize()];
            ExternalFunctions.GetMaxTime(WrongTime);

            m_GridCameraWindow.Children.Add(new CameraWindow());


            ThreadStart ts = new ThreadStart(DisplayInfos);

            t = new Thread(ts);
            t.Start();

            playbeep = new Thread(new ParameterizedThreadStart(_Beep));

            playfiletune = new Thread(new ParameterizedThreadStart(_PlayTune));


            countDownTimer          = new DispatcherTimer();
            countDownTimer.Interval = new TimeSpan(10000000);   //时间间隔为一秒
            countDownTimer.Tick    += new EventHandler(timer_Tick);

            HourArea.Text   = Default.SetTimeHour.ToString();
            MinuteArea.Text = Default.SetTimeMinute.ToString();
            SecondArea.Text = Default.SetTimeSecond.ToString();

            Int32 hour   = Convert.ToInt32(HourArea.Text);
            Int32 minute = Convert.ToInt32(MinuteArea.Text);
            Int32 second = Convert.ToInt32(SecondArea.Text);

            //处理倒计时的类
            processCount = new ProcessCount(hour * 3600 + minute * 60 + second);
            CountDown   += new CountDownHandler(processCount.ProcessCountDown);

            ExternalFunctions.ConfigDisable(4);
        }
Ejemplo n.º 7
0
        public Settings()
        {
            InitializeComponent();

            ExternalFunctions.ConfigDisable(3); //先隐藏画面,防止占用过多资源

            m_LstBoxTune.SelectedIndex = (frequency - 1000) / 500;

            m_TxtBoxShouldersDistanceMin.Text   = MainWindow.config[0].ToString();
            m_TxtBoxShouldersDistanceMax.Text   = MainWindow.config[1].ToString();
            m_TxtBoxShouldersWidth.Text         = MainWindow.ShouldersWidth.ToString();
            m_TxtBoxHeadAngleFrontNBack.Text    = MainWindow.config[2].ToString();
            m_TxtBoxHeadAngleLeftNRightMin.Text = MainWindow.config[3].ToString();
            m_TxtBoxHeadAngleLeftNRightMax.Text = MainWindow.config[4].ToString();
            m_TxtBoxWaistAngle.Text             = MainWindow.config[5].ToString();
            m_TxtBoxHeadAngleSideMin.Text       = MainWindow.config[6].ToString();
            m_TxtBoxHeadAngleSideMax.Text       = MainWindow.config[7].ToString();
            m_TxtBoxTimer.Text        = MainWindow.config[8].ToString();
            m_TxtBoxSetTime.Text      = MainWindow.SetTime.ToString();
            m_ChcBoxDetail.IsChecked  = MainWindow.isShowDetails;
            m_ChcBoxUseFile.IsChecked = !MainWindow.isUseDefaultTunes;
            m_TxtBoxSetWrongTime.Text = MainWindow.WrongTime[0].ToString();
            if ((bool)m_ChcBoxUseFile.IsChecked)
            {
                m_LstBoxTune.IsEnabled     = false;
                m_TxtBoxTuneFile.IsEnabled = true;
            }
            else
            {
                m_LstBoxTune.IsEnabled     = true;
                m_TxtBoxTuneFile.IsEnabled = false;
                fileName = null;
                m_TxtBoxTuneFile.Text = "";
            }
            m_TxtBoxTuneFile.Text = MainWindow.tuneFileAddress;
            isSelecting           = true;
        }
 public CameraWindow()
 {
     InitializeComponent();
     ex = new ExternalFunctions();
 }
Ejemplo n.º 9
0
        private void m_BtnConfirm_Click(object sender, RoutedEventArgs e)
        {
            m_TxtBoxShouldersDistanceMin.BorderBrush   = Brushes.Gray;
            m_TxtBoxShouldersDistanceMax.BorderBrush   = Brushes.Gray;
            m_TxtBoxShouldersWidth.BorderBrush         = Brushes.Gray;
            m_TxtBoxHeadAngleFrontNBack.BorderBrush    = Brushes.Gray;
            m_TxtBoxHeadAngleLeftNRightMin.BorderBrush = Brushes.Gray;
            m_TxtBoxHeadAngleLeftNRightMax.BorderBrush = Brushes.Gray;
            m_TxtBoxWaistAngle.BorderBrush             = Brushes.Gray;
            m_TxtBoxHeadAngleSideMin.BorderBrush       = Brushes.Gray;
            m_TxtBoxHeadAngleSideMax.BorderBrush       = Brushes.Gray;
            m_TxtBoxTimer.BorderBrush        = Brushes.Gray;
            m_TxtBoxSetTime.BorderBrush      = Brushes.Gray;
            m_TxtBoxSetWrongTime.BorderBrush = Brushes.Gray;
            bool isInputWrong = false;

            if (!double.TryParse(m_TxtBoxShouldersDistanceMin.Text.Trim(), out ShouldersDistanceMin))
            {
                m_TxtBoxShouldersDistanceMin.BorderBrush = Brushes.Red;
                isInputWrong = true;
            }
            if (!double.TryParse(m_TxtBoxShouldersDistanceMax.Text.Trim(), out ShouldersDistanceMax))
            {
                m_TxtBoxShouldersDistanceMax.BorderBrush = Brushes.Red;
                isInputWrong = true;
            }
            if (!double.TryParse(m_TxtBoxShouldersWidth.Text.Trim(), out ShouldersWidth))
            {
                m_TxtBoxShouldersWidth.BorderBrush = Brushes.Red;
                isInputWrong = true;
            }
            if (!double.TryParse(m_TxtBoxHeadAngleFrontNBack.Text.Trim(), out HeadAngleFrontNBack))
            {
                m_TxtBoxHeadAngleFrontNBack.BorderBrush = Brushes.Red;
                isInputWrong = true;
            }
            if (!double.TryParse(m_TxtBoxHeadAngleLeftNRightMin.Text.Trim(), out HeadAngleLeftNRightMin))
            {
                m_TxtBoxHeadAngleLeftNRightMin.BorderBrush = Brushes.Red;
                isInputWrong = true;
            }
            if (!double.TryParse(m_TxtBoxHeadAngleLeftNRightMax.Text.Trim(), out HeadAngleLeftNRightMax))
            {
                m_TxtBoxHeadAngleLeftNRightMax.BorderBrush = Brushes.Red;
                isInputWrong = true;
            }
            if (!double.TryParse(m_TxtBoxWaistAngle.Text.Trim(), out WaistAngle))
            {
                m_TxtBoxWaistAngle.BorderBrush = Brushes.Red;
                isInputWrong = true;
            }
            if (!double.TryParse(m_TxtBoxHeadAngleSideMin.Text.Trim(), out HeadAngleSideMin))
            {
                m_TxtBoxHeadAngleSideMin.BorderBrush = Brushes.Red;
                isInputWrong = true;
            }
            if (!double.TryParse(m_TxtBoxHeadAngleSideMax.Text.Trim(), out HeadAngleSideMax))
            {
                m_TxtBoxHeadAngleSideMax.BorderBrush = Brushes.Red;
                isInputWrong = true;
            }
            if (!int.TryParse(m_TxtBoxTimer.Text.Trim(), out Timer))
            {
                m_TxtBoxTimer.BorderBrush = Brushes.Red;
                isInputWrong = true;
            }
            if (!int.TryParse(m_TxtBoxSetTime.Text.Trim(), out SetTime))
            {
                m_TxtBoxSetTime.BorderBrush = Brushes.Red;
                isInputWrong = true;
            }
            if (!double.TryParse(m_TxtBoxSetWrongTime.Text.Trim(), out wrongtime))
            {
                m_TxtBoxSetWrongTime.BorderBrush = Brushes.Red;
                isInputWrong = true;
            }
            if (isInputWrong)
            {
                MessageBox.Show("输入错误\n请重试!");
                return;
            }

            MainWindow.config[0]      = ShouldersDistanceMin;
            MainWindow.config[1]      = ShouldersDistanceMax;
            MainWindow.ShouldersWidth = ShouldersWidth;
            MainWindow.config[2]      = HeadAngleFrontNBack;
            MainWindow.config[3]      = HeadAngleLeftNRightMin;
            MainWindow.config[4]      = HeadAngleLeftNRightMax;
            MainWindow.config[5]      = WaistAngle;
            MainWindow.config[6]      = HeadAngleSideMin;
            MainWindow.config[7]      = HeadAngleSideMax;
            MainWindow.config[8]      = Timer;
            for (int i = 0; i < ExternalFunctions.GetMaxTimeSize(); i++)
            {
                MainWindow.WrongTime[i] = wrongtime;
            }
            ExternalFunctions.SetMaxTime(MainWindow.WrongTime);
            ExternalFunctions.SetConfig(MainWindow.config);
            MainWindow.SetTime = SetTime;
            if (!(bool)m_ChcBoxUseFile.IsChecked)
            {
                MainWindow.TuneFrequency     = frequency;
                MainWindow.isUseDefaultTunes = true;
            }
            else
            {
                MainWindow.tuneFileAddress = fileName;
                if (fileName != "" && fileName != null)
                {
                    MainWindow.isUseDefaultTunes = false;
                }
            }
            MainWindow.isShowDetails   = (bool)m_ChcBoxDetail.IsChecked;
            MainWindow.tuneFileAddress = m_TxtBoxTuneFile.Text;
            MainWindow.isNeedToRefresh = true;



            this.Close();
        }
Ejemplo n.º 10
0
 protected override void OnClosed(EventArgs e)
 {
     base.OnClosed(e);
     ExternalFunctions.ConfigEnable(3);
 }
 private void Window_KeyDown(object sender, KeyEventArgs e)
 {
     ExternalFunctions.OnKeyDown((uint)asciiEncoding.GetBytes(e.Key.ToString())[e.Key.ToString().Length - 1]);
 }
 private void OpenGLControl_OpenGLDraw(object sender, SharpGL.SceneGraph.OpenGLEventArgs args)
 {
     //  Get the OpenGL instance that's been passed to us.
     ExternalFunctions.SetWindowsSize((int)this.ActualWidth, (int)this.ActualHeight);
     ExternalFunctions.OnPaint();
 }
 public CameraWindow()
 {
     InitializeComponent();
     ex = new ExternalFunctions();
 }