internal StylesEditorDialog(StyleSheet stylesheet, StyleSheetDesigner styleSheetDesigner, string initialStyleName) { if (Utils.GetDuplicateStyles(stylesheet).Count > 0) { MessageBox.Show(MobileResource.GetString("StylesEditorDialog_DuplicateStyleNames"), MobileResource.GetString("StylesEditorDialog_Title")); throw new ArgumentException(MobileResource.GetString("StylesEditorDialog_DuplicateStyleException")); } this._tempStyleSheet = new StyleSheet(); this._previewStyle = new Style(); this._styleSheet = stylesheet; this._styleSheetDesigner = styleSheetDesigner; this._tempStyleSheet.Site = this._styleSheet.Site; this.InitializeComponent(); this.InitAvailableStyles(); this.LoadStyleItems(); if (this._tvDefinedStyles.Nodes.Count > 0) { int num = 0; if (initialStyleName != null) { num = this.StyleIndex(initialStyleName); } this.SelectedStyle = (StyleNode) this._tvDefinedStyles.Nodes[num]; this._tvDefinedStyles.Enabled = true; this.UpdateTypeText(); this.UpdatePropertyGrid(); } this.UpdateButtonsEnabling(); this.UpdateFieldsEnabling(); }
public static ICollection GetDuplicateStyles(StyleSheet styleSheet) { ICollection is2 = null; if (_styleSheetDuplicateStyles == null) { _styleSheetDuplicateStyles = typeof(StyleSheet).GetProperty("DuplicateStyles", BindingFlags.GetProperty | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); } if ((_styleSheetDuplicateStyles != null) && (styleSheet != null)) { is2 = (ICollection) _styleSheetDuplicateStyles.GetValue(styleSheet, null); } return is2; }
/// <include file='doc\MobilePage.uex' path='docs/doc[@for="MobilePage.AddParsedSubObject"]/*' /> protected override void AddParsedSubObject(Object o) { // Note : AddParsedSubObject is never called at DesignTime if (o is StyleSheet) { if (_styleSheet != null) { throw new Exception(SR.GetString(SR.StyleSheet_DuplicateWarningMessage)); } else { _styleSheet = (StyleSheet)o; } } base.AddParsedSubObject(o); }
/// <summary> /// <para> /// Initializes the designer. /// </para> /// </summary> /// <param name='component'> /// The control element being designed. /// </param> /// <remarks> /// <para> /// This is called by the designer host to establish the component being /// designed. /// </para> /// </remarks> /// <seealso cref='System.ComponentModel.Design.IDesigner'/> public override void Initialize(IComponent component) { Debug.Assert(component is System.Web.UI.MobileControls.StyleSheet, "StyleSheetDesigner.Initialize - Invalid StyleSheet Control"); base.Initialize(component); _isDuplicate = false; _styleSheet = (System.Web.UI.MobileControls.StyleSheet)component; if (_requiresDesignTimeChanges) { _shouldRepersistStyles = true; } _loadComplete = new EventHandler(this.OnLoadComplete); IWebFormsDocumentService.LoadComplete += _loadComplete; if (IMobileWebFormServices != null) { TemplateStyle = (String)IMobileWebFormServices.GetCache(_styleSheet.ID, _templateStyle); TemplateDeviceFilter = (String)IMobileWebFormServices.GetCache( _styleSheet.ID, MobileTemplatedControlDesigner.DefaultTemplateDeviceFilter); } }
/// <summary> /// Create a new StylesEditorDialog instance /// </summary> /// <internalonly/> internal StylesEditorDialog(StyleSheet stylesheet, StyleSheetDesigner styleSheetDesigner, String initialStyleName) : base (stylesheet.Site) { if(stylesheet.DuplicateStyles.Count > 0) { GenericUI.ShowErrorMessage( SR.GetString(SR.StylesEditorDialog_Title), SR.GetString(SR.StylesEditorDialog_DuplicateStyleNames) ); throw new ArgumentException( SR.GetString(SR.StylesEditorDialog_DuplicateStyleException) ); } _tempStyleSheet = new StyleSheet(); _previewStyle = new Style(); _styleSheet = stylesheet; _styleSheetDesigner = styleSheetDesigner; _tempStyleSheet.Site = _styleSheet.Site; InitializeComponent(); InitAvailableStyles(); LoadStyleItems(); if (_tvDefinedStyles.Nodes.Count > 0) { int initialIndex = 0; if (initialStyleName != null) { initialIndex = StyleIndex(initialStyleName); } SelectedStyle = (StyleNode)_tvDefinedStyles.Nodes[initialIndex]; _tvDefinedStyles.Enabled = true; UpdateTypeText(); UpdatePropertyGrid(); } UpdateButtonsEnabling(); UpdateFieldsEnabling(); }
public override void Initialize(IComponent component) { this._styleSheet = (StyleSheet) component; base.Initialize(component); }
/// <summary> /// <para> /// Initializes the designer. /// </para> /// </summary> /// <param name='component'> /// The control element being designed. /// </param> /// <remarks> /// <para> /// This is called by the designer host to establish the component being /// designed. /// </para> /// </remarks> /// <seealso cref='System.ComponentModel.Design.IDesigner'/> public override void Initialize(IComponent component) { Debug.Assert(component is System.Web.UI.MobileControls.StyleSheet, "StyleSheetDesigner.Initialize - Invalid StyleSheet Control"); base.Initialize(component); _isDuplicate = false; _styleSheet = (System.Web.UI.MobileControls.StyleSheet) component; if(_requiresDesignTimeChanges) { _shouldRepersistStyles = true; } _loadComplete = new EventHandler(this.OnLoadComplete); IWebFormsDocumentService.LoadComplete += _loadComplete; if (IMobileWebFormServices != null) { TemplateStyle = (String) IMobileWebFormServices.GetCache(_styleSheet.ID, _templateStyle); TemplateDeviceFilter = (String) IMobileWebFormServices.GetCache( _styleSheet.ID, MobileTemplatedControlDesigner.DefaultTemplateDeviceFilter); } }