Files
BeWoPlaner/BeWo/View/Controls/DPCtrlWeek.cs

75 lines
2.4 KiB
C#

using BS.Shared.DataContracts;
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 DPCtrlWeek : DienstplanerControl
{
public static readonly DependencyProperty DienstInfoDCListProperty = DependencyProperty.Register(
"DienstInfoDCList",
typeof(List<DienstInfoDC>),
typeof(DPCtrlWeek),
new UIPropertyMetadata(
(s, e) =>
{
var dc = (List<DienstInfoDC>)e.NewValue;
var c = (DPCtrlWeek)s;
if (c != null)
{
if (dc != null)
{
dc.RemoveAll(x => x == null);
c.BorderBlack.BorderThickness = new Thickness(0, 0, 1, 1);
double res = 0.0;
if (dc.Count != 0)
{
foreach (var x in dc)
{
res += x.DurationHours;
}
c.Text = res.ToString("0.##");
}
else
{
c.BorderBlack.BorderThickness = new Thickness(0, 0, 1, 1);
c.Text = "";
}
}
else
{
c.BorderBlack.BorderThickness = new Thickness(0, 0, 1, 1);
c.Text = "";
}
}
}));
public DPCtrlWeek()
{
InitializeComponent();
BorderBlack.BorderThickness = new Thickness(0, 0, 1, 0);
txt.TextAlignment = TextAlignment.Left;
txt.HorizontalAlignment = HorizontalAlignment.Left;
}
public List<DienstInfoDC> DienstInfoDCList
{
get { return (List<DienstInfoDC>)GetValue(DienstInfoDCListProperty); }
set { SetValue(DienstInfoDCListProperty, value); }
}
}
}