Skip to content

Commit

Permalink
Added WPF application.
Browse files Browse the repository at this point in the history
A WPF application called Ultimate Temperature Converter has been added to the solution to demonstrate the purpose and capabilities of the Ultimate Temperature library.
  • Loading branch information
KUTlime committed Jul 14, 2019
1 parent 0f24773 commit 5cd9425
Show file tree
Hide file tree
Showing 16 changed files with 1,067 additions and 0 deletions.
Binary file added Resources/thermometer.ico
Binary file not shown.
6 changes: 6 additions & 0 deletions Ultimate Temperature Library.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UltimateTemperatureLibrary"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UltimateTemperatureLibrary.UnitTests", "UltimateTemperatureLibrary.UnitTests\UltimateTemperatureLibrary.UnitTests.csproj", "{CA18515F-ED14-41F8-B23E-DD1F285AE5A4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UltimateTemperatureLibrary.WPF", "UltimateTemperatureLibrary.WPF\UltimateTemperatureLibrary.WPF.csproj", "{1C7A12D7-76BA-4F17-BAAE-20F04645A35F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -21,6 +23,10 @@ Global
{CA18515F-ED14-41F8-B23E-DD1F285AE5A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CA18515F-ED14-41F8-B23E-DD1F285AE5A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CA18515F-ED14-41F8-B23E-DD1F285AE5A4}.Release|Any CPU.Build.0 = Release|Any CPU
{1C7A12D7-76BA-4F17-BAAE-20F04645A35F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1C7A12D7-76BA-4F17-BAAE-20F04645A35F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1C7A12D7-76BA-4F17-BAAE-20F04645A35F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1C7A12D7-76BA-4F17-BAAE-20F04645A35F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
14 changes: 14 additions & 0 deletions UltimateTemperatureLibrary.WPF/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
9 changes: 9 additions & 0 deletions UltimateTemperatureLibrary.WPF/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Application x:Class="UltimateTemperatureConverter.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:UltimateTemperatureConverter"
StartupUri="MainWindow.xaml">
<Application.Resources>

</Application.Resources>
</Application>
11 changes: 11 additions & 0 deletions UltimateTemperatureLibrary.WPF/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System.Windows;

namespace UltimateTemperatureLibrary.WPF
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}
25 changes: 25 additions & 0 deletions UltimateTemperatureLibrary.WPF/Extensions/TextBoxExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.Reflection;
using System.Windows.Controls;

