Пример #1
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;
		}
Пример #2
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);
 }
Пример #3
0
		private void LoadWorkspace ()
		{
			_workspace = new Workspace ();
			_workspace.ActiveDocumentChanged += delegate (object sender, ActiveDocumentChangedEventArgs args) {
				propertyGrid.ActiveComponent = GetPrimarySelection (args.NewDocument);

			};
			_workspace.References.ReferencesChanged += delegate {
				PopulateToolbox (toolbox, _workspace.References);
			};
			_workspace.Services.AddService (typeof (IToolboxService), (IToolboxService) toolbox);
			_workspace.Load ();
		}
Пример #4
0
		private void LoadDocument (string file, Workspace workspace)
		{
			Document doc = new Document (file, workspace);
			doc.Load ();
			doc.Modified += delegate {
				if (!surfaceTabs.TabPages[file].Text.EndsWith (" *"))
					surfaceTabs.TabPages[file].Text += " *";
			};
			workspace.AddDocument (doc);
			workspace.ActiveDocument = doc;
			surfaceTabs.TabPages.Add (file, Path.GetFileNameWithoutExtension (file));
			surfaceTabs.TabPages[file].Controls.Add ((Control)doc.DesignSurface.View);
			surfaceTabs.SelectedTab = surfaceTabs.TabPages[file];
			surfaceTabs.SelectedTab.Text.Replace (" *", "---");
		}
Пример #5
0
 private void LoadWorkspace()
 {
     _workspace = new Workspace ();
     surfaceTabs.SelectedIndexChanged += delegate {
         UpdateWorkspaceActiveDocument ();
     };
     _workspace.ActiveDocumentChanged += OnActiveDocumentChanged;
     _workspace.Services.AddService (typeof (IToolboxService), (IToolboxService) toolbox);
     _toolboxFiller = new ToolboxFiller (_workspace.References, toolbox);
     AddErrorsTab ();
     _workspace.Load ();
 }
Пример #6
0
        private void LoadDocument(string file, Workspace workspace)
        {
            TabPage tab = new TabPage (Path.GetFileNameWithoutExtension (file));
            tab.Name = file; // the key

            // loads and associates the tab page with the document
            Document doc = workspace.CreateDocument (file, tab);
            doc.Services.AddService (typeof (IMenuCommandService), new MenuCommandService (doc.Services));
            doc.Load ();
            doc.Services.AddService (typeof (UndoEngine), new UndoRedoEngine (doc.Services));
            if (doc.LoadSuccessful) {
                doc.Modified += OnDocumentModified;
                workspace.ActiveDocument = doc;
                ((Control)doc.DesignSurface.View).Dock = DockStyle.Fill;
                tab.Controls.Add ((Control)doc.DesignSurface.View);
                surfaceTabs.SuspendLayout ();
                surfaceTabs.TabPages.Add (tab);
                surfaceTabs.ResumeLayout ();
                surfaceTabs.SelectedTab = surfaceTabs.TabPages[file];
            } else {
                MessageBox.Show ("Unable to load!");
                tab.Dispose ();
                workspace.CloseDocument (doc);
            }
        }