コード例 #1
0
ファイル: OpenedFile.cs プロジェクト: vu111293/pat-design
        static Properties GetMemento(IViewContent viewContent)
        {
            IMementoCapable mementoCapable = viewContent as IMementoCapable;

            if (mementoCapable == null)
            {
                return(null);
            }
            else
            {
                return(mementoCapable.CreateMemento());
            }
        }
コード例 #2
0
        private static VelerSoftware.SZC.Debugger.Core.Properties GetMemento(IViewContent viewContent)
        {
            IMementoCapable mementoCapable = viewContent as IMementoCapable;

            if (mementoCapable == null)
            {
                return(null);
            }
            else
            {
                return(mementoCapable.CreateMemento());
            }
        }
コード例 #3
0
ファイル: WpfWorkbench.cs プロジェクト: Amichai/SharpDevelop
        /// <summary>
        /// Stores the memento for the view content.
        /// Such mementos are automatically loaded in ShowView().
        /// </summary>
        public void StoreMemento(IViewContent viewContent)
        {
            IMementoCapable mementoCapable = viewContent as 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.Set(key, memento);
                FileUtility.ObservedSave(new NamedFileOperationDelegate(p.Save), this.ViewContentMementosFileName, FileErrorPolicy.Inform);
            }
        }