Ejemplo n.º 1
0
		public EditorHost (MonoDevelopProxy proxy)
		{
			this.proxy = proxy;
			
			//set up the services
			services = new ServiceContainer ();
			services.AddService (typeof(INameCreationService), new NameCreationService ());
			services.AddService (typeof(ISelectionService), new SelectionService ());
			services.AddService (typeof(ITypeResolutionService), new TypeResolutionService ());
			services.AddService (
				typeof(IEventBindingService),
				new AspNetEdit.Editor.ComponentModel.EventBindingService (proxy)
			);
			ExtenderListService extListServ = new ExtenderListService ();
			services.AddService (typeof(IExtenderListService), extListServ);
			services.AddService (typeof(IExtenderProviderService), extListServ);
			services.AddService (typeof(ITypeDescriptorFilterService), new TypeDescriptorFilterService ());
			services.AddService (typeof (IMenuCommandService), new AspNetEdit.Editor.ComponentModel.MenuCommandService ());
			//services.AddService (typeof (IToolboxService), toolboxService);

			var project = MonoDevelop.Ide.IdeApp.Workbench.ActiveDocument.Project as AspNetAppProject;
			var aspParsedDoc = MonoDevelop.Ide.IdeApp.Workbench.ActiveDocument.ParsedDocument as AspNetParsedDocument;
			if (project != null && aspParsedDoc != null) {
				WebFormReferenceManager refMan = new WebFormReferenceManager (project);
				refMan.Doc = aspParsedDoc;
				services.AddService (typeof(WebFormReferenceManager), refMan);
			}

			System.Diagnostics.Trace.WriteLine ("Creating DesignerHost");
			designerHost = new DesignerHost (services, this);
			System.Diagnostics.Trace.WriteLine ("Created DesignerHost");
			designerHost.DocumentChanged += new DesignerHost.DocumentChangedEventHandler (OnDocumentChanged);
		}
Ejemplo n.º 2
0
		public EditorHost (MonoDevelopProxy proxy)
		{
			this.proxy = proxy;
			
			//set up the services
			services = new ServiceContainer ();
			services.AddService (typeof (INameCreationService), new NameCreationService ());
			services.AddService (typeof (ISelectionService), new SelectionService ());
			services.AddService (typeof (ITypeResolutionService), new TypeResolutionService ());
			services.AddService (typeof (IEventBindingService), new AspNetEdit.Editor.ComponentModel.EventBindingService (proxy));
			ExtenderListService extListServ = new ExtenderListService ();
			services.AddService (typeof (IExtenderListService), extListServ);
			services.AddService (typeof (IExtenderProviderService), extListServ);
			services.AddService (typeof (ITypeDescriptorFilterService), new TypeDescriptorFilterService ());
			//services.AddService (typeof (IToolboxService), toolboxService);
			
			System.Diagnostics.Trace.WriteLine ("Creating DesignerHost");
			host = new DesignerHost (services);
			System.Diagnostics.Trace.WriteLine ("Created DesignerHost");
		}
Ejemplo n.º 3
0
        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 ();
        }
Ejemplo n.º 4
0
        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();
        }