83 lines
2.7 KiB
C#
83 lines
2.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
|
|
namespace BeWo.View.Controls
|
|
{
|
|
public class DPCtrlMonth : DienstplanerControl
|
|
{
|
|
public static readonly DependencyProperty DPCtrlMonthProperty = DependencyProperty.Register(
|
|
"DPCtrlMonthInformation",
|
|
typeof(DPCtrlMonthInformation),
|
|
typeof(DPCtrlMonth),
|
|
new UIPropertyMetadata(
|
|
(s, e) =>
|
|
{
|
|
var dc = (DPCtrlMonthInformation)e.NewValue;
|
|
var c = (DPCtrlMonth)s;
|
|
|
|
if (c != null)
|
|
{
|
|
if (dc != null)
|
|
{
|
|
double res = 0.0;
|
|
|
|
if (dc.Hours.Count != 0 || dc.Row == 2)
|
|
{
|
|
foreach (var stunde in dc.Hours)
|
|
{
|
|
res += stunde;
|
|
}
|
|
c.Text = res.ToString("0.##");
|
|
c.BorderBlack.BorderThickness = new Thickness(0, 0, 1, 1);
|
|
}
|
|
else
|
|
{
|
|
if (dc.Statuszeile)
|
|
c.BorderBlack.BorderThickness = new Thickness(0, 0, 1, 2);
|
|
else
|
|
c.BorderBlack.BorderThickness = new Thickness(0, 0, 1, 0);
|
|
|
|
c.Text = "";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
c.BorderBlack.BorderThickness = new Thickness(0, 0, 1, 0);
|
|
|
|
c.Text = "";
|
|
}
|
|
}
|
|
|
|
|
|
}));
|
|
|
|
public DPCtrlMonth()
|
|
{
|
|
InitializeComponent();
|
|
|
|
BorderBlack.BorderThickness = new Thickness(1, 0, 0, 0);
|
|
txt.TextAlignment = TextAlignment.Left;
|
|
txt.HorizontalAlignment = HorizontalAlignment.Left;
|
|
txt.FontWeight = FontWeights.SemiBold;
|
|
}
|
|
|
|
public DPCtrlMonthInformation DPCtrlMonthInformation
|
|
{
|
|
get { return (DPCtrlMonthInformation)GetValue(DPCtrlMonthProperty); }
|
|
|
|
set { SetValue(DPCtrlMonthProperty, value); }
|
|
}
|
|
}
|
|
|
|
public class DPCtrlMonthInformation
|
|
{
|
|
public List<double> Hours { get; set; }
|
|
public int Row { get; set; }
|
|
public bool Statuszeile { get; set; }
|
|
}
|
|
}
|