Added source code.
This commit is contained in:
BIN
Source/Calculator/ASTRONAU.TTF
Normal file
BIN
Source/Calculator/ASTRONAU.TTF
Normal file
Binary file not shown.
8
Source/Calculator/App.xaml
Normal file
8
Source/Calculator/App.xaml
Normal file
@ -0,0 +1,8 @@
|
||||
<Application x:Class="Calculator.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
17
Source/Calculator/App.xaml.cs
Normal file
17
Source/Calculator/App.xaml.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
|
||||
namespace Calculator
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
|
||||
}
|
||||
}
|
144
Source/Calculator/Calculator.csproj
Normal file
144
Source/Calculator/Calculator.csproj
Normal file
@ -0,0 +1,144 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{D0040DA8-5B61-4B40-AF35-1320C1CC7121}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Calculator</RootNamespace>
|
||||
<AssemblyName>Calculator</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>calculator-logo.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<NoWin32Manifest>true</NoWin32Manifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release %28Publish%29|x86'">
|
||||
<OutputPath>bin\x86\Release %28Publish%29\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release - Publish|x86'">
|
||||
<OutputPath>..\..\TibisMathematicsSuite - Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
|
||||
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MainWindow.xaml.cs">
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Page Include="Styles\Buttons.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Styles\Display.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MathHelper.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<Resource Include="ASTRONAU.TTF" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<AppDesigner Include="Properties\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Launcher\DynamicLink.csproj">
|
||||
<Project>{A04B247B-6A95-462B-9E07-3337A1C158F1}</Project>
|
||||
<Name>DynamicLink</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Images\calculator-logo.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="calculator-logo.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.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
BIN
Source/Calculator/Images/calculator-logo.png
Normal file
BIN
Source/Calculator/Images/calculator-logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.3 KiB |
298
Source/Calculator/MainWindow.xaml
Normal file
298
Source/Calculator/MainWindow.xaml
Normal file
@ -0,0 +1,298 @@
|
||||
<Window x:Class="Calculator.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="Calculator" Height="330" Width="555"
|
||||
MinHeight="290" MinWidth="455"
|
||||
MaxHeight="360" MaxWidth="700"
|
||||
WindowStyle="SingleBorderWindow" KeyDown="Window_KeyDown"
|
||||
Icon="/Calculator;component/Images/calculator-logo.png">
|
||||
|
||||
<Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary>
|
||||
<Style x:Key="Calc2ndF" TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Margin" Value="0,2,0,0" />
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
<Setter Property="Foreground" Value="Gray" />
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
|
||||
<ResourceDictionary Source="Styles\Buttons.xaml" />
|
||||
<ResourceDictionary Source="Styles\Display.xaml" />
|
||||
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
|
||||
<Window.Background>
|
||||
<RadialGradientBrush GradientOrigin=".5, 1"
|
||||
Center=".5, .6">
|
||||
<GradientStop Color="#606060" Offset="0" />
|
||||
<GradientStop Color="#333" Offset="1" />
|
||||
</RadialGradientBrush>
|
||||
</Window.Background>
|
||||
|
||||
<Grid Margin="2">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Tag="Input" Height="Auto" />
|
||||
<RowDefinition Tag="Mods" Height="Auto" />
|
||||
<RowDefinition Tag="Secondf" Height="Auto" />
|
||||
<RowDefinition Tag="Buttons" />
|
||||
<RowDefinition Tag="Secondf" Height="Auto" />
|
||||
<RowDefinition Tag="Buttons" />
|
||||
<RowDefinition Tag="Secondf" Height="Auto" />
|
||||
<RowDefinition Tag="Buttons" />
|
||||
<RowDefinition Tag="Secondf" Height="Auto" />
|
||||
<RowDefinition Tag="Buttons" />
|
||||
<RowDefinition Tag="Secondf" Height="Auto" />
|
||||
<RowDefinition Tag="Buttons" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="10" Tag="Separator"/>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- Menu strip -->
|
||||
<!-- Display -->
|
||||
<TextBox Name="Display" Grid.Column="0"
|
||||
Grid.ColumnSpan="100"
|
||||
Height="44" Text="0"
|
||||
Focusable="False"
|
||||
Style="{StaticResource DisplayStyle}" />
|
||||
|
||||
<StackPanel HorizontalAlignment="Left" Width="30"
|
||||
Margin="2">
|
||||
<Border Style="{StaticResource DisplayIndicatorStyle}" Margin="1"
|
||||
Name="Indicator2ndf">
|
||||
<TextBlock HorizontalAlignment="Center" Foreground="#555" FontSize="9">2ndf</TextBlock>
|
||||
</Border>
|
||||
<Border Style="{StaticResource DisplayIndicatorStyle}" Margin="1,0,1,1"
|
||||
Name="IndicatorMem">
|
||||
<TextBlock HorizontalAlignment="Center" Foreground="#555" FontSize="9">Mem</TextBlock>
|
||||
</Border>
|
||||
<Border Style="{StaticResource DisplayIndicatorStyle}" Margin="1,0,1,1"
|
||||
Name="IndicatorError">
|
||||
<TextBlock HorizontalAlignment="Center" Foreground="#555" FontSize="9">Error</TextBlock>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Column 1 (scientific) functionality -->
|
||||
<Button Name="B2ndf" MouseUp="Button_MouseUp" Click="Button_Click"
|
||||
Grid.Row="3" Grid.Column="0"
|
||||
ToolTip="Activates second function.">2ndf
|
||||
</Button>
|
||||
|
||||
<TextBlock Grid.Row="4" Grid.Column="0"
|
||||
Style="{StaticResource Calc2ndF}">{x}</TextBlock>
|
||||
<Button Name="BInt" MouseUp="Button_MouseUp" Click="Button_Click"
|
||||
Grid.Row="5" Grid.Column="0"
|
||||
ToolTip="Integral portion
2ndf: Fractional portion">[x]</Button>
|
||||
|
||||
<TextBlock Grid.Row="6" Grid.Column="0"
|
||||
Style="{StaticResource Calc2ndF}">arcsin</TextBlock>
|
||||
<Button Name="BSin" MouseUp="Button_MouseUp" Click="Button_Click"
|
||||
Grid.Row="7" Grid.Column="0"
|
||||
ToolTip="Sine
2ndf: arcsin">sin</Button>
|
||||
|
||||
<TextBlock Grid.Row="8" Grid.Column="0"
|
||||
Style="{StaticResource Calc2ndF}">arcsinh</TextBlock>
|
||||
<Button Name="BSinh" MouseUp="Button_MouseUp" Click="Button_Click"
|
||||
Grid.Row="9" Grid.Column="0"
|
||||
ToolTip="Hyperbolic sine
2ndf: Hyperbolic arcsin">sinh</Button>
|
||||
|
||||
<TextBlock Grid.Row="10" Grid.Column="0"
|
||||
Style="{StaticResource Calc2ndF}">2π</TextBlock>
|
||||
<Button Name="BPi" MouseUp="Button_MouseUp" Click="Button_Click"
|
||||
Grid.Row="11" Grid.Column="0"
|
||||
ToolTip="Pi constant
2ndf: 2Pi constant">π</Button>
|
||||
|
||||
|
||||
<!-- Column 2 (scientific) functionality -->
|
||||
<TextBlock Grid.Row="2" Grid.Column="1"
|
||||
Style="{StaticResource Calc2ndF}">eⁿ</TextBlock>
|
||||
<Button Name="BLn" MouseUp="Button_MouseUp" Click="Button_Click"
|
||||
Grid.Row="3" Grid.Column="1"
|
||||
ToolTip="Natural logarithm
2ndf: e at nth power">ln</Button>
|
||||
|
||||
<TextBlock Grid.Row="4" Grid.Column="1"
|
||||
Style="{StaticResource Calc2ndF}">-Abs</TextBlock>
|
||||
<Button Name="BAbs" MouseUp="Button_MouseUp" Click="Button_Click"
|
||||
Grid.Row="5" Grid.Column="1"
|
||||
ToolTip="Absolute
2ndf: Reverse absolute">Abs</Button>
|
||||
|
||||
<TextBlock Grid.Row="6" Grid.Column="1"
|
||||
Style="{StaticResource Calc2ndF}">arccos</TextBlock>
|
||||
<Button Name="BCos" MouseUp="Button_MouseUp" Click="Button_Click"
|
||||
Grid.Row="7" Grid.Column="1"
|
||||
ToolTip="Cosine
2ndf: arccos">cos</Button>
|
||||
|
||||
<TextBlock Grid.Row="8" Grid.Column="1"
|
||||
Style="{StaticResource Calc2ndF}">arccosh</TextBlock>
|
||||
<Button Name="BCosh" MouseUp="Button_MouseUp" Click="Button_Click"
|
||||
Grid.Row="9" Grid.Column="1"
|
||||
ToolTip="Hyperbolic cosine
2ndf: Hyperbolic arccos">cosh</Button>
|
||||
|
||||
<Button Name="BE" MouseUp="Button_MouseUp" Click="Button_Click"
|
||||
Grid.Row="11" Grid.Column="1"
|
||||
ToolTip="e constant">e</Button>
|
||||
|
||||
|
||||
<!-- Column 3 (scientific) functionality -->
|
||||
<TextBlock Grid.Row="2" Grid.Column="2"
|
||||
Style="{StaticResource Calc2ndF}">10ⁿ</TextBlock>
|
||||
<Button Name="BLog" MouseUp="Button_MouseUp" Click="Button_Click"
|
||||
Grid.Row="3" Grid.Column="2"
|
||||
ToolTip="Decimal logarithm
2ndf: 10 at nth power">log</Button>
|
||||
|
||||
<Button Name="BInverse" MouseUp="Button_MouseUp" Click="Button_Click"
|
||||
Grid.Row="5" Grid.Column="2"
|
||||
ToolTip="Inverse">1/x</Button>
|
||||
|
||||
<TextBlock Grid.Row="6" Grid.Column="2"
|
||||
Style="{StaticResource Calc2ndF}">arctan</TextBlock>
|
||||
<Button Name="BTan" MouseUp="Button_MouseUp" Click="Button_Click"
|
||||
Grid.Row="7" Grid.Column="2"
|
||||
ToolTip="Tangent
2ndf: arctan">tan</Button>
|
||||
|
||||
<TextBlock Grid.Row="8" Grid.Column="2"
|
||||
Style="{StaticResource Calc2ndF}">arctanh</TextBlock>
|
||||
<Button Name="BTanh" MouseUp="Button_MouseUp" Click="Button_Click"
|
||||
Grid.Row="9" Grid.Column="2"
|
||||
ToolTip="Hyperbolic tangent
2ndf: Hyperbolic arctan">tanh</Button>
|
||||
|
||||
<TextBlock Grid.Row="10" Grid.Column="2"
|
||||
Style="{StaticResource Calc2ndF}">xPy</TextBlock>
|
||||
<Button Name="BCombinations" MouseUp="Button_MouseUp" Click="Button_Click"
|
||||
Grid.Row="11" Grid.Column="2"
|
||||
ToolTip="Combinations of y items from x
2ndf: Permutations of y items from x">xCy</Button>
|
||||
|
||||
|
||||
<!-- Column 4 (scientific) functionality -->
|
||||
<Button Name="BLogn" MouseUp="Button_MouseUp" Click="Button_Click"
|
||||
Grid.Row="3" Grid.Column="3"
|
||||
ToolTip="Logarithm with base n">
|
||||
<TextBlock>log<Run BaselineAlignment="Subscript">n</Run> x</TextBlock>
|
||||
</Button>
|
||||
|
||||
<TextBlock Grid.Row="4" Grid.Column="3"
|
||||
Style="{StaticResource Calc2ndF}">ⁿ√x</TextBlock>
|
||||
<Button Name="BPown" MouseUp="Button_MouseUp" Click="Button_Click"
|
||||
Grid.Row="5" Grid.Column="3"
|
||||
ToolTip="nth power
2ndf: nth root">xⁿ</Button>
|
||||
|
||||
<TextBlock Grid.Row="6" Grid.Column="3"
|
||||
Style="{StaticResource Calc2ndF}">√x</TextBlock>
|
||||
<Button Name="BSquare" MouseUp="Button_MouseUp" Click="Button_Click"
|
||||
Grid.Row="7" Grid.Column="3"
|
||||
ToolTip="Square
2ndf: Square root">x²</Button>
|
||||
|
||||
<TextBlock Grid.Row="8" Grid.Column="3"
|
||||
Style="{StaticResource Calc2ndF}">∛x</TextBlock>
|
||||
<Button Name="BCube" MouseUp="Button_MouseUp" Click="Button_Click"
|
||||
Grid.Row="9" Grid.Column="3"
|
||||
ToolTip="Cube
2ndf: Cube root">x³</Button>
|
||||
|
||||
<Button Name="BFact" MouseUp="Button_MouseUp" Click="Button_Click"
|
||||
Grid.Row="11" Grid.Column="3"
|
||||
ToolTip="Factorial">x!</Button>
|
||||
|
||||
|
||||
<!-- Column 5 (Memory ops) -->
|
||||
<TextBlock Grid.Row="2" Grid.Column="5" Style="{StaticResource Calc2ndF}">Add</TextBlock>
|
||||
<Button Name="BMemAdd" MouseUp="Button_MouseUp" Click="Button_Click"
|
||||
Grid.Row="3" Grid.Column="5"
|
||||
ToolTip="Adds to memory">M+</Button>
|
||||
|
||||
<TextBlock Grid.Row="4" Grid.Column="5" Style="{StaticResource Calc2ndF}">Subtract</TextBlock>
|
||||
<Button Name="BMemSub" MouseUp="Button_MouseUp" Click="Button_Click"
|
||||
Grid.Row="5" Grid.Column="5"
|
||||
ToolTip="Subtracts from memory">M-</Button>
|
||||
|
||||
<TextBlock Grid.Row="6" Grid.Column="5" Style="{StaticResource Calc2ndF}">Clear</TextBlock>
|
||||
<Button Name="BMemClear" MouseUp="Button_MouseUp" Click="Button_Click"
|
||||
Grid.Row="7" Grid.Column="5"
|
||||
ToolTip="Clears the memory">MC</Button>
|
||||
|
||||
<TextBlock Grid.Row="8" Grid.Column="5" Style="{StaticResource Calc2ndF}">Set</TextBlock>
|
||||
<Button Name="BMemSet" MouseUp="Button_MouseUp" Click="Button_Click"
|
||||
Grid.Row="9" Grid.Column="5"
|
||||
ToolTip="Replace the memory content">MS</Button>
|
||||
|
||||
<TextBlock Grid.Row="10" Grid.Column="5" Style="{StaticResource Calc2ndF}">Recall</TextBlock>
|
||||
<Button Name="BMemRecall" MouseUp="Button_MouseUp" Click="Button_Click"
|
||||
Grid.Row="11" Grid.Column="5"
|
||||
ToolTip="Displays number from memory">MR</Button>
|
||||
|
||||
|
||||
<!-- Column 6 (Numbers) -->
|
||||
<Button Name="BNum7" MouseUp="Button_MouseUp" Click="Button_Click"
|
||||
Grid.Row="4" Grid.Column="6" Grid.RowSpan="2"
|
||||
Style="{StaticResource BigButton}">7</Button>
|
||||
<Button Name="BNum4" MouseUp="Button_MouseUp" Click="Button_Click"
|
||||
Grid.Row="6" Grid.Column="6" Grid.RowSpan="2"
|
||||
Style="{StaticResource BigButton}">4</Button>
|
||||
<Button Name="BNum1" MouseUp="Button_MouseUp" Click="Button_Click"
|
||||
Grid.Row="8" Grid.Column="6" Grid.RowSpan="2"
|
||||
Style="{StaticResource BigButton}">1</Button>
|
||||
<Button Name="BNum0" MouseUp="Button_MouseUp" Click="Button_Click"
|
||||
Grid.Row="10" Grid.Column="6" Grid.RowSpan="2" Grid.ColumnSpan="2"
|
||||
Style="{StaticResource BigButton}">0</Button>
|
||||
|
||||
<!-- Column 7 (Numbers) -->
|
||||
<Button Name="BHelp" Grid.Row="3" Grid.Column="7"
|
||||
Margin="6,4,6,4"
|
||||
Style="{StaticResource BigButton}"
|
||||
FontSize="11" Click="BHelp_Click"
|
||||
ToolTip="Get help using the application. (Keyboard shortcut: F1)">Help</Button>
|
||||
|
||||
<Button Name="BNum8" MouseUp="Button_MouseUp" Click="Button_Click"
|
||||
Grid.Row="4" Grid.Column="7" Grid.RowSpan="2"
|
||||
Style="{StaticResource BigButton}">8</Button>
|
||||
<Button Name="BNum5" MouseUp="Button_MouseUp" Click="Button_Click"
|
||||
Grid.Row="6" Grid.Column="7" Grid.RowSpan="2"
|
||||
Style="{StaticResource BigButton}">5</Button>
|
||||
<Button Name="BNum2" MouseUp="Button_MouseUp" Click="Button_Click"
|
||||
Grid.Row="8" Grid.Column="7" Grid.RowSpan="2"
|
||||
Style="{StaticResource BigButton}">2</Button>
|
||||
|
||||
<!-- Column 8 (Numbers) -->
|
||||
<Button Name="BBackspace" MouseUp="Button_MouseUp" Click="Button_Click"
|
||||
Grid.Row="3" Grid.Column="8"
|
||||
ToolTip="Backspace" >Back</Button>
|
||||
<Button Name="BNum9" MouseUp="Button_MouseUp" Click="Button_Click" Grid.Row="4" Grid.RowSpan="2" Grid.Column="8" Style="{StaticResource BigButton}">9</Button>
|
||||
<Button Name="BNum6" MouseUp="Button_MouseUp" Click="Button_Click" Grid.Row="6" Grid.RowSpan="2" Grid.Column="8" Style="{StaticResource BigButton}">6</Button>
|
||||
<Button Name="BNum3" MouseUp="Button_MouseUp" Click="Button_Click" Grid.Row="8" Grid.RowSpan="2" Grid.Column="8" Style="{StaticResource BigButton}">3</Button>
|
||||
<Button Name="BPeriod" MouseUp="Button_MouseUp" Click="Button_Click" Grid.Row="10" Grid.RowSpan="2" Grid.Column="8" Style="{StaticResource BigButton}">.</Button>
|
||||
|
||||
<!-- Column 9 (Operations) -->
|
||||
<Button Name="BClear" MouseUp="Button_MouseUp" Click="Button_Click"
|
||||
Grid.Row="3" Grid.Column="9"
|
||||
ToolTip="Clears the current number">Clear</Button>
|
||||
|
||||
<Button Name="BOpDivide" MouseUp="Button_MouseUp" Click="Button_Click" Grid.Row="4" Grid.RowSpan="2" Grid.Column="9" Style="{StaticResource BigButton}">/</Button>
|
||||
<Button Name="BOpMultiply" MouseUp="Button_MouseUp" Click="Button_Click" Grid.Row="6" Grid.RowSpan="2" Grid.Column="9" Style="{StaticResource BigButton}">*</Button>
|
||||
<Button Name="BOpSub" MouseUp="Button_MouseUp" Click="Button_Click" Grid.Row="8" Grid.RowSpan="2" Grid.Column="9" Style="{StaticResource BigButton}">-</Button>
|
||||
<Button Name="BOpAdd" MouseUp="Button_MouseUp" Click="Button_Click" Grid.Row="10" Grid.RowSpan="2" Grid.Column="9" Style="{StaticResource BigButton}">+</Button>
|
||||
|
||||
<!-- Column 10 (Operations) -->
|
||||
<Button Name="BClearAC" MouseUp="Button_MouseUp" Click="Button_Click"
|
||||
Grid.Row="3" Grid.Column="10"
|
||||
ToolTip="Clears the entire calculation">AC</Button>
|
||||
|
||||
<Button Name="BOpMod" MouseUp="Button_MouseUp" Click="Button_Click" Grid.Row="4" Grid.RowSpan="2" Grid.Column="10" Style="{StaticResource BigButton}">MOD</Button>
|
||||
<Button Name="BOpSign" MouseUp="Button_MouseUp" Click="Button_Click" Grid.Row="6" Grid.RowSpan="2" Grid.Column="10" Style="{StaticResource BigButton}">±</Button>
|
||||
<Button Name="BEqual" MouseUp="Button_MouseUp" Click="Button_Click" Grid.Row="8" Grid.Column="10" Grid.RowSpan="4" Style="{StaticResource BigButton}">=</Button>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
378
Source/Calculator/MainWindow.xaml.cs
Normal file
378
Source/Calculator/MainWindow.xaml.cs
Normal file
@ -0,0 +1,378 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace Calculator
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
enum Operator
|
||||
{
|
||||
None, Sum, Subtraction, Multiplication, Division, Mod, Logn, Pown, NRoot, Combinations, Arrangements
|
||||
};
|
||||
|
||||
enum Stages
|
||||
{
|
||||
First, FirstDisplay, Second
|
||||
};
|
||||
|
||||
#region Variables
|
||||
double memory = 0;
|
||||
bool is2ndOn = false, error = false;
|
||||
double first = 0, second = 0;
|
||||
Stages stage = Stages.First;
|
||||
Operator oper = Operator.None;
|
||||
|
||||
Brush IndicatorColor = (Brushes.Orange);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
public bool Is2ndOn
|
||||
{
|
||||
get { return is2ndOn; }
|
||||
set
|
||||
{
|
||||
is2ndOn = value;
|
||||
Indicator2ndf.Background = (value) ? (IndicatorColor) : (Brushes.Transparent);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Error
|
||||
{
|
||||
get { return error; }
|
||||
set
|
||||
{
|
||||
error = value;
|
||||
IndicatorError.Background = (value) ? (IndicatorColor) : (Brushes.Transparent);
|
||||
}
|
||||
}
|
||||
|
||||
public double DisplayValue
|
||||
{
|
||||
set { Display.Text = value.ToString(); }
|
||||
get
|
||||
{
|
||||
double val;
|
||||
string temp = Display.Text;
|
||||
|
||||
if (temp.EndsWith(".") || temp.Length == 0) temp += '0';
|
||||
if (!Double.TryParse(temp, out val))
|
||||
{
|
||||
Error = true;
|
||||
val = 0;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
}
|
||||
|
||||
public string DisplayText
|
||||
{
|
||||
get { return Display.Text; }
|
||||
set { Display.Text = value; }
|
||||
}
|
||||
|
||||
public double Memory
|
||||
{
|
||||
get { return memory; }
|
||||
set
|
||||
{
|
||||
memory = value;
|
||||
IndicatorMem.Background = (value != 0) ? (IndicatorColor) : (Brushes.Transparent);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Calculator logics
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
void BinaryOperatorPressed(bool isEqual = false)
|
||||
{
|
||||
if (stage == Stages.First)
|
||||
{
|
||||
first = DisplayValue; stage = Stages.FirstDisplay;
|
||||
}
|
||||
|
||||
else if (stage == Stages.Second)
|
||||
{
|
||||
second = DisplayValue;
|
||||
DisplayValue = Calculate();
|
||||
|
||||
if (isEqual) stage = Stages.First;
|
||||
else
|
||||
{
|
||||
first = DisplayValue;
|
||||
stage = Stages.FirstDisplay;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double Calculate()
|
||||
{
|
||||
switch (oper)
|
||||
{
|
||||
case Operator.Sum: return first + second;
|
||||
case Operator.Subtraction: return first - second;
|
||||
case Operator.Multiplication: return first * second;
|
||||
case Operator.Division: return first / second;
|
||||
case Operator.Mod: return first % second;
|
||||
case Operator.Logn: return Math.Log(first, second);
|
||||
case Operator.Pown: return Math.Pow(first, second);
|
||||
case Operator.NRoot: return Math.Pow(first, 1.0 / second);
|
||||
case Operator.Combinations: return MathHelper.Combinations(first, second);
|
||||
case Operator.Arrangements: return MathHelper.Arrangements(first, second);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AddDigit(char digit)
|
||||
{
|
||||
if (stage == Stages.FirstDisplay) { DisplayText = ""; stage = Stages.Second; }
|
||||
DisplayText += digit;
|
||||
}
|
||||
|
||||
void SetValue(double value)
|
||||
{
|
||||
if (stage == Stages.FirstDisplay) stage = Stages.Second;
|
||||
DisplayValue = value;
|
||||
}
|
||||
|
||||
private void Handle_Click(object sender, bool is2nd)
|
||||
{
|
||||
var s = sender as Button;
|
||||
if (s == null) return;
|
||||
|
||||
is2nd = is2nd || Is2ndOn;
|
||||
if (s.Name != "B2ndf") Is2ndOn = false;
|
||||
double val = DisplayValue;
|
||||
|
||||
if (DisplayText == "0") DisplayText = "";
|
||||
|
||||
switch (s.Name)
|
||||
{
|
||||
// Column 1
|
||||
case "B2ndf": Is2ndOn = !Is2ndOn; break;
|
||||
case "BInt":
|
||||
if (!is2nd) SetValue(Math.Floor(val));
|
||||
else SetValue(val - Math.Floor(val));
|
||||
break;
|
||||
case "BSin":
|
||||
if (!is2nd) SetValue(Math.Sin(val));
|
||||
else SetValue(Math.Asin(val));
|
||||
break;
|
||||
case "BSinh":
|
||||
if (!is2nd) SetValue(Math.Sinh(val));
|
||||
else SetValue(Math.Log(val + Math.Sqrt(val * val + 1)));
|
||||
break;
|
||||
case "BPi":
|
||||
if (!is2nd) SetValue(Math.PI);
|
||||
else SetValue(2 * Math.PI);
|
||||
break;
|
||||
|
||||
// Column 2
|
||||
case "BLn":
|
||||
if (!is2nd) SetValue(Math.Log(val));
|
||||
else SetValue(Math.Exp(val));
|
||||
break;
|
||||
case "BAbs":
|
||||
if (!is2nd) SetValue(Math.Abs(val));
|
||||
else SetValue(-Math.Abs(val));
|
||||
break;
|
||||
case "BCos":
|
||||
if (!is2nd) SetValue(Math.Cos(val));
|
||||
else SetValue(Math.Acos(val));
|
||||
break;
|
||||
case "BCosh":
|
||||
if (!is2nd) SetValue(Math.Cosh(val));
|
||||
else SetValue(Math.Log(val + Math.Sqrt(val * val - 1)));
|
||||
break;
|
||||
case "BE": SetValue(Math.E); break;
|
||||
|
||||
// Column 3
|
||||
case "BLog":
|
||||
if (!is2nd) SetValue(Math.Log10(val));
|
||||
else SetValue(Math.Pow(10, val));
|
||||
break;
|
||||
case "BInverse": SetValue(1 / val);
|
||||
break;
|
||||
case "BTan":
|
||||
if (!is2nd) SetValue(Math.Tan(val));
|
||||
else SetValue(Math.Atan(val));
|
||||
break;
|
||||
case "BTanh":
|
||||
if (!is2nd) SetValue(Math.Tanh(val));
|
||||
else SetValue(Math.Log((1+val) * (1-val))/2);
|
||||
break;
|
||||
case "BCombinations":
|
||||
if (!is2nd) oper = Operator.Combinations;
|
||||
else oper = Operator.Arrangements;
|
||||
BinaryOperatorPressed();
|
||||
break;
|
||||
|
||||
// Column 4
|
||||
case "BLogn":
|
||||
oper = Operator.Logn;
|
||||
BinaryOperatorPressed();
|
||||
break;
|
||||
case "BPown":
|
||||
if (!is2nd) oper = Operator.Pown;
|
||||
else oper = Operator.NRoot;
|
||||
BinaryOperatorPressed();
|
||||
break;
|
||||
case "BSquare":
|
||||
if (!is2nd) SetValue(val * val);
|
||||
else SetValue(Math.Pow(val, 1.0 / 2.0));
|
||||
break;
|
||||
case "BCube":
|
||||
if (!is2nd) SetValue(val * val * val);
|
||||
else SetValue(Math.Pow(val, 1.0 / 3.0));
|
||||
break;
|
||||
case "BFact":
|
||||
SetValue(MathHelper.Factorial(val));
|
||||
break;
|
||||
|
||||
// Memory operations
|
||||
case "BMemAdd": Memory += val; break;
|
||||
case "BMemSub": Memory -= val; break;
|
||||
case "BMemClear": Memory = 0; break;
|
||||
case "BMemSet": Memory = val; break;
|
||||
case "BMemRecall": SetValue(Memory); break;
|
||||
|
||||
// Numbers
|
||||
case "BNum7": AddDigit('7'); break;
|
||||
case "BNum4": AddDigit('4'); break;
|
||||
case "BNum1": AddDigit('1'); break;
|
||||
case "BNum0": AddDigit('0'); break;
|
||||
|
||||
// Numbers
|
||||
case "BNum8": AddDigit('8'); break;
|
||||
case "BNum5": AddDigit('5'); break;
|
||||
case "BNum2": AddDigit('2'); break;
|
||||
|
||||
// Numbers
|
||||
case "BBackspace": if (DisplayText.Length >= 1) DisplayText = DisplayText.Substring(0, DisplayText.Length - 1); break;
|
||||
case "BNum9": AddDigit('9'); break;
|
||||
case "BNum6": AddDigit('6'); break;
|
||||
case "BNum3": AddDigit('3'); break;
|
||||
case "BPeriod": if (!DisplayText.Contains('.')) AddDigit('.'); break;
|
||||
|
||||
// Ops
|
||||
case "BClear": SetValue(0); break;
|
||||
case "BOpDivide": oper = Operator.Division; BinaryOperatorPressed(); break;
|
||||
case "BOpMultiply": oper = Operator.Multiplication; BinaryOperatorPressed(); break;
|
||||
case "BOpSub": oper = Operator.Subtraction; BinaryOperatorPressed(); break;
|
||||
case "BOpAdd": oper = Operator.Sum; BinaryOperatorPressed(); break;
|
||||
|
||||
// Ops
|
||||
case "BClearAC": stage = Stages.First; oper = Operator.None; DisplayValue = 0; break;
|
||||
case "BOpMod": oper = Operator.Mod; BinaryOperatorPressed(); break;
|
||||
case "BOpSign": SetValue(val * -1); break;
|
||||
case "BEqual":
|
||||
if (stage == Stages.Second) BinaryOperatorPressed(true);
|
||||
break;
|
||||
}
|
||||
|
||||
Error = (DisplayText == "NaN");
|
||||
if (DisplayText == "") DisplayText = "0";
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region User input
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Handle_Click(sender, false);
|
||||
}
|
||||
|
||||
private void Button_MouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (e.ChangedButton == MouseButton.Left) Handle_Click(sender, false);
|
||||
else if (e.ChangedButton == MouseButton.Right) Handle_Click(sender, true);
|
||||
}
|
||||
|
||||
private void Window_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
e.Handled = true;
|
||||
|
||||
if (Keyboard.Modifiers == ModifierKeys.Shift) switch (e.Key)
|
||||
{
|
||||
case Key.D6: Handle_Click(BPown, false); break;
|
||||
case Key.D8: Handle_Click(BOpMultiply, false); break;
|
||||
case Key.D5: Handle_Click(BOpMod, false); break;
|
||||
}
|
||||
|
||||
if (Keyboard.Modifiers == ModifierKeys.Control && e.Key == Key.Q)
|
||||
this.Close();
|
||||
|
||||
else if (Keyboard.Modifiers == ModifierKeys.None) switch (e.Key)
|
||||
{
|
||||
// Numeric keys
|
||||
case Key.D0:
|
||||
case Key.NumPad0: Handle_Click(BNum0, false); break;
|
||||
case Key.D1:
|
||||
case Key.NumPad1: Handle_Click(BNum1, false); break;
|
||||
case Key.D2:
|
||||
case Key.NumPad2: Handle_Click(BNum2, false); break;
|
||||
case Key.D3:
|
||||
case Key.NumPad3: Handle_Click(BNum3, false); break;
|
||||
case Key.D4:
|
||||
case Key.NumPad4: Handle_Click(BNum4, false); break;
|
||||
case Key.D5:
|
||||
case Key.NumPad5: Handle_Click(BNum5, false); break;
|
||||
case Key.D6:
|
||||
case Key.NumPad6: Handle_Click(BNum6, false); break;
|
||||
case Key.D7:
|
||||
case Key.NumPad7: Handle_Click(BNum7, false); break;
|
||||
case Key.D8:
|
||||
case Key.NumPad8: Handle_Click(BNum8, false); break;
|
||||
case Key.D9:
|
||||
case Key.NumPad9: Handle_Click(BNum9, false); break;
|
||||
case Key.OemPeriod:
|
||||
case Key.Decimal: Handle_Click(BPeriod, false); break;
|
||||
|
||||
// Binary Operators
|
||||
case Key.Add:
|
||||
case Key.OemPlus: Handle_Click(BOpAdd, false); break;
|
||||
|
||||
case Key.Subtract:
|
||||
case Key.OemMinus: Handle_Click(BOpSub, false); break;
|
||||
|
||||
case Key.Multiply: Handle_Click(BOpMultiply, false); break;
|
||||
|
||||
case Key.OemBackslash:
|
||||
case Key.Divide: Handle_Click(BOpDivide, false); break;
|
||||
|
||||
// Others
|
||||
case Key.Return: Handle_Click(BEqual, false); break;
|
||||
case Key.Escape: Handle_Click(BClearAC, false); break;
|
||||
case Key.Back: Handle_Click(BBackspace, false); break;
|
||||
case Key.Delete: Handle_Click(BClear, false); break;
|
||||
case Key.F1: BHelp_Click(this, new RoutedEventArgs()); break;
|
||||
}
|
||||
}
|
||||
|
||||
private void BHelp_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
DynamicLink.Launcher.StartModule("Help", "Calculator");
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
43
Source/Calculator/MathHelper.cs
Normal file
43
Source/Calculator/MathHelper.cs
Normal file
@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Calculator
|
||||
{
|
||||
public static class MathHelper
|
||||
{
|
||||
|
||||
#region Combinations
|
||||
public static double Combinations(double n, double k)
|
||||
{
|
||||
k = Math.Min(k, n - k);
|
||||
double a = 1, b = 1;
|
||||
|
||||
for (int i = 1; i <= k; i++)
|
||||
{
|
||||
a *= n - i + 1;
|
||||
b *= i;
|
||||
}
|
||||
|
||||
return a / b;
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static double Arrangements(double n, double k)
|
||||
{
|
||||
double a = 1;
|
||||
for (int i = 0; i < k; i++) a *= n - i;
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
public static double Factorial(double n)
|
||||
{
|
||||
double a = 1;
|
||||
for (int i = 1; i <= n; i++) a *= i;
|
||||
|
||||
return a;
|
||||
}
|
||||
}
|
||||
}
|
55
Source/Calculator/Properties/AssemblyInfo.cs
Normal file
55
Source/Calculator/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,55 @@
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Scientific Calculator")]
|
||||
[assembly: AssemblyDescription("A calculator with various functions.")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Tibi Software")]
|
||||
[assembly: AssemblyProduct("Tibi's Mathematics Suite")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2012")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
//In order to begin building localizable applications, set
|
||||
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
||||
//inside a <PropertyGroup>. For example, if you are using US english
|
||||
//in your source files, set the <UICulture> to en-US. Then uncomment
|
||||
//the NeutralResourceLanguage attribute below. Update the "en-US" in
|
||||
//the line below to match the UICulture setting in the project file.
|
||||
|
||||
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
||||
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
71
Source/Calculator/Properties/Resources.Designer.cs
generated
Normal file
71
Source/Calculator/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,71 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.261
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Calculator.Properties
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources
|
||||
{
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
{
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Calculator.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
117
Source/Calculator/Properties/Resources.resx
Normal file
117
Source/Calculator/Properties/Resources.resx
Normal file
@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
30
Source/Calculator/Properties/Settings.Designer.cs
generated
Normal file
30
Source/Calculator/Properties/Settings.Designer.cs
generated
Normal file
@ -0,0 +1,30 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.261
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Calculator.Properties
|
||||
{
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
7
Source/Calculator/Properties/Settings.settings
Normal file
7
Source/Calculator/Properties/Settings.settings
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
102
Source/Calculator/Styles/Buttons.xaml
Normal file
102
Source/Calculator/Styles/Buttons.xaml
Normal file
@ -0,0 +1,102 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<ControlTemplate x:Key="CalcButton" TargetType="{x:Type Button}">
|
||||
<Grid>
|
||||
<Border Background="{TemplateBinding Background}" CornerRadius="5" BorderThickness="1"/>
|
||||
|
||||
<Border Name="BorderHover" CornerRadius="5" Opacity="0">
|
||||
<Border.Background>
|
||||
<RadialGradientBrush GradientOrigin=".5,1" Center=".5, .8">
|
||||
<GradientStop Color="Orange" Offset="0" />
|
||||
<GradientStop Color="OrangeRed" Offset="1" />
|
||||
</RadialGradientBrush>
|
||||
</Border.Background>
|
||||
<Border.BitmapEffect>
|
||||
<DropShadowBitmapEffect Color="Orange" ShadowDepth="1" Softness=".3"/>
|
||||
</Border.BitmapEffect>
|
||||
</Border>
|
||||
|
||||
<Border Name="BorderDown" CornerRadius="5" Opacity="0"
|
||||
Background="DarkRed" />
|
||||
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
|
||||
<Border CornerRadius="5" >
|
||||
<Border.Background>
|
||||
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientStop Color="#40FFFFFF" Offset="0" />
|
||||
<GradientStop Color="#70FFFFFF" Offset=".5" />
|
||||
<GradientStop Color="#40FFFFFF" Offset=".5" />
|
||||
<GradientStop Color="Transparent" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
</Border.Background>
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
|
||||
<ControlTemplate.Triggers>
|
||||
<EventTrigger RoutedEvent="Button.MouseEnter">
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<DoubleAnimation Storyboard.TargetName="BorderHover"
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
To="1" Duration="0:0:0.5"
|
||||
AccelerationRatio=".02" DecelerationRatio=".2"/>
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</EventTrigger>
|
||||
|
||||
<EventTrigger RoutedEvent="Button.MouseLeave">
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<DoubleAnimation Storyboard.TargetName="BorderHover"
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
To="0" Duration="0:0:0.7"
|
||||
AccelerationRatio=".1" DecelerationRatio=".03"/>
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</EventTrigger>
|
||||
|
||||
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="BorderDown" Property="Opacity" Value=".3" />
|
||||
</Trigger>
|
||||
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
|
||||
<Style TargetType="{x:Type Button}">
|
||||
<Setter Property="Margin" Value="2,0,2,2" />
|
||||
<Setter Property="FontSize" Value="14" />
|
||||
<Setter Property="Background" >
|
||||
<Setter.Value>
|
||||
<RadialGradientBrush GradientOrigin=".5,1" Center=".5, .8">
|
||||
<GradientStop Color="LightBlue" Offset="0" />
|
||||
<GradientStop Color="#62B1D0" Offset="1" />
|
||||
</RadialGradientBrush>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||||
<Setter Property="OverridesDefaultStyle" Value="True" />
|
||||
<Setter Property="Template" Value="{StaticResource CalcButton}" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="BigButton" TargetType="{x:Type Button}">
|
||||
<Setter Property="Margin" Value="2,4,2,2" />
|
||||
<Setter Property="FontSize" Value="18" />
|
||||
<Setter Property="Background" >
|
||||
<Setter.Value>
|
||||
<RadialGradientBrush GradientOrigin=".5,1" Center=".5, .8" RadiusX=".5">
|
||||
<GradientStop Color="#C0F0D0" Offset="0" />
|
||||
<GradientStop Color="#60d6A7" Offset="1" />
|
||||
</RadialGradientBrush>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||||
<Setter Property="OverridesDefaultStyle" Value="True" />
|
||||
<Setter Property="Template" Value="{StaticResource CalcButton}" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
26
Source/Calculator/Styles/Display.xaml
Normal file
26
Source/Calculator/Styles/Display.xaml
Normal file
@ -0,0 +1,26 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<Style x:Key="DisplayStyle" TargetType="{x:Type TextBox}">
|
||||
<Setter Property="TextAlignment" Value="Right"/>
|
||||
<Setter Property="FontFamily" Value="/#Astronaut" />
|
||||
<Setter Property="FontSize" Value="40" />
|
||||
<Setter Property="Foreground" Value="#FFC94A" />
|
||||
<Setter Property="Background" Value="#20FFFFFF" />
|
||||
<Setter Property="BorderBrush" Value="Gray" />
|
||||
<Setter Property="BitmapEffect">
|
||||
<Setter.Value>
|
||||
<DropShadowBitmapEffect Color="Orange"
|
||||
ShadowDepth="1" Opacity=".6"
|
||||
/>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="DisplayIndicatorStyle" TargetType="{x:Type Border}">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Padding" Value="3,0,3,0" />
|
||||
<Setter Property="CornerRadius" Value="3" />
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
BIN
Source/Calculator/calculator-logo.ico
Normal file
BIN
Source/Calculator/calculator-logo.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
Reference in New Issue
Block a user