public MIU(int _size, double[] _data) { int packets = _size / 2; m_iu = new IU[packets]; for (int p = 0; p < packets; p++) { m_iu[p] = new IU() { I = _data[p * 2], U = _data[p * 2 + 1] } } ; } void LoadString(string _data) { if (_data == null) { return; } if (_data.Length == 0) { return; } string[] M = _data.Split(';'); int packets = Convert.ToInt32(M[0]); m_iu = new IU[packets]; for (int p = 0; p < packets; p++) { string[] mm = M[p + 1].Split(' '); m_iu[p] = new IU(Convert.ToDouble(mm[0]), Convert.ToDouble(mm[1])); } }
bool LoadFile(string _fname) { using (StreamReader file = new StreamReader(_fname, Encoding.Default)) { string line; line = file.ReadLine(); if (line == null) { return(false); } int count = Convert.ToInt32(line); m_iu = new IU[count]; line = file.ReadLine(); for (int i = 0; i < count; i++) { line = file.ReadLine(); if (line == null) { return(false); } string[] mm = line.Split(' '); m_iu[i] = new IU() { I = Convert.ToDouble(mm[0]), U = Convert.ToDouble(mm[1]) }; } file.Close(); } return(true); }
private void chart1_MouseClick(object sender, MouseEventArgs e) { pr("MouseClick"); if (mouse_click_block) { mouse_click_block = false; return; } if (e.Button != MouseButtons.Left) { return; } Axis ax = chart1.ChartAreas[0].AxisX; int pos = (int)(ax.PixelPositionToValue(e.X)); if (pos < 0) { return; } if (pos >= miu.Length) { return; } SGHalfPeriod sghp = null; for (int i = 0; i < Msghp.Length - 1; i++) { if (pos >= Msghp[i].start && pos < Msghp[i + 1].start) { sghp = Msghp[i]; break; } } if (sghp == null) { return; } IU[] liu = new IU[sghp.size]; for (int i = 0; i < sghp.size; i++) { liu[i] = new IU(miu[sghp.start + i]); } using (FTubeHalfPeriod f = new FTubeHalfPeriod(TSName, liu, sghp)) { f.ShowDialog(); if (f.IsChange) { if (f.Ok == "Ok") { IsChandge = true; Close(); } else { prs("Не смогли записать пороги"); } } } }
public IU(IU _iu) { I = _iu.I; U = _iu.U; }