Skip to content

Commit

Permalink
v0.2.2
Browse files Browse the repository at this point in the history
Improved Integer Center Display
  • Loading branch information
MattMcManis committed Jul 23, 2018
1 parent a672408 commit 072104e
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 22 deletions.
22 changes: 20 additions & 2 deletions source/Triangulum/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
Closing="Window_Closing"

Icon="icon.ico"
Title="Triangulum v0.2.1"
Title="Triangulum v0.2.2"

RenderOptions.BitmapScalingMode="Fant"
UseLayoutRounding="True"
Expand All @@ -53,7 +53,6 @@
<Grid>

<!-- Display -->
<!--FontSize="{Binding Value, ElementName=slFontSize, UpdateSourceTrigger=PropertyChanged}"-->
<TextBox x:Name="tbxDisplay"
FontFamily="{DynamicResource RobotoMono}"
Text="{Binding Display_Text, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Expand All @@ -75,6 +74,25 @@
</TextBox.Resources>
</TextBox>

<!--<RichTextBox x:Name="rtbDisplay"
Margin="10,10,10,46"
Padding="10"
FontSize="12"
Foreground="White"
Background="Black"
IsReadOnly="True"
Grid.ColumnSpan="1"
IsUndoEnabled="False"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Auto">
<RichTextBox.Resources>
<Style x:Key="RobotMono-Regular">
<Setter Property="TextElement.FontFamily"
Value="Resources/#Roboto Mono" />
</Style>
</RichTextBox.Resources>
</RichTextBox>-->

<!-- Sum -->
<CheckBox x:Name="cbxSum"
IsChecked="{Binding Sum_IsChecked, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Expand Down
44 changes: 27 additions & 17 deletions source/Triangulum/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ You should have received a copy of the GNU General Public License
using System.ComponentModel;
using System.Numerics;
using System.Linq;
using System.Windows.Documents;

namespace Triangulum
{
Expand All @@ -43,6 +44,11 @@ public partial class MainWindow : Window
/// </summary>
public ViewModel vm = new ViewModel();

/// <summary>
/// RichTextBox
/// </summary>
public static Paragraph p = new Paragraph();


/// <summary>
/// Main Window
Expand Down Expand Up @@ -263,29 +269,23 @@ public void PascalsTriangle(ViewModel vm, int rows)
if (vm.Decimal_IsChecked == false &&
vm.Sum_IsChecked == false)
{
// Center
if (vm.Center_IsChecked == true)
{
string rowJoin = string.Join(" ", triangle_row);
triangle.Add(string.Join(" ", triangle_row));
}

int maxLength = rows;
} // End Loop

int spacer = maxLength - i;

rowJoin = new string(' ', spacer) + rowJoin;

triangle.Add(rowJoin);
}

// Left
else if (vm.Center_IsChecked == false)
{
triangle.Add(string.Join(" ", triangle_row));
}

// Center
if (vm.Center_IsChecked == true)
{
var maxLength = triangle.Last().Length;
for (i = 0; i < rows; i++)
{
triangle[i] = new string(' ', (maxLength - triangle[i].Length) / 2) + triangle[i];
}
}

} // End Loop


// Output
Expand Down Expand Up @@ -333,6 +333,16 @@ public void PascalsTriangle(ViewModel vm, int rows)

// Display
vm.Display_Text = output;

//Dispatcher.BeginInvoke((Action)(() =>
//{
// p.Inlines.Clear();
// rtbDisplay.Document = new FlowDocument(p);
// rtbDisplay.BeginChange();
// p.Inlines.Add(new Run(vm.Display_Text));
// rtbDisplay.EndChange();
//}));

}


Expand Down
4 changes: 2 additions & 2 deletions source/Triangulum/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// 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("0.0.2.1")]
[assembly: AssemblyFileVersion("0.0.2.1")]
[assembly: AssemblyVersion("0.0.2.2")]
[assembly: AssemblyFileVersion("0.0.2.2")]
2 changes: 1 addition & 1 deletion source/Triangulum/ViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public ViewModel()

Inline_IsChecked = false;

Rows_Text = "300";
Rows_Text = "200";
}


Expand Down

0 comments on commit 072104e

Please sign in to comment.