Skip to content

Commit c01dd31

Browse files
committed
Simple editor app
Added a simple editor app for easy validation of the component.
1 parent d4f6041 commit c01dd31

File tree

3 files changed

+55
-1
lines changed

3 files changed

+55
-1
lines changed

Src/EditorApp/App.config

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,41 @@
33
<startup>
44
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
55
</startup>
6+
<runtime>
7+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
8+
<dependentAssembly>
9+
<assemblyIdentity name="Microsoft.VisualStudio.CoreUtility" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
10+
<bindingRedirect oldVersion="10.0.0.0-11.0.0.0" newVersion="14.0.0.0"/>
11+
</dependentAssembly>
12+
<dependentAssembly>
13+
<assemblyIdentity name="Microsoft.VisualStudio.Editor" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
14+
<bindingRedirect oldVersion="10.0.0.0-11.0.0.0" newVersion="14.0.0.0"/>
15+
</dependentAssembly>
16+
<dependentAssembly>
17+
<assemblyIdentity name="Microsoft.VisualStudio.Language.Intellisense" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
18+
<bindingRedirect oldVersion="10.0.0.0-11.0.0.0" newVersion="14.0.0.0"/>
19+
</dependentAssembly>
20+
<dependentAssembly>
21+
<assemblyIdentity name="Microsoft.VisualStudio.Language.StandardClassification" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
22+
<bindingRedirect oldVersion="10.0.0.0-11.0.0.0" newVersion="14.0.0.0"/>
23+
</dependentAssembly>
24+
<dependentAssembly>
25+
<assemblyIdentity name="Microsoft.VisualStudio.Text.Data" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
26+
<bindingRedirect oldVersion="10.0.0.0-11.0.0.0" newVersion="14.0.0.0"/>
27+
</dependentAssembly>
28+
<dependentAssembly>
29+
<assemblyIdentity name="Microsoft.VisualStudio.Text.Logic" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
30+
<bindingRedirect oldVersion="10.0.0.0-11.0.0.0" newVersion="14.0.0.0"/>
31+
</dependentAssembly>
32+
<dependentAssembly>
33+
<assemblyIdentity name="Microsoft.VisualStudio.Text.UI" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
34+
<bindingRedirect oldVersion="10.0.0.0-11.0.0.0" newVersion="14.0.0.0"/>
35+
</dependentAssembly>
36+
<dependentAssembly>
37+
<assemblyIdentity name="Microsoft.VisualStudio.Text.UI.Wpf" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
38+
<bindingRedirect oldVersion="10.0.0.0-11.0.0.0" newVersion="14.0.0.0"/>
39+
</dependentAssembly>
40+
</assemblyBinding>
41+
</runtime>
42+
643
</configuration>

Src/EditorApp/EditorApp.csproj

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@
9898
<ItemGroup>
9999
<None Include="App.config" />
100100
</ItemGroup>
101+
<ItemGroup>
102+
<ProjectReference Include="..\EditorUtils\EditorUtils.csproj">
103+
<Project>{fb418222-c105-4942-8eeb-832ddcffd89d}</Project>
104+
<Name>EditorUtils</Name>
105+
</ProjectReference>
106+
</ItemGroup>
101107
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
102108
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
103109
Other similar extension points exist, see Microsoft.Common.targets.
@@ -106,4 +112,4 @@
106112
<Target Name="AfterBuild">
107113
</Target>
108114
-->
109-
</Project>
115+
</Project>

Src/EditorApp/MainWindow.xaml.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using System.Windows.Media.Imaging;
1313
using System.Windows.Navigation;
1414
using System.Windows.Shapes;
15+
using EditorUtils;
1516

1617
namespace EditorApp
1718
{
@@ -23,6 +24,16 @@ public partial class MainWindow : Window
2324
public MainWindow()
2425
{
2526
InitializeComponent();
27+
28+
var editorHostFactory = new EditorHostFactory(EditorVersion.Vs2015);
29+
var editorHost = editorHostFactory.CreateEditorHost();
30+
31+
var textBuffer = editorHost.TextBufferFactoryService.CreateTextBuffer();
32+
textBuffer.Insert(0, "Hello Editor");
33+
34+
var wpfTextView = editorHost.TextEditorFactoryService.CreateTextView(textBuffer);
35+
var wpfTextViewHost = editorHost.TextEditorFactoryService.CreateTextViewHost(wpfTextView, setFocus: true);
36+
Content = wpfTextViewHost.HostControl;
2637
}
2738
}
2839
}

0 commit comments

Comments
 (0)