Skip to content

Commit

Permalink
improve GUI for first release (#6)
Browse files Browse the repository at this point in the history
* add help/feedback menu
* add version info
* add versioning script
* fix build for codecov and SonarQube
  • Loading branch information
lg2de authored Feb 8, 2020
1 parent 3ae82fd commit bb8639d
Show file tree
Hide file tree
Showing 9 changed files with 230 additions and 103 deletions.
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,11 @@ dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case

# PowerShell files
[*.ps1]

# Indentation and spacing
indent_size = 2
indent_style = space
tab_width = 2
9 changes: 6 additions & 3 deletions .github/workflows/dotnetcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- run: |
git fetch --prune --unshallow
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.100
- name: Setup SonarScanner
run: choco install "sonarscanner-msbuild-net46" -y
- name: Patch version info
run: .\PatchVersion.ps1
shell: pwsh

- name: Restore packages
run: dotnet restore --configfile nuget.config
Expand All @@ -40,5 +43,5 @@ jobs:
- name: Upload artifacts
uses: actions/upload-artifact@v1
with:
name: application
name: SimpleAccounting
path: src\SimpleAccounting\bin\Release\netcoreapp3.1
20 changes: 20 additions & 0 deletions PatchVersion.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# check whether build on tag
$version = "DEVEL"
if ($env:GITHUB_REF -match "/tags/") {
# use tag as version name
$version = $env:GITHUB_REF -replace "(\w+/)*",""
} else {
# use git sha as version name
$version = ($env:GITHUB_SHA).Substring(0, 8)
}

Write-Host version = $version

$file = gi .\src\SimpleAccounting\SimpleAccounting.csproj
$xml = [xml](gc $file)
$xml.Project.PropertyGroup.InformationalVersion = $version

$utf8 = New-Object System.Text.UTF8Encoding($true)
$sw = New-Object System.IO.StreamWriter($file.Fullname, $false, $utf8)
$xml.Save( $sw )
$sw.Close()
8 changes: 6 additions & 2 deletions SimpleAccounting.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.gitattributes = .gitattributes
.gitignore = .gitignore
CreateCoverReport.ps1 = CreateCoverReport.ps1
LICENSE = LICENSE
nuget.config = nuget.config
PatchVersion.ps1 = PatchVersion.ps1
README.md = README.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleAccounting", "src\SimpleAccounting\SimpleAccounting.csproj", "{976604F7-86B8-407E-A9B2-592E376D7006}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleAccounting", "src\SimpleAccounting\SimpleAccounting.csproj", "{976604F7-86B8-407E-A9B2-592E376D7006}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleAccounting.UnitTests", "tests\SimpleAccounting.UnitTests\SimpleAccounting.UnitTests.csproj", "{E77B3647-FBC9-4138-A0D5-C9165EF45417}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleAccounting.UnitTests", "tests\SimpleAccounting.UnitTests\SimpleAccounting.UnitTests.csproj", "{E77B3647-FBC9-4138-A0D5-C9165EF45417}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{3F74D64E-D629-4AC0-A60B-29ED0C265896}"
ProjectSection(SolutionItems) = preProject
Expand Down
1 change: 1 addition & 0 deletions src/SimpleAccounting/Presentation/ShellDesignViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public ShellDesignViewModel()

var accountItem = new AccountViewModel { Identifier = 100, Name = "Kasse" };
this.Accounts.Add(accountItem);
this.SelectedAccount = accountItem;

var journalItem = new JournalViewModel
{
Expand Down
187 changes: 109 additions & 78 deletions src/SimpleAccounting/Presentation/ShellView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
MinWidth="400" MinHeight="400"
d:DesignWidth="800" d:DesignHeight="450"
d:DataContext="{d:DesignInstance Type=local:ShellDesignViewModel, IsDesignTimeCreatable=True}">
<UserControl.Resources>
<Style TargetType="TextBlock">
<Setter Property="FontSize" Value="15" />
<Setter Property="Margin" Value="5" />
</Style>
</UserControl.Resources>
<DockPanel>
<Menu DockPanel.Dock="Top">
<Menu.Resources>
Expand Down Expand Up @@ -48,6 +54,10 @@
<MenuItem Header="Bestandskontosalden" Command="{Binding AssetBalancesReportCommand}" />
<MenuItem Header="Jahresbilanz" Command="{Binding AnnualBalanceReportCommand}" />
</MenuItem>
<MenuItem Header="Hilfe">
<MenuItem Header="Über" Command="{Binding HelpAboutCommand}" />
<MenuItem Header="Problem melden" Command="{Binding HelpFeedbackCommand}" />
</MenuItem>
</Menu>
<Grid>
<Grid.ColumnDefinitions>
Expand All @@ -61,6 +71,12 @@
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.Resources>
<Style x:Key="GridRowStyle" TargetType="{x:Type DataGridRow}">
<Setter Property="FontSize" Value="11" />
</Style>
<Style TargetType="DataGridCell">
<Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self},Path=Content.Text}"/>
</Style>
<Style x:Key="SummaryGridStyle" TargetType="DataGridCell">
<Style.Triggers>
<DataTrigger Binding="{Binding IsSummary}" Value="True">
Expand All @@ -69,88 +85,103 @@
</Style.Triggers>
</Style>
</Grid.Resources>
<DataGrid
Grid.Column="0"
ItemsSource="{Binding Journal}"
AutoGenerateColumns="False"
CanUserAddRows="False"
IsReadOnly="True">
<DataGrid.Columns>
<DataGridTextColumn Header="Datum" Width="60" Binding="{Binding Date, StringFormat=\{0:d\}}" />
<DataGridTextColumn Header="Belegnr." Width="50" Binding="{Binding Identifier}" />
<DataGridTextColumn Header="Buchungstext" Width="200" Binding="{Binding Text}" />
<DataGridTextColumn Header="Betrag" Width="70" Binding="{Binding Value, StringFormat=\{0:0.00\}}" ElementStyle="{StaticResource ValueGridStyle}" />
<DataGridTextColumn Header="Sollkonto" Width="100" Binding="{Binding DebitAccount}" />
<DataGridTextColumn Header="Habenkonto" Width="100" Binding="{Binding CreditAccount}" />
</DataGrid.Columns>
<DataGrid.RowStyle>
<Style TargetType="{x:Type DataGridRow}">
<Setter Property="FontSize" Value="11" />
</Style>
</DataGrid.RowStyle>
</DataGrid>
<DockPanel Grid.Column="0">
<TextBlock
DockPanel.Dock="Top"
Text="Journal des Buchungsjahres" />
<DataGrid
DockPanel.Dock="Bottom"
ItemsSource="{Binding Journal}"
RowStyle="{StaticResource GridRowStyle}"
AutoGenerateColumns="False" CanUserAddRows="False" IsReadOnly="True">
<DataGrid.Columns>
<DataGridTextColumn Header="Datum" Width="60" Binding="{Binding Date, StringFormat=\{0:d\}}" />
<DataGridTextColumn Header="Belegnr." Width="50" Binding="{Binding Identifier}" />
<DataGridTextColumn Header="Buchungstext" Width="200" Binding="{Binding Text}" />
<DataGridTextColumn Header="Betrag" Width="70" Binding="{Binding Value, StringFormat=\{0:0.00\}}" ElementStyle="{StaticResource ValueGridStyle}" />
<DataGridTextColumn Header="Sollkonto" Width="100" Binding="{Binding DebitAccount}" />
<DataGridTextColumn Header="Habenkonto" Width="100" Binding="{Binding CreditAccount}" />
</DataGrid.Columns>
</DataGrid>
</DockPanel>
<GridSplitter Grid.Column="1" HorizontalAlignment="Stretch" />
<DataGrid
Grid.Column="2"
ItemsSource="{Binding AccountJournal}"
AutoGenerateColumns="False"
CanUserAddRows="False"
IsReadOnly="True">
<DataGrid.Columns>
<DataGridTextColumn Header="Datum" Width="50" Binding="{Binding Date, StringFormat=\{0:d\}}" CellStyle="{StaticResource SummaryGridStyle}" />
<DataGridTextColumn Header="Belegnr." Width="50" Binding="{Binding Identifier}" CellStyle="{StaticResource SummaryGridStyle}" />
<DataGridTextColumn Header="Buchungstext" Width="200" Binding="{Binding Text}" />
<DataGridTextColumn Header="Sollwert" Width="70" Binding="{Binding DebitValue, StringFormat=\{0:0.00;;#\}}" ElementStyle="{StaticResource ValueGridStyle}" />
<DataGridTextColumn Header="Habenwert" Width="70" Binding="{Binding CreditValue, StringFormat=\{0:0.00;;#\}}" ElementStyle="{StaticResource ValueGridStyle}" />
<DataGridTextColumn Header="Gegenkonto" Width="100" Binding="{Binding RemoteAccount}" />
</DataGrid.Columns>
<DataGrid.RowStyle>
<Style TargetType="{x:Type DataGridRow}">
<Setter Property="FontSize" Value="11" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsSummary}" Value="True">
<Setter Property="Background" Value="LightGray" />
</DataTrigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
</DataGrid>
<DockPanel Grid.Column="2">
<TextBlock DockPanel.Dock="Top">
<Run Text="Kontenblatt '" />
<Run Text="{Binding SelectedAccount.Name}" />
<Run Text="'" />
</TextBlock>
<DataGrid
DockPanel.Dock="Bottom"
ItemsSource="{Binding AccountJournal}"
AutoGenerateColumns="False"
CanUserAddRows="False"
IsReadOnly="True">
<DataGrid.Columns>
<DataGridTextColumn Header="Datum" Width="60" Binding="{Binding Date, StringFormat=\{0:d\}}" CellStyle="{StaticResource SummaryGridStyle}" />
<DataGridTextColumn Header="Belegnr." Width="50" Binding="{Binding Identifier}" CellStyle="{StaticResource SummaryGridStyle}" />
<DataGridTextColumn Header="Buchungstext" Width="200" Binding="{Binding Text}" />
<DataGridTextColumn Header="Sollwert" Width="70" Binding="{Binding DebitValue, StringFormat=\{0:0.00;;#\}}" ElementStyle="{StaticResource ValueGridStyle}" />
<DataGridTextColumn Header="Habenwert" Width="70" Binding="{Binding CreditValue, StringFormat=\{0:0.00;;#\}}" ElementStyle="{StaticResource ValueGridStyle}" />
<DataGridTextColumn Header="Gegenkonto" Width="100" Binding="{Binding RemoteAccount}" />
</DataGrid.Columns>
<DataGrid.RowStyle>
<Style BasedOn="{StaticResource GridRowStyle}" TargetType="{x:Type DataGridRow}">
<Style.Triggers>
<DataTrigger Binding="{Binding IsSummary}" Value="True">
<Setter Property="Background" Value="LightGray" />
</DataTrigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
</DataGrid>
</DockPanel>
<GridSplitter Grid.ColumnSpan="3" Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
<DataGrid
Grid.ColumnSpan="3" Grid.Row="2"
ItemsSource="{Binding Accounts}"
AutoGenerateColumns="False"
CanUserAddRows="False"
IsReadOnly="True"
IsSynchronizedWithCurrentItem="True">
<DataGrid.Columns>
<DataGridTextColumn Header="Nummer" Binding="{Binding Identifier}" />
<DataGridTextColumn Header="Bezeichnung" Binding="{Binding Name}" />
<DataGridTextColumn Header="Typ" Binding="{Binding Type}" />
</DataGrid.Columns>
<DataGrid.InputBindings>
<MouseBinding
MouseAction="LeftDoubleClick"
Command="{Binding AccountSelectionCommand}"
CommandParameter="{Binding Accounts/}" />
</DataGrid.InputBindings>
<DataGrid.ContextMenu>
<ContextMenu>
<MenuItem
Header="Kontenblatt aktualisieren"
<DockPanel Grid.ColumnSpan="3" Grid.Row="2">
<TextBlock
DockPanel.Dock="Left"
Text="Konten"
VerticalAlignment="Center">
<TextBlock.LayoutTransform>
<RotateTransform Angle="-90"/>
</TextBlock.LayoutTransform>
</TextBlock>
<DataGrid
DockPanel.Dock="Right"
ItemsSource="{Binding Accounts}"
AutoGenerateColumns="False"
CanUserAddRows="False"
IsReadOnly="True"
IsSynchronizedWithCurrentItem="True">
<DataGrid.Columns>
<DataGridTextColumn Header="Nummer" Binding="{Binding Identifier}" />
<DataGridTextColumn Header="Bezeichnung" Binding="{Binding Name}" />
<DataGridTextColumn Header="Typ" Binding="{Binding Type}" />
</DataGrid.Columns>
<DataGrid.InputBindings>
<MouseBinding
MouseAction="LeftDoubleClick"
Command="{Binding AccountSelectionCommand}"
CommandParameter="{Binding Accounts/}" />
<MenuItem
Header="Konto bearbeiten"
Command="{Binding EditAccountCommand}"
CommandParameter="{Binding Accounts/}" />
<Separator />
<MenuItem
Header="Konto erstellen"
Command="{Binding NewAccountCommand}" />
</ContextMenu>
</DataGrid.ContextMenu>
</DataGrid>
</DataGrid.InputBindings>
<DataGrid.ContextMenu>
<ContextMenu>
<MenuItem
Header="Kontenblatt aktualisieren"
Command="{Binding AccountSelectionCommand}"
CommandParameter="{Binding Accounts/}" />
<MenuItem
Header="Konto bearbeiten"
Command="{Binding EditAccountCommand}"
CommandParameter="{Binding Accounts/}" />
<Separator />
<MenuItem
Header="Konto erstellen"
Command="{Binding NewAccountCommand}" />
</ContextMenu>
</DataGrid.ContextMenu>
</DataGrid>
</DockPanel>
</Grid>
</DockPanel>
</UserControl>
Loading

0 comments on commit bb8639d

Please sign in to comment.