Ejemplo n.º 1
0
        public MainWindow()
        {
            InitializeComponent();
            SerialPortComboBox.ItemsSource   = SerialPort.GetPortNames();
            SerialPortComboBox.SelectedIndex = 0;
            buffer          = new byte[1024 * 1024];
            ConnectionState = 0;
            AdcDatas        = new SequenceData(20, 10000, 0);
            //ConsoleManager.Show();
            string path     = @"./tmp/";
            string filename = path + "tmp.jpg";

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            fs         = new FileStream(filename, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite);
            adcDataset = new AdcDataset();
        }
Ejemplo n.º 2
0
        private void LoadADCGraph_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter     = "HST Binary File(*.hst)|*.hst";
            openFileDialog.DefaultExt = ".hst"; // Default file extension
            string strDir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\AdcGraph\";

            if (!Directory.Exists(strDir))
            {
                Directory.CreateDirectory(strDir);
            }

            openFileDialog.InitialDirectory = strDir;
            if (openFileDialog.ShowDialog() == true)//注意,此处一定要手动引入System.Window.Forms空间,否则你如果使用默认的DialogResult会发现没有OK属性
            {
                Data2Show = new SequenceData(0, 0, 0);
                Data2Show.ReadFrom(openFileDialog.FileName);
                ShowAdcData showAdcData = new ShowAdcData();
                showAdcData.AdcData = Data2Show;
                showAdcData.Show();
            }
        }