コード例 #1
0
        /// <summary>
        /// Saves the appearance. Triggered from callback in AppearancePanel itself, passing itself back to be stored in the database.
        /// </summary>
        /// <param name='obj'>
        /// Object.
        /// </param>
        void SaveAppearance(Layout.AppearanceClass obj)
        {
            if (null == obj)
                throw new Exception ("A null appearance was passed into save routine.");
            if (obj.Name == Constants.BLANK)
                throw new Exception ("A name must be assigned to any new Appearance that is created!");
            BaseDatabase db = CreateDatabase ();

            Store (db, obj.Name, obj.GetAppearanceXML (), 1);
            db.Dispose ();

            // the moment we save an appearance I think we need to PURGE the Cahce in LayoutDetails
            // so that the NEXT time a page is loaded, it benefits from the new appearnces (likewise if a new note is created).
            LayoutDetails.Instance.PurgeAppearanceCache ();
            if (null != Appearances) {
                // deselect on the list
                Appearances.SelectedIndex = -1;

                // we rebuild the list in case we added a new one
                BuildAppearanceListBox (Appearances);
            }
        }