Hello.
Well, if I understand you well, I guess the best way to determine this is to compare current
ViewMode with one from the
ViewModeEnum enumeration (as listed below),
e.g. by using
CMSContext.ViewMode property, like:
if (CMSContext.ViewMode == ViewModeEnum.LiveSite)
{
// perform only when in the live site mode
}
and vice-versa with NOT operator (when not in live site).
The enumeration also contains various modes that can be distinguished:
namespace CMS.PortalEngine
{
// Summary:
// Page mode enumeration
public enum ViewModeEnum
{
// Summary:
// Live site mode
LiveSite = 0,
//
// Summary:
// Preview mode
Preview = 2,
//
// Summary:
// Edit mode - content editing
Edit = 3,
//
// Summary:
// Edit mode - content editing (editing disabled)
EditDisabled = 4,
//
// Summary:
// Edit mode - not current page
EditNotCurrent = 5,
//
// Summary:
// Edit mode with disabled controls - when not authorized or cannot edit
Design = 6,
//
// Summary:
// Design mode with disabled controls - for portal engine pages
DesignDisabled = 7,
//
// Summary:
// Edit form mode - for portal engine pages
EditForm = 8,
//
// Summary:
// Unknown / does not matter
Unknown = 9,
//
// Summary:
// Properties tab
Properties = 10,
//
// Summary:
// Product tab
Product = 11,
//
// Summary:
// User widgets mode
UserWidgets = 12,
//
// Summary:
// User widgets mode with disabled functionality (for preview mode)
UserWidgetsDisabled = 13,
//
// Summary:
// Group widgets mode
GroupWidgets = 14,
}
}
Best Regards,
Radek Macalik