Skip to content

Commit

Permalink
v0.3.1-alpha
Browse files Browse the repository at this point in the history
Added Display CheckBox
Added System Resources Warnings CheckBox
Added Autosave CheckBox
  • Loading branch information
MattMcManis committed Jun 11, 2019
1 parent 65876f3 commit 51f8dd5
Show file tree
Hide file tree
Showing 5 changed files with 348 additions and 64 deletions.
28 changes: 26 additions & 2 deletions source/Triangulum/Generator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@ You should have received a copy of the GNU General Public License
using System.Text;
using System.Text.RegularExpressions;
using System.Numerics;
using System.IO;

namespace Triangulum
{
public class Generator
{
public static string output;

/// <summary>
/// Pascals Triangle - Method
/// </summary>
Expand Down Expand Up @@ -120,6 +123,13 @@ public static void PascalsTriangle(ViewModel vm, int rows)
} // End Loop


// Progress Info
if (vm.Display_IsChecked == false)
{
vm.Display_Text = "Complete\r\n\r\nPlease Enable Display or Save Output.";
}


// -------------------------
// Center
// -------------------------
Expand All @@ -136,7 +146,7 @@ public static void PascalsTriangle(ViewModel vm, int rows)
// -------------------------
// Output
// -------------------------
string output = string.Join("\r\n", triangle);
output = string.Join("\r\n", triangle);


// -------------------------
Expand All @@ -162,6 +172,7 @@ public static void PascalsTriangle(ViewModel vm, int rows)
// Do not Regex Replace
}


// -------------------------
// Convert to ASCII
// -------------------------
Expand Down Expand Up @@ -196,6 +207,7 @@ public static void PascalsTriangle(ViewModel vm, int rows)
"9: " + output.Count(d => d == '9');
}


// -------------------------
// Inline
// -------------------------
Expand All @@ -205,10 +217,22 @@ public static void PascalsTriangle(ViewModel vm, int rows)
output = Regex.Replace(output, "\r\n", "");
}

// -------------------------
// Autosave Export
// -------------------------
if (vm.Autosave_IsChecked == true)
{
//Export.SaveFile();
File.WriteAllText(MainWindow.desktopDir + "Triangulum " + DateTime.Now.ToString("yyyy-MM-dd HHmmss") + ".txt", Generator.output, Encoding.Unicode);
}

// -------------------------
// Display
// -------------------------
vm.Display_Text = output;
if (vm.Display_IsChecked == true)
{
vm.Display_Text = output;
}
}


Expand Down
90 changes: 77 additions & 13 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.3.0"
Title="Triangulum v0.3.1"

RenderOptions.BitmapScalingMode="Fant"
UseLayoutRounding="True"
Expand Down Expand Up @@ -106,9 +106,9 @@
IsChecked="{Binding Decimal_IsChecked, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
IsEnabled="{Binding Decimal_IsEnabled, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Content="Decimal"
Margin="0,138,31,0"
Margin="0,138,18,0"
HorizontalAlignment="Right"
Width="66"
Width="79"
Checked="cbxDecimal_Checked"
Height="15"
VerticalAlignment="Top"
Expand All @@ -121,9 +121,9 @@
<CheckBox x:Name="cbxCenter"
IsChecked="{Binding Center_IsChecked, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Content="Center"
Margin="0,24,33,0"
Margin="0,24,18,0"
HorizontalAlignment="Right"
Width="64"
Width="79"
Checked="cbxCenter_Checked"
Height="15"
VerticalAlignment="Top"
Expand All @@ -135,9 +135,9 @@
<CheckBox x:Name="cbxWrap"
IsChecked="{Binding Wrap_IsChecked, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Content="Wrap"
Margin="0,64,47,0"
Margin="0,64,18,0"
HorizontalAlignment="Right"
Width="50"
Width="79"
Checked="cbxWrap_Checked"
Unchecked="cbxWrap_Unchecked"
Height="15"
Expand All @@ -147,6 +147,22 @@
ToolTip="Enable text wrapping."
/>


<!-- CPU Usage -->
<TextBlock Margin="0,352,18,210"
TextWrapping="Wrap"
Text="{Binding CPU_Text, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
HorizontalAlignment="Right"
Width="79"/>

<!-- RAM Usage -->
<TextBlock Margin="0,373,18,189"
TextWrapping="Wrap"
Text="{Binding RAM_Text, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
HorizontalAlignment="Right"
Width="79"/>


<!-- Info -->
<Button x:Name="btnInfo"
Cursor="Hand"
Expand Down Expand Up @@ -261,9 +277,9 @@
<CheckBox x:Name="cbxInline"
IsChecked="{Binding Inline_IsChecked, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Content="Inline"
Margin="0,44,47,0"
Margin="0,44,18,0"
HorizontalAlignment="Right"
Width="50"
Width="79"
Checked="cbxInline_Checked"
Height="15"
VerticalAlignment="Top"/>
Expand All @@ -272,9 +288,9 @@
<CheckBox x:Name="cbxASCII"
IsChecked="{Binding ASCII_IsChecked, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Content="ASCII"
Margin="0,192,47,0"
Margin="0,192,18,0"
HorizontalAlignment="Right"
Width="50"
Width="79"
Checked="cbxASCII_Checked"
Height="15"
VerticalAlignment="Top"
Expand All @@ -287,9 +303,9 @@
<CheckBox x:Name="cbxNumberDistribution"
IsChecked="{Binding NumberDistribution_IsChecked, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Content="Distr"
Margin="0,212,45,0"
Margin="0,212,18,0"
HorizontalAlignment="Right"
Width="52"
Width="79"
Checked="cbxNumberDistribution_Checked"
Height="15"
VerticalAlignment="Top"
Expand All @@ -298,6 +314,54 @@
ToolTip="Display the number occurrence distribution."
/>

<!-- Display -->
<CheckBox x:Name="cbxDisplay"
IsChecked="{Binding Display_IsChecked, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Content="Display"
Margin="0,245,18,0"
HorizontalAlignment="Right"
Width="79"
Checked="cbxDisplay_Checked"
Unchecked="cbxDisplay_Unchecked"
Height="15"
VerticalAlignment="Top"
ToolTipService.InitialShowDelay="500"
ToolTipService.ShowOnDisabled="True"
ToolTip="Display the output."
/>

<!-- Warnings-->
<CheckBox x:Name="cbxWarnings"
IsChecked="{Binding Warnings_IsChecked, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Content="Warnings"
Margin="0,265,18,0"
HorizontalAlignment="Right"
Width="79"
Checked="cbxWarnings_Checked"
Unchecked="cbxWarnings_Unchecked"
Height="15"
VerticalAlignment="Top"
ToolTipService.InitialShowDelay="500"
ToolTipService.ShowOnDisabled="True"
ToolTip="Enable system resource warning notifications."
/>

<!-- Autosave-->
<CheckBox x:Name="cbxAutosave"
IsChecked="{Binding Autosave_IsChecked, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Content="Autosave"
Margin="0,285,18,0"
HorizontalAlignment="Right"
Width="79"
Checked="cbxAutosave_Checked"
Unchecked="cbxAutosave_Unchecked"
Height="15"
VerticalAlignment="Top"
ToolTipService.InitialShowDelay="500"
ToolTipService.ShowOnDisabled="True"
ToolTip="Auto Save output to text file."
/>

<!-- Binary -->
<CheckBox x:Name="cbxBinary"
IsChecked="{Binding Binary_IsChecked, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Expand Down
Loading

0 comments on commit 51f8dd5

Please sign in to comment.