Beispiel #1
0
 /// <summary>
 /// 导入指令
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void LoadCmd_Click(object sender, RoutedEventArgs e)
 {
     System.Windows.Forms.OpenFileDialog openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
     openFileDialog1.Filter     = "指令文件|*.mathb";
     openFileDialog1.DefaultExt = "mathb";//缺省默认后缀名
     if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         string pat = openFileDialog1.FileName;
         if (FileXmlOperate.Exist(pat))
         {
             Movement tmp_Movement = new Movement();
             tmp_Movement = (Movement)FileXmlOperate.ReadXmlSerializer(pat, tmp_Movement);
             for (int i = 0; i < tmp_Movement.mlist.Count; i++)
             {
                 Mlist.Add(tmp_Movement.mlist[i]);
             }
             UpdateListbox();
         }
     }
 }
Beispiel #2
0
        public WorkWindow()
        {
            InitializeComponent();
            if (FileXmlOperate.ExistFolderPath(Configfolder) == false)
            {
                FileXmlOperate.CreateFoldPath(Configfolder);
            }
            Filepathd  = Configfolder + "\\" + "movedata.mathb";
            ConfigPath = Configfolder + "\\" + "DebugConfig.txt";

            Mlist.Clear();

            if (FileXmlOperate.Exist(Filepathd))
            {
                Movement tmp_Movement = new Movement();
                tmp_Movement = (Movement)FileXmlOperate.ReadXmlSerializer(Filepathd, tmp_Movement);
                Mlist        = tmp_Movement.mlist;
                UpdateListbox();
            }
            EnabledBeginEnd(false);
            //Enabled_Readybutton(true);
            isRunning  = true;
            SendThread = new Thread(SendMethod);
            SendThread.Start();
            Intlized();

            timer2.Interval = new System.TimeSpan(0, 0, 1);
            timer2.Tick    += new EventHandler(Timer2_Tick);
            timer1.Tick    += Timer1_Tick;

            /// serial chart line
            ///
            ////
            //Chart chart = new Chart();
            Title title = new Title();

            title.Text    = "角度曲线";
            title.Padding = new Thickness(0, 10, 5, 0);
            // 向图标添加标题
            _chart.Titles.Add(title);
            //////////////////////////////////////////////////////////////////////////
            _chart.Series.Clear();
            DataSeries dataSeriesx = new DataSeries();

            dataSeriesx.RenderAs = RenderAs.QuickLine;
            dataSeriesx.Name     = "rx";
            _chart.Series.Add(dataSeriesx);
            DataSeries dataSeriesy = new DataSeries();

            dataSeriesy.RenderAs = RenderAs.QuickLine;
            dataSeriesy.Name     = "ry";
            _chart.Series.Add(dataSeriesy);
            DataSeries dataSeriesz = new DataSeries();

            dataSeriesz.RenderAs = RenderAs.QuickLine;
            dataSeriesz.Name     = "rz";
            _chart.Series.Add(dataSeriesz);

            _chart.Series[0].DataPoints = new DataPointCollection();
            _chart.Series[1].DataPoints = new DataPointCollection();
            _chart.Series[2].DataPoints = new DataPointCollection();
        }