Files
eJay/View/MainView.xaml
2019-01-06 15:44:03 +01:00

173 lines
12 KiB
XML

<Window x:Class="DebtMgr.View.MainView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:converters="clr-namespace:DebtMgr.Converters"
mc:Ignorable="d"
Name="MainViewWindow"
Icon="../Content/money_green.ico"
Title="eJay" Height="600" MinHeight="600" Width="900" MinWidth="900"
Background="White">
<Window.Resources>
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"></converters:BoolToVisibilityConverter>
<converters:AmountToColorConverter x:Key="AmountToColorConverter" />
<Style TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
</Style>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<!-- #region Ribbon -->
<Ribbon Grid.Row="0" Loaded="Ribbon_Loaded" Margin="0 -1 0 0">
<Ribbon.QuickAccessToolBar>
<RibbonQuickAccessToolBar Visibility="Visible">
<Label>asd</Label>
</RibbonQuickAccessToolBar>
</Ribbon.QuickAccessToolBar>
<Ribbon.ApplicationMenu>
<RibbonApplicationMenu Visibility="Visible"></RibbonApplicationMenu>
</Ribbon.ApplicationMenu>
<RibbonTab Header="234">
<RibbonGroup Header="Person">
<RibbonButton Label="New Person" SmallImageSource="../Content/addperson.ico" Command="{Binding NewPersonContextMenuCommand}"></RibbonButton>
<RibbonButton Label="Edit Person" SmallImageSource="../Content/addperson.ico" Command="{Binding EditPersonContextMenuCommand}"></RibbonButton>
<RibbonButton Label="Delete Person" SmallImageSource="../Content/delete.ico" Command="{Binding DeletePersonContextMenuCommand}"></RibbonButton>
<RibbonButton Label="Save Screenshot" LargeImageSource="../Content/camera.png" Command="{Binding SaveScreenshotCommand}" CommandParameter="{Binding ElementName=RightPanel}" IsEnabled="{Binding ScreenshotPossible}"></RibbonButton>
<RibbonButton Label="Send via Telegram" LargeImageSource="../Content/telegram.png" Command="{Binding SendViaTelegramCommand}" CommandParameter="{Binding ElementName=RightPanel}"></RibbonButton>
</RibbonGroup>
<RibbonGroup Header="Transaction">
<RibbonButton Label="Edit Transaction" SmallImageSource="../Content/addperson.ico" Command="{Binding EditTransactionContextMenuCommand}"></RibbonButton>
<RibbonButton Label="Delete Transaction" SmallImageSource="../Content/delete.ico" Command="{Binding DeleteTransactionContextMenuCommand}"></RibbonButton>
<RibbonButton Label="Add Charge" LargeImageSource="../Content/money_red.ico" Command="{Binding AddChargeContextMenuCommand}"></RibbonButton>
<RibbonButton Label="Add Deposit" LargeImageSource="../Content/money_green.ico" Command="{Binding AddDepositContextMenuCommand}"></RibbonButton>
</RibbonGroup>
<RibbonGroup Header="Settings">
<RibbonButton Label="Switch Database" SmallImageSource="../Content/db_plus.ico" Command="{Binding SwitchDatabaseMenuCommand}"></RibbonButton>
<RibbonButton Label="Open Database Location" SmallImageSource="../Content/db_info.ico" Command="{Binding OpenDatabaseLocationMenuCommand}"></RibbonButton>
<RibbonButton Label="Select Telegram Path" SmallImageSource="../Content/telegram.png" Command="{Binding SetTelegramLocationCommand}"></RibbonButton>
</RibbonGroup>
<RibbonGroup Header="Application">
<Label Content="{Binding CurrentVersionLabelContent}"></Label>
<Label Content="{Binding UpdateInfoLabelContent}" Visibility="{Binding UpdateInfoLabelVisible, Converter={StaticResource BoolToVisibilityConverter}}"></Label>
<RibbonButton SmallImageSource="../Content/moneybag.ico" Label="{Binding UpdateButtonLabel}" IsEnabled="{Binding UpdateButtonEnabled}" Visibility="{Binding UpdateButtonVisible, Converter={StaticResource BoolToVisibilityConverter}}" Command="{Binding UpdateButtonCommand}"></RibbonButton>
</RibbonGroup>
</RibbonTab>
</Ribbon>
<!-- #endregion -->
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="3*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<!-- #region PersonListView -->
<Grid Grid.Column="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Label Grid.Row="0" Content="Overview" FontWeight="Bold" FontSize="22" Margin="0 0 0 -5"></Label>
<TextBlock Grid.Row="1" FontSize="18" Margin="5 0 0 5" VerticalAlignment="Center">
<TextBlock Text="Overall Balance:"></TextBlock>
<TextBlock Text="{Binding OverallBalanceLabel}" Foreground="{Binding OverallBalanceLabel, Converter={StaticResource AmountToColorConverter}}"></TextBlock>
<TextBlock Text="€" Foreground="{Binding OverallBalanceLabel, Converter={StaticResource AmountToColorConverter}}"></TextBlock>
</TextBlock>
<ListView Name="PersonListView" Grid.Row="2" ItemsSource="{Binding PersonListViewItemSource}" SelectedItem="{Binding PersonListViewSelectedItem}" MouseDoubleClick="PersonListView_OnMouseDoubleClick" SelectionMode="Single">
<ListView.View>
<GridView>
<GridViewColumn DisplayMemberBinding="{Binding FirstName}" Width="120">
<GridViewColumnHeader Command="{Binding SortPersonListViewCommand}" CommandParameter="FirstName">First name</GridViewColumnHeader>
</GridViewColumn>
<GridViewColumn DisplayMemberBinding="{Binding LastName}" Width="120">
<GridViewColumnHeader Command="{Binding SortPersonListViewCommand}" CommandParameter="LastName">Last name</GridViewColumnHeader>
</GridViewColumn>
<GridViewColumn Width="84">
<GridViewColumnHeader Command="{Binding SortPersonListViewCommand}" CommandParameter="Total">Balance</GridViewColumnHeader>
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock TextAlignment="Right" Foreground="{Binding Total, Converter={StaticResource AmountToColorConverter}}" Text="{Binding Total, StringFormat='{}{0:N} €'}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
<ListBox.Resources>
<ContextMenu x:Key="PersonListViewContextMenu">
<MenuItem Header="_Edit Person" Command="{Binding EditPersonContextMenuCommand}" />
<MenuItem Header="Delete Person" Command="{Binding DeletePersonContextMenuCommand}" />
<MenuItem Header="_New Person" Command="{Binding NewPersonContextMenuCommand}" />
<Separator></Separator>
<MenuItem Header="Add _Charge" Command="{Binding AddChargeContextMenuCommand}" />
<MenuItem Header="Add _Deposit" Command="{Binding AddDepositContextMenuCommand}" />
</ContextMenu>
</ListBox.Resources>
<ListBox.ContextMenu>
<StaticResource ResourceKey="PersonListViewContextMenu" />
</ListBox.ContextMenu>
</ListView>
</Grid>
<!-- #endregion -->
<StackPanel Grid.Column="1" Orientation="Horizontal">
<Separator Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" />
</StackPanel>
<Grid Grid.Column="2" Name="RightPanel">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Content="{Binding DetailViewHeaderLabelContent}" FontWeight="Bold" FontSize="22" Margin="0 0 0 -5"></Label>
<TextBlock Grid.Row="1" FontSize="18" Margin="5 0 0 5" VerticalAlignment="Center">
<TextBlock Text="Balance:"></TextBlock>
<TextBlock Text="{Binding DetailViewBalanceLabel}" Foreground="{Binding DetailViewBalanceLabel, Converter={StaticResource AmountToColorConverter}}"></TextBlock>
<TextBlock Text="€" Foreground="{Binding DetailViewBalanceLabel, Converter={StaticResource AmountToColorConverter}}"></TextBlock>
</TextBlock>
<ListView Name="TransactionHistoryListView" Grid.Row="2" ItemsSource="{Binding TransactionHistoryListViewItemSource}" SelectedItem="{Binding TransactionHistoryListViewSelectedItem}" HorizontalContentAlignment="Stretch" MouseDoubleClick="TransactionHistoryListView_OnMouseDoubleClick" SelectionMode="Single">
<ListView.View>
<GridView>
<GridView.ColumnHeaderContainerStyle>
<Style TargetType="{x:Type GridViewColumnHeader}">
<Setter Property="IsEnabled" Value="False"/>
</Style>
</GridView.ColumnHeaderContainerStyle>
<GridViewColumn DisplayMemberBinding="{Binding Time, StringFormat='{}{0:MMM. yyyy}'}" Width="80" Header="Date" />
<GridViewColumn Width="80" Header="Amount">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock TextAlignment="Right" Foreground="{Binding SignedAmount, Converter={StaticResource AmountToColorConverter}}" Text="{Binding SignedAmount, StringFormat='{}{0:N} €'}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn DisplayMemberBinding="{Binding Description}" Width="340" Header="Description" />
</GridView>
</ListView.View>
<ListBox.Resources>
<ContextMenu x:Key="TransactionHistoryListViewContextMenu">
<MenuItem Header="Delete Transaction" Command="{Binding DeleteTransactionContextMenuCommand}" CommandParameter="{Binding Path=SelectedItem}" />
<Separator></Separator>
<MenuItem Header="Add _Charge" Command="{Binding AddChargeContextMenuCommand}" />
<MenuItem Header="Add _Deposit" Command="{Binding AddDepositContextMenuCommand}" />
</ContextMenu>
</ListBox.Resources>
<ListBox.ContextMenu>
<StaticResource ResourceKey="TransactionHistoryListViewContextMenu" />
</ListBox.ContextMenu>
</ListView>
</Grid>
</Grid>
</Grid>
</Window>