namespace UltimateTemperatureLibrary.WPF.Extensions
{
public static class TextBoxExt
{
private static readonly FieldInfo Field;
private static readonly PropertyInfo Prop;

static TextBoxExt()
{
Type type = typeof(Control);
Field = type.GetField("text", BindingFlags.Instance | BindingFlags.NonPublic);
Prop = type.GetProperty("WindowText", BindingFlags.Instance | BindingFlags.NonPublic);
}

public static void SetText(this TextBox box, string text)
{
Field.SetValue(box, text);
Prop.SetValue(box, text, null);
}
}
}
255 changes: 255 additions & 0 deletions UltimateTemperatureLibrary.WPF/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,255 @@
<Window
x:Class="UltimateTemperatureLibrary.WPF.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:UltimateTemperatureLibrary.WPF"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="Ultimate Temperature Converter"
Width="500"
Height="550"
MinWidth="500"
MinHeight="550"
MaxWidth="500"
MaxHeight="550"
mc:Ignorable="d"
>
<Grid
Margin="0,0,0,0"
>
<Grid.RowDefinitions>
<RowDefinition
Height="494*"
/>
<RowDefinition
Height="5*"
/>
<RowDefinition
Height="20*"
/>
</Grid.RowDefinitions>
<TextBlock
Margin="94,10,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
FontSize="20"
FontWeight="Bold"
Text="Ultimate Temperature Converter"
/>
<TextBlock
Grid.Row="0"
Height="21"
Margin="12,68,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
FontSize="16"
Text="Kelvin:"
TextWrapping="Wrap"
/>
<TextBox
Name="KelvinTextBox"
Grid.Row="0"
Width="300"
Height="23"
Margin="117,66,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
FontSize="16"
FontWeight="Bold"
MaxLines="1"
Text="273.15 K"
TextChanged="OnTextChanged"
TextWrapping="Wrap"
/>
<TextBlock
Grid.Row="0"
Height="21"
Margin="12,108,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
FontSize="16"
TextWrapping="Wrap"
><Run
Text="Celsius"
/><Run
Text=":"
/></TextBlock>
<TextBox
Name="CelsiusTextBox"
Grid.Row="0"
Width="300"
Height="23"
Margin="117,106,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
FontSize="16"
FontWeight="Bold"
LostFocus="OnLostFocus"
MaxLines="1"
TextChanged="OnTextChanged"
TextWrapping="Wrap"
/>
<TextBlock
Grid.Row="0"
Height="21"
Margin="12,148,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
FontSize="16"
Text="Fahrenheit:"
TextWrapping="Wrap"
/>
<TextBox
Name="FahrenheitTextBox"
Grid.Row="0"
Width="300"
Height="23"
Margin="117,146,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
FontSize="16"
FontWeight="Bold"
MaxLines="1"
TextChanged="OnTextChanged"
TextWrapping="Wrap"
/>
<TextBlock
Grid.Row="0"
Height="21"
Margin="12,188,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
FontSize="16"
Text="Rankine:"
TextWrapping="Wrap"
/>
<TextBox
Name="RankineTextBox"
Grid.Row="0"
Width="300"
Height="23"
Margin="117,186,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
FontSize="16"
FontWeight="Bold"
MaxLines="1"
TextChanged="OnTextChanged"
TextWrapping="Wrap"
/>
<TextBlock
Grid.Row="0"
Height="21"
Margin="12,227,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
FontSize="16"
Text="Delisle:"
TextWrapping="Wrap"
/>
<TextBox
Name="DelisleTextBox"
Grid.Row="0"
Width="300"
Height="23"
Margin="117,225,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
FontSize="16"
FontWeight="Bold"
MaxLines="1"
TextChanged="OnTextChanged"
TextWrapping="Wrap"
/>
<TextBlock
Grid.Row="0"
Height="21"
Margin="12,267,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
FontSize="16"
Text="Newton:"
TextWrapping="Wrap"
/>
<TextBox
Name="NewtonTextBox"
Grid.Row="0"
Width="300"
Height="23"
Margin="117,265,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
FontSize="16"
FontWeight="Bold"
MaxLines="1"
TextChanged="OnTextChanged"
TextWrapping="Wrap"
/>
<TextBlock
Grid.Row="0"
Height="21"
Margin="12,308,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
FontSize="16"
Text="Réaumur"
TextWrapping="Wrap"
/>
<TextBox
Name="RéaumurTextBox"
Grid.Row="0"
Width="300"
Height="23"
Margin="117,306,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
FontSize="16"
FontWeight="Bold"
MaxLines="1"
TextChanged="OnTextChanged"
TextWrapping="Wrap"
/>
<TextBlock
Grid.Row="0"
Height="21"
Margin="12,348,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
FontSize="16"
Text="Rømer"
TextWrapping="Wrap"
/>
<TextBox
Name="RømerTextBox"
Grid.Row="0"
Width="300"
Height="23"
Margin="117,346,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
FontSize="16"
FontWeight="Bold"
MaxLines="1"
TextChanged="OnTextChanged"
TextWrapping="Wrap"
/>
<TextBlock
Grid.Row="0"
Grid.RowSpan="3"
Width="300"
Height="30"
Margin="10,0,0,10"
HorizontalAlignment="Left"
VerticalAlignment="Bottom"
FontSize="16"
>
<Hyperlink
NavigateUri="https://github.com/KUTlime/Ultimate-Temperature-Library/"
RequestNavigate="Hyperlink_RequestNavigate"
>
Powered by Ultimate Temperature Library
</Hyperlink>
</TextBlock>

</Grid>
</Window>
Loading

0 comments on commit 5cd9425

Please sign in to comment.