Skip to content

Commit

Permalink
Fixed WPF sample icon and colour of console text.
Browse files Browse the repository at this point in the history
  • Loading branch information
dwmkerr committed Jan 14, 2015
1 parent a4a0e06 commit 9657f73
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 30 deletions.
2 changes: 1 addition & 1 deletion source/ConsoleControl.WPF/ConsoleControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</LinearGradientBrush>
</UserControl.Background>
<UserControl.FontSize>12</UserControl.FontSize>

<!-- The internal rich text box for the console. -->
<RichTextBox
x:Name="richTextBoxConsole" Foreground="White"
Expand Down
16 changes: 9 additions & 7 deletions source/ConsoleControl.WPF/ConsoleControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,15 @@ public void WriteOutput(string output, Color color)
return;

RunOnUIDespatcher(() =>
{
// Write the output.
richTextBoxConsole.Selection.Select(richTextBoxConsole.Document.ContentEnd, richTextBoxConsole.Document.ContentEnd);
richTextBoxConsole.Selection.ApplyPropertyValue(TextBlock.ForegroundProperty, new SolidColorBrush(color));
richTextBoxConsole.AppendText(output);
inputStartPos = richTextBoxConsole.Selection.Start.GetPositionAtOffset(0);
});
{
// Write the output.
var range = new TextRange(richTextBoxConsole.Document.ContentEnd, richTextBoxConsole.Document.ContentEnd);
range.Text = output;
range.ApplyPropertyValue(TextElement.ForegroundProperty, new SolidColorBrush(color));
// Record the new input start.
inputStartPos = richTextBoxConsole.Document.ContentEnd.GetPositionAtOffset(0);
});
}

/// <summary>
Expand Down
8 changes: 5 additions & 3 deletions source/ConsoleControl.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleControl", "ConsoleControl\ConsoleControl.csproj", "{737CC7F2-EC7C-4800-B7EB-72637E892C42}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleControlSample", "ConsoleControlSample\ConsoleControlSample.csproj", "{85D51BC3-E7F2-4C63-80B4-D16BE768707E}"
Expand Down Expand Up @@ -87,10 +89,10 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{737CC7F2-EC7C-4800-B7EB-72637E892C42} = {75F316A9-2D1A-4788-B37B-8671FA2F17ED}
{85D51BC3-E7F2-4C63-80B4-D16BE768707E} = {88DD7B77-D58C-4AF8-B21B-A2FE9B3C74C2}
{A4B8573F-EBFC-4140-B8AA-7C037919EF57} = {75F316A9-2D1A-4788-B37B-8671FA2F17ED}
{FD9FF553-D7C6-45A8-8321-5D9058B38E2D} = {75F316A9-2D1A-4788-B37B-8671FA2F17ED}
{737CC7F2-EC7C-4800-B7EB-72637E892C42} = {75F316A9-2D1A-4788-B37B-8671FA2F17ED}
{4FA35552-432C-4AEF-8B5B-05883D11F098} = {88DD7B77-D58C-4AF8-B21B-A2FE9B3C74C2}
{85D51BC3-E7F2-4C63-80B4-D16BE768707E} = {88DD7B77-D58C-4AF8-B21B-A2FE9B3C74C2}
EndGlobalSection
EndGlobal
Binary file added source/ConsoleControlSample.WPF/Console.ico
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@
<Resource Include="Resources\Play.png" />
<Resource Include="Resources\Stop.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Console.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
5 changes: 3 additions & 2 deletions source/ConsoleControlSample.WPF/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xmlns:consoleControl="clr-namespace:ConsoleControl.WPF;assembly=ConsoleControl.WPF"
xmlns:local="clr-namespace:ConsoleControlSample.WPF"
xmlns:apexConverters="clr-namespace:Apex.Converters;assembly=Apex"
Title="Console Control WPF Sample" Height="400" Width="600">
Title="Console Control WPF Sample" Height="600" Width="800" Icon="Console.ico">

<!-- The view model. -->
<Window.DataContext>
Expand Down Expand Up @@ -71,7 +71,8 @@
</TextBlock>
</StatusBar>
<consoleControl:ConsoleControl
x:Name="consoleControl" />
x:Name="consoleControl"
FontSize="14" />
</DockPanel>
</Grid>
</Window>
34 changes: 17 additions & 17 deletions source/ConsoleControlSample/FormConsoleControlSample.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9657f73

Please sign in to comment.