Inheritance: IDesignerHost, IDisposable
Ejemplo n.º 1
0
        private void initDocument(Control parent, DesignerHost host)
        {
            System.Diagnostics.Trace.WriteLine("Creating document...");

            // get the ExtensibleTextEditor instance of the Source code's view
            textEditor = IdeApp.Workbench.ActiveDocument.PrimaryView.GetContent <SourceEditorView> ().TextEditor;

            if (!(parent is WebFormPage))
            {
                throw new NotImplementedException("Only WebFormsPages can have a document for now");
            }
            this.parent = parent;
            this.host   = host;

            if (!host.Loading)
            {
                throw new InvalidOperationException("The document cannot be initialised or loaded unless the host is loading");
            }

            directives            = new Hashtable(StringComparer.InvariantCultureIgnoreCase);
            txtDocDirty           = true;
            suppressSerialization = false;
            // create and set the event, to let the parser run the first time
            updateEditorContent = new ManualResetEvent(true);
            undoTracker         = new UndoTracker();
            undoHandler         = IdeApp.Workbench.ActiveDocument.PrimaryView.GetContent <IUndoHandler> ();
            if (undoHandler == null)
            {
                throw new NullReferenceException("Could not obtain the IUndoHandler from the SourceEditorView");
            }
        }
Ejemplo n.º 2
0
 ///<summary>Creates a new document</summary>
 public Document(Control parent, DesignerHost host, string documentName)
 {
     initDocument(parent, host);
     //newDocument. this.textEditor
     //Parse (String.Format (newDocument, documentName), documentName);
     // TODO: get a ExtensibleTextEditor instance, if we have an new empty file
 }
Ejemplo n.º 3
0
 public DocumentSerializer(DesignerHost hst)
 {
     host            = hst;
     document        = host.RootDocument;
     designerContext = String.Empty;
     //designerContext = ((host.GetDesigner (host.RootComponent) as RootDesigner).GetView (ViewTechnology.Default) as RootDesignerView).DesignerContext;
 }
Ejemplo n.º 4
0
        ///<summary>Creates a document from an existing file</summary>
        public Document(Control parent, DesignerHost host, string document, string fileName)
        {
            initDocument(parent, host);

            Control[] controls;
            aspParser.ProcessFragment(document, out controls, out this.document);
            GetView();
        }
Ejemplo n.º 5
0
 protected override void OnCommit()
 {
     if (host == null)
     {
         return;
     }
     host.OnTransactionClosing(true);
     host.OnTransactionClosed(true, this);
     host = null;
 }
Ejemplo n.º 6
0
 protected override void OnCancel()
 {
     if (host == null)
     {
         return;
     }
     host.OnTransactionClosing(false);
     host.OnTransactionClosed(false, this);
     host = null;
 }
Ejemplo n.º 7
0
 //TODO: Some way to reset this when host is reset
 public WebFormReferenceManager(DesignerHost host)
 {
     if (host == null)
     {
         throw new ArgumentNullException("host");
     }
     this.host    = host;
     this.typeRes = host.GetService(typeof(ITypeResolutionService)) as ITypeResolutionService;
     if (typeRes == null)
     {
         throw new Exception("Could not obtain ITypesResolutionService from host");
     }
 }
Ejemplo n.º 8
0
        protected override IComponent[] CreateComponentsCore(IDesignerHost host)
        {
            DesignerHost desHost = host as DesignerHost;

            if (desHost == null)
            {
                throw new ArgumentException("host", "Must be a AspNetEdit.Editor.ComponentModel.DesignerHost");
            }

            OnComponentsCreating(new ToolboxComponentsCreatingEventArgs(host));

            desHost.RootDocument.InsertFragment(text);

            OnComponentsCreated(new ToolboxComponentsCreatedEventArgs(new IComponent[] {}));
            return(new IComponent[] {});
        }
Ejemplo n.º 9
0
        ///<summary>Creates a document from an existing file</summary>
        public Document(Control parent, DesignerHost host, Stream fileStream, string fileName)
        {
            initDocument(parent, host);

            TextReader reader = new StreamReader(fileStream);

            try {
                this.document = DeserializeAndAdd(reader.ReadToEnd());
            }
            catch (ParseException ex) {
                this.document = ConstructErrorDocument(ex.Title, ex.Message);
            }
            catch (Exception ex) {
                this.document = ConstructErrorDocument("Error loading document", ex.Message + ex.StackTrace);
            }

            GetView();
        }
Ejemplo n.º 10
0
        private void initDocument(Control parent, DesignerHost host)
        {
            System.Diagnostics.Trace.WriteLine("Creating document...");
            if (!(parent is WebFormPage))
            {
                throw new NotImplementedException("Only WebFormsPages can have a document for now");
            }
            this.parent = parent;
            this.host   = host;

            if (!host.Loading)
            {
                throw new InvalidOperationException("The document cannot be initialised or loaded unless the host is loading");
            }

            CaseInsensitiveHashCodeProvider provider = new CaseInsensitiveHashCodeProvider(CultureInfo.InvariantCulture);
            CaseInsensitiveComparer         comparer = new CaseInsensitiveComparer(CultureInfo.InvariantCulture);

            directives = new Hashtable(provider, comparer);

            this.aspParser = new DesignTimeParser(host, this);
        }
Ejemplo n.º 11
0
		public ContextMenu (DesignerHost hst)
		{
			host = hst;
			contextMenu = new Menu ();
		}
Ejemplo n.º 12
0
 public DesignContainer(DesignerHost host)
 {
     this.host       = host;
     this.designers  = new Hashtable();
     this.components = new ArrayList();
 }
Ejemplo n.º 13
0
 public Transaction(DesignerHost host, string description)
     : base(description)
 {
     this.host = host;
 }
Ejemplo n.º 14
0
 ///<summary>Creates a document from an existing file</summary>
 public Document(Control parent, DesignerHost host)
 {
     initDocument(parent, host);
 }
Ejemplo n.º 15
0
 ///<summary>Creates a new document</summary>
 public Document(Control parent, DesignerHost host, string documentName)
 {
     initDocument(parent, host);
     this.document = String.Format(newDocument, documentName);
     GetView();
 }
Ejemplo n.º 16
0
 public DesignerSerializer(DesignerHost hst)
 {
     host     = hst;
     document = host.RootDocument;
 }