public void ExitTemplateMode(bool fSwitchingTemplates, bool fNested, bool fSave) { try { this.ExitNestedTemplates(fSave); this.ActiveTemplateEditingFrame.Close(fSave); if (!fSwitchingTemplates) { this._currentTemplateGroup = null; this.RaiseTemplateModeChanged(); if (!fNested) { this.UpdateDesignTimeHtml(); TypeDescriptor.Refresh(base.Component); IWebFormsDocumentService service = (IWebFormsDocumentService)this.GetService(typeof(IWebFormsDocumentService)); if (service != null) { service.UpdateSelection(); } } } } catch { } }
/// <include file='doc\URLBuilder.uex' path='docs/doc[@for="UrlBuilder.BuildUrl2"]/*' /> /// <devdoc> /// Launches the Url Picker to build a color. /// </devdoc> public static string BuildUrl(IComponent component, System.Windows.Forms.Control owner, string initialUrl, string caption, string filter, UrlBuilderOptions options) { string baseUrl = String.Empty; string result = null; ISite componentSite = component.Site; Debug.Assert(componentSite != null, "Component does not have a valid site."); if (componentSite == null) { Debug.Fail("Component does not have a valid site."); return(null); } // Work out the base Url. IWebFormsDocumentService wfdServices = (IWebFormsDocumentService)componentSite.GetService(typeof(IWebFormsDocumentService)); if (wfdServices != null) { baseUrl = wfdServices.DocumentUrl; } IWebFormsBuilderUIService builderService = (IWebFormsBuilderUIService)componentSite.GetService(typeof(IWebFormsBuilderUIService)); if (builderService != null) { result = builderService.BuildUrl(owner, initialUrl, baseUrl, caption, filter, options); } return(result); }
public static string BuildUrl(IServiceProvider serviceProvider, Control owner, string initialUrl, string caption, string filter, UrlBuilderOptions options) { string baseUrl = string.Empty; string str2 = null; IDesignerHost host = (IDesignerHost)serviceProvider.GetService(typeof(IDesignerHost)); if (host != null) { WebFormsRootDesigner designer = host.GetDesigner(host.RootComponent) as WebFormsRootDesigner; if (designer != null) { baseUrl = designer.DocumentUrl; } } if (baseUrl.Length == 0) { IWebFormsDocumentService service = (IWebFormsDocumentService)serviceProvider.GetService(typeof(IWebFormsDocumentService)); if (service != null) { baseUrl = service.DocumentUrl; } } IWebFormsBuilderUIService service2 = (IWebFormsBuilderUIService)serviceProvider.GetService(typeof(IWebFormsBuilderUIService)); if (service2 != null) { str2 = service2.BuildUrl(owner, initialUrl, baseUrl, caption, filter, options); } return(str2); }
/// <summary> /// Initializes the designer. /// </summary> /// <param name="component">Component for which this designer is for.</param> /// <remarks>It sets up all parameters for the designer and updates web.config file.</remarks> public override void Initialize(IComponent component) { _mapControl = component as MapControl; IDesignerHost host = (IDesignerHost)component.Site.GetService(typeof(IDesignerHost)); IWebFormsDocumentService docService = (IWebFormsDocumentService)component.Site.GetService(typeof(IWebFormsDocumentService)); string documentUrl = docService.DocumentUrl; UpdateForMapControl(documentUrl); base.Initialize(component); }
/// <include file='doc\TemplatedControlDesigner.uex' path='docs/doc[@for="TemplatedControlDesigner.ExitTemplateMode"]/*' /> /// <devdoc> /// <para> /// Closes the currently active template editing frame after saving any relevant changes. /// </para> /// </devdoc> public void ExitTemplateMode(bool fSwitchingTemplates, bool fNested, bool fSave) { Debug.Assert(ActiveTemplateEditingFrame != null, "Invalid current template frame!"); try { IWebFormsDocumentService wfServices = (IWebFormsDocumentService)GetService(typeof(IWebFormsDocumentService)); Debug.Assert(wfServices != null, "Did not get IWebFormsDocumentService"); // First let the inner/nested designers handle exiting of their template mode. // Note: This has to be done inside-out in order to ensure that the changes // made in a particular template are saved before its immediate outer level // control designer saves its children. ExitNestedTemplates(fSave); // Save the current contents of all the templates within the active frame, and // close the frame by removing it from the tree. ActiveTemplateEditingFrame.Close(fSave); // Reset the pointer to the active template frame. // NOTE: Do not call activeTemplateFrame.Dispose here - we're in the process of exiting template mode // and calling Dispose will attempt to exit template mode again. Calling dispose would also // throw away the cached html tree, which we want to hang on for perf reasons. activeTemplateFrame = null; if (!fSwitchingTemplates) { // No longer in template editing mode. // This will fire the OnTemplateModeChanged notification SetTemplateMode(false, fSwitchingTemplates); // When not switching from one template frame to another and it is the // outer most designer being switched out of template editing, then // update its design-time html: if (!fNested) { UpdateDesignTimeHtml(); // Invalidate the type descriptor so that proper filtering of properties // is done when exiting template mode. TypeDescriptor.Refresh(Component); if (wfServices != null) { wfServices.UpdateSelection(); } } } } catch (Exception) { } }
public void EnterTemplateMode(ITemplateEditingFrame newTemplateEditingFrame) { if ((this.ActiveTemplateEditingFrame != newTemplateEditingFrame) && (this.BehaviorInternal != null)) { IControlDesignerBehavior behaviorInternal = (IControlDesignerBehavior)this.BehaviorInternal; try { bool fSwitchingTemplates = false; if (this.InTemplateModeInternal) { fSwitchingTemplates = true; this.ExitTemplateModeInternal(fSwitchingTemplates, false, true); } else if (behaviorInternal != null) { behaviorInternal.DesignTimeHtml = string.Empty; } this._currentTemplateGroup = (TemplatedControlDesignerTemplateGroup)this.TemplateGroupTable[newTemplateEditingFrame]; if (this._currentTemplateGroup == null) { this._currentTemplateGroup = new TemplatedControlDesignerTemplateGroup(null, newTemplateEditingFrame); } if (!fSwitchingTemplates) { this.RaiseTemplateModeChanged(); } this.ActiveTemplateEditingFrame.Open(); base.IsDirtyInternal = true; TypeDescriptor.Refresh(base.Component); } catch { } IWebFormsDocumentService service = (IWebFormsDocumentService)this.GetService(typeof(IWebFormsDocumentService)); if (service != null) { service.UpdateSelection(); } } }
/// <include file='doc\TemplatedControlDesigner.uex' path='docs/doc[@for="TemplatedControlDesigner.EnterTemplateMode"]/*' /> /// <devdoc> /// <para> /// Opens a particular template frame object for editing in the designer. /// </para> /// </devdoc> public void EnterTemplateMode(ITemplateEditingFrame newTemplateEditingFrame) { Debug.Assert(newTemplateEditingFrame != null, "New template frame passed in is null!"); // Return immediately when trying to open (again) the currently active template frame. if (ActiveTemplateEditingFrame == newTemplateEditingFrame) { return; } Debug.Assert((Behavior == null) || (Behavior is IControlDesignerBehavior), "Invalid element behavior!"); IControlDesignerBehavior behavior = (IControlDesignerBehavior)Behavior; IWebFormsDocumentService wfServices = (IWebFormsDocumentService)GetService(typeof(IWebFormsDocumentService)); Debug.Assert(wfServices != null, "Did not get IWebFormsDocumentService"); try { bool switchingTemplates = false; if (InTemplateMode) { // This is the case of switching from template frame to another. switchingTemplates = true; ExitTemplateMode(switchingTemplates, /*fNested*/ false, /*fSave*/ true); } else { // Clear the design time HTML when entering template mode from read-only/preview mode. if (behavior != null) { behavior.DesignTimeHtml = String.Empty; } } // Hold onto the new template frame as the currently active template frame. this.activeTemplateFrame = newTemplateEditingFrame; // The designer is now in template editing mode. if (templateMode == false) { SetTemplateMode(/*templateMode*/ true, switchingTemplates); } // Open the new template frame and make it visible. ActiveTemplateEditingFrame.Open(); // Mark the designer as dirty when in template mode. IsDirty = true; // Invalidate the type descriptor so that proper filtering of properties // is done when entering template mode. TypeDescriptor.Refresh(Component); } catch (Exception) { } if (wfServices != null) { wfServices.UpdateSelection(); } }