Пример #1
0
        private void dateiImportierenToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            StreamReader sr = new StreamReader(openFileDialog1.FileName);

            while (!sr.ReadLine().StartsWith("Datum;Uhrzeit;Messwert;Einheit;"))
            {
                ;
            }

            string line;

            while (true)
            {
                line = sr.ReadLine();
                if (line.StartsWith("   "))
                {
                    break;
                }

                string[] args = line.Split(';');
                args[0] = String.Format("{0} {1}", args[0], args[1]);
                args[1] = "";

                DateTime dt    = DateTime.ParseExact(args[0], "dd.MM.yyyy HH:mm", CultureInfo.InvariantCulture);
                short    value = Convert.ToInt16(args[2]);

                if (!ManualDataRepository.HasTimestamp(dt))
                {
                    ManualDataRepository.StoreValue(dt, value, args[3]);
                }
            }
            ManualDataEntires_Shown(sender, e);
        }