Example #1
0
        private void btnSaveData_Click(object sender, RoutedEventArgs e)
        {
            // Luodaan uusi mittausdata olio ja näytetään se käyttäjälle
            MittausData md = new MittausData(txtClock.Text, txtData.Text);

            //lbData.Items.Add(md);
            // Lisätään mittaus-olio kokoelmaan
            mitatut.Add(md);
            ApplyChanges();
        }
Example #2
0
 private void btnSave_Click(object sender, RoutedEventArgs e)
 {
     try {
         //kirjoitetaan mitatut tiedostoon
         MittausData.SaveToFile(txtFileName.Text, mitatut);
         MessageBox.Show("Tiedot tallennettu onnistuneesti tiedostoon " + txtFileName.Text);
     } catch (Exception ex) {
         MessageBox.Show(ex.Message);
     }
 }
Example #3
0
 private void btnRead_Click(object sender, RoutedEventArgs e)
 {
     try {
         //kirjoitetaan mitatut tiedostoon
         mitatut = MittausData.ReadFromFile(txtFileName.Text);
         ApplyChanges();
         MessageBox.Show("Tiedot haettu onnistuneesti tiedostosta " + txtFileName.Text);
     } catch (Exception ex) {
         MessageBox.Show(ex.Message);
     }
 }
Example #4
0
 private void btnRead_Click(object sender, RoutedEventArgs e)
 {
     //haetaan käyttäjän antamasta tiedostosta mitatut arvot
     try {
         measured = MittausData.ReadFromFile(txtFileName.Text);
         ApplyChanges();
         MessageBox.Show("Tiedot haettu onnistuneesti tiedostostoa " + txtFileName.Text);
     }
     catch (Exception ex) {
         MessageBox.Show(ex.Message);
     }
 }
Example #5
0
 private void btnWriteOut_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         MittausData.SaveDataToFile(mitatut, txtFileName.Text);
         MessageBox.Show("Data saved to " + txtFileName.Text);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Example #6
0
 private void btnSaveData_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         MittausData.SaveDataToFile(mitatut, txtDataName.Text);
         MessageBox.Show("Tiedot tallennettu upupupuu~");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Example #7
0
 private void btnSaveToFile_Click(object sender, RoutedEventArgs e)
 {
     // Kutsu BL:n tallennusmetodia
     try {
         MittausData.SaveDataToFile(mitatut, txtFileName.Text);
         MessageBox.Show("Tiedot tallennettu onnistuneesti tiedostoon " + txtFileName.Text);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Example #8
0
 private void btnGetFromFile_Click(object sender, RoutedEventArgs e)
 {
     //luetaan datat käyttäjän antamasta tiedostosta
     try {
         mitatut = null;
         mitatut = MittausData.ReadDataFromFile(txtFileName.Text);
         ApplyChanges();
         MessageBox.Show("Tiedot luettu onnistuneesti tiedostosta " + txtFileName.Text);
     }
     catch (Exception ex) {
         MessageBox.Show(ex.Message);
     }
 }
Example #9
0
 private void btnLoad_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         measureds = MittausData.LoadFromFileV2(txtFileName.Text);
         ApplyChanges();
         MessageBox.Show("Tiedot luettu onnistuneesti tiedostosta " + txtFileName.Text);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Example #10
0
 private void btnFromFile_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         mitatut = null;
         mitatut = MittausData.ReadDataFromFile(txtFileName.Text);
         ApplyChanges();
         MessageBox.Show("Tiedot Luettu upupupupu~");
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #11
0
        private void btnReadFromFile_Click(object sender, RoutedEventArgs e)
        {
            //Luetaan data käyttäjän antamasta tiedostosta
            try
            {
                mitatut = null;

                mitatut = MittausData.ReadDataFromFile(txtFileName.Text);
                ApplyChanges();
                MessageBox.Show("Data read from " + txtFileName.Text);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #12
0
 private void btnLoadData_Click(object sender, RoutedEventArgs e)
 {
     // Luetaan data käyttäjän antamasta tiedostosta
     // kutsu BL:N tallennusmetodia
     try
     {
         mitatut = null;
         mitatut = MittausData.ReadDataFromFile(txtFileName.Text);
         ApplyChanges();
         MessageBox.Show("Tiedot luettu tiedostosta " + txtFileName.Text);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Example #13
0
        private void btnSaveData_Click(object sender, RoutedEventArgs e)
        {
            // luodaan uusi mittausdata olio ja näytetään se käyttäjälle
            MittausData md = new MittausData(DateTime.Today.ToShortDateString(),
                                             txtFileName.Text,
                                             txtReportFile.Text);

            lbData.Items.Add(md);

            // This text is always added, making the file longer over time if it is not deleted.
            using (StreamWriter sw = File.AppendText(txtReportFile.Text))
            {
                sw.WriteLine(md);
            }

            string fileName   = txtFileName.Text;
            string sourcePath = txtSourcePath.Text;
            string targetPath = txtTargetPath.Text;

            // Use Path class to manipulate file and directory paths.
            string sourceFile = System.IO.Path.Combine(sourcePath, fileName);
            string destFile   = System.IO.Path.Combine(targetPath, fileName);

            // Create a new target folder, if necessary.
            if (!System.IO.Directory.Exists(targetPath))
            {
                System.IO.Directory.CreateDirectory(targetPath);
            }
            try
            {
                // To copy a file to another location and overwrite the destination file if it already exists.
                System.IO.File.Copy(sourceFile, destFile, true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            IniMyStuff();
        }