Пример #1
0
        //открытие json-файла с построенным рт-графиком
        private void btn_OpenRTGraph_Click(object sender, EventArgs e)
        {
            string filePath; DialogResult result;

            using (OpenFileDialog open = new OpenFileDialog())
            {
                result   = open.ShowDialog();
                filePath = open.FileName;
            }

            if (result == DialogResult.OK && filePath != "")
            {
                string jsonData = File.ReadAllText(filePath);
                Dictionary <double, double> ptDic = JsonConvert.DeserializeObject <Dictionary <double, double> >(jsonData);

                PointF[] pt = new PointF[ptDic.Count];
                int      i  = 0;
                foreach (KeyValuePair <double, double> pair in ptDic)
                {
                    pt[i].X = (float)pair.Key;
                    pt[i].Y = (float)pair.Value;
                    i++;
                }

                Curves RTcurve = new Curves(pt, Color.Black, Legend: filePath);
                graph.AddCurve(RTcurve);

                addGraph.AddGraphToList(filePath, Color.Black);
                MessageBox.Show("Конвертация успешно завершена", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #2
0
 public void SpiralAction(bool action)
 {
     if (action)
     {
         Curves spiral = gr.GraphCurves[0];
         gr.GraphCurves = SavedCurves;
         gr.AddCurve(spiral);
     }
     else
     {
         gr.GraphCurves = SavedCurves;
         isCreating     = false;
     }
 }