Example #1
0
        public static void Save(BindingList <VisaTask> tasks, VisaEntityType type)
        {
            string filemane = getFileName(type);

            using (FileStream fs = new FileStream(AssemblyDirectory + filemane, FileMode.Create))
            {
                XmlSerializer xs = new XmlSerializer(typeof(BindingList <VisaTask>));
                xs.Serialize(fs, tasks);
            }
        }
Example #2
0
        public static BindingList <VisaTask> DeSerialize(VisaEntityType type)
        {
            string filemane = getFileName(type);
            BindingList <VisaTask> tasks = new BindingList <VisaTask>();

            if (File.Exists(AssemblyDirectory + filemane))
            {
                using (FileStream fs = new FileStream(AssemblyDirectory + filemane, FileMode.Open))
                {
                    XmlSerializer xs = new XmlSerializer(typeof(BindingList <VisaTask>));
                    tasks = (BindingList <VisaTask>)xs.Deserialize(fs);
                }
            }
            return(tasks);
        }
Example #3
0
 private static string getFileName(VisaEntityType type)
 {
     return(type == VisaEntityType.New ? "\\data.xml" : "\\completedData.xml");
 }