示例#1
0
 private void ExitTemplateMode()
 {
     this._templateEditingDialog = null;
     this.OnTemplateModeChanged(EventArgs.Empty);
 }
示例#2
0
 public TemplateDesignView(IServiceProvider serviceProvider, Control defaultControlParent, TemplateEditingDialog owner)
     : base(serviceProvider, WebFormsEditorMode.Template)
 {
     this._defaultControlParent = defaultControlParent;
     this._owner = owner;
 }
示例#3
0
 protected override bool HandleCommand(Command command)
 {
     bool flag = false;
     if (this.InTemplateMode)
     {
         return ((ICommandHandler) this._templateEditingDialog.DesignView).HandleCommand(command);
     }
     if ((command.CommandGroup == typeof(WebCommands)) && (command.CommandID == 240))
     {
         ISelectionService service = (ISelectionService) base.ServiceProvider.GetService(typeof(ISelectionService));
         if (service.SelectionCount == 1)
         {
             System.Web.UI.Control primarySelection = service.PrimarySelection as System.Web.UI.Control;
             if (primarySelection != null)
             {
                 IDesignerHost host = base.ServiceProvider.GetService(typeof(IDesignerHost)) as IDesignerHost;
                 TemplatedControlDesigner designer = host.GetDesigner(primarySelection) as TemplatedControlDesigner;
                 if (designer != null)
                 {
                     TemplateEditingVerb[] templateEditingVerbs = designer.GetTemplateEditingVerbs();
                     if ((templateEditingVerbs != null) && (templateEditingVerbs.Length > 0))
                     {
                         base.EnableSelectionTracking(false);
                         DocumentWindow window = (DocumentWindow) base.ServiceProvider.GetService(typeof(DocumentWindow));
                         foreach (System.Windows.Forms.Control control2 in window.Controls)
                         {
                             control2.Enabled = false;
                         }
                         this._templateEditingDialog = new TemplateEditingDialog(designer, (WebFormsEditor) base.Editor, base.ServiceProvider);
                         this._templateEditingDialog.Closed += new EventHandler(this.OnTemplateEditingDialogClose);
                         this._templateEditingDialog.Location = new Point(0, 0);
                         this._templateEditingDialog.Size = new Size(500, 250);
                         this._templateEditingDialog.TopLevel = false;
                         this._templateEditingDialog.Parent = window;
                         IServiceContainer container = (ServiceContainer) base.ServiceProvider.GetService(typeof(IServiceContainer));
                         container.RemoveService(typeof(IDesignView));
                         container.AddService(typeof(IDesignView), this._templateEditingDialog.DesignView);
                         this.EnterTemplateMode();
                     }
                 }
             }
         }
         flag = true;
     }
     if (!flag)
     {
         flag = base.HandleCommand(command);
     }
     return flag;
 }