diff --git a/src/AdvancedCalculator.csproj b/src/AdvancedCalculator.csproj
index 6347acd..f1825ea 100644
--- a/src/AdvancedCalculator.csproj
+++ b/src/AdvancedCalculator.csproj
@@ -33,6 +33,9 @@
prompt
4
+
+ icon.ico
+
packages\csmic.1.1.4\lib\net40\csmic.dll
@@ -105,5 +108,11 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/FunctionDefinitonItem.cs b/src/FunctionDefinitonItem.cs
index 1d02047..7a30815 100644
--- a/src/FunctionDefinitonItem.cs
+++ b/src/FunctionDefinitonItem.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Collections.Generic;
namespace AdvancedCalculator
{
@@ -14,29 +10,31 @@ namespace AdvancedCalculator
public string FunctionDescription { get; private set; }
+ public string Icon { get; private set; }
+
public IEnumerable> FunctionArguments { get; private set; }
public static IEnumerable DefinedFunctions
{
get
{
- yield return new FunctionDefinitonItem() { FunctionName = "sin", FunctionDescription = "Returns the sine value of a given expression.", FunctionArguments = new[] { new KeyValuePair("expression", "An expression to compute.") } };
- yield return new FunctionDefinitonItem() { FunctionName = "cos", FunctionDescription = "Returns the cosine value of a given expression.", FunctionArguments = new[] { new KeyValuePair("expression", "An expression to compute.") } };
- yield return new FunctionDefinitonItem() { FunctionName = "tan", FunctionDescription = "Returns the tangent value of a given expression.", FunctionArguments = new[] { new KeyValuePair("expression", "An expression to compute.") } };
- yield return new FunctionDefinitonItem() { FunctionName = "round", FunctionDescription = "Rounds an expression to the nearest whole number.", FunctionArguments = new[] { new KeyValuePair("expression", "An expression to compute.") } };
- yield return new FunctionDefinitonItem() { FunctionName = "sqrt", FunctionDescription = "Returns the square root of a given expression.", FunctionArguments = new[] { new KeyValuePair("expression", "An expression to compute.") } };
- yield return new FunctionDefinitonItem() { FunctionName = "abs", FunctionDescription = "Returns the absolute value of a given expression.", FunctionArguments = new[] { new KeyValuePair("expression", "An expression to compute.") } };
- yield return new FunctionDefinitonItem() { FunctionName = "exp", FunctionDescription = "Returns the constant e to a given power.", FunctionArguments = new[] { new KeyValuePair("power", "An expression to compute.") } };
- yield return new FunctionDefinitonItem() { FunctionName = "log", FunctionDescription = "Returns the log of the first expression to the base of the second expression.", FunctionArguments = new[] { new KeyValuePair("value", "An expression to compute."), new KeyValuePair("base", "An expression to compute.") } };
- yield return new FunctionDefinitonItem() { FunctionName = "precision", FunctionDescription = "Returns the value of expression1 to a given precision. For example, precision(12.3456789, 4) will return 12.3456.", FunctionArguments = new[] { new KeyValuePair("value", "An expression to compute."), new KeyValuePair("precision", "An expression to compute.") } };
+ yield return new FunctionDefinitonItem() { FunctionName = "sin", Icon = IconFont.SineWave, FunctionDescription = "Returns the sine value of a given expression.", FunctionArguments = new[] { new KeyValuePair("expression", "An expression to compute.") } };
+ yield return new FunctionDefinitonItem() { FunctionName = "cos", Icon = IconFont.CosineWave, FunctionDescription = "Returns the cosine value of a given expression.", FunctionArguments = new[] { new KeyValuePair("expression", "An expression to compute.") } };
+ yield return new FunctionDefinitonItem() { FunctionName = "tan", Icon = IconFont.MathTan, FunctionDescription = "Returns the tangent value of a given expression.", FunctionArguments = new[] { new KeyValuePair("expression", "An expression to compute.") } };
+ yield return new FunctionDefinitonItem() { FunctionName = "round", Icon = IconFont.RoundedCorner, FunctionDescription = "Rounds an expression to the nearest whole number.", FunctionArguments = new[] { new KeyValuePair("expression", "An expression to compute.") } };
+ yield return new FunctionDefinitonItem() { FunctionName = "sqrt", Icon = IconFont.SquareRoot, FunctionDescription = "Returns the square root of a given expression.", FunctionArguments = new[] { new KeyValuePair("expression", "An expression to compute.") } };
+ yield return new FunctionDefinitonItem() { FunctionName = "abs", Icon = IconFont.PlusCircle, FunctionDescription = "Returns the absolute value of a given expression.", FunctionArguments = new[] { new KeyValuePair("expression", "An expression to compute.") } };
+ yield return new FunctionDefinitonItem() { FunctionName = "exp", Icon = IconFont.AlphaECircle, FunctionDescription = "Returns the constant e to a given power.", FunctionArguments = new[] { new KeyValuePair("power", "An expression to compute.") } };
+ yield return new FunctionDefinitonItem() { FunctionName = "log", Icon = IconFont.MathLog, FunctionDescription = "Returns the log of the first expression to the base of the second expression.", FunctionArguments = new[] { new KeyValuePair("value", "An expression to compute."), new KeyValuePair("base", "An expression to compute.") } };
+ yield return new FunctionDefinitonItem() { FunctionName = "precision", Icon = IconFont.DecimalIncrease, FunctionDescription = "Returns the value of expression1 to a given precision. For example, precision(12.3456789, 4) will return 12.3456.", FunctionArguments = new[] { new KeyValuePair("value", "An expression to compute."), new KeyValuePair("precision", "An expression to compute.") } };
}
}
- #endregion
+ #endregion Properties
private FunctionDefinitonItem()
{
//
}
}
-}
+}
\ No newline at end of file
diff --git a/src/MainWindow.xaml b/src/MainWindow.xaml
index 7564aa5..0bda146 100644
--- a/src/MainWindow.xaml
+++ b/src/MainWindow.xaml
@@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:AdvancedCalculator"
mc:Ignorable="d"
- Title="MainWindow" Height="450" Width="800">
+ Title="Advanced Calculator" Height="450" Width="800" Icon="calculator-variant-black.png">
@@ -19,19 +19,19 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -51,7 +51,10 @@
-
+
+
+
+
@@ -80,7 +83,7 @@
-
+
@@ -89,15 +92,22 @@
-
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
@@ -113,4 +123,4 @@
-
+
\ No newline at end of file
diff --git a/src/MainWindow.xaml.cs b/src/MainWindow.xaml.cs
index 8defa41..e326051 100644
--- a/src/MainWindow.xaml.cs
+++ b/src/MainWindow.xaml.cs
@@ -1,18 +1,9 @@
using csmic;
-using System;
using System.Collections.Generic;
using System.Linq;
-using System.Text;
using System.Threading.Tasks;
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 AdvancedCalculator
{
@@ -42,11 +33,12 @@ namespace AdvancedCalculator
{
this.interpreter.Interpret(input);
this.historyItems.Add(new HistoryItem() { Input = input, Output = this.interpreter.Output });
- this.variableItems = this.interpreter.Variables.Select(kp => new VariableItem() { VariableName = kp.Key, Value = kp.Value.Value.ToString(), ExpressionVisibility = kp.Value.Type == VariableType.Equation ? Visibility.Visible : Visibility.Hidden, ExpressionComputation = "" }).ToList();
+ this.variableItems = this.interpreter.Variables.Select(kp => new VariableItem() { VariableName = kp.Key, Value = kp.Value.Value.ToString(), ExpressionVisibility = kp.Value.Type == VariableType.Equation ? Visibility.Visible : Visibility.Hidden, ExpressionComputation = "", Icon = IconFont.Variable }).ToList();
foreach(var expressionVariable in this.variableItems.Where(v => v.ExpressionVisibility == Visibility.Visible))
{
this.interpreter.Interpret(expressionVariable.Value);
expressionVariable.ExpressionComputation = this.interpreter.Output;
+ expressionVariable.Icon = IconFont.Function;
}
});
@@ -75,4 +67,4 @@ namespace AdvancedCalculator
}
}
}
-}
+}
\ No newline at end of file
diff --git a/src/VariableItem.cs b/src/VariableItem.cs
index ea8f597..226907d 100644
--- a/src/VariableItem.cs
+++ b/src/VariableItem.cs
@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
+using System.Windows;
namespace AdvancedCalculator
{
@@ -13,12 +8,14 @@ namespace AdvancedCalculator
public string VariableName { get; set; }
+ public string Icon { get; set; }
+
public string Value { get; set; }
public Visibility ExpressionVisibility { get; set; }
public string ExpressionComputation { get; set; }
- #endregion
+ #endregion Properties
}
-}
+}
\ No newline at end of file
diff --git a/src/calculator-variant-black.png b/src/calculator-variant-black.png
new file mode 100644
index 0000000..f70daac
Binary files /dev/null and b/src/calculator-variant-black.png differ
diff --git a/src/icon.ico b/src/icon.ico
new file mode 100644
index 0000000..1494c62
Binary files /dev/null and b/src/icon.ico differ