상속: IDesignerHost, IDisposable
예제 #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");
            }
        }
예제 #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
 }
예제 #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;
 }
예제 #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();
        }
예제 #5
0
 protected override void OnCommit()
 {
     if (host == null)
     {
         return;
     }
     host.OnTransactionClosing(true);
     host.OnTransactionClosed(true, this);
     host = null;
 }
예제 #6
0
 protected override void OnCancel()
 {
     if (host == null)
     {
         return;
     }
     host.OnTransactionClosing(false);
     host.OnTransactionClosed(false, this);
     host = null;
 }
예제 #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");
     }
 }
예제 #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[] {});
        }
예제 #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();
        }
예제 #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);
        }
예제 #11
0
		public ContextMenu (DesignerHost hst)
		{
			host = hst;
			contextMenu = new Menu ();
		}
예제 #12
0
 public DesignContainer(DesignerHost host)
 {
     this.host       = host;
     this.designers  = new Hashtable();
     this.components = new ArrayList();
 }
예제 #13
0
 public Transaction(DesignerHost host, string description)
     : base(description)
 {
     this.host = host;
 }
예제 #14
0
 ///<summary>Creates a document from an existing file</summary>
 public Document(Control parent, DesignerHost host)
 {
     initDocument(parent, host);
 }
예제 #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();
 }
예제 #16
0
 public DesignerSerializer(DesignerHost hst)
 {
     host     = hst;
     document = host.RootDocument;
 }