public void SaveAndLoadDataTest()
        {
            var dataPersistance = new DataPersistance
            {
                Active = true,
                CreatedDate = DateTime.Now,
                UserName = "******",
            };
            var data1 = new DataPoint { ControlName = "c1", TimeOfInteraction = DateTime.Now };
            var data2 = new DataPoint { ControlName = "c2", TimeOfInteraction = DateTime.Now };

            dataPersistance.Data.Add(data1);
            dataPersistance.Data.Add(data2);

            // Save the data
            var persistData = new PersistData();
            persistData.SaveData(dataPersistance);

            // load the data
            var loadedData = persistData.LoadData("Sean");

            Assert.IsTrue(dataPersistance.Equals(loadedData), "Unable to save data correctly");
        }
 private void ExecuteSaveData()
 {
     DataPersistance persistanceData = new DataPersistance
     {
         UserName = CurrentUser
     };
     foreach (IData dta in DataList)
     {
         persistanceData.Data.Add((DataPoint) dta);
     }
     var persistData = new PersistData();
     persistData.SaveData(persistanceData);
 }
        private void ExecuteLoadData()
        {
            Debug.WriteLine("Load Data has been clicked.");

            var data = new PersistData();
            var loadedData = new DataPersistance();
            try
            {
                loadedData = data.LoadData(CurrentUser);
            }
            catch (FileNotFoundException)
            {
                MessageBox.Show(string.Format("File not found for user \"{0}\"", CurrentUser), "File not found", MessageBoxButton.OK, MessageBoxImage.Stop);
            }

            if (loadedData.Data.Count <= 0)
                return;

            ExecuteResetData();
            foreach (var c in loadedData.Data)
            {
                ProcessNumberButton(c.ControlName);
            }
            ProcessGoButton();
        }