Skip to content

Commit 9657f73

Browse files
committed
Fixed WPF sample icon and colour of console text.
1 parent a4a0e06 commit 9657f73

File tree

7 files changed

+38
-30
lines changed

7 files changed

+38
-30
lines changed

source/ConsoleControl.WPF/ConsoleControl.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</LinearGradientBrush>
1717
</UserControl.Background>
1818
<UserControl.FontSize>12</UserControl.FontSize>
19-
19+
2020
<!-- The internal rich text box for the console. -->
2121
<RichTextBox
2222
x:Name="richTextBoxConsole" Foreground="White"

source/ConsoleControl.WPF/ConsoleControl.xaml.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,15 @@ public void WriteOutput(string output, Color color)
141141
return;
142142

143143
RunOnUIDespatcher(() =>
144-
{
145-
// Write the output.
146-
richTextBoxConsole.Selection.Select(richTextBoxConsole.Document.ContentEnd, richTextBoxConsole.Document.ContentEnd);
147-
richTextBoxConsole.Selection.ApplyPropertyValue(TextBlock.ForegroundProperty, new SolidColorBrush(color));
148-
richTextBoxConsole.AppendText(output);
149-
inputStartPos = richTextBoxConsole.Selection.Start.GetPositionAtOffset(0);
150-
});
144+
{
145+
// Write the output.
146+
var range = new TextRange(richTextBoxConsole.Document.ContentEnd, richTextBoxConsole.Document.ContentEnd);
147+
range.Text = output;
148+
range.ApplyPropertyValue(TextElement.ForegroundProperty, new SolidColorBrush(color));
149+
150+
// Record the new input start.
151+
inputStartPos = richTextBoxConsole.Document.ContentEnd.GetPositionAtOffset(0);
152+
});
151153
}
152154

153155
/// <summary>

source/ConsoleControl.sln

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 2012
3+
# Visual Studio 2013
4+
VisualStudioVersion = 12.0.31101.0
5+
MinimumVisualStudioVersion = 10.0.40219.1
46
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleControl", "ConsoleControl\ConsoleControl.csproj", "{737CC7F2-EC7C-4800-B7EB-72637E892C42}"
57
EndProject
68
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleControlSample", "ConsoleControlSample\ConsoleControlSample.csproj", "{85D51BC3-E7F2-4C63-80B4-D16BE768707E}"
@@ -87,10 +89,10 @@ Global
8789
HideSolutionNode = FALSE
8890
EndGlobalSection
8991
GlobalSection(NestedProjects) = preSolution
92+
{737CC7F2-EC7C-4800-B7EB-72637E892C42} = {75F316A9-2D1A-4788-B37B-8671FA2F17ED}
93+
{85D51BC3-E7F2-4C63-80B4-D16BE768707E} = {88DD7B77-D58C-4AF8-B21B-A2FE9B3C74C2}
9094
{A4B8573F-EBFC-4140-B8AA-7C037919EF57} = {75F316A9-2D1A-4788-B37B-8671FA2F17ED}
9195
{FD9FF553-D7C6-45A8-8321-5D9058B38E2D} = {75F316A9-2D1A-4788-B37B-8671FA2F17ED}
92-
{737CC7F2-EC7C-4800-B7EB-72637E892C42} = {75F316A9-2D1A-4788-B37B-8671FA2F17ED}
9396
{4FA35552-432C-4AEF-8B5B-05883D11F098} = {88DD7B77-D58C-4AF8-B21B-A2FE9B3C74C2}
94-
{85D51BC3-E7F2-4C63-80B4-D16BE768707E} = {88DD7B77-D58C-4AF8-B21B-A2FE9B3C74C2}
9597
EndGlobalSection
9698
EndGlobal
31.8 KB
Binary file not shown.

source/ConsoleControlSample.WPF/ConsoleControlSample.WPF.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@
115115
<Resource Include="Resources\Play.png" />
116116
<Resource Include="Resources\Stop.png" />
117117
</ItemGroup>
118+
<ItemGroup>
119+
<Resource Include="Console.ico" />
120+
</ItemGroup>
118121
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
119122
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
120123
Other similar extension points exist, see Microsoft.Common.targets.

source/ConsoleControlSample.WPF/MainWindow.xaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
xmlns:consoleControl="clr-namespace:ConsoleControl.WPF;assembly=ConsoleControl.WPF"
55
xmlns:local="clr-namespace:ConsoleControlSample.WPF"
66
xmlns:apexConverters="clr-namespace:Apex.Converters;assembly=Apex"
7-
Title="Console Control WPF Sample" Height="400" Width="600">
7+
Title="Console Control WPF Sample" Height="600" Width="800" Icon="Console.ico">
88

99
<!-- The view model. -->
1010
<Window.DataContext>
@@ -71,7 +71,8 @@
7171
</TextBlock>
7272
</StatusBar>
7373
<consoleControl:ConsoleControl
74-
x:Name="consoleControl" />
74+
x:Name="consoleControl"
75+
FontSize="14" />
7576
</DockPanel>
7677
</Grid>
7778
</Window>

source/ConsoleControlSample/FormConsoleControlSample.Designer.cs

Lines changed: 17 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)