Added icon.

Started to implement costs.
This commit is contained in:
Tobias Erbshäußer
2020-06-16 10:52:05 +02:00
parent 3f97fbfae4
commit 1e21078d3f
25 changed files with 535 additions and 23 deletions
+90
View File
@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
sodipodi:docname="logo.svg"
inkscape:version="1.0 (4035a4fb49, 2020-05-01)"
id="svg1058"
version="1.1"
viewBox="0 0 55.562498 78.581248"
height="512"
width="512">
<defs
id="defs1052">
<linearGradient
id="linearGradient1664"
inkscape:collect="always">
<stop
id="stop1660"
offset="0"
style="stop-color:#1c71d8;stop-opacity:1"/>
<stop
id="stop1662"
offset="1"
style="stop-color:#ffffff;stop-opacity:1"/>
</linearGradient>
<linearGradient
y2="-93.913315"
x2="29.710697"
y1="77.178017"
x1="29.710697"
gradientUnits="userSpaceOnUse"
id="linearGradient1668"
xlink:href="#linearGradient1664"
inkscape:collect="always"/>
</defs>
<sodipodi:namedview
inkscape:window-maximized="1"
inkscape:window-y="-8"
inkscape:window-x="-8"
inkscape:window-height="1017"
inkscape:window-width="1920"
units="px"
showgrid="false"
inkscape:document-rotation="0"
inkscape:current-layer="layer1"
inkscape:document-units="mm"
inkscape:cy="277.99481"
inkscape:cx="273.18446"
inkscape:zoom="0.35"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
borderopacity="1.0"
bordercolor="#666666"
pagecolor="#ffffff"
id="base"/>
<metadata
id="metadata1055">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:groupmode="layer"
inkscape:label="Ebene 1">
<rect
ry="5.271265"
y="1.53479"
x="-9.9745846"
height="75.511665"
width="75.511665"
id="rect1637"
style="fill:url(#linearGradient1668);fill-opacity:1;stroke-width:0.112041;stroke-miterlimit:4;stroke-dasharray:none"/>
<path
style="stroke-width:0.116596;stroke-miterlimit:4;stroke-dasharray:none;fill:#ffffff"
d="M 26.92595,26.232268 6.2781497,44.63259 v 19.859261 a 1.7918576,1.9387893 0 0 0 1.791858,1.938789 L 20.61973,66.3955 a 1.7918576,1.9387893 0 0 0 1.7829,-1.93879 V 52.859115 a 1.7918576,1.9387893 0 0 1 1.791857,-1.938789 h 7.167431 a 1.7918576,1.9387893 0 0 1 1.791857,1.938789 v 11.589114 a 1.7918576,1.9387893 0 0 0 1.791858,1.944848 l 12.545243,0.03757 a 1.7918576,1.9387893 0 0 0 1.791858,-1.938789 V 44.619261 L 28.639414,26.232268 a 1.3651715,1.4771151 0 0 0 -1.713464,0 z M 59.541118,38.73867 50.178662,30.388547 V 13.604692 A 1.3438932,1.454092 0 0 0 48.834769,12.1506 h -6.271501 a 1.3438932,1.454092 0 0 0 -1.343893,1.454092 v 8.798467 l -10.026564,-8.9257 a 5.3755728,5.8163679 0 0 0 -6.831457,0 L -3.9869543,38.73867 a 1.3438932,1.454092 0 0 0 -0.179186,2.047847 l 2.855773,3.756404 a 1.3438932,1.454092 0 0 0 1.89376899,0.197514 L 26.92595,21.264121 a 1.3651715,1.4771151 0 0 1 1.713464,0 l 26.343667,23.476314 a 1.3438932,1.454092 0 0 0 1.892649,-0.193878 l 2.855773,-3.756405 A 1.3438932,1.454092 0 0 0 59.541118,38.73867 Z"
id="path1033"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.1 KiB

+37
View File
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--This file is NOT compatible with Silverlight-->
<Viewbox xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Stretch="Uniform">
<Canvas Name="svg1058" Width="55.562498" Height="78.581248">
<Canvas.RenderTransform>
<TranslateTransform X="0" Y="0"/>
</Canvas.RenderTransform>
<Canvas.Resources>
<LinearGradientBrush xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Key="linearGradient1664" MappingMode="RelativeToBoundingBox" StartPoint="0,0" EndPoint="1,1">
<LinearGradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="#FF1C71D8" Offset="0"/>
<GradientStop Color="#FFFFFFFF" Offset="1"/>
</GradientStopCollection>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
<LinearGradientBrush xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Key="linearGradient1668" MappingMode="Absolute" StartPoint="40,76" EndPoint="40,-95">
<LinearGradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="#FF1C71D8" Offset="0"/>
<GradientStop Color="#FFFFFFFF" Offset="1"/>
</GradientStopCollection>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Canvas.Resources>
<!--Unknown tag: sodipodi:namedview-->
<!--Unknown tag: metadata-->
<Canvas Name="layer1">
<Rectangle xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Canvas.Left="-9.9745846" Canvas.Top="1.53479" Width="75.511665" Height="75.511665" RadiusY="5.271265" RadiusX="5.271265" Name="rect1637" Fill="{StaticResource linearGradient1668}" StrokeThickness="0.112041" StrokeMiterLimit="4"/>
<Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path1033" Fill="#FFFFFFFF" StrokeThickness="0.116596" StrokeMiterLimit="4">
<Path.Data>
<PathGeometry Figures="M 26.92595 26.232268 6.2781497 44.63259 v 19.859261 a 1.7918576 1.9387893 0 0 0 1.791858 1.938789 L 20.61973 66.3955 a 1.7918576 1.9387893 0 0 0 1.7829 -1.93879 V 52.859115 a 1.7918576 1.9387893 0 0 1 1.791857 -1.938789 h 7.167431 a 1.7918576 1.9387893 0 0 1 1.791857 1.938789 v 11.589114 a 1.7918576 1.9387893 0 0 0 1.791858 1.944848 l 12.545243 0.03757 a 1.7918576 1.9387893 0 0 0 1.791858 -1.938789 V 44.619261 L 28.639414 26.232268 a 1.3651715 1.4771151 0 0 0 -1.713464 0 z M 59.541118 38.73867 50.178662 30.388547 V 13.604692 A 1.3438932 1.454092 0 0 0 48.834769 12.1506 h -6.271501 a 1.3438932 1.454092 0 0 0 -1.343893 1.454092 v 8.798467 l -10.026564 -8.9257 a 5.3755728 5.8163679 0 0 0 -6.831457 0 L -3.9869543 38.73867 a 1.3438932 1.454092 0 0 0 -0.179186 2.047847 l 2.855773 3.756404 a 1.3438932 1.454092 0 0 0 1.89376899 0.197514 L 26.92595 21.264121 a 1.3651715 1.4771151 0 0 1 1.713464 0 l 26.343667 23.476314 a 1.3438932 1.454092 0 0 0 1.892649 -0.193878 l 2.855773 -3.756405 A 1.3438932 1.454092 0 0 0 59.541118 38.73867 Z" FillRule="NonZero"/>
</Path.Data>
</Path>
</Canvas>
</Canvas>
</Viewbox>
+3 -1
View File
@@ -11,7 +11,8 @@
Height="600"
MinWidth="600"
MinHeight="400"
Closed="OnClosed">
Closed="OnClosed"
Icon="logo.ico">
<DockPanel>
<Frame Name="SideBarFrame"
@@ -39,6 +40,7 @@
</TabItem>
<TabItem Visibility="Collapsed">
<Frame Source="Pages/CostsPage.xaml"
LoadCompleted="OnCostsFrameLoadCompleted"
Focusable="False" />
</TabItem>
<TabItem Visibility="Collapsed">
+9
View File
@@ -57,5 +57,14 @@ namespace UCalc
page.House = Model.Root.House;
page.ParentWindow = this;
}
private void OnCostsFrameLoadCompleted(object sender, NavigationEventArgs e)
{
var page = (CostsPage) ((Frame) sender).Content;
page.Model = Model;
page.Costs = Model.Root.Costs;
page.House = Model.Root.House;
page.ParentWindow = this;
}
}
}
+20
View File
@@ -113,4 +113,24 @@ namespace UCalc.Controls
return null;
}
}
public class NameToTextConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var str = (string) value;
if (str == "")
{
return "(Unbenannt)";
}
return str;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new InvalidOperationException();
}
}
}
+60
View File
@@ -0,0 +1,60 @@
<Window x:Class="UCalc.CostWindow"
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:UCalc"
xmlns:controls="clr-namespace:UCalc.Controls"
mc:Ignorable="d"
Title="Kostenpunkt bearbeiten"
Width="500"
Height="600"
MinWidth="400"
MinHeight="190"
WindowStartupLocation="CenterOwner"
ShowInTaskbar="False"
Icon="logo.ico">
<DockPanel>
<StackPanel DockPanel.Dock="Bottom">
<Separator Margin="0, 12, 0, 0"
Background="{x:Static local:Constants.SubMainColor}" />
<DockPanel LastChildFill="False">
<Button DockPanel.Dock="Right"
MinWidth="100"
MinHeight="24"
Margin="12"
Content="OK"
Click="OnOkClick" />
</DockPanel>
</StackPanel>
<ScrollViewer HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Auto">
<StackPanel>
<controls:SectionHeader Header="Allgemeine Informationen" />
<DockPanel Margin="12, 8, 12, 0">
<Label DockPanel.Dock="Left"
Content="Name:"
Width="180"
Foreground="{x:Static local:Constants.SubMainColor}" />
<controls:ErrorIcon Margin="12, 0, 0, 0"
DockPanel.Dock="Right"
VerticalAlignment="Center"
Property="{Binding Path=Cost.Name, RelativeSource={RelativeSource AncestorType=local:CostWindow}}" />
<TextBox
VerticalAlignment="Center"
MinHeight="22"
Text="{Binding Path=Cost.Name.Value, RelativeSource={RelativeSource AncestorType=local:CostWindow}, UpdateSourceTrigger=PropertyChanged}" />
</DockPanel>
</StackPanel>
</ScrollViewer>
</DockPanel>
</Window>
+26
View File
@@ -0,0 +1,26 @@
using System.Windows;
using UCalc.Models;
namespace UCalc
{
public partial class CostWindow
{
public Model Model { get; }
public CostProperty Cost { get; }
public HouseProperty House { get; }
public CostWindow(Model model, CostProperty cost, HouseProperty house)
{
Model = model;
Cost = cost;
House = house;
InitializeComponent();
}
private void OnOkClick(object sender, RoutedEventArgs e)
{
Close();
}
}
}
+2 -1
View File
@@ -12,7 +12,8 @@
MinWidth="400"
MinHeight="190"
WindowStartupLocation="CenterOwner"
ShowInTaskbar="False">
ShowInTaskbar="False"
Icon="logo.ico">
<DockPanel>
<StackPanel DockPanel.Dock="Bottom">
+55 -5
View File
@@ -9,10 +9,13 @@
Height="400"
Width="500"
WindowStartupLocation="CenterScreen"
ResizeMode="CanMinimize">
ResizeMode="CanMinimize"
Icon="logo.ico">
<Grid>
<Viewbox Grid.Row="0" Grid.Column="0" Stretch="Fill">
<Viewbox Grid.Row="0"
Grid.Column="0"
Stretch="Fill">
<Canvas Width="100" Height="100">
<Canvas.RenderTransform>
<TranslateTransform X="0" Y="0" />
@@ -33,7 +36,54 @@
</Canvas>
</Viewbox>
<StackPanel Grid.Row="0" Grid.Column="0" Margin="100, 180, 100, 0">
<Viewbox Grid.Row="0"
Grid.Column="0"
Stretch="Uniform"
Width="100"
Height="100"
Margin="0, 0, 0, 200">
<Canvas Width="55.562498" Height="78.581248">
<Canvas.RenderTransform>
<TranslateTransform X="0" Y="0" />
</Canvas.RenderTransform>
<Canvas.Resources>
<LinearGradientBrush x:Key="LinearGradient1664" MappingMode="RelativeToBoundingBox"
StartPoint="0,0" EndPoint="1,1">
<LinearGradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="#FF1C71D8" Offset="0" />
<GradientStop Color="#FFFFFFFF" Offset="1" />
</GradientStopCollection>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
<LinearGradientBrush x:Key="LinearGradient1668" MappingMode="Absolute" StartPoint="40,76"
EndPoint="40,-95">
<LinearGradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="#FF1C71D8" Offset="0" />
<GradientStop Color="#FFFFFFFF" Offset="1" />
</GradientStopCollection>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Canvas.Resources>
<Canvas>
<Rectangle Canvas.Left="-9.9745846"
Canvas.Top="1.53479" Width="75.511665" Height="75.511665" RadiusY="5.271265"
RadiusX="5.271265" Fill="{StaticResource LinearGradient1668}"
StrokeThickness="0.112041" StrokeMiterLimit="4" />
<Path Fill="#FFFFFFFF"
StrokeThickness="0.116596" StrokeMiterLimit="4">
<Path.Data>
<PathGeometry
Figures="M 26.92595 26.232268 6.2781497 44.63259 v 19.859261 a 1.7918576 1.9387893 0 0 0 1.791858 1.938789 L 20.61973 66.3955 a 1.7918576 1.9387893 0 0 0 1.7829 -1.93879 V 52.859115 a 1.7918576 1.9387893 0 0 1 1.791857 -1.938789 h 7.167431 a 1.7918576 1.9387893 0 0 1 1.791857 1.938789 v 11.589114 a 1.7918576 1.9387893 0 0 0 1.791858 1.944848 l 12.545243 0.03757 a 1.7918576 1.9387893 0 0 0 1.791858 -1.938789 V 44.619261 L 28.639414 26.232268 a 1.3651715 1.4771151 0 0 0 -1.713464 0 z M 59.541118 38.73867 50.178662 30.388547 V 13.604692 A 1.3438932 1.454092 0 0 0 48.834769 12.1506 h -6.271501 a 1.3438932 1.454092 0 0 0 -1.343893 1.454092 v 8.798467 l -10.026564 -8.9257 a 5.3755728 5.8163679 0 0 0 -6.831457 0 L -3.9869543 38.73867 a 1.3438932 1.454092 0 0 0 -0.179186 2.047847 l 2.855773 3.756404 a 1.3438932 1.454092 0 0 0 1.89376899 0.197514 L 26.92595 21.264121 a 1.3651715 1.4771151 0 0 1 1.713464 0 l 26.343667 23.476314 a 1.3438932 1.454092 0 0 0 1.892649 -0.193878 l 2.855773 -3.756405 A 1.3438932 1.454092 0 0 0 59.541118 38.73867 Z"
FillRule="NonZero" />
</Path.Data>
</Path>
</Canvas>
</Canvas>
</Viewbox>
<StackPanel Grid.Row="0" Grid.Column="0" Margin="100, 220, 100, 0">
<Button MinHeight="40"
Margin="0, 0, 0, 12"
@@ -55,7 +105,7 @@
</Canvas>
</Viewbox>
<Label Content="Neue Abrechnung anlegen"/>
<Label Content="Neue Abrechnung anlegen" />
</DockPanel>
</Button>
@@ -79,7 +129,7 @@
</Canvas>
</Viewbox>
<Label Content="Abrechnung öffnen"/>
<Label Content="Abrechnung öffnen" />
</DockPanel>
<Button.ContextMenu>
+2 -3
View File
@@ -8,9 +8,7 @@ namespace UCalc.Models
public LandlordProperty Landlord { get; }
public HouseProperty House { get; }
public TenantsProperty Tenants { get; }
// TODO: Costs
public CostsProperty Costs { get; }
public BillingProperty(Model model, Property parent, Billing data) : base(model, parent)
{
@@ -24,6 +22,7 @@ namespace UCalc.Models
}
Tenants = Add(new TenantsProperty(model, this, data.Tenants, flatToProperty));
Costs = Add(new CostsProperty(model, this, data.Costs, flatToProperty));
}
}
}
+29
View File
@@ -0,0 +1,29 @@
using System.Collections.Generic;
using UCalc.Data;
namespace UCalc.Models
{
public class CostProperty : NestedProperty
{
public NotEmptyStringProperty Name { get; }
public AlwaysValidProperty<int> Division { get; }
public AlwaysValidProperty<bool> AffectsAll { get; }
public AlwaysValidProperty<bool> IncludeUnrented { get; }
// TODO: public HashSet<Flat> AffectedFlats { get; }
// TODO: public List<CostEntry> Entries { get; }
public AlwaysValidProperty<bool> DisplayInBill { get; }
public CostProperty(Model model, Property parent, Cost cost,
IReadOnlyDictionary<Flat, FlatProperty> flatToProperty = null) : base(model, parent)
{
Name = Add(new NotEmptyStringProperty(model, this, "Name", cost.Name));
Division = Add(new AlwaysValidProperty<int>(model, this, "Aufteilung", (int) cost.Division));
AffectsAll = Add(new AlwaysValidProperty<bool>(model, this, "Betrifft alle", cost.AffectsAll));
IncludeUnrented =
Add(new AlwaysValidProperty<bool>(model, this, "Unvermietete einbeziehen", cost.IncludeUnrented));
DisplayInBill = Add(new AlwaysValidProperty<bool>(model, this, "In Rechnung anzeigen", cost.DisplayInBill));
}
}
}
+38
View File
@@ -0,0 +1,38 @@
using System.Collections.Generic;
using UCalc.Data;
namespace UCalc.Models
{
public class CostsProperty : MultiProperty<CostProperty>
{
public CostsProperty(Model model, Property parent, IEnumerable<Cost> data,
IReadOnlyDictionary<Flat, FlatProperty> flatToProperty = null) : base(model, parent,
"Kosten: Geben Sie einen oder mehr Kostenpunkte an.")
{
using var validator = Model.BeginValidation();
foreach (var cost in data)
{
base.Add(new CostProperty(Model, this, cost, flatToProperty));
}
Modified = false;
}
public CostProperty Add()
{
using var validator = Model.BeginValidation();
var cost = new CostProperty(Model, this, new Cost());
base.Add(cost);
return cost;
}
public new void Remove(CostProperty cost)
{
using var validator = Model.BeginValidation();
base.Remove(cost);
}
}
}
+3 -1
View File
@@ -19,7 +19,7 @@ namespace UCalc.Models
Modified = false;
}
public void Add()
public FlatProperty Add()
{
FlatProperty flat;
{
@@ -33,6 +33,8 @@ namespace UCalc.Models
using var validator = Model.BeginValidation();
validator.Validate(flat);
}
return flat;
}
public new void Remove(FlatProperty flat)
+4 -2
View File
@@ -20,11 +20,13 @@ namespace UCalc.Models
Modified = false;
}
public void Add()
public TenantProperty Add()
{
using var validator = Model.BeginValidation();
base.Add(new TenantProperty(Model, this, new Tenant()));
var tenant = new TenantProperty(Model, this, new Tenant());
base.Add(tenant);
return tenant;
}
public new void Remove(TenantProperty tenant)
+2 -1
View File
@@ -10,7 +10,8 @@
ShowInTaskbar="False"
ResizeMode="NoResize"
WindowStartupLocation="CenterOwner"
PreviewMouseUp="OnPreviewMouseUp">
PreviewMouseUp="OnPreviewMouseUp"
Icon="logo.ico">
<!-- TODO: Wrap in scroll to handle small screens! -->
+94 -2
View File
@@ -3,7 +3,99 @@
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:UCalc.Pages"
xmlns:controls="clr-namespace:UCalc.Controls"
xmlns:local="clr-namespace:UCalc"
xmlns:pages="clr-namespace:UCalc.Pages"
mc:Ignorable="d">
<Grid />
<Page.Resources>
<controls:EmptyMultiPropertyToVisibilityConverter x:Key="EmptyMultiPropertyToVisibilityConverter" />
<controls:NameToTextConverter x:Key="NameToTextConverter" />
</Page.Resources>
<DockPanel>
<DockPanel DockPanel.Dock="Top"
Margin="0, 0, 0, 8">
<controls:ErrorIcon Margin="0, 0, 12, 0"
DockPanel.Dock="Right"
VerticalAlignment="Center"
Property="{Binding Path=Costs, RelativeSource={RelativeSource AncestorType=pages:CostsPage}}"
Visibility="{Binding Path=Costs.Count, RelativeSource={RelativeSource AncestorType=pages:CostsPage}, Converter={StaticResource EmptyMultiPropertyToVisibilityConverter}}" />
<controls:HighlightButton Margin="12, 0, 12, 0"
HighlightForeground="{x:Static local:Constants.SubMainColor}"
HighlightBackground="{x:Static local:Constants.MainColor}"
Click="OnAddCostClick">
<Viewbox Width="24"
Height="24"
Margin="12, 12, 6, 12"
Stretch="Uniform">
<Canvas Width="512" Height="512">
<Canvas.RenderTransform>
<TranslateTransform X="0" Y="0" />
</Canvas.RenderTransform>
<Path>
<Path.Data>
<PathGeometry
Figures="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm144 276c0 6.6-5.4 12-12 12h-92v92c0 6.6-5.4 12-12 12h-56c-6.6 0-12-5.4-12-12v-92h-92c-6.6 0-12-5.4-12-12v-56c0-6.6 5.4-12 12-12h92v-92c0-6.6 5.4-12 12-12h56c6.6 0 12 5.4 12 12v92h92c6.6 0 12 5.4 12 12v56z"
FillRule="NonZero" />
</Path.Data>
</Path>
</Canvas>
</Viewbox>
<Label Content="Kostenpunkt hinzufügen"
Margin="0, 12, 12, 12" />
</controls:HighlightButton>
</DockPanel>
<ScrollViewer HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Auto">
<ItemsControl
ItemsSource="{Binding Path=Costs, RelativeSource={RelativeSource AncestorType=pages:CostsPage}}"
Margin="12, 0, 12, 12">
<ItemsControl.ItemTemplate>
<DataTemplate>
<DockPanel>
<controls:HighlightButton DockPanel.Dock="Right"
HighlightForeground="Red"
HighlightBackground="White"
Click="OnCostDeleteClick">
<Viewbox Width="24"
Height="24"
Margin="8, 12, 8, 12"
Stretch="Uniform">
<Canvas Width="448" Height="512">
<Canvas.RenderTransform>
<TranslateTransform X="0" Y="0" />
</Canvas.RenderTransform>
<Path>
<Path.Data>
<PathGeometry
Figures="M32 464a48 48 0 0 0 48 48h288a48 48 0 0 0 48-48V128H32zm272-256a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zM432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16z"
FillRule="NonZero" />
</Path.Data>
</Path>
</Canvas>
</Viewbox>
</controls:HighlightButton>
<controls:HighlightButton HighlightForeground="{x:Static local:Constants.SubMainColor}"
HighlightBackground="{x:Static local:Constants.MainColor}"
Click="OnCostEditClick">
<controls:ErrorIcon Property="{Binding .}"
DockPanel.Dock="Left"
Margin="12, 12, 8, 12" />
<Label Content="{Binding Path=Name.Value, Converter={StaticResource NameToTextConverter}}"
VerticalAlignment="Center" />
</controls:HighlightButton>
</DockPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</DockPanel>
</Page>
+33 -2
View File
@@ -1,12 +1,43 @@
using System.Windows.Controls;
using System.Windows;
using UCalc.Controls;
using UCalc.Models;
namespace UCalc.Pages
{
public partial class CostsPage : Page
public partial class CostsPage
{
public Window ParentWindow { get; set; }
public Model Model { get; set; }
public CostsProperty Costs { get; set; }
public HouseProperty House { get; set; }
public CostsPage()
{
InitializeComponent();
}
private void OnAddCostClick(object sender, RoutedEventArgs e)
{
var cost = Costs.Add();
new CostWindow(Model, cost, House) {Owner = ParentWindow}.ShowDialog();
}
private void OnCostDeleteClick(object sender, RoutedEventArgs e)
{
var cost = (CostProperty) ((HighlightButton) sender).DataContext;
if (MessageBox.Show($"Möchten Sie den Kostenpunkt \"{cost.Name.Value}\" wirlick löschen?", "Löschen?",
MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
{
Costs.Remove(cost);
}
}
private void OnCostEditClick(object sender, RoutedEventArgs e)
{
var cost = (CostProperty) ((HighlightButton) sender).DataContext;
new CostWindow(Model, cost, House) {Owner = ParentWindow}.ShowDialog();
}
}
}
+2 -1
View File
@@ -10,6 +10,7 @@
<Page.Resources>
<controls:EmptyMultiPropertyToVisibilityConverter x:Key="EmptyMultiPropertyToVisibilityConverter" />
<controls:NameToTextConverter x:Key="NameToTextConverter" />
</Page.Resources>
<ScrollViewer HorizontalScrollBarVisibility="Disabled"
@@ -159,7 +160,7 @@
DockPanel.Dock="Left"
Margin="12, 12, 8, 12" />
<Label Content="{Binding Name.Value}"
<Label Content="{Binding Path=Name.Value, Converter={StaticResource NameToTextConverter}}"
VerticalAlignment="Center" />
</controls:HighlightButton>
</DockPanel>
+3 -1
View File
@@ -16,7 +16,9 @@ namespace UCalc.Pages
private void OnAddFlatClick(object sender, RoutedEventArgs e)
{
House.Flats.Add();
var flat = House.Flats.Add();
new FlatWindow(flat) {Owner = ParentWindow}.ShowDialog();
}
private void OnFlatDeleteClick(object sender, RoutedEventArgs e)
+5
View File
@@ -227,6 +227,11 @@
</Canvas>
</Viewbox>
<controls:ErrorCounter DockPanel.Dock="Right"
Margin="0, 12, 12, 12"
VerticalAlignment="Center"
Property="{Binding Path=Model.Root.Costs, RelativeSource={RelativeSource AncestorType=pages:SideBar}}"/>
<Label Content="Kosten"
Margin="0, 12, 12, 12"
VerticalAlignment="Center"
+2 -1
View File
@@ -10,6 +10,7 @@
<Page.Resources>
<controls:EmptyMultiPropertyToVisibilityConverter x:Key="EmptyMultiPropertyToVisibilityConverter" />
<controls:NameToTextConverter x:Key="NameToTextConverter" />
</Page.Resources>
<DockPanel>
@@ -87,7 +88,7 @@
DockPanel.Dock="Left"
Margin="12, 12, 8, 12" />
<Label Content="{Binding Name.Value}"
<Label Content="{Binding Path=Name.Value, Converter={StaticResource NameToTextConverter}}"
VerticalAlignment="Center" />
</controls:HighlightButton>
</DockPanel>
+3 -1
View File
@@ -18,7 +18,9 @@ namespace UCalc.Pages
private void OnAddTenantClick(object sender, RoutedEventArgs e)
{
Tenants.Add();
var tenant = Tenants.Add();
new TenantWindow(Model, tenant, House) {Owner = ParentWindow}.ShowDialog();
}
private void OnTenantDeleteClick(object sender, RoutedEventArgs e)
+2 -1
View File
@@ -12,7 +12,8 @@
MinWidth="400"
MinHeight="190"
WindowStartupLocation="CenterOwner"
ShowInTaskbar="False">
ShowInTaskbar="False"
Icon="logo.ico">
<Window.Resources>
<controls:FlatToRentedConverter x:Key="FlatToRentedConverter" />
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

+11
View File
@@ -43,6 +43,9 @@
<Page Update="TenantWindow.xaml">
<Generator></Generator>
</Page>
<Page Update="CostWindow.xaml">
<Generator></Generator>
</Page>
</ItemGroup>
<ItemGroup>
@@ -82,6 +85,14 @@
<Compile Update="TenantWindow.xaml.cs">
<DependentUpon>TenantWindow.xaml</DependentUpon>
</Compile>
<Compile Update="CostWindow.xaml.cs">
<DependentUpon>CostWindow.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<None Remove="logo.ico"/>
<Resource Include="logo.ico"/>
</ItemGroup>
</Project>