Esempio n. 1
0
		public void Load ()
		{
			_modified = false;

			// Initialize code provider, loader and surface
			//
			_codeProvider = new CodeProvider (this.FileName, this.CodeBehindFileName);
			_loader = new CodeProviderDesignerLoader (_codeProvider);
			_surface = new DesignSurface (_workspace.Services);

			// Initialize and add the services
			//
			IServiceContainer container = (IServiceContainer)_surface.GetService (typeof (IServiceContainer));
			container.AddService (typeof (IEventBindingService),new CodeProviderEventBindingService (_codeProvider, 
																									 (IServiceProvider) container));
			_surface.BeginLoad (_loader);

			// Mark as Modified on ComponentChanged
			//
			IComponentChangeService changeService = (IComponentChangeService)_surface.GetService (typeof (IComponentChangeService));
			changeService.ComponentChanged += delegate {
				_modified = true;
				if (Modified != null)
					Modified (this, EventArgs.Empty);
			};
			if (Loaded != null)
				Loaded (this, EventArgs.Empty);
		}
Esempio n. 2
0
        public void Load()
        {
            _modified = false;

            // Initialize code provider, loader and surface
            //
            _codeProvider = new CodeProvider(this.FileName, this.CodeBehindFileName);
            _loader       = new CodeProviderDesignerLoader(_codeProvider);
            _surface      = new DesignSurface(_workspace.Services);

            // Initialize and add the services
            //
            IServiceContainer container = (IServiceContainer)_surface.GetService(typeof(IServiceContainer));

            container.AddService(typeof(IEventBindingService), new CodeProviderEventBindingService(_codeProvider,
                                                                                                   (IServiceProvider)container));
            _surface.BeginLoad(_loader);

            // Mark as Modified on ComponentChanged
            //
            IComponentChangeService changeService = (IComponentChangeService)_surface.GetService(typeof(IComponentChangeService));

            changeService.ComponentChanged += delegate {
                _modified = true;
                if (Modified != null)
                {
                    Modified(this, EventArgs.Empty);
                }
            };
            if (Loaded != null)
            {
                Loaded(this, EventArgs.Empty);
            }
        }
Esempio n. 3
0
 public Document(string fileName, Workspace workspace)
 {
     if (workspace == null)
         throw new ArgumentNullException ("workspace");
     if (fileName == null)
         throw new ArgumentNullException ("fileName");
     _fileName = fileName;
     _workspace = workspace;
     _loaded = false;
     _surface = new DesignSurface (_workspace.Services);
 }
Esempio n. 4
0
        public DesignSurface this[int index] {
            get {
                IDesignerHost designer = _designers[index];
                DesignSurface surface  = designer.GetService(typeof(DesignSurface)) as DesignSurface;
                if (surface == null)
                {
                    throw new NotSupportedException();
                }

                return(surface);
            }
        }
Esempio n. 5
0
 public Document(string fileName, Workspace workspace)
 {
     if (workspace == null)
     {
         throw new ArgumentNullException("workspace");
     }
     if (fileName == null)
     {
         throw new ArgumentNullException("fileName");
     }
     _fileName  = fileName;
     _workspace = workspace;
     _loaded    = false;
     _surface   = new DesignSurface(_workspace.Services);
 }
        private void OnDesignSurfaceCreated(DesignSurface surface)
        {
            if (DesignSurfaceCreated != null)
            {
                DesignSurfaceCreated(this, new DesignSurfaceEventArgs(surface));
            }

            // monitor disposing
            surface.Disposed += new EventHandler(OnDesignSurfaceDisposed);

            DesignerEventService eventService = GetService(typeof(IDesignerEventService)) as DesignerEventService;

            if (eventService != null)
            {
                eventService.RaiseDesignerCreated(surface.GetService(typeof(IDesignerHost)) as IDesignerHost);
            }
        }
        private void OnDesignSurfaceDisposed(object sender, EventArgs args)
        {
            DesignSurface surface = (DesignSurface)sender;

            surface.Disposed -= new EventHandler(OnDesignSurfaceDisposed);

            if (DesignSurfaceDisposed != null)
            {
                DesignSurfaceDisposed(this, new DesignSurfaceEventArgs(surface));
            }

            DesignerEventService eventService = GetService(typeof(IDesignerEventService)) as DesignerEventService;

            if (eventService != null)
            {
                eventService.RaiseDesignerDisposed(surface.GetService(typeof(IDesignerHost)) as IDesignerHost);
            }
        }
 public ActiveDesignSurfaceChangedEventArgs(DesignSurface oldSurface, DesignSurface newSurface)
 {
     _newSurface = newSurface;
     _oldSurface = oldSurface;
 }
Esempio n. 9
0
 public DesignSurfaceEventArgs(DesignSurface surface)
 {
     _surface = surface;
 }
		public DesignSurfaceEventArgs (DesignSurface surface)
		{
			_surface = surface;
		}
		public ActiveDesignSurfaceChangedEventArgs (DesignSurface oldSurface, DesignSurface newSurface)
		{
			_newSurface = newSurface;
			_oldSurface = oldSurface;
		}