Ejemplo n.º 1
0
 public static AdcDataset ReadFrom(string uriString)
 {
     if (File.Exists(uriString))
     {
         BinaryFormatter bf         = new BinaryFormatter();
         FileStream      filestream = File.Open(uriString, FileMode.Open);
         AdcDataset      ret        = bf.Deserialize(filestream) as AdcDataset;
         filestream.Close();
         return(ret);
     }
     else
     {
         //Debug.Log("不存在存档");
         MessageBox.Show("不存在存档");
         return(null);
     }
 }
Ejemplo n.º 2
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.º 3
0
        private void ViewOldADCData_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

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

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

            openFileDialog.InitialDirectory = strDir;
            if (openFileDialog.ShowDialog() == true)//注意,此处一定要手动引入System.Window.Forms空间,否则你如果使用默认的DialogResult会发现没有OK属性
            {
                ShowAdcDataset window = new ShowAdcDataset();
                window.AdcDataset = AdcDataset.ReadFrom(openFileDialog.FileName);
                window.Show();
            }
        }
Ejemplo n.º 4
0
 public AdcDataset(AdcDataset oldDataset)
     : base(oldDataset)
 {
 }