Exemplo n.º 1
0
        public static void WriteToFile(string Filepath, TomodoriRepository Repository)
        {
            FileInfo finfo = new FileInfo(Filepath);
            Directory.CreateDirectory(finfo.DirectoryName);

            System.Xml.Serialization.XmlSerializer ser = new System.Xml.Serialization.XmlSerializer(Repository.GetType());

            File.Delete(Filepath);
            FileStream fstream = new FileStream(Filepath, FileMode.OpenOrCreate);
            ser.Serialize(fstream, Repository);
            fstream.Flush();
            fstream.Close();
        }
Exemplo n.º 2
0
 private void Tomodoro_Load(object sender, EventArgs e)
 {
     CurrentRepository = Data.TomodoriRepository.LoadFromFile(RepositoryPath);
     PopulateUI(DateTime.Today);
 }