void IDeviceSpecificDesigner.SetDeviceSpecific(String deviceSpecificParentID, DeviceSpecific ds) { Style style = (Style)_styleSheet[deviceSpecificParentID]; Debug.Assert(null != style, "style is null in IDeviceSpecificDesigner.SetDeviceSpecific"); if (null != ds) { ds.SetOwner((MobileControl)_styleSheet); } style.DeviceSpecific = ds; if (CurrentChoice != null && 0 == String.Compare(CurrentStyle.Name, deviceSpecificParentID, StringComparison.OrdinalIgnoreCase)) { if (ds == null) { CurrentChoice = null; } else { // This makes sure that the CurrentChoice value is set to null is // it was deleted during the deviceSpecific object editing if (CurrentChoice.Filter.Length == 0) { TemplateDeviceFilter = SR.GetString(SR.DeviceFilter_DefaultChoice); } else { TemplateDeviceFilter = DesignerUtility.ChoiceToUniqueIdentifier(CurrentChoice); } } } }
void IDeviceSpecificDesigner.SetDeviceSpecific(String deviceSpecificParentID, DeviceSpecific ds) { Debug.Assert(_defaultDeviceSpecificIdentifier == deviceSpecificParentID); if (null != ds) { ds.SetOwner((MobileControl)_mobileControl); } _mobileControl.DeviceSpecific = ds; }
public override void OnSetParent() { // MessageBox.Show("OnSetParent call for _ds.Site.Name=" + _ds.Site.Name + ", _ds.ID=" + _ds.ID); base.OnSetParent(); Debug.Assert(_ds.Parent != null, "_ds.Parent is null"); if (null != _parentContainer) { ParentContainerInvalid(); } System.Web.UI.Control parentContainer = _ds.Parent; if (parentContainer is System.Web.UI.MobileControls.Panel) { _parentContainer = (System.Web.UI.MobileControls.Panel)parentContainer; _ds.SetOwner(_parentContainer); if (null != _parentContainer.DeviceSpecific && 0 != String.Compare(_ds.ID, _parentContainer.DeviceSpecific.ID, StringComparison.OrdinalIgnoreCase)) { // the parent container already has a deviceSpecific child. // this instance is a duplicate and needs to update its rendering. // MessageBox.Show("OnSetParent - this instance is a duplicate"); TreatAsDuplicate(true); // the current valid DeviceSpecific is intentionaly refreshed because // if this deviceSpecific instance is recreated via a Undo operation // the current valid DeviceSpecific appears as a duplicate if not refreshed. IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); Debug.Assert(host != null, "Did not get a valid IDesignerHost reference"); IDesigner designer = host.GetDesigner((IComponent)_parentContainer.DeviceSpecific); Debug.Assert(designer != null, "designer is null in DeviceSpecificDesigner"); DeviceSpecificDesigner dsd = (DeviceSpecificDesigner)designer; dsd.UpdateRendering(); } else { // MessageBox.Show("OnSetParent - this instance becomes the valid ds"); _parentContainer.DeviceSpecific = _ds; if (_isDuplicate) { TreatAsDuplicate(false); } } } else { _parentContainer = null; } // Invalidate the type descriptor so that the PropertyOverrides // property browsable status gets updated TypeDescriptor.Refresh(Component); }
void IDeviceSpecificDesigner.SetDeviceSpecific(String deviceSpecificParentID, DeviceSpecific ds) { Debug.Assert(_defaultDeviceSpecificIdentifier == deviceSpecificParentID); if (_mobileControl != null) { if (null != ds) { ds.SetOwner(_mobileControl); } _mobileControl.DeviceSpecific = ds; } else if (_control != null && ds == null) { Debug.Assert(_control is DeviceSpecific); // Clear the choices if it is a DeviceSpecific control. ((DeviceSpecific)_control).Choices.Clear(); } if (null != CurrentChoice) { if (null == ds) { CurrentChoice = null; } else { // This makes sure that the CurrentChoice value is set to null if // it was deleted during the deviceSpecific object editing if (CurrentChoice.Filter.Length == 0) { TemplateDeviceFilter = SR.GetString(SR.DeviceFilter_DefaultChoice); } else { TemplateDeviceFilter = DesignerUtility.ChoiceToUniqueIdentifier(CurrentChoice); } } } }