Changeset 4245 for trunk/sources/HeuristicLab.Common/3.3/Content
- Timestamp:
- 08/17/10 16:42:58 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Common/3.3/Content/ContentManager.cs
r3500 r4245 60 60 public static void Save(IStorableContent content, string filename, bool compressed) { 61 61 if (instance == null) throw new InvalidOperationException("ContentManager is not initialized."); 62 instance.SaveContent( (IStorableContent)content.Clone(), filename, compressed);62 instance.SaveContent(content, filename, compressed); 63 63 content.Filename = filename; 64 64 } 65 65 public static void SaveAsync(IStorableContent content, string filename, bool compressed, Action<IStorableContent, Exception> savingCompletedCallback) { 66 66 if (instance == null) throw new InvalidOperationException("ContentManager is not initialized."); 67 var action = new Action<IStorableContent, string, bool>(instance.SaveContent); 68 action.BeginInvoke(content, filename, compressed, delegate(IAsyncResult result) { 69 Exception error = null; 70 try { 71 action.EndInvoke(result); 72 content.Filename = filename; 73 } 74 catch (Exception ex) { 75 error = ex; 76 } 77 savingCompletedCallback(content, error); 78 }, null); 67 79 68 IStorableContent clone = null;69 try {70 clone = (IStorableContent)content.Clone();71 }72 catch (Exception ex) {73 savingCompletedCallback(content, ex);74 }75 76 if (clone != null) {77 var action = new Action<IStorableContent, string, bool>(instance.SaveContent);78 action.BeginInvoke(clone, filename, compressed, delegate(IAsyncResult result) {79 Exception error = null;80 try {81 action.EndInvoke(result);82 content.Filename = filename;83 }84 catch (Exception ex) {85 error = ex;86 }87 savingCompletedCallback(content, error);88 }, null);89 }90 80 } 91 81 protected abstract void SaveContent(IStorableContent content, string filename, bool compressed);
Note: See TracChangeset
for help on using the changeset viewer.