Пример #1
0
 public MyComputerProjectItem(Project owningProject)
     : base(owningProject, "My Computer (" + Environment.MachineName + ")")
 {
     base.SetIconIndex(8);
     base.SetFlags(ProjectItemFlags.SupportsAddItem, false);
     base.SetFlags(ProjectItemFlags.NotDeletable, true);
 }
Пример #2
0
 public ShortcutProjectItem(Project owningProject, string path)
     : base(owningProject, path)
 {
     base.SetIconIndex(6);
     base.SetFlags(ProjectItemFlags.IsDropTarget, true);
     this._path = path;
 }
Пример #3
0
 public AddFileDialog(Project project, string location, bool fixedLocation)
     : base(project)
 {
     if (project == null)
     {
         throw new ArgumentNullException("project");
     }
     this.InitializeComponent();
     Bitmap bitmap = new Bitmap(typeof(AddFileDialog), "IconView.bmp");
     bitmap.MakeTransparent(Color.Fuchsia);
     this._iconViewButton.EnabledImage = bitmap;
     bitmap = new Bitmap(typeof(AddFileDialog), "ListView.bmp");
     bitmap.MakeTransparent(Color.Fuchsia);
     this._listViewButton.EnabledImage = bitmap;
     this._project = project;
     if (location != null)
     {
         if (fixedLocation)
         {
             this._location = location;
             this._locationText.ReadOnly = true;
         }
         this._locationText.Text = location;
     }
     this._codeLanguages = new ArrayList();
     ILanguageManager manager = (ILanguageManager) this.GetService(typeof(ILanguageManager));
     if (manager != null)
     {
         foreach (DocumentLanguage language in manager.DocumentLanguages)
         {
             CodeDocumentLanguage language2 = language as CodeDocumentLanguage;
             if (language2 != null)
             {
                 this._codeLanguages.Add(language2);
             }
         }
         this._defaultLanguage = (CodeDocumentLanguage) manager.DefaultCodeLanguage;
     }
     IPreferencesService service = (IPreferencesService) this.GetService(typeof(IPreferencesService));
     if (service != null)
     {
         PreferencesStore preferencesStore = service.GetPreferencesStore(typeof(AddFileDialog));
         if ((preferencesStore != null) && (preferencesStore.GetValue("View", 0) != 0))
         {
             this._listViewButton.Checked = true;
             this._iconViewButton.Checked = false;
             this._templateListView.View = View.List;
         }
     }
 }
Пример #4
0
 bool IProjectManager.CloseProject(Project project)
 {
     if (project == null)
     {
         throw new ArgumentNullException("project");
     }
     if (!this._openProjects.Contains(project))
     {
         throw new ArgumentException("Unknown project", "project");
     }
     bool flag = true;
     IDocumentManager service = (IDocumentManager) this._serviceProvider.GetService(typeof(IDocumentManager));
     if (service != null)
     {
         bool flag2 = false;
         foreach (Document document in service.OpenDocuments)
         {
             if (document.ProjectItem.Project == project)
             {
                 flag2 = true;
                 service.CloseDocument(document, false);
             }
         }
         if (flag2)
         {
             foreach (Document document2 in service.OpenDocuments)
             {
                 if (document2.ProjectItem.Project == project)
                 {
                     flag = false;
                     break;
                 }
             }
         }
     }
     if (flag)
     {
         this.OnProjectClosed(new ProjectEventArgs(project));
         this._openProjects.Remove(project);
         try
         {
             ((IDisposable) project).Dispose();
         }
         catch (Exception)
         {
         }
     }
     return flag;
 }
Пример #5
0
 void IDisposable.Dispose()
 {
     if (this._serviceProvider != null)
     {
         ICommandManager service = (ICommandManager) this._serviceProvider.GetService(typeof(ICommandManager));
         if (service != null)
         {
             service.RemoveGlobalCommandHandler(this);
         }
     }
     if (this._openProjects != null)
     {
         foreach (IDisposable disposable in this._openProjects)
         {
             if (disposable != this._myComputerProject)
             {
                 disposable.Dispose();
             }
         }
         this._openProjects = null;
     }
     if (this._factories != null)
     {
         foreach (IDisposable disposable2 in this._factories.Values)
         {
             if (disposable2.GetType() != this._myComputerFactoryType)
             {
                 disposable2.Dispose();
             }
         }
         this._creatableFactoryList = null;
         this._factories = null;
     }
     if (this._myComputerProject != null)
     {
         IProjectFactory projectFactory = this._myComputerProject.ProjectFactory;
         ((IDisposable) this._myComputerProject).Dispose();
         projectFactory.Dispose();
         this._myComputerProject = null;
     }
     this._myComputerFactoryType = null;
     this._serviceProvider = null;
 }
Пример #6
0
 object IProjectFactory.SaveProject(Project project)
 {
     if (!(project is ShortcutProject))
     {
         throw new ArgumentException("Unexpected type of project");
     }
     return project.ProjectItem.Path;
 }
Пример #7
0
 object IProjectFactory.SaveProject(Project project)
 {
     throw new NotSupportedException();
 }
Пример #8
0
 public MiscFileProjectItem(string caption, string path, Microsoft.Matrix.Core.Projects.Project project)
     : base(caption)
 {
     this._project = project;
     this._path = path;
 }
Пример #9
0
 DocumentProjectItem IDocumentManager.CreateDocument(Project project, FolderProjectItem parentItem, bool fixedParentItem)
 {
     if (project == null)
     {
         throw new ArgumentNullException("project");
     }
     if (fixedParentItem && (parentItem == null))
     {
         throw new ArgumentNullException("parentItem");
     }
     IMxUIService service = (IMxUIService) this._serviceProvider.GetService(typeof(IMxUIService));
     string location = null;
     if (parentItem != null)
     {
         location = parentItem.Path;
     }
     AddFileDialog dialog = new AddFileDialog(project, location, fixedParentItem);
     if (service.ShowDialog(dialog) == DialogResult.OK)
     {
         return dialog.NewProjectItem;
     }
     return null;
 }
Пример #10
0
 private void OnAfterSelectTreeView(object sender, TreeViewEventArgs e)
 {
     this.UpdateToolBarButtons();
     ProjectTreeNode selectedNode = this._treeView.SelectedNode as ProjectTreeNode;
     Project project = null;
     if (selectedNode != null)
     {
         ProjectItem projectItem = selectedNode.ProjectItem;
         if (projectItem != null)
         {
             project = projectItem.Project;
         }
     }
     if (this._activeProject != project)
     {
         this._activeProject = project;
         ICommandManager service = (ICommandManager) this.GetService(typeof(ICommandManager));
         if (service != null)
         {
             service.UpdateCommands(false);
         }
     }
 }
Пример #11
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         IProjectManager service = (IProjectManager) this.GetService(typeof(IProjectManager));
         if (service != null)
         {
             service.ProjectAdded -= new ProjectEventHandler(this.OnProjectAdded);
             service.ProjectClosed -= new ProjectEventHandler(this.OnProjectClosed);
         }
         ICommandManager manager2 = (ICommandManager) this.GetService(typeof(ICommandManager));
         if (manager2 != null)
         {
             manager2.RemoveGlobalCommandHandler(this);
         }
         this._myComputerProject = null;
         this._activeProject = null;
     }
     base.Dispose(disposing);
 }
Пример #12
0
 object IProjectFactory.SaveProject(Project project)
 {
     AccessDatabaseProject project2 = project as AccessDatabaseProject;
     if (project2 == null)
     {
         throw new ArgumentException("Unexpected project type");
     }
     return ((AccessDatabase) project2.Database).ConnectionSettings;
 }
Пример #13
0
 public AddFileDialog(Project project)
     : this(project, null, false)
 {
 }
Пример #14
0
 object IProjectFactory.SaveProject(Project project)
 {
     FtpProject project2 = project as FtpProject;
     if (project2 == null)
     {
         throw new ArgumentException("Unexpected project type");
     }
     FtpConnectionInfo info = new FtpConnectionInfo();
     info.RemoteHostName = project2.Connection.RemoteHostName;
     info.RemotePort = project2.Connection.RemotePort;
     info.UserName = project2.Connection.UserName;
     info.Password = project2.Connection.Password;
     info.HttpRoot = project2.HttpRoot;
     info.HttpUrl = project2.HttpUrl;
     return info;
 }
Пример #15
0
 public ClassBrowserProjectItem(Project owningProject)
     : base(owningProject, "Class Browser")
 {
     base.SetFlags(ProjectItemFlags.NotDeletable, true);
 }
Пример #16
0
 private Project CreateProject(IProjectFactory factory, object creationArgs)
 {
     Project project = null;
     if (factory.IsSingleInstance)
     {
         foreach (Project project2 in this._openProjects)
         {
             if (project2.ProjectFactory == factory)
             {
                 project = project2;
                 break;
             }
         }
     }
     if (project == null)
     {
         try
         {
             project = factory.CreateProject(creationArgs);
         }
         catch (Exception exception)
         {
             IMxUIService service = (IMxUIService) this._serviceProvider.GetService(typeof(IMxUIService));
             if (service != null)
             {
                 service.ReportError(exception.Message, "Unable to create a new " + factory.Name + " workspace.", false);
             }
         }
         if (project == null)
         {
             return project;
         }
         this._openProjects.Add(project);
         if ((this._myComputerProject == null) && (factory.GetType() == this._myComputerFactoryType))
         {
             this._myComputerProject = project;
         }
         try
         {
             ProjectEventArgs e = new ProjectEventArgs(project);
             this.OnProjectAdded(e);
         }
         catch (Exception)
         {
         }
     }
     return project;
 }
Пример #17
0
 public ProjectSaveData(Project project)
 {
     IProjectFactory projectFactory = project.ProjectFactory;
     Type type = projectFactory.GetType();
     this._data = projectFactory.SaveProject(project);
     this._factoryTypeName = type.FullName + ", " + type.Assembly.GetName().Name;
 }
Пример #18
0
 private void OnProjectAdded(object sender, ProjectEventArgs e)
 {
     if (e.Project is WorkspaceProject)
     {
         base.Activate();
         if (this._firstProject)
         {
             this._firstProject = false;
             IDocumentTypeManager service = (IDocumentTypeManager) this.GetService(typeof(IDocumentTypeManager));
             ImageList documentIcons = service.DocumentIcons;
             ImageList imageList = this._treeView.ImageList;
             this._documentIconOffset = imageList.Images.Count;
             foreach (Image image in documentIcons.Images)
             {
                 imageList.Images.Add(image);
             }
             if (e.Project is MyComputerProject)
             {
                 this._myComputerProject = e.Project;
             }
         }
         RootProjectItem projectItem = e.Project.ProjectItem;
         ProjectTreeNode node = this.CreateProjectTreeNode(projectItem, !projectItem.ShowChildrenByDefault);
         this._treeView.Nodes.Add(node);
         if (projectItem.ShowChildrenByDefault)
         {
             ProjectItemCollection childItems = projectItem.ChildItems;
             if (childItems != null)
             {
                 foreach (ProjectItem item2 in childItems)
                 {
                     ProjectTreeNode node2 = this.CreateProjectTreeNode(item2, true);
                     node.Nodes.Add(node2);
                 }
             }
             if (node.Nodes.Count != 0)
             {
                 node.Expand();
             }
         }
         this._treeView.SelectedNode = node;
     }
 }