public SmartVisualStudio(IObjectSpace os, CsharpCode value) : this() { this._codeObject = value; CreateEditor(); if (value != null) { if (value.Workspace != null) { this._workspace = (SmartIDEWorkspace) value.Workspace; } else { this._workspace = SmartIDEWorkspace.GetIDE(os); } this._document = value.Provider; } #region 预设置智能感知项目,如果是一个方法,就需要先看一下方法中可以用的智能感知条目列表 if (_document is IPartCodeProvider && _document!=null) { var code = value?.Code + ""; IList<ICompletionData> list = new List<ICompletionData>(); _workspace.GetIntellisenseItems(_document, 0, true, code, null, list); } if (value == null) { Editor.IsEnabled = false; } #endregion #region 设置环境 if (value != null) { tabSolution.Visibility = value.ShowSolutionFiles ? DevExpress.XtraBars.Docking.DockVisibility.Visible : DevExpress.XtraBars.Docking.DockVisibility.Hidden; if (value.ShowSolutionFiles) { solutionTreeView.Nodes.Clear(); var solution = solutionTreeView.Nodes.Add("Solution"); foreach (var item in _workspace.Workspace.CurrentSolution.Projects) { var projectNode = solution.Nodes.Add(item.Name, item.Name); projectNode.Tag = item; var references = projectNode.Nodes.Add("引用", "引用"); foreach (var refence in item.MetadataReferences) { references.Nodes.Add(refence.Display); } foreach (var doc in item.Documents.OrderBy(x=>x.Name)) { var docNode = projectNode.Nodes.Add(doc.Name, doc.Name); docNode.Tag = doc; } } } if (value.Diagnostics != null && value.Diagnostics.Count > 0) { this.SetDiagnosticMessage(value.Diagnostics); } } #endregion }
public SmartVisualStudio(IObjectSpace os, CsharpCode value, cp project) : this() { this._codeObject = value; CreateEditor(); if (value != null) { if (value.Workspace != null) { this._workspace = (SmartIDEWorkspace)value.Workspace; } else { this._workspace = SmartIDEWorkspace.GetIDE(os, project); } this._document = value.Provider; } #region 预设置智能感知项目,如果是一个方法,就需要先看一下方法中可以用的智能感知条目列表 if (_document is IPartCodeProvider && _document != null) { var code = value?.Code + ""; IList <ICompletionData> list = new List <ICompletionData>(); _workspace.GetIntellisenseItems(_document, 0, true, code, null, list); } if (value == null) { Editor.IsEnabled = false; } #endregion #region 设置环境 if (value != null) { tabSolution.Visibility = value.ShowSolutionFiles ? DevExpress.XtraBars.Docking.DockVisibility.Visible : DevExpress.XtraBars.Docking.DockVisibility.Hidden; if (value.ShowSolutionFiles) { solutionTreeView.Nodes.Clear(); solutionTreeView.MouseClick += SolutionTreeView_MouseClick; var solution = solutionTreeView.Nodes.Add("Solution"); foreach (var item in _workspace.Workspace.CurrentSolution.Projects) { var projectNode = solution.Nodes.Add(item.Name, item.Name); projectNode.Tag = item; var references = projectNode.Nodes.Add("引用", "引用"); foreach (var refence in item.MetadataReferences) { references.Nodes.Add(refence.Display); } foreach (var doc in item.Documents.OrderBy(x => x.Name)) { var docNode = projectNode.Nodes.Add(doc.Name, doc.Name); docNode.Tag = doc; } } } if (value.Diagnostics != null && value.Diagnostics.Count > 0) { this.SetDiagnosticMessage(value.Diagnostics); } } #endregion }