Exemplo n.º 1
0
        public bool LoadDataFromCsv(string filename, bool doReadDesease = true)
        {
            SpmVals.Clear();
            using (var reader = new StreamReader(File.OpenRead(filename)))
            {
                // болезнь
                if (doReadDesease)
                {
                    var desStr = reader.ReadLine();
                    currentDes = (DeseaseType)Convert.ToInt32(desStr);
                }

                while (!reader.EndOfStream)
                {
                    var line   = reader.ReadLine();
                    var values = line?.Split(';');
                    if (values?.Length < 2)
                    {
                        continue;
                    }

                    double[] doubles;
                    bool     valid = TryConvertToDoubleArr(values, out doubles);
                    if (valid)
                    {
                        SpmVals.Add(new Point(doubles[0], doubles[1]));
                    }
                }
            }
            return(true);
        }
Exemplo n.º 2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            List <NodeData> resultList = new List <CoreData.NodeData>();


            var dataStorage = new DataStorage();

            if (!dataStorage.Init())
            {
                return;
            }
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();

            // Set filter for file extension and default file extension
            dlg.DefaultExt = ".csv";
            dlg.Filter     = "Spectr data (.csv)|*.csv";
            // Display OpenFileDialog by calling ShowDialog method

            Nullable <bool> result = dlg.ShowDialog();

            // Get the selected file name and display in a TextBox
            if (result == true)
            {
                // Open document
                string filename = dlg.FileName;
                //resultList = dataStorage.HandleCsvRet(filename);
                Kcalc.Clear();
                // всё что нужно получаем тут
                Desease = dataStorage.AnalyzeFile(filename, Kcalc);
                Kreal   = dataStorage.SpmVals;

                cchart.DataContext = resultList;
            }
        }
Exemplo n.º 3
0
 public NodeData(int id, double low, double high, DeseaseType destype, ParamType paramType)
 {
     this.Id        = id;
     this.Low       = low;
     this.High      = high;
     this.DesType   = destype;
     this.ParamType = paramType;
 }