예제 #1
0
        public static bool LoadTaskList(ref TaskList taskList)
        {
            bool success = true;

            taskList = new();

            if (File.Exists(Global.fileLocation))
            {
                XmlSerializer serializer   = new XmlSerializer(taskList.GetType());
                StreamReader  streamReader = new(Global.fileLocation);
                try
                {
                    taskList = (TaskList)serializer.Deserialize(streamReader);
                    streamReader.Close();
                }
                catch (System.InvalidOperationException e)
                {
                    streamReader.Close();
                    success = HandleLoadError(e);
                }
            }

            return(success);
        }