Skip to content

Commit

Permalink
added settings flyout; moved all calculations to transactions wrapper…
Browse files Browse the repository at this point in the history
… and separate sub-controls
  • Loading branch information
arkein committed May 1, 2016
1 parent 9d86897 commit 2ad0564
Show file tree
Hide file tree
Showing 23 changed files with 443 additions and 135 deletions.
4 changes: 2 additions & 2 deletions Hearthstone Treasury/Controls/DistributionChart.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
xmlns:metroChart="clr-namespace:De.TorstenMandelkow.MetroChart;assembly=De.TorstenMandelkow.MetroChart"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<metroChart:PieChart ChartTitle="Gold income by source"
ChartSubTitle="Shows where your gold comes from"
<metroChart:PieChart ChartTitle="{Binding ChartTitle}"
ChartSubTitle="{Binding ChartSubTitle}"
SelectedItem="{Binding Path=SelectedItem,Mode=TwoWay}">
<metroChart:PieChart.Series>
<metroChart:ChartSeries SeriesTitle="Gold"
Expand Down
70 changes: 34 additions & 36 deletions Hearthstone Treasury/Controls/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,40 @@
BorderBrush="{DynamicResource AccentColorBrush}" BorderThickness="1"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<ScrollViewer Margin="0, 0, 2, 0">
<WrapPanel Orientation="Vertical">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal">
<Label>Current balance:</Label>
<Label Content="{Binding Balance}"></Label>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal">
<Label>Gold per day:</Label>
<Label Content="{Binding GoldVelocity}"></Label>
<Controls:MetroWindow.RightWindowCommands>
<Controls:WindowCommands>
<Button Command="{Binding OptionsFlyoutOpen}">
<StackPanel Orientation="Horizontal">
<TextBlock Margin="4" VerticalAlignment="Center" Text="Options" />
</StackPanel>
</Grid>
<local:DistributionChart DataContext="{Binding DistributionChart}" ></local:DistributionChart>
<!-- Width="{Binding Path=Width,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl}}"
Height="{Binding Path=Height,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl}}"
/>-->
<DataGrid ItemsSource="{Binding Transactions}" AutoGenerateColumns="False" CanUserReorderColumns="False">
<DataGrid.Resources>
<ObjectDataProvider x:Key="categoryEnum" MethodName="GetValues" ObjectType="{x:Type sys:Enum}">
<ObjectDataProvider.MethodParameters>
<x:Type Type="Models:CategoryEnum"/>
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
</DataGrid.Resources>
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Moment}" Header="When" SortDirection="Ascending"/>
<DataGridComboBoxColumn Header="Category" SelectedItemBinding="{Binding Category}" ItemsSource="{Binding Source={StaticResource categoryEnum}}"/>
<DataGridTextColumn Binding="{Binding Difference}" Header="Difference"/>
<DataGridTextColumn Binding="{Binding Comment}" Header="Comments" />
</DataGrid.Columns>
</DataGrid>

</WrapPanel>
</Button>
</Controls:WindowCommands>
</Controls:MetroWindow.RightWindowCommands>
<Controls:MetroWindow.Flyouts>
<Controls:FlyoutsControl Margin="{Binding TitleBarMargin, RelativeSource={RelativeSource AncestorType=local:MainWindow}}">
<!-- Options -->
<Controls:Flyout x:Name="FlyoutOptions" IsOpen="{Binding OptionsFlyoutState}" Header="Options" Position="Left" Width="400">
<local:SettingsControl DataContext="{Binding Path=Settings}" />
</Controls:Flyout>
</Controls:FlyoutsControl>
</Controls:MetroWindow.Flyouts>
<ScrollViewer Margin="0, 0, 2, 0">
<StackPanel>
<local:StatisticsControl DataContext="{Binding Statistics}"/>
<WrapPanel Orientation="Vertical">
<Controls:MetroTabControl>
<Controls:MetroTabItem Header="Transactions">
<Controls:MetroTabItem.Content>
<local:TransactionsListingControl DataContext="{Binding TransactionList}"/>
</Controls:MetroTabItem.Content>
</Controls:MetroTabItem>
<Controls:MetroTabItem Header="Reports">
<Controls:MetroTabItem.Content>
<local:ReportControl DataContext="{Binding Reports}"/>
</Controls:MetroTabItem.Content>
</Controls:MetroTabItem>
</Controls:MetroTabControl>
</WrapPanel>
</StackPanel>
</ScrollViewer>
</Controls:MetroWindow>
9 changes: 8 additions & 1 deletion Hearthstone Treasury/Controls/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace Hearthstone_Treasury.Controls
using System.Windows;

namespace Hearthstone_Treasury.Controls
{
/// <summary>
/// Interaction logic for MainWindow.xaml
Expand All @@ -9,5 +11,10 @@ public MainWindow()
{
InitializeComponent();
}

public Thickness TitleBarMargin
{
get { return new Thickness(0, TitlebarHeight, 0, 0); }
}
}
}
13 changes: 13 additions & 0 deletions Hearthstone Treasury/Controls/ReportControl.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<UserControl x:Class="Hearthstone_Treasury.Controls.ReportControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Hearthstone_Treasury.Controls"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<WrapPanel>
<local:DistributionChart DataContext="{Binding IncomeDistributionChart}" ></local:DistributionChart>
<local:DistributionChart DataContext="{Binding OutcomeDistributionChart}" ></local:DistributionChart>
</WrapPanel>
</UserControl>
28 changes: 28 additions & 0 deletions Hearthstone Treasury/Controls/ReportControl.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
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 Hearthstone_Treasury.Controls
{
/// <summary>
/// Interaction logic for ReportControl.xaml
/// </summary>
public partial class ReportControl : UserControl
{
public ReportControl()
{
InitializeComponent();
}
}
}
30 changes: 30 additions & 0 deletions Hearthstone Treasury/Controls/SettingsControl.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<UserControl x:Class="Hearthstone_Treasury.Controls.SettingsControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Hearthstone_Treasury.Controls"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Label Content="Initial Balance" />
<TextBox Grid.Column="1" Width="50" Margin="2">
<TextBox.Text>
<Binding Path="InitialBalance" Mode="TwoWay" NotifyOnValidationError="True">
<Binding.ValidationRules>
<DataErrorValidationRule ValidatesOnTargetUpdated="True"/>
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
<Button Grid.Column="2" Content="Apply" Margin="2" />
</Grid>
</UserControl>
28 changes: 28 additions & 0 deletions Hearthstone Treasury/Controls/SettingsControl.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
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 Hearthstone_Treasury.Controls
{
/// <summary>
/// Interaction logic for SettingsControl.xaml
/// </summary>
public partial class SettingsControl : UserControl
{
public SettingsControl()
{
InitializeComponent();
}
}
}
14 changes: 1 addition & 13 deletions Hearthstone Treasury/Controls/SettingsWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,6 @@
BorderBrush="{DynamicResource AccentColorBrush}" BorderThickness="1"
d:DesignHeight="300" d:DesignWidth="300">
<StackPanel>
<StackPanel Orientation="Horizontal">
<Label Content="Initial Balance" />
<TextBox Width="50">
<TextBox.Text>
<Binding Path="InitialBalance" Mode="TwoWay" NotifyOnValidationError="True">
<Binding.ValidationRules>
<DataErrorValidationRule ValidatesOnTargetUpdated="True"/>
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
<Button Content="Apply" />
</StackPanel>
<local:SettingsControl/>
</StackPanel>
</Controls:MetroWindow>
25 changes: 25 additions & 0 deletions Hearthstone Treasury/Controls/StatisticsControl.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<UserControl x:Class="Hearthstone_Treasury.Controls.StatisticsControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Hearthstone_Treasury.Controls"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<WrapPanel>
<StackPanel Orientation="Horizontal">
<Label Content="{Binding Balance}" ContentStringFormat="Balance: {0}"></Label>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Label>Stats: </Label>
<Label Content="{Binding GoldIncomeVelocity}" ContentStringFormat="In {0:N2}"></Label>
<Label> / </Label>
<Label Content="{Binding GoldOutcomeVelocity}" ContentStringFormat="Out {0:N2}"></Label>
<Label> / </Label>
<Label Content="{Binding GoldTotalVelocity}" ContentStringFormat="Total {0:N2}"></Label>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Label Content="{Binding TransactionList.ReportingDays}" ContentStringFormat="Period {0:N2} days"></Label>
</StackPanel>
</WrapPanel>
</UserControl>
28 changes: 28 additions & 0 deletions Hearthstone Treasury/Controls/StatisticsControl.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
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 Hearthstone_Treasury.Controls
{
/// <summary>
/// Interaction logic for StatisticsControl.xaml
/// </summary>
public partial class StatisticsControl : UserControl
{
public StatisticsControl()
{
InitializeComponent();
}
}
}
26 changes: 26 additions & 0 deletions Hearthstone Treasury/Controls/TransactionsListingControl.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<UserControl x:Class="Hearthstone_Treasury.Controls.TransactionsListingControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Hearthstone_Treasury.Controls"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:Models="clr-namespace:Hearthstone_Treasury.ViewModels"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<DataGrid ItemsSource="{Binding Transactions}" AutoGenerateColumns="False" CanUserReorderColumns="False">
<DataGrid.Resources>
<ObjectDataProvider x:Key="categoryEnum" MethodName="GetValues" ObjectType="{x:Type sys:Enum}">
<ObjectDataProvider.MethodParameters>
<x:Type Type="Models:CategoryEnum"/>
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
</DataGrid.Resources>
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Moment}" Header="When" SortDirection="Ascending"/>
<DataGridComboBoxColumn Header="Category" SelectedItemBinding="{Binding Category}" ItemsSource="{Binding Source={StaticResource categoryEnum}}"/>
<DataGridTextColumn Binding="{Binding Difference}" Header="Difference"/>
<DataGridTextColumn Binding="{Binding Comment}" Header="Comments" />
</DataGrid.Columns>
</DataGrid>
</UserControl>
28 changes: 28 additions & 0 deletions Hearthstone Treasury/Controls/TransactionsListingControl.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
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 Hearthstone_Treasury.Controls
{
/// <summary>
/// Interaction logic for TransactionsListingControl.xaml
/// </summary>
public partial class TransactionsListingControl : UserControl
{
public TransactionsListingControl()
{
InitializeComponent();
}
}
}
Loading

0 comments on commit 2ad0564

Please sign in to comment.