示例#1
0
        public void SaveToFile(string filename)
        {
            var settings = new DataContractSerializerSettings
            {
                PreserveObjectReferences = true
            };

            var serializer = new DataContractSerializer(typeof(Project), settings);

            var xmlSettings = new XmlWriterSettings
            {
                Indent = true
            };

            using (var file = XmlWriter.Create(new FileStream(filename, FileMode.Create), xmlSettings))
            {
                serializer.WriteObject(file, this);
            }

            IsDirty = false;
            ProjectDirtied?.Invoke(IsDirty);
        }
示例#2
0
 public void MarkDirty()
 {
     IsDirty = true;
     ProjectDirtied?.Invoke(IsDirty);
 }