private void GetView() { IRootDesigner rd = (IRootDesigner)host.GetDesigner(host.RootComponent); this.view = (RootDesignerView)rd.GetView(ViewTechnology.Passthrough); view.BeginLoad(); System.Diagnostics.Trace.WriteLine("Document created."); }
// Provides a RootDesignerView object that supports ViewTechnology.WindowsForms. object IRootDesigner.GetView(ViewTechnology technology) { if (technology != ViewTechnology.WindowsForms) { throw new ArgumentException("Not a supported view technology", "technology"); } if (m_view == null) { // Create the view control. In this example, a Control of type RootDesignerView is used. // A WindowsForms ViewTechnology view provider requires a class that inherits from Control. m_view = new RootDesignerView(this, this.Component); } return(m_view); }
// This method returns an instance of the view for this root // designer. The "view" is the user interface that is presented // in a document window for the user to manipulate. object IRootDesigner.GetView(ViewTechnology technology) { if (technology != ViewTechnology.Default) { throw new ArgumentException("Not a supported view technology", "technology"); } if (m_view == null) { // Some type of displayable Form or control is required // for a root designer that overrides GetView(). In this // example, a Control of type RootDesignerView is used. // Any class that inherits from Control will work. m_view = new RootDesignerView(this); } return(m_view); }
// This method returns an object that provides the view for this root designer. object IRootDesigner.GetView(ViewTechnology technology) { // If the design environment requests a view technology other than Windows // Forms, this method throws an Argument Exception. if (technology != ViewTechnology.Default) { throw new ArgumentException("An unsupported view technology was requested", "Unsupported view technology."); } // Creates the view object if it has not yet been initialized. if (view == null) { view = new RootDesignerView(this); } return(view); }
public void Initialise() { DispatchService.AssertGuiThread(); System.Diagnostics.Trace.WriteLine("Loading document into DesignerHost"); designerHost.LoadDocument(); System.Diagnostics.Trace.WriteLine("Loaded document into DesignerHost"); designerHost.Activate(); System.Diagnostics.Trace.WriteLine("DesignerHost activated; getting designer view"); IRootDesigner rootDesigner = (IRootDesigner)designerHost.GetDesigner(designerHost.RootComponent); designerView = (RootDesignerView)rootDesigner.GetView(ViewTechnology.Default); // designerView.Realized += delegate { // System.Diagnostics.Trace.WriteLine ("Designer view realized"); // }; designerView.Realized += new EventHandler(designerHost.RootDesignerView_Realized); }
public void Initialise(string document, string fileName) { DispatchService.AssertGuiThread(); System.Diagnostics.Trace.WriteLine("Loading document into DesignerHost"); if (document != null) { host.Load(document, fileName); } else { host.NewFile(); } System.Diagnostics.Trace.WriteLine("Loaded document into DesignerHost"); host.Activate(); System.Diagnostics.Trace.WriteLine("DesignerHost activated; getting designer view"); IRootDesigner rootDesigner = (IRootDesigner)host.GetDesigner(host.RootComponent); designerView = (RootDesignerView)rootDesigner.GetView(ViewTechnology.Passthrough); designerView.Realized += delegate { System.Diagnostics.Trace.WriteLine("Designer view realized"); }; }
public RootDesigner(IComponent component) { System.Diagnostics.Trace.WriteLine("Creating RootDesigner"); view = new RootDesignerView(component.Site.GetService(typeof(IDesignerHost)) as IDesignerHost); }
static void Main() { #if TRACE System.Diagnostics.TextWriterTraceListener listener = new System.Diagnostics.TextWriterTraceListener(System.Console.Out); System.Diagnostics.Trace.Listeners.Add(listener); #endif Application.Init(); #region Packing and layout Window window = new Window("AspNetEdit Host Sample"); window.SetDefaultSize(1000, 700); window.DeleteEvent += new DeleteEventHandler(window_DeleteEvent); VBox outerBox = new VBox(); window.Add(outerBox); HPaned leftBox = new HPaned(); outerBox.PackEnd(leftBox, true, true, 0); HPaned rightBox = new HPaned(); leftBox.Add2(rightBox); geckoFrame = new Frame(); geckoFrame.Shadow = ShadowType.In; rightBox.Pack1(geckoFrame, true, false); #endregion #region Toolbar // * Save/Open Toolbar buttons = new Toolbar(); outerBox.PackStart(buttons, false, false, 0); ToolButton saveButton = new ToolButton(Stock.Save); buttons.Add(saveButton); saveButton.Clicked += new EventHandler(saveButton_Clicked); ToolButton openButton = new ToolButton(Stock.Open); buttons.Add(openButton); openButton.Clicked += new EventHandler(openButton_Clicked); buttons.Add(new SeparatorToolItem()); // * Clipboard ToolButton undoButton = new ToolButton(Stock.Undo); buttons.Add(undoButton); undoButton.Clicked += new EventHandler(undoButton_Clicked); ToolButton redoButton = new ToolButton(Stock.Redo); buttons.Add(redoButton); redoButton.Clicked += new EventHandler(redoButton_Clicked); ToolButton cutButton = new ToolButton(Stock.Cut); buttons.Add(cutButton); cutButton.Clicked += new EventHandler(cutButton_Clicked); ToolButton copyButton = new ToolButton(Stock.Copy); buttons.Add(copyButton); copyButton.Clicked += new EventHandler(copyButton_Clicked); ToolButton pasteButton = new ToolButton(Stock.Paste); buttons.Add(pasteButton); pasteButton.Clicked += new EventHandler(pasteButton_Clicked); buttons.Add(new SeparatorToolItem()); // * Text style ToolButton boldButton = new ToolButton(Stock.Bold); buttons.Add(boldButton); boldButton.Clicked += new EventHandler(boldButton_Clicked); ToolButton italicButton = new ToolButton(Stock.Italic); buttons.Add(italicButton); italicButton.Clicked += new EventHandler(italicButton_Clicked); ToolButton underlineButton = new ToolButton(Stock.Underline); buttons.Add(underlineButton); underlineButton.Clicked += new EventHandler(underlineButton_Clicked); ToolButton indentButton = new ToolButton(Stock.Indent); buttons.Add(indentButton); indentButton.Clicked += new EventHandler(indentButton_Clicked); ToolButton unindentButton = new ToolButton(Stock.Unindent); buttons.Add(unindentButton); unindentButton.Clicked += new EventHandler(unindentButton_Clicked); buttons.Add(new SeparatorToolItem()); // * Toolbox ToolButton toolboxAddButton = new ToolButton(Stock.Add); buttons.Add(toolboxAddButton); toolboxAddButton.Clicked += new EventHandler(toolboxAddButton_Clicked); #endregion #region Designer services and host //set up the services ServiceContainer services = new ServiceContainer(); services.AddService(typeof(INameCreationService), new NameCreationService()); services.AddService(typeof(ISelectionService), new SelectionService()); services.AddService(typeof(IEventBindingService), new EventBindingService(window)); services.AddService(typeof(ITypeResolutionService), new TypeResolutionService()); ExtenderListService extListServ = new AspNetEdit.Editor.ComponentModel.ExtenderListService(); services.AddService(typeof(IExtenderListService), extListServ); services.AddService(typeof(IExtenderProviderService), extListServ); services.AddService(typeof(ITypeDescriptorFilterService), new TypeDescriptorFilterService()); toolboxService = new ToolboxService(); services.AddService(typeof(IToolboxService), toolboxService); //create our host host = new DesignerHost(services); host.NewFile(); host.Activate(); #endregion #region Designer UI and panels IRootDesigner rootDesigner = (IRootDesigner)host.GetDesigner(host.RootComponent); RootDesignerView designerView = (RootDesignerView)rootDesigner.GetView(ViewTechnology.Passthrough); geckoFrame.Add(designerView); PropertyGrid p = new PropertyGrid(services); p.WidthRequest = 200; rightBox.Pack2(p, false, false); Toolbox toolbox = new Toolbox(services); leftBox.Pack1(toolbox, false, false); toolboxService.PopulateFromAssembly(System.Reflection.Assembly.GetAssembly(typeof(System.Web.UI.Control))); toolboxService.AddToolboxItem(new TextToolboxItem("<table><tr><td></td><td></td></tr><tr><td></td><td></td></tr></table>", "Table"), "Html"); toolboxService.AddToolboxItem(new TextToolboxItem("<div style=\"width: 100px; height: 100px;\"></div>", "Div"), "Html"); toolboxService.AddToolboxItem(new TextToolboxItem("<hr />", "Horizontal Rule"), "Html"); toolboxService.AddToolboxItem(new TextToolboxItem("<select><option></option></select>", "Select"), "Html"); toolboxService.AddToolboxItem(new TextToolboxItem("<img src=\"\" />", "Image"), "Html"); toolboxService.AddToolboxItem(new TextToolboxItem("<textarea cols=\"20\" rows=\"2\"></textarea>", "Textarea"), "Html"); toolboxService.AddToolboxItem(new TextToolboxItem("<input type=\"hidden\" />", "Input [Hidden]"), "Html"); toolboxService.AddToolboxItem(new TextToolboxItem("<input type=\"radio\" />", "Input [Radio]"), "Html"); toolboxService.AddToolboxItem(new TextToolboxItem("<input type=\"checkbox\" />", "Input [Checkbox]"), "Html"); toolboxService.AddToolboxItem(new TextToolboxItem("<input type=\"password\" />", "Input [Password]"), "Html"); toolboxService.AddToolboxItem(new TextToolboxItem("<input type=\"file\" />", "Input [File]"), "Html"); toolboxService.AddToolboxItem(new TextToolboxItem("<input type=\"text\" />", "Input [Text]"), "Html"); toolboxService.AddToolboxItem(new TextToolboxItem("<input type=\"submit\" value=\"submit\" />", "Input [Submit]"), "Html"); toolboxService.AddToolboxItem(new TextToolboxItem("<input type=\"reset\" value=\"reset\" />", "Input [Reset]"), "Html"); toolboxService.AddToolboxItem(new TextToolboxItem("<input type=\"button\" value=\"button\" />", "Input [Button]"), "Html"); toolbox.Refresh(); #endregion window.ShowAll(); Application.Run(); }
public DesignerMessageManager(DesignerHost dhost, RootDesignerView rview) { host = dhost; view = rview; }