void LoadViewContentMemento(IViewContent viewContent) { IMementoCapable mementoCapable = viewContent as IMementoCapable; if (mementoCapable != null && LoadDocumentProperties) { if (viewContent.PrimaryFileName == null) { return; } try { string key = GetMementoKeyName(viewContent); LoggingService.Debug("Trying to restore memento of '" + viewContent.ToString() + "' from key '" + key + "'"); Properties memento = this.LoadOrCreateViewContentMementos().Get <Properties>(key, null); if (memento != null) { mementoCapable.SetMemento(memento); } } catch (Exception e) { MessageService.ShowException(e, "Can't get/set memento"); } } }
Properties GetStoredMemento(IViewContent viewContent) { if (viewContent.PrimaryFileName == null) { return(null); } string key = GetMementoKeyName(viewContent); LoggingService.Debug("Trying to restore memento of '" + viewContent.ToString() + "' from key '" + key + "'"); return(this.LoadOrCreateViewContentMementos().Get <Properties>(key, null)); }
void StoreMemento(IViewContent viewContent) { if (viewContent.PrimaryFileName == null) { return; } string key = GetMementoKeyName(viewContent); LoggingService.Debug("Saving memento of '" + viewContent.ToString() + "' to key '" + key + "'"); Core.Properties memento = ((IMementoCapable)viewContent).CreateMemento(); Core.Properties p = this.LoadOrCreateViewContentMementos(); p.Set(key, memento); FileUtility.ObservedSave(new NamedFileOperationDelegate(p.Save), this.ViewContentMementosFileName, FileErrorPolicy.Inform); }
/// <summary> /// Stores the memento for the view content. /// Such mementos are automatically loaded in ShowView(). /// </summary> public void StoreMemento(IViewContent viewContent) { IMementoCapable mementoCapable = viewContent.GetService <IMementoCapable>(); if (mementoCapable != null && LoadDocumentProperties) { if (viewContent.PrimaryFileName == null) { return; } string key = GetMementoKeyName(viewContent); LoggingService.Debug("Saving memento of '" + viewContent.ToString() + "' to key '" + key + "'"); Properties memento = mementoCapable.CreateMemento(); Properties p = this.LoadOrCreateViewContentMementos(); p.SetNestedProperties(key, memento); FileUtility.ObservedSave(new NamedFileOperationDelegate(p.Save), this.ViewContentMementosFileName, FileErrorPolicy.Inform); } }
Properties GetStoredMemento(IViewContent viewContent) { if (viewContent.PrimaryFileName == null) return null; string key = GetMementoKeyName(viewContent); LoggingService.Debug("Trying to restore memento of '" + viewContent.ToString() + "' from key '" + key + "'"); return this.LoadOrCreateViewContentMementos().Get<Properties>(key, null); }
void StoreMemento(IViewContent viewContent) { if (viewContent.PrimaryFileName == null) return; string key = GetMementoKeyName(viewContent); LoggingService.Debug("Saving memento of '" + viewContent.ToString() + "' to key '" + key + "'"); Properties memento = ((IMementoCapable)viewContent).CreateMemento(); Properties p = this.LoadOrCreateViewContentMementos(); p.Set(key, memento); FileUtility.ObservedSave(new NamedFileOperationDelegate(p.Save), this.ViewContentMementosFileName, FileErrorPolicy.Inform); }
void LoadViewContentMemento(IViewContent viewContent) { IMementoCapable mementoCapable = viewContent as IMementoCapable; if (mementoCapable != null && LoadDocumentProperties) { if (viewContent.PrimaryFileName == null) return; try { string key = GetMementoKeyName(viewContent); LoggingService.Debug("Trying to restore memento of '" + viewContent.ToString() + "' from key '" + key + "'"); Properties memento = this.LoadOrCreateViewContentMementos().Get<Properties>(key, null); if (memento != null) { mementoCapable.SetMemento(memento); } } catch (Exception e) { MessageService.ShowException(e, "Can't get/set memento"); } } }