diff --git a/Client/Application/Components/StatsBar.xaml b/Client/Application/Components/StatsBar.xaml
new file mode 100644
index 0000000..9d047d5
--- /dev/null
+++ b/Client/Application/Components/StatsBar.xaml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
diff --git a/Client/Application/Components/StatsBar.xaml.cs b/Client/Application/Components/StatsBar.xaml.cs
new file mode 100644
index 0000000..38e96ad
--- /dev/null
+++ b/Client/Application/Components/StatsBar.xaml.cs
@@ -0,0 +1,128 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace Client.Application.Components
+{
+ public partial class StatsBar : UserControl
+ {
+ public static readonly DependencyProperty BackgroundSourceProperty =
+ DependencyProperty.Register("BackgroundSource", typeof(ImageSource), typeof(StatsBar), new PropertyMetadata(default(ImageSource)));
+ public static readonly DependencyProperty ForegroundSourceProperty =
+ DependencyProperty.Register("ForegroundSource", typeof(ImageSource), typeof(StatsBar), new PropertyMetadata(default(ImageSource)));
+ public static readonly DependencyProperty CurrentProperty =
+ DependencyProperty.Register("Current", typeof(double), typeof(StatsBar), new PropertyMetadata(0.0, OnDataChanged));
+ public static readonly DependencyProperty TotalProperty =
+ DependencyProperty.Register("Total", typeof(double), typeof(StatsBar), new PropertyMetadata(0.0, OnDataChanged));
+ public static readonly DependencyProperty FormatProperty =
+ DependencyProperty.Register("Format", typeof(string), typeof(StatsBar), new PropertyMetadata("{0}/{1}", OnFormatChanged));
+ public static readonly DependencyProperty ForegroundWidthProperty =
+ DependencyProperty.Register("ForegroundWidth", typeof(double), typeof(StatsBar), new PropertyMetadata(0.0, null, OnCoerceForegroundWidth));
+ public static readonly DependencyProperty TextProperty =
+ DependencyProperty.Register("Text", typeof(string), typeof(StatsBar), new PropertyMetadata("", null, OnCoerceText));
+
+ private static void OnDataChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ var model = (StatsBar)d;
+ model.CoerceValue(ForegroundWidthProperty);
+ model.CoerceValue(TextProperty);
+ }
+
+ private static void OnFormatChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ var model = (StatsBar)d;
+ model.CoerceValue(TextProperty);
+ }
+
+ private static object OnCoerceForegroundWidth(DependencyObject d, object baseValue)
+ {
+ var model = (StatsBar)d;
+ var actualWidth = (double)model.GetValue(ActualWidthProperty);
+
+ return actualWidth / 100 * model.GetPercent();
+ }
+
+ private static object OnCoerceText(DependencyObject d, object baseValue)
+ {
+ var model = (StatsBar)d;
+
+ return string.Format(model.Format, model.Current, model.Total, model.GetPercent());
+ }
+
+ public StatsBar()
+ {
+ InitializeComponent();
+ }
+
+ public override void OnApplyTemplate()
+ {
+ SizeChanged += StatsBar_SizeChanged;
+ }
+
+ private void StatsBar_SizeChanged(object sender, SizeChangedEventArgs e)
+ {
+ if (e.WidthChanged)
+ {
+ var model = (StatsBar)sender;
+ model.CoerceValue(ForegroundWidthProperty);
+ }
+ }
+
+ private double GetPercent()
+ {
+ var percent = Current;
+ if (Total > 0)
+ {
+ percent = Current / Total * 100;
+ }
+
+ return percent;
+ }
+
+ public ImageSource BackgroundSource
+ {
+ get { return (ImageSource)GetValue(BackgroundSourceProperty); }
+ set { SetValue(BackgroundSourceProperty, value); }
+ }
+ public ImageSource ForegroundSource
+ {
+ get { return (ImageSource)GetValue(ForegroundSourceProperty); }
+ set { SetValue(ForegroundSourceProperty, value); }
+ }
+ public double ForegroundWidth
+ {
+ get { return (double)GetValue(ForegroundWidthProperty); }
+ set { SetValue(ForegroundWidthProperty, value); }
+ }
+ public double Current
+ {
+ get { return (double)GetValue(CurrentProperty); }
+ set { SetValue(CurrentProperty, value); }
+ }
+ public double Total
+ {
+ get { return (double)GetValue(TotalProperty); }
+ set { SetValue(TotalProperty, value); }
+ }
+ public string Text
+ {
+ get { return (string)GetValue(TextProperty); }
+ set { SetValue(TextProperty, value); }
+ }
+ public string Format
+ {
+ get { return (string)GetValue(FormatProperty); }
+ set { SetValue(FormatProperty, value); }
+ }
+ }
+}
diff --git a/Client/Application/Components/StatsPanel.xaml b/Client/Application/Components/StatsPanel.xaml
new file mode 100644
index 0000000..a160e32
--- /dev/null
+++ b/Client/Application/Components/StatsPanel.xaml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
diff --git a/Client/Application/Components/StatsPanel.xaml.cs b/Client/Application/Components/StatsPanel.xaml.cs
new file mode 100644
index 0000000..f59e559
--- /dev/null
+++ b/Client/Application/Components/StatsPanel.xaml.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace Client.Application.Components
+{
+ ///
+ /// Interaction logic for StatsPanel.xaml
+ ///
+ public partial class StatsPanel : StackPanel
+ {
+ public StatsPanel()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Client/Application/Views/MainWindow.xaml b/Client/Application/Views/MainWindow.xaml
index 80e94ba..f688740 100644
--- a/Client/Application/Views/MainWindow.xaml
+++ b/Client/Application/Views/MainWindow.xaml
@@ -6,6 +6,7 @@
xmlns:local="clr-namespace:Client"
xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
xmlns:converters="clr-namespace:Client.Application.Converters"
+ xmlns:components="clr-namespace:Client.Application.Components"
mc:Ignorable="d"
Title="MainWindow" Height="600" Width="1024">
@@ -19,7 +20,6 @@
-
@@ -109,84 +109,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
Position: