Exemplo n.º 1
0
        public void save_chart1(CFGData _CFGData)
        {
            var    chartImgFormats = Enum.GetNames(typeof(ChartImageFormat));
            string strFilter       = string.Empty;

            foreach (string format in chartImgFormats)
            {
                strFilter += format + "(*." + format + ")|*." + format + "|";
            }
            strFilter            += "All files (*.*)|*.*";
            saveFileDialog.Filter = strFilter;
            saveFileDialog.ShowDialog();
            if (saveFileDialog.CheckPathExists && !string.IsNullOrEmpty(saveFileDialog.FileName))
            {
                this.chart1.Annotations.Add(new TextAnnotation()
                {
                    ForeColor = Color.White,
                    AnchorX   = 80,
                    AnchorY   = 8,
                    LineWidth = 0,
                    Text      = "Location:" + _CFGData.Location + "  StartDate:" + _CFGData.startDate + "   StartTime:" + _CFGData.startTime.Substring(0, _CFGData.startTime.Length - 3) + "\n\n Device:" + _CFGData.Device + "   TriggerDate:" + _CFGData.triggerDate + "   TriggerTime:" + _CFGData.triggerTime.Substring(0, _CFGData.triggerTime.Length - 3),
                    Name      = "Information"
                });
                chart1.SaveImage(saveFileDialog.FileName, ChartImageFormat.Jpeg);
                this.chart1.Annotations.Remove(this.chart1.Annotations["Information"]);
            }
        }
Exemplo n.º 2
0
 public frmChart(CFGData _CFGData, DATData _DATData, FFTData _FFTData, int _PSMode)
 {
     InitializeComponent();
     mCFGData = _CFGData;
     mDATData = _DATData;
     mFFTData = _FFTData;
     PSMode   = _PSMode;
 }
Exemplo n.º 3
0
 private void Set_Information(CFGData _CFGData)
 {
     Clear_Information();
     labLocatiion.Text   = _CFGData.Location;
     labDevice.Text      = _CFGData.Device;
     labStartDate.Text   = _CFGData.startDate;
     labTriggerDate.Text = _CFGData.triggerDate;
     labStartTime.Text   = _CFGData.startTime.Substring(0, _CFGData.startTime.Length - 3);
     labTriggerTime.Text = _CFGData.triggerTime.Substring(0, _CFGData.triggerTime.Length - 3);
 }
Exemplo n.º 4
0
 private void SetPSData(CFGData _CFGData)
 {
     mPSData.Clear();
     for (int i = 0; i < _CFGData.A_Amount; i++)
     {
         PSData _PSData = new PSData();
         if (_CFGData.arrAnalogyData[i].PrimaryOrSecondary == "P")
         {
             _PSData.P       = _CFGData.arrAnalogyData[i].Magnification1;
             _PSData.PerUnit = _CFGData.arrAnalogyData[i].Magnification1 * _CFGData.arrAnalogyData[i].Magnification1;
             _PSData.S       = _PSData.PerUnit / _CFGData.arrAnalogyData[i].Magnification2;
         }
         else if (_CFGData.arrAnalogyData[i].PrimaryOrSecondary == "S")
         {
             _PSData.S       = _CFGData.arrAnalogyData[i].Zoom;
             _PSData.PerUnit = 1 / _CFGData.arrAnalogyData[i].Magnification2 * _CFGData.arrAnalogyData[i].Zoom;
             _PSData.P       = _CFGData.arrAnalogyData[i].Magnification1 / _CFGData.arrAnalogyData[i].Magnification2 * _CFGData.arrAnalogyData[i].Zoom;
         }
         mPSData.Add(_PSData);
     }
 }
Exemplo n.º 5
0
        private void Form1_Load(object sender, EventArgs e)
        {
            this.pnlAnagol.MouseWheel += new MouseEventHandler(pnlAnagol_MouserWheel);

            set_Form();
            set_ButtonImage();

            setEnable(false);

            arrPRData       = new List <PRData>();
            mCompressWinRAR = new Compress_WinRAR();
            mCFGData        = new CFGData();
            mDATData        = new DATData();
            m_LoadDataFile  = new LoadDataFile();

            cbxPS.Items.Add("P");
            cbxPS.Items.Add("S");
            cbxPS.Items.Add("Per Unit");

            Clear_Information();

            GetAllRARFileName();
        }
Exemplo n.º 6
0
 //public string fileName = @"D:\AQ\AQ DR\2016-08-21_16-49-57-685_GCB5\2016-08-21_16-49-57-685_GCB5.dat";
 public void DisplayValues_CFG(string fileName, ref CFGData m_CFGData)
 {
     if (File.Exists(fileName))
     {
         using (StreamReader reader = new StreamReader(File.Open(fileName, FileMode.Open)))
         {
             int count  = 0;
             int ACount = 0;
             int DCount = 0;
             foreach (var ReadLine in reader.ReadToEnd().Split('\n'))
             {
                 if (count == 0)
                 {
                     int index = 0;
                     foreach (string value in ReadLine.Split(','))
                     {
                         if (index == 0)
                         {
                             m_CFGData.Location = value;
                         }
                         else if (index == 1)
                         {
                             m_CFGData.Device = value;
                         }
                         index++;
                     }
                 }
                 else if (count == 1)
                 {
                     foreach (string value in ReadLine.Split(','))
                     {
                         if (value.IndexOf("A") != -1)
                         {
                             m_CFGData.A_Amount       = Convert.ToInt32(value.Substring(0, value.Length - 1));
                             m_CFGData.arrAnalogyData = new CFGData.AnalogyData[m_CFGData.A_Amount];
                         }
                         else if (value.IndexOf("D") != -1)
                         {
                             m_CFGData.D_Amount       = Convert.ToInt32(value.Substring(0, value.Length - 1));
                             m_CFGData.arrDigitalData = new CFGData.DigitalData[m_CFGData.D_Amount];
                         }
                         else
                         {
                             m_CFGData.TotalAmount = Convert.ToInt32(value);
                         }
                     }
                 }
                 else if (count >= 2 && count < 2 + m_CFGData.TotalAmount)
                 {
                     if (ACount < m_CFGData.A_Amount)
                     {
                         string[] value = ReadLine.Split(',');
                         m_CFGData.arrAnalogyData[ACount].No                 = Convert.ToInt32(value[0]);
                         m_CFGData.arrAnalogyData[ACount].Name               = value[1];
                         m_CFGData.arrAnalogyData[ACount].value1             = value[2];
                         m_CFGData.arrAnalogyData[ACount].value2             = value[3];
                         m_CFGData.arrAnalogyData[ACount].value3             = value[4];
                         m_CFGData.arrAnalogyData[ACount].Zoom               = Convert.ToDecimal(value[5]);
                         m_CFGData.arrAnalogyData[ACount].value4             = Convert.ToDecimal(value[6]);
                         m_CFGData.arrAnalogyData[ACount].value5             = Convert.ToDecimal(value[7]);
                         m_CFGData.arrAnalogyData[ACount].value6             = Convert.ToDecimal(value[8]);
                         m_CFGData.arrAnalogyData[ACount].value7             = Convert.ToDecimal(value[9]);
                         m_CFGData.arrAnalogyData[ACount].Magnification1     = Convert.ToDecimal(value[value.Length - 3]);
                         m_CFGData.arrAnalogyData[ACount].Magnification2     = Convert.ToDecimal(value[value.Length - 2]);
                         m_CFGData.arrAnalogyData[ACount].PrimaryOrSecondary = value[value.Length - 1];
                         ACount++;
                     }
                     else if (DCount < m_CFGData.D_Amount)
                     {
                         string[] value = ReadLine.Split(',');
                         m_CFGData.arrDigitalData[DCount].No     = Convert.ToInt32(value[0]);
                         m_CFGData.arrDigitalData[DCount].Name   = value[1];
                         m_CFGData.arrDigitalData[DCount].value1 = value[2];
                         m_CFGData.arrDigitalData[DCount].value2 = value[3];
                         m_CFGData.arrDigitalData[DCount].value3 = value[4];
                         DCount++;
                     }
                 }
                 else if (count == 2 + m_CFGData.TotalAmount)
                 {
                     string[] value = ReadLine.Split(',');
                     m_CFGData.Hz = Convert.ToDecimal(value[0]);
                 }
                 else if (count == 4 + m_CFGData.TotalAmount)
                 {
                     string[] value = ReadLine.Split(',');
                     m_CFGData.SamplingPoint = Convert.ToDecimal(value[0]);
                     m_CFGData.TotalPoint    = Convert.ToDecimal(value[1]);
                 }
                 else if (count == 5 + m_CFGData.TotalAmount)
                 {
                     string[] value = ReadLine.Split(',');
                     m_CFGData.startDate = value[0];
                     m_CFGData.startTime = value[1];
                 }
                 else if (count == 6 + m_CFGData.TotalAmount)
                 {
                     string[] value = ReadLine.Split(',');
                     m_CFGData.triggerDate = value[0];
                     m_CFGData.triggerTime = value[1];
                 }
                 count++;
             }
         }
     }
     else
     {
         throw new ApplicationException("檔案不存在");
     }
 }