예제 #1
0
        private void Button_PPMS_Serial_Connect_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                myparts.myDialog dlg = new myparts.myDialog("シリアルポートに接続します");
                if (dlg.ShowDialog() != true)
                {
                    return;
                }

                this.serialport          = new System.IO.Ports.SerialPort("COM" + this.TextBox_PPMS_COMPORT.Text, int.Parse(this.TextBox_PPMS_BaudRate.Text), System.IO.Ports.Parity.None, 8, System.IO.Ports.StopBits.One);
                this.serialport.Encoding = Encoding.ASCII;

                byte[] endsign = { 170, 255 };
                this.serialport.NewLine = Encoding.ASCII.GetString(endsign, 0, 1);
                this.serialport.Open();

                this.fps = new FPSAdjuster.FPSAdjuster();
                fps.Fps  = int.Parse(this.TextBox_PPMS_FPS.Text);
                fps.Start();

                this.CTS      = new CancellationTokenSource();
                this.maintask = new Task(new Action(this.MainTask_PPMS), this.CTS.Token);
                this.maintask.Start();
            }
            catch (Exception ex)
            {
                myparts.myDialog dlg = new myparts.myDialog(ex.Message);
                dlg.ShowDialog();
            }
        }
예제 #2
0
 private void MainTask()
 {
     try
     {
         FPSAdjuster.FPSAdjuster fps = new FPSAdjuster.FPSAdjuster();
         fps.Fps = 30;
         fps.Start();
         int DT = DateTime.Now.Millisecond;
         while (!this.CTS.IsCancellationRequested)
         {
             fps.Adjust();
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
예제 #3
0
 private void MainTask()
 {
     try
     {
         FPSAdjuster.FPSAdjuster fps = new FPSAdjuster.FPSAdjuster();
         fps.Fps = 30;
         fps.Start();
         int DT = DateTime.Now.Millisecond;
         while (!this.CTS.IsCancellationRequested)
         {
             fps.Adjust();
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
예제 #4
0
        private void Button_SC_Serial_Connect_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                myparts.myDialog dlg = new myparts.myDialog("シリアルポートに接続します");
                if (dlg.ShowDialog() != true)
                {
                    return;
                }

                this.serialport          = new System.IO.Ports.SerialPort("COM" + this.TextBox_SC_COMPORT.Text, int.Parse(this.TextBox_SC_BaudRate.Text), System.IO.Ports.Parity.None, 8, System.IO.Ports.StopBits.One);
                this.serialport.Encoding = Encoding.ASCII;
                this.serialport.Open();

                this.fps = new FPSAdjuster.FPSAdjuster();
                fps.Fps  = 30;
                fps.Start();
            }
            catch (Exception ex)
            {
                myparts.myDialog dlg = new myparts.myDialog(ex.Message);
                dlg.ShowDialog();
            }
        }
예제 #5
0
        private void Button_SC_Serial_Connect_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                myparts.myDialog dlg = new myparts.myDialog("シリアルポートに接続します");
                if (dlg.ShowDialog() != true)
                {
                    return;
                }

                this.serialport = new System.IO.Ports.SerialPort("COM" + this.TextBox_SC_COMPORT.Text, int.Parse(this.TextBox_SC_BaudRate.Text), System.IO.Ports.Parity.None, 8, System.IO.Ports.StopBits.One);
                this.serialport.Encoding = Encoding.ASCII;
                this.serialport.Open();

                this.fps = new FPSAdjuster.FPSAdjuster();
                fps.Fps = 30;
                fps.Start();
            }
            catch (Exception ex)
            {
                myparts.myDialog dlg = new myparts.myDialog(ex.Message);
                dlg.ShowDialog();
            }
        }
예제 #6
0
        private void Button_PPMS_Serial_Connect_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                myparts.myDialog dlg = new myparts.myDialog("シリアルポートに接続します");
                if (dlg.ShowDialog() != true)
                {
                    return;
                }

                this.serialport = new System.IO.Ports.SerialPort("COM" + this.TextBox_PPMS_COMPORT.Text, int.Parse(this.TextBox_PPMS_BaudRate.Text), System.IO.Ports.Parity.None, 8, System.IO.Ports.StopBits.One);
                this.serialport.Encoding = Encoding.ASCII;

                this.serialport.Open();

                this.fps = new FPSAdjuster.FPSAdjuster();
                fps.Fps = int.Parse( this.TextBox_PPMS_FPS.Text);
                fps.Start();

                this.CTS = new CancellationTokenSource();
                this.maintask = new Task(new Action(this.MainTask_PPMS), this.CTS.Token);
                this.maintask.Start();
            }
            catch (Exception ex)
            {
                myparts.myDialog dlg = new myparts.myDialog(ex.Message);
                dlg.ShowDialog();
            }
        }