aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.SharedUI
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2024-07-14 23:06:47 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2024-07-14 23:06:47 +0300
commitc03fb4a1b2aadd8952b321d08ca840e55fcee72d (patch)
tree453cc2986a60c87ddff21bff348d6d35d7ed1c2e /Software/Visual_Studio/Tango.SharedUI
parent70c0c5921c3c124779ec0d603e43d72e67def63f (diff)
downloadTango-c03fb4a1b2aadd8952b321d08ca840e55fcee72d.tar.gz
Tango-c03fb4a1b2aadd8952b321d08ca840e55fcee72d.zip
Revision of statistics and resumed jobs.
Diffstat (limited to 'Software/Visual_Studio/Tango.SharedUI')
-rw-r--r--Software/Visual_Studio/Tango.SharedUI/Controls/RangeProgressBar.cs92
-rw-r--r--Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj3
-rw-r--r--Software/Visual_Studio/Tango.SharedUI/Themes/Generic.xaml16
3 files changed, 110 insertions, 1 deletions
diff --git a/Software/Visual_Studio/Tango.SharedUI/Controls/RangeProgressBar.cs b/Software/Visual_Studio/Tango.SharedUI/Controls/RangeProgressBar.cs
new file mode 100644
index 000000000..f1d323a3a
--- /dev/null
+++ b/Software/Visual_Studio/Tango.SharedUI/Controls/RangeProgressBar.cs
@@ -0,0 +1,92 @@
+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.Navigation;
+using System.Windows.Shapes;
+
+namespace Tango.SharedUI.Controls
+{
+ public class RangeProgressBar : Control
+ {
+ private Border _innerBorder;
+ private Border _outerBorder;
+
+ static RangeProgressBar()
+ {
+ DefaultStyleKeyProperty.OverrideMetadata(typeof(RangeProgressBar), new FrameworkPropertyMetadata(typeof(RangeProgressBar)));
+ }
+
+ public Brush FillBrush
+ {
+ get { return (Brush)GetValue(FillBrushProperty); }
+ set { SetValue(FillBrushProperty, value); }
+ }
+ public static readonly DependencyProperty FillBrushProperty =
+ DependencyProperty.Register("FillBrush", typeof(Brush), typeof(RangeProgressBar), new PropertyMetadata(Brushes.Red));
+
+ public double Maximum
+ {
+ get { return (double)GetValue(MaximumProperty); }
+ set { SetValue(MaximumProperty, value); }
+ }
+ public static readonly DependencyProperty MaximumProperty =
+ DependencyProperty.Register("Maximum", typeof(double), typeof(RangeProgressBar), new FrameworkPropertyMetadata(100.0, FrameworkPropertyMetadataOptions.AffectsRender));
+
+ public double LowerValue
+ {
+ get { return (double)GetValue(LowerValueProperty); }
+ set { SetValue(LowerValueProperty, value); }
+ }
+ public static readonly DependencyProperty LowerValueProperty =
+ DependencyProperty.Register("LowerValue", typeof(double), typeof(RangeProgressBar), new FrameworkPropertyMetadata(100.0, FrameworkPropertyMetadataOptions.AffectsRender));
+
+ public double UpperValue
+ {
+ get { return (double)GetValue(UpperValueProperty); }
+ set { SetValue(UpperValueProperty, value); }
+ }
+ public static readonly DependencyProperty UpperValueProperty =
+ DependencyProperty.Register("UpperValue", typeof(double), typeof(RangeProgressBar), new FrameworkPropertyMetadata(100.0, FrameworkPropertyMetadataOptions.AffectsRender));
+
+ public override void OnApplyTemplate()
+ {
+ base.OnApplyTemplate();
+ _innerBorder = GetTemplateChild("PART_InnerBorder") as Border;
+ _outerBorder = GetTemplateChild("PART_OuterBorder") as Border;
+ }
+
+ public RangeProgressBar()
+ {
+ SizeChanged += RangeProgressBar_SizeChanged;
+ }
+
+ private void RangeProgressBar_SizeChanged(object sender, SizeChangedEventArgs e)
+ {
+ PlaceInnerBorder();
+ }
+
+ private void PlaceInnerBorder()
+ {
+ if (_innerBorder != null && !double.IsNaN(_outerBorder.ActualWidth) && _outerBorder.ActualWidth > 0 && Maximum > 0)
+ {
+ _innerBorder.Margin = new Thickness(LowerValue / Maximum * _outerBorder.ActualWidth, 0, _outerBorder.ActualWidth - (UpperValue / Maximum * _outerBorder.ActualWidth), 0);
+ }
+ }
+
+ protected override void OnRender(DrawingContext drawingContext)
+ {
+ base.OnRender(drawingContext);
+
+ PlaceInnerBorder();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj b/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj
index c7eccab9f..07c79e7af 100644
--- a/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj
+++ b/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj
@@ -88,6 +88,7 @@
<DependentUpon>MultiTransitionControl.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\NavigationControl.cs" />
+ <Compile Include="Controls\RangeProgressBar.cs" />
<Compile Include="Controls\SearchComboBox.cs" />
<Compile Include="Controls\SpannedUniformGrid.cs" />
<Compile Include="Controls\TableGrid.cs" />
@@ -264,7 +265,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
+ <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
</VisualStudio>
</ProjectExtensions>
</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/Tango.SharedUI/Themes/Generic.xaml b/Software/Visual_Studio/Tango.SharedUI/Themes/Generic.xaml
index ec9e86d07..f6aa44ee5 100644
--- a/Software/Visual_Studio/Tango.SharedUI/Themes/Generic.xaml
+++ b/Software/Visual_Studio/Tango.SharedUI/Themes/Generic.xaml
@@ -139,4 +139,20 @@
</Setter.Value>
</Setter>
</Style>
+
+ <Style TargetType="{x:Type local:RangeProgressBar}">
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="{x:Type local:RangeProgressBar}">
+ <Border x:Name="PART_OuterBorder" Background="{TemplateBinding Background}"
+ BorderBrush="{TemplateBinding BorderBrush}"
+ BorderThickness="{TemplateBinding BorderThickness}">
+ <Border x:Name="PART_InnerBorder" Background="{TemplateBinding FillBrush}">
+
+ </Border>
+ </Border>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
</ResourceDictionary>