Implemented page switching with side bar buttons.

This commit is contained in:
Tobias Erbshäußer
2020-06-10 10:30:14 +02:00
parent 6b03c881a3
commit 0300090806
24 changed files with 762 additions and 21 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ namespace UCalc
public App()
{
_recentlyOpenedList = new RecentlyOpenedList();
_recentlyOpenedList = new RecentlyOpenedList("recently.txt");
}
}
}
+33 -2
View File
@@ -5,6 +5,37 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:UCalc"
mc:Ignorable="d"
Title="BillingWindow" Height="450" Width="800">
<Grid />
Title="MietRechner"
Width="800"
Height="600"
MinWidth="600"
MinHeight="400"
Closed="OnClosed">
<DockPanel>
<Frame Name="SideBarFrame"
Source="Pages/SideBar.xaml"
Width="240"
LoadCompleted="OnSideBarFrameLoadCompleted"/>
<TabControl Name="TabControl"
BorderBrush="White">
<TabItem Visibility="Collapsed">
<Frame Source="Pages/LandlordPage.xaml"/>
</TabItem>
<TabItem Visibility="Collapsed">
<Frame Source="Pages/HousePage.xaml"/>
</TabItem>
<TabItem Visibility="Collapsed">
<Frame Source="Pages/TenantsPage.xaml"/>
</TabItem>
<TabItem Visibility="Collapsed">
<Frame Source="Pages/CostsPage.xaml"/>
</TabItem>
<TabItem Visibility="Collapsed">
<Frame Source="Pages/DetailsPage.xaml"/>
</TabItem>
</TabControl>
</DockPanel>
</Window>
+20 -1
View File
@@ -1,4 +1,8 @@
using UCalc.Data;
using System;
using System.Windows;
using System.Windows.Navigation;
using UCalc.Data;
using UCalc.Pages;
namespace UCalc
{
@@ -12,6 +16,21 @@ namespace UCalc
_savedBilling = savedBilling;
Billing = billing;
InitializeComponent();
Title =
$"MietRechner - Abrechnung von {billing.StartDate.ToShortDateString()} - {billing.EndDate.Date.ToShortDateString()}";
}
private void OnClosed(object sender, EventArgs e)
{
Application.Current.MainWindow?.Show();
}
private void OnSideBarFrameLoadCompleted(object sender, NavigationEventArgs e)
{
var sideBar = (SideBar) SideBarFrame.Content;
sideBar.TabControl = TabControl;
sideBar.LandlordButton.Selected = true;
}
}
}
+9
View File
@@ -0,0 +1,9 @@
<UserControl x:Class="UCalc.Controls.ErrorCounter"
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.Controls"
mc:Ignorable="d">
<Grid />
</UserControl>
+10
View File
@@ -0,0 +1,10 @@
namespace UCalc.Controls
{
public partial class ErrorCounter
{
public ErrorCounter()
{
InitializeComponent();
}
}
}
+30
View File
@@ -0,0 +1,30 @@
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Shapes;
namespace UCalc.Controls
{
public static class Helpers
{
public static IEnumerable<T> FindChildren<T>(this Panel parent) where T : FrameworkElement
{
foreach (var child in parent.Children)
{
if (child is T t)
{
yield return t;
}
}
}
public static void ChangeColor(this Viewbox viewbox, SolidColorBrush brush)
{
foreach (var path in ((Canvas) viewbox.Child).FindChildren<Path>())
{
path.Fill = brush;
}
}
}
}
+132
View File
@@ -0,0 +1,132 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Shapes;
namespace UCalc.Controls
{
public class HighlightButton : DockPanel
{
public static readonly RoutedEvent ClickEvent =
EventManager.RegisterRoutedEvent(nameof(Click), RoutingStrategy.Bubble, typeof(RoutedEventHandler),
typeof(HighlightButton));
public event RoutedEventHandler Click
{
add => AddHandler(ClickEvent, value);
remove => RemoveHandler(ClickEvent, value);
}
public SolidColorBrush HighlightForeground { get; set; }
public SolidColorBrush HighlightBackground { get; set; }
public bool Selectable { get; set; }
private bool _selected;
public bool Selected
{
get => _selected;
set
{
if (_selected && !value)
{
Unhighlight();
}
else if (value)
{
if (!_selected)
{
Highlight();
}
RaiseEvent(new RoutedEventArgs(ClickEvent));
}
_selected = value;
}
}
public HighlightButton()
{
HighlightForeground = Brushes.White;
HighlightBackground = Brushes.Black;
}
private void SetColors(SolidColorBrush foreground, SolidColorBrush background)
{
Background = background;
foreach (var child in Children)
{
switch (child)
{
case Label label:
label.Foreground = foreground;
break;
case Path path:
path.Fill = foreground;
break;
case Viewbox viewbox:
viewbox.ChangeColor(foreground);
break;
}
}
}
private void Highlight()
{
SetColors(HighlightBackground, HighlightForeground);
}
private void Unhighlight()
{
SetColors(HighlightForeground, HighlightBackground);
}
protected override void OnMouseEnter(MouseEventArgs e)
{
base.OnMouseEnter(e);
if (!Selected)
{
Highlight();
}
}
protected override void OnMouseLeave(MouseEventArgs e)
{
base.OnMouseLeave(e);
if (!Selected)
{
Unhighlight();
}
}
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
{
base.OnMouseLeftButtonUp(e);
if (Selectable)
{
Selected = true;
}
else
{
RaiseEvent(new RoutedEventArgs(ClickEvent));
}
}
protected override void OnInitialized(EventArgs e)
{
base.OnInitialized(e);
if (!Selected)
{
Highlight();
Unhighlight();
}
}
}
}
+18
View File
@@ -0,0 +1,18 @@
using System;
namespace UCalc.Data
{
public class BillingLoader
{
public Billing Load(string path)
{
// TODO
return new Billing();
}
public void Store(string path, Billing billing)
{
throw new NotImplementedException();
}
}
}
+45 -4
View File
@@ -1,6 +1,8 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace UCalc.Data
{
@@ -40,11 +42,43 @@ namespace UCalc.Data
public class RecentlyOpenedList : ICollection<RecentlyOpenedItem>
{
private const int MaxCount = 10;
private readonly string _path;
private readonly List<RecentlyOpenedItem> _list;
public RecentlyOpenedList()
public RecentlyOpenedList(string path)
{
_path = path;
_list = new List<RecentlyOpenedItem>();
Load(path);
}
private void Load(string path)
{
try
{
var lines = File.ReadAllLines(path);
_list.AddRange(lines.Where(itemPath => itemPath != "").Take(MaxCount)
.Select(itemPath => new RecentlyOpenedItem(itemPath)));
}
catch (IOException)
{
// Do nothing
}
}
private void Store(string path)
{
try
{
File.WriteAllLines(path, _list.Select(item => item.Path));
}
catch (IOException)
{
// Do nothing
}
}
public IEnumerator<RecentlyOpenedItem> GetEnumerator()
@@ -67,15 +101,19 @@ namespace UCalc.Data
_list.Insert(0, item);
if (_list.Count > 10)
if (_list.Count > MaxCount)
{
_list.RemoveAt(10);
_list.RemoveAt(MaxCount);
}
Store(_path);
}
public void Clear()
{
_list.Clear();
Store(_path);
}
public bool Contains(RecentlyOpenedItem item)
@@ -90,7 +128,10 @@ namespace UCalc.Data
public bool Remove(RecentlyOpenedItem item)
{
return _list.Remove(item);
var result = _list.Remove(item);
Store(_path);
return result;
}
public int Count => _list.Count;
+4 -6
View File
@@ -44,7 +44,7 @@
<Canvas.RenderTransform>
<TranslateTransform X="0" Y="0" />
</Canvas.RenderTransform>
<Path Fill="{x:Static local:Constants.SubMainColor}">
<Path Fill="Black">
<Path.Data>
<PathGeometry
Figures="M224 136V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zm160-14.1v6.1H256V0h6.1c6.4 0 12.5 2.5 17 7l97.9 98c4.5 4.5 7 10.6 7 16.9z"
@@ -54,8 +54,7 @@
</Canvas>
</Viewbox>
<Label Content="Neue Abrechnung anlegen"
Foreground="{x:Static local:Constants.SubMainColor}"/>
<Label Content="Neue Abrechnung anlegen"/>
</DockPanel>
</Button>
@@ -69,7 +68,7 @@
<Canvas.RenderTransform>
<TranslateTransform X="0" Y="0" />
</Canvas.RenderTransform>
<Path Fill="{x:Static local:Constants.SubMainColor}">
<Path Fill="Black">
<Path.Data>
<PathGeometry
Figures="M572.694 292.093L500.27 416.248A63.997 63.997 0 0 1 444.989 448H45.025c-18.523 0-30.064-20.093-20.731-36.093l72.424-124.155A64 64 0 0 1 152 256h399.964c18.523 0 30.064 20.093 20.73 36.093zM152 224h328v-48c0-26.51-21.49-48-48-48H272l-64-64H48C21.49 64 0 85.49 0 112v278.046l69.077-118.418C86.214 242.25 117.989 224 152 224z"
@@ -79,8 +78,7 @@
</Canvas>
</Viewbox>
<Label Content="Abrechnung öffnen"
Foreground="{x:Static local:Constants.SubMainColor}"/>
<Label Content="Abrechnung öffnen"/>
</DockPanel>
<Button.ContextMenu>
+21 -1
View File
@@ -1,9 +1,11 @@
using System;
using System.IO;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using Microsoft.Win32;
using UCalc.Data;
namespace UCalc
{
@@ -50,7 +52,7 @@ namespace UCalc
if (dialog.ShowDialog() == true)
{
throw new NotImplementedException();
OpenBilling(dialog.FileName);
}
if (e != null)
@@ -60,8 +62,26 @@ namespace UCalc
}
private void OnOpenRecentClick(object sender, RoutedEventArgs e)
{
var recentlyOpenedItem = (RecentlyOpenedItem) ((MenuItem) sender).DataContext;
OpenBilling(recentlyOpenedItem.Path);
}
private void OpenBilling(string path)
{
try
{
var billing = new BillingLoader().Load(path);
App.RecentlyOpenedList.Add(new RecentlyOpenedItem(path));
new BillingWindow(billing, billing.Clone()).Show();
Hide();
}
catch (IOException)
{
throw new NotImplementedException();
}
}
}
}
+9
View File
@@ -0,0 +1,9 @@
<Page x:Class="UCalc.Pages.CostsPage"
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.Pages"
mc:Ignorable="d">
<Grid />
</Page>
+12
View File
@@ -0,0 +1,12 @@
using System.Windows.Controls;
namespace UCalc.Pages
{
public partial class CostsPage : Page
{
public CostsPage()
{
InitializeComponent();
}
}
}
+9
View File
@@ -0,0 +1,9 @@
<Page x:Class="UCalc.Pages.DetailsPage"
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.Pages"
mc:Ignorable="d">
<Grid />
</Page>
+12
View File
@@ -0,0 +1,12 @@
using System.Windows.Controls;
namespace UCalc.Pages
{
public partial class DetailsPage : Page
{
public DetailsPage()
{
InitializeComponent();
}
}
}
+9
View File
@@ -0,0 +1,9 @@
<Page x:Class="UCalc.Pages.HousePage"
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.Pages"
mc:Ignorable="d">
<Grid />
</Page>
+10
View File
@@ -0,0 +1,10 @@
namespace UCalc.Pages
{
public partial class HousePage
{
public HousePage()
{
InitializeComponent();
}
}
}
+9
View File
@@ -0,0 +1,9 @@
<Page x:Class="UCalc.Pages.LandlordPage"
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.Pages"
mc:Ignorable="d">
<Grid />
</Page>
+12
View File
@@ -0,0 +1,12 @@
using System.Windows.Controls;
namespace UCalc.Pages
{
public partial class LandlordPage : Page
{
public LandlordPage()
{
InitializeComponent();
}
}
}
+253
View File
@@ -0,0 +1,253 @@
<Page x:Class="UCalc.Pages.SideBar"
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"
Background="{x:Static local:Constants.SubMainColor}">
<StackPanel>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<controls:HighlightButton HighlightForeground="{x:Static local:Constants.MainColor}"
HighlightBackground="{x:Static local:Constants.SubMainColor}"
Grid.Row="0"
Grid.Column="0"
ToolTip="Speichern">
<Viewbox Width="24"
Height="24"
Margin="8"
Stretch="Uniform">
<Canvas Width="448" Height="512">
<Canvas.RenderTransform>
<TranslateTransform X="0" Y="0" />
</Canvas.RenderTransform>
<Path>
<Path.Data>
<PathGeometry
Figures="M433.941 129.941l-83.882-83.882A48 48 0 0 0 316.118 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V163.882a48 48 0 0 0-14.059-33.941zM224 416c-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64s64 28.654 64 64c0 35.346-28.654 64-64 64zm96-304.52V212c0 6.627-5.373 12-12 12H76c-6.627 0-12-5.373-12-12V108c0-6.627 5.373-12 12-12h228.52c3.183 0 6.235 1.264 8.485 3.515l3.48 3.48A11.996 11.996 0 0 1 320 111.48z"
FillRule="NonZero" />
</Path.Data>
</Path>
</Canvas>
</Viewbox>
</controls:HighlightButton>
<controls:HighlightButton HighlightForeground="{x:Static local:Constants.MainColor}"
HighlightBackground="{x:Static local:Constants.SubMainColor}"
Grid.Row="0"
Grid.Column="1"
ToolTip="Drucken">
<Viewbox Width="24"
Height="24"
Margin="8"
Stretch="Uniform">
<Canvas Width="512" Height="512">
<Canvas.RenderTransform>
<TranslateTransform X="0" Y="0" />
</Canvas.RenderTransform>
<Path>
<Path.Data>
<PathGeometry
Figures="M448 192V77.25c0-8.49-3.37-16.62-9.37-22.63L393.37 9.37c-6-6-14.14-9.37-22.63-9.37H96C78.33 0 64 14.33 64 32v160c-35.35 0-64 28.65-64 64v112c0 8.84 7.16 16 16 16h48v96c0 17.67 14.33 32 32 32h320c17.67 0 32-14.33 32-32v-96h48c8.84 0 16-7.16 16-16V256c0-35.35-28.65-64-64-64zm-64 256H128v-96h256v96zm0-224H128V64h192v48c0 8.84 7.16 16 16 16h48v96zm48 72c-13.25 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24z"
FillRule="NonZero" />
</Path.Data>
</Path>
</Canvas>
</Viewbox>
</controls:HighlightButton>
<controls:HighlightButton HighlightForeground="{x:Static local:Constants.MainColor}"
HighlightBackground="{x:Static local:Constants.SubMainColor}"
Grid.Row="0"
Grid.Column="2"
ToolTip="Über MietRechner">
<Viewbox Width="24"
Height="24"
Margin="8"
Stretch="Uniform">
<Canvas Width="512" Height="512">
<Canvas.RenderTransform>
<TranslateTransform X="0" Y="0" />
</Canvas.RenderTransform>
<Path>
<Path.Data>
<PathGeometry
Figures="M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 110c23.196 0 42 18.804 42 42s-18.804 42-42 42-42-18.804-42-42 18.804-42 42-42zm56 254c0 6.627-5.373 12-12 12h-88c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h12v-64h-12c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h64c6.627 0 12 5.373 12 12v100h12c6.627 0 12 5.373 12 12v24z"
FillRule="NonZero" />
</Path.Data>
</Path>
</Canvas>
</Viewbox>
</controls:HighlightButton>
</Grid>
<controls:HighlightButton x:Name="LandlordButton"
HighlightForeground="{x:Static local:Constants.MainColor}"
HighlightBackground="{x:Static local:Constants.SubMainColor}"
Margin="0, 1, 0, 0"
Selectable="True"
Click="OnTabButtonClick">
<Viewbox DockPanel.Dock="Left"
Width="32"
Height="32"
Margin="12, 12, 6, 12"
Stretch="Uniform">
<Canvas Width="496" Height="512">
<Canvas.RenderTransform>
<TranslateTransform X="0" Y="0" />
</Canvas.RenderTransform>
<Path>
<Path.Data>
<PathGeometry
Figures="M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm0 96c48.6 0 88 39.4 88 88s-39.4 88-88 88-88-39.4-88-88 39.4-88 88-88zm0 344c-58.7 0-111.3-26.6-146.5-68.2 18.8-35.4 55.6-59.8 98.5-59.8 2.4 0 4.8.4 7.1 1.1 13 4.2 26.6 6.9 40.9 6.9 14.3 0 28-2.7 40.9-6.9 2.3-.7 4.7-1.1 7.1-1.1 42.9 0 79.7 24.4 98.5 59.8C359.3 421.4 306.7 448 248 448z"
FillRule="NonZero" />
</Path.Data>
</Path>
</Canvas>
</Viewbox>
<Label Content="Vermieter"
Margin="0, 12, 12, 12"
VerticalAlignment="Center"
FontSize="14" />
</controls:HighlightButton>
<controls:HighlightButton x:Name="HouseButton"
HighlightForeground="{x:Static local:Constants.MainColor}"
HighlightBackground="{x:Static local:Constants.SubMainColor}"
Margin="0, 1, 0, 0"
Selectable="True"
Click="OnTabButtonClick">
<Viewbox DockPanel.Dock="Left"
Width="32"
Height="32"
Margin="12, 12, 6, 12"
Stretch="Uniform">
<Canvas Width="576" Height="512">
<Canvas.RenderTransform>
<TranslateTransform X="0" Y="0" />
</Canvas.RenderTransform>
<Path>
<Path.Data>
<PathGeometry
Figures="M280.37 148.26L96 300.11V464a16 16 0 0 0 16 16l112.06-.29a16 16 0 0 0 15.92-16V368a16 16 0 0 1 16-16h64a16 16 0 0 1 16 16v95.64a16 16 0 0 0 16 16.05L464 480a16 16 0 0 0 16-16V300L295.67 148.26a12.19 12.19 0 0 0-15.3 0zM571.6 251.47L488 182.56V44.05a12 12 0 0 0-12-12h-56a12 12 0 0 0-12 12v72.61L318.47 43a48 48 0 0 0-61 0L4.34 251.47a12 12 0 0 0-1.6 16.9l25.5 31A12 12 0 0 0 45.15 301l235.22-193.74a12.19 12.19 0 0 1 15.3 0L530.9 301a12 12 0 0 0 16.9-1.6l25.5-31a12 12 0 0 0-1.7-16.93z"
FillRule="NonZero" />
</Path.Data>
</Path>
</Canvas>
</Viewbox>
<Label Content="Haus"
Margin="0, 12, 12, 12"
VerticalAlignment="Center"
FontSize="14" />
</controls:HighlightButton>
<controls:HighlightButton x:Name="TenantsButton"
HighlightForeground="{x:Static local:Constants.MainColor}"
HighlightBackground="{x:Static local:Constants.SubMainColor}"
Margin="0, 1, 0, 0"
Selectable="True"
Click="OnTabButtonClick">
<Viewbox DockPanel.Dock="Left"
Width="32"
Height="32"
Margin="12, 12, 6, 12"
Stretch="Uniform">
<Canvas Width="576" Height="512">
<Canvas.RenderTransform>
<TranslateTransform X="0" Y="0" />
</Canvas.RenderTransform>
<Path>
<Path.Data>
<PathGeometry
Figures="M570.69 236.27 512 184.44V48a16 16 0 0 0-16-16H432a16 16 0 0 0-16 16V99.67L314.78 10.3C308.5 4.61 296.53 0 288 0s-20.46 4.61-26.74 10.3l-256 226A18.27 18.27 0 0 0 0 248.2a18.64 18.64 0 0 0 4.09 10.71L25.5 282.7a21.14 21.14 0 0 0 12 5.3 21.67 21.67 0 0 0 10.69-4.11l15.9-14V480a32 32 0 0 0 32 32H480a32 32 0 0 0 32-32V269.88l15.91 14A21.94 21.94 0 0 0 538.63 288a20.89 20.89 0 0 0 11.87-5.31l21.41-23.81A21.64 21.64 0 0 0 576 248.19 21 21 0 0 0 570.69 236.27ZM288 176a64 64 0 1 1-64 64A64 64 0 0 1 288 176ZM400 448H176a16 16 0 0 1-16-16 96 96 0 0 1 96-96h64a96 96 0 0 1 96 96A16 16 0 0 1 400 448Z"
FillRule="NonZero" />
</Path.Data>
</Path>
</Canvas>
</Viewbox>
<Label Content="Mieter"
Margin="0, 12, 12, 12"
VerticalAlignment="Center"
FontSize="14" />
</controls:HighlightButton>
<controls:HighlightButton x:Name="CostsButton"
HighlightForeground="{x:Static local:Constants.MainColor}"
HighlightBackground="{x:Static local:Constants.SubMainColor}"
Margin="0, 1, 0, 0"
Selectable="True"
Click="OnTabButtonClick">
<Viewbox DockPanel.Dock="Left"
Width="32"
Height="32"
Margin="12, 12, 6, 12"
Stretch="Uniform">
<Canvas Width="384" Height="512">
<Canvas.RenderTransform>
<TranslateTransform X="0" Y="0" />
</Canvas.RenderTransform>
<Path>
<Path.Data>
<PathGeometry
Figures="M377 105L279.1 7c-4.5-4.5-10.6-7-17-7H256v128h128v-6.1c0-6.3-2.5-12.4-7-16.9zm-153 31V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H248c-13.2 0-24-10.8-24-24zM64 72c0-4.42 3.58-8 8-8h80c4.42 0 8 3.58 8 8v16c0 4.42-3.58 8-8 8H72c-4.42 0-8-3.58-8-8V72zm0 80v-16c0-4.42 3.58-8 8-8h80c4.42 0 8 3.58 8 8v16c0 4.42-3.58 8-8 8H72c-4.42 0-8-3.58-8-8zm144 263.88V440c0 4.42-3.58 8-8 8h-16c-4.42 0-8-3.58-8-8v-24.29c-11.29-.58-22.27-4.52-31.37-11.35-3.9-2.93-4.1-8.77-.57-12.14l11.75-11.21c2.77-2.64 6.89-2.76 10.13-.73 3.87 2.42 8.26 3.72 12.82 3.72h28.11c6.5 0 11.8-5.92 11.8-13.19 0-5.95-3.61-11.19-8.77-12.73l-45-13.5c-18.59-5.58-31.58-23.42-31.58-43.39 0-24.52 19.05-44.44 42.67-45.07V232c0-4.42 3.58-8 8-8h16c4.42 0 8 3.58 8 8v24.29c11.29.58 22.27 4.51 31.37 11.35 3.9 2.93 4.1 8.77.57 12.14l-11.75 11.21c-2.77 2.64-6.89 2.76-10.13.73-3.87-2.43-8.26-3.72-12.82-3.72h-28.11c-6.5 0-11.8 5.92-11.8 13.19 0 5.95 3.61 11.19 8.77 12.73l45 13.5c18.59 5.58 31.58 23.42 31.58 43.39 0 24.53-19.05 44.44-42.67 45.07z"
FillRule="NonZero" />
</Path.Data>
</Path>
</Canvas>
</Viewbox>
<Label Content="Kosten"
Margin="0, 12, 12, 12"
VerticalAlignment="Center"
FontSize="14" />
</controls:HighlightButton>
<controls:HighlightButton x:Name="DetailsButton"
HighlightForeground="{x:Static local:Constants.MainColor}"
HighlightBackground="{x:Static local:Constants.SubMainColor}"
Margin="0, 1, 0, 0"
Selectable="True"
Click="OnTabButtonClick">
<Viewbox DockPanel.Dock="Left"
Width="32"
Height="32"
Margin="12, 12, 6, 12"
Stretch="Uniform">
<Canvas Width="576" Height="512">
<Canvas.RenderTransform>
<TranslateTransform X="0" Y="0" />
</Canvas.RenderTransform>
<Path>
<Path.Data>
<PathGeometry
Figures="M571.31 251.31l-22.62-22.62c-6.25-6.25-16.38-6.25-22.63 0L480 274.75l-46.06-46.06c-6.25-6.25-16.38-6.25-22.63 0l-22.62 22.62c-6.25 6.25-6.25 16.38 0 22.63L434.75 320l-46.06 46.06c-6.25 6.25-6.25 16.38 0 22.63l22.62 22.62c6.25 6.25 16.38 6.25 22.63 0L480 365.25l46.06 46.06c6.25 6.25 16.38 6.25 22.63 0l22.62-22.62c6.25-6.25 6.25-16.38 0-22.63L525.25 320l46.06-46.06c6.25-6.25 6.25-16.38 0-22.63zM552 0H307.65c-14.54 0-27.26 9.8-30.95 23.87l-84.79 322.8-58.41-106.1A32.008 32.008 0 0 0 105.47 224H24c-13.25 0-24 10.74-24 24v48c0 13.25 10.75 24 24 24h43.62l88.88 163.73C168.99 503.5 186.3 512 204.94 512c17.27 0 44.44-9 54.28-41.48L357.03 96H552c13.25 0 24-10.75 24-24V24c0-13.26-10.75-24-24-24z"
FillRule="NonZero" />
</Path.Data>
</Path>
</Canvas>
</Viewbox>
<Label Content="Details"
Margin="0, 12, 12, 12"
VerticalAlignment="Center"
FontSize="14" />
</controls:HighlightButton>
</StackPanel>
</Page>
+39
View File
@@ -0,0 +1,39 @@
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using UCalc.Controls;
namespace UCalc.Pages
{
public partial class SideBar
{
public TabControl TabControl { get; set; }
public SideBar()
{
InitializeComponent();
}
private void OnTabButtonClick(object sender, RoutedEventArgs e)
{
foreach (var button in ((Panel) ((HighlightButton) sender).Parent).FindChildren<HighlightButton>())
{
if (!ReferenceEquals(sender, button))
{
button.Selected = false;
}
}
var buttons = new List<HighlightButton>
{LandlordButton, HouseButton, TenantsButton, CostsButton, DetailsButton};
for (var i = 0; i < buttons.Count; ++i)
{
if (ReferenceEquals(sender, buttons[i]))
{
TabControl.SelectedIndex = i;
break;
}
}
}
}
}
+9
View File
@@ -0,0 +1,9 @@
<Page x:Class="UCalc.Pages.TenantsPage"
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.Pages"
mc:Ignorable="d">
<Grid />
</Page>
+12
View File
@@ -0,0 +1,12 @@
using System.Windows.Controls;
namespace UCalc.Pages
{
public partial class TenantsPage : Page
{
public TenantsPage()
{
InitializeComponent();
}
}
}
+42 -4
View File
@@ -6,20 +6,58 @@
<UseWPF>true</UseWPF>
</PropertyGroup>
<ItemGroup>
<Folder Include="Controls"/>
</ItemGroup>
<ItemGroup>
<Page Update="BillingWindow.xaml">
<Generator></Generator>
</Page>
<Page Update="Pages\SideBar.xaml">
<Generator></Generator>
</Page>
<Page Update="Pages\LandlordPage.xaml">
<Generator></Generator>
</Page>
<Page Update="Pages\HousePage.xaml">
<Generator></Generator>
</Page>
<Page Update="Pages\CostsPage.xaml">
<Generator></Generator>
</Page>
<Page Update="Pages\TenantsPage.xaml">
<Generator></Generator>
</Page>
<Page Update="Pages\DetailsPage.xaml">
<Generator></Generator>
</Page>
<Page Update="Controls\ErrorCounter.xaml">
<Generator></Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Update="BillingWindow.xaml.cs">
<DependentUpon>BillingWindow.xaml</DependentUpon>
</Compile>
<Compile Update="Pages\SideBar.xaml.cs">
<DependentUpon>SideBar.xaml</DependentUpon>
</Compile>
<Compile Update="Pages\LandlordPage.xaml.cs">
<DependentUpon>LandlordPage.xaml</DependentUpon>
</Compile>
<Compile Update="Pages\HousePage.xaml.cs">
<DependentUpon>HousePage.xaml</DependentUpon>
</Compile>
<Compile Update="Pages\CostsPage.xaml.cs">
<DependentUpon>CostsPage.xaml</DependentUpon>
</Compile>
<Compile Update="Pages\TenantsPage.xaml.cs">
<DependentUpon>TenantsPage.xaml</DependentUpon>
</Compile>
<Compile Update="Pages\DetailsPage.xaml.cs">
<DependentUpon>DetailsPage.xaml</DependentUpon>
</Compile>
<Compile Update="Controls\ErrorCounter.xaml.cs">
<DependentUpon>ErrorCounter.xaml</DependentUpon>
</Compile>
</ItemGroup>
</Project>