예제 #1
0
        private static void SaveConditions(TreeList treeList, string fileName)
        {
            XmlXtraSerializer serializer = new XmlXtraSerializer();

            using (FileStream stream = new FileStream(fileName, FileMode.OpenOrCreate))
            {
                try
                {
                    TreeListFormatConditions collection = new TreeListFormatConditions(treeList.FormatConditions);
                    serializer.SerializeObject(collection, stream, "FormatConditions");
                }
                finally { stream.Close(); }
            }
        }
예제 #2
0
        private static void RestoreConditions(TreeList treeList, string fileName)
        {
            if (!File.Exists(fileName))
            {
                return;
            }
            XmlXtraSerializer serializer = new XmlXtraSerializer();

            using (FileStream stream = new FileStream(fileName, FileMode.Open))
            {
                try
                {
                    TreeListFormatConditions collection = new TreeListFormatConditions();
                    serializer.DeserializeObject(collection, stream, "FormatConditions");
                    collection.Conditions.CopyToStyleFormats(treeList.FormatConditions);
                    treeList.Refresh();
                }
                finally { stream.Close(); }
            }
        }