aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.CircularGauge
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-08-23 13:25:37 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-08-23 13:25:37 +0300
commit658d3d07ed46c6fdb7276b614a93b78c3e02060f (patch)
tree17f5ad6851a497d1af97f239cc48268638d7e08e /Software/Visual_Studio/Tango.CircularGauge
parent44f71ccd29edeeb13621996659232fca4554faf1 (diff)
downloadTango-658d3d07ed46c6fdb7276b614a93b78c3e02060f.tar.gz
Tango-658d3d07ed46c6fdb7276b614a93b78c3e02060f.zip
Fixed some issues with MS 3.0
Diffstat (limited to 'Software/Visual_Studio/Tango.CircularGauge')
-rw-r--r--Software/Visual_Studio/Tango.CircularGauge/CircularGaugeControl.cs194
-rw-r--r--Software/Visual_Studio/Tango.CircularGauge/Properties/AssemblyInfo.cs2
2 files changed, 100 insertions, 96 deletions
diff --git a/Software/Visual_Studio/Tango.CircularGauge/CircularGaugeControl.cs b/Software/Visual_Studio/Tango.CircularGauge/CircularGaugeControl.cs
index f2068d713..344308dac 100644
--- a/Software/Visual_Studio/Tango.CircularGauge/CircularGaugeControl.cs
+++ b/Software/Visual_Studio/Tango.CircularGauge/CircularGaugeControl.cs
@@ -1141,132 +1141,136 @@ namespace Tango.CircularGauge
//Drawing the scale with the Scale Radius
private void DrawScale()
{
- foreach (var item in _toClear)
+ try
{
- rootGrid.Children.Remove(item);
- }
+ foreach (var item in _toClear)
+ {
+ rootGrid.Children.Remove(item);
+ }
- _toClear.Clear();
+ _toClear.Clear();
- //Calculate one major tick angle
- Double majorTickUnitAngle = ScaleSweepAngle / MajorDivisionsCount;
+ //Calculate one major tick angle
+ Double majorTickUnitAngle = ScaleSweepAngle / MajorDivisionsCount;
- //Obtaining One minor tick angle
- Double minorTickUnitAngle = ScaleSweepAngle / MinorDivisionsCount;
+ //Obtaining One minor tick angle
+ Double minorTickUnitAngle = ScaleSweepAngle / MinorDivisionsCount;
- //Obtaining One major ticks value
- Double majorTicksUnitValue = (MaxValue - MinValue) / MajorDivisionsCount;
- majorTicksUnitValue = Math.Round(majorTicksUnitValue, ScaleValuePrecision);
+ //Obtaining One major ticks value
+ Double majorTicksUnitValue = (MaxValue - MinValue) / MajorDivisionsCount;
+ majorTicksUnitValue = Math.Round(majorTicksUnitValue, ScaleValuePrecision);
- Double minvalue = MinValue; ;
+ Double minvalue = MinValue; ;
- // Drawing Major scale ticks
- for (Double i = ScaleStartAngle; i <= (ScaleStartAngle + ScaleSweepAngle); i = i + majorTickUnitAngle)
- {
+ // Drawing Major scale ticks
+ for (Double i = ScaleStartAngle; i <= (ScaleStartAngle + ScaleSweepAngle); i = i + majorTickUnitAngle)
+ {
- //Majortick is drawn as a rectangle
- Rectangle majortickrect = new Rectangle();
- majortickrect.Height = MajorTickSize.Height;
- majortickrect.Width = MajorTickSize.Width;
- majortickrect.Fill = new SolidColorBrush(MajorTickColor);
- Point p = new Point(0.5, 0.5);
- majortickrect.RenderTransformOrigin = p;
- majortickrect.HorizontalAlignment = HorizontalAlignment.Center;
- majortickrect.VerticalAlignment = VerticalAlignment.Center;
+ //Majortick is drawn as a rectangle
+ Rectangle majortickrect = new Rectangle();
+ majortickrect.Height = MajorTickSize.Height;
+ majortickrect.Width = MajorTickSize.Width;
+ majortickrect.Fill = new SolidColorBrush(MajorTickColor);
+ Point p = new Point(0.5, 0.5);
+ majortickrect.RenderTransformOrigin = p;
+ majortickrect.HorizontalAlignment = HorizontalAlignment.Center;
+ majortickrect.VerticalAlignment = VerticalAlignment.Center;
- TransformGroup majortickgp = new TransformGroup();
- RotateTransform majortickrt = new RotateTransform();
+ TransformGroup majortickgp = new TransformGroup();
+ RotateTransform majortickrt = new RotateTransform();
- //Obtaining the angle in radians for calulating the points
- Double i_radian = (i * Math.PI) / 180;
- majortickrt.Angle = i;
- majortickgp.Children.Add(majortickrt);
- TranslateTransform majorticktt = new TranslateTransform();
+ //Obtaining the angle in radians for calulating the points
+ Double i_radian = (i * Math.PI) / 180;
+ majortickrt.Angle = i;
+ majortickgp.Children.Add(majortickrt);
+ TranslateTransform majorticktt = new TranslateTransform();
- //Finding the point on the Scale where the major ticks are drawn
- //here drawing the points with center as (0,0)
- majorticktt.X = (int)((ScaleRadius) * Math.Cos(i_radian));
- majorticktt.Y = (int)((ScaleRadius) * Math.Sin(i_radian));
+ //Finding the point on the Scale where the major ticks are drawn
+ //here drawing the points with center as (0,0)
+ majorticktt.X = (int)((ScaleRadius) * Math.Cos(i_radian));
+ majorticktt.Y = (int)((ScaleRadius) * Math.Sin(i_radian));
- //Points for the textblock which hold the scale value
- TranslateTransform majorscalevaluett = new TranslateTransform();
- //here drawing the points with center as (0,0)
- majorscalevaluett.X = (int)((ScaleLabelRadius) * Math.Cos(i_radian));
- majorscalevaluett.Y = (int)((ScaleLabelRadius) * Math.Sin(i_radian));
+ //Points for the textblock which hold the scale value
+ TranslateTransform majorscalevaluett = new TranslateTransform();
+ //here drawing the points with center as (0,0)
+ majorscalevaluett.X = (int)((ScaleLabelRadius) * Math.Cos(i_radian));
+ majorscalevaluett.Y = (int)((ScaleLabelRadius) * Math.Sin(i_radian));
- //Defining the properties of the scale value textbox
- TextBlock tb = new TextBlock();
+ //Defining the properties of the scale value textbox
+ TextBlock tb = new TextBlock();
- tb.Height = ScaleLabelSize.Height;
- tb.Width = ScaleLabelSize.Width;
- tb.FontSize = ScaleLabelFontSize;
- tb.Foreground = new SolidColorBrush(ScaleLabelForeground);
- tb.TextAlignment = TextAlignment.Center;
- tb.VerticalAlignment = VerticalAlignment.Center;
- tb.HorizontalAlignment = HorizontalAlignment.Center;
+ tb.Height = ScaleLabelSize.Height;
+ tb.Width = ScaleLabelSize.Width;
+ tb.FontSize = ScaleLabelFontSize;
+ tb.Foreground = new SolidColorBrush(ScaleLabelForeground);
+ tb.TextAlignment = TextAlignment.Center;
+ tb.VerticalAlignment = VerticalAlignment.Center;
+ tb.HorizontalAlignment = HorizontalAlignment.Center;
- //Writing and appending the scale value
+ //Writing and appending the scale value
- //checking minvalue < maxvalue w.r.t scale precion value
- if (Math.Round(minvalue, ScaleValuePrecision) <= Math.Round(MaxValue, ScaleValuePrecision))
- {
- minvalue = Math.Round(minvalue, ScaleValuePrecision);
- tb.Text = minvalue.ToString();
- minvalue = minvalue + majorTicksUnitValue;
+ //checking minvalue < maxvalue w.r.t scale precion value
+ if (Math.Round(minvalue, ScaleValuePrecision) <= Math.Round(MaxValue, ScaleValuePrecision))
+ {
+ minvalue = Math.Round(minvalue, ScaleValuePrecision);
+ tb.Text = minvalue.ToString();
+ minvalue = minvalue + majorTicksUnitValue;
- }
- else
- {
- break;
- }
- majortickgp.Children.Add(majorticktt);
- majortickrect.RenderTransform = majortickgp;
- tb.RenderTransform = majorscalevaluett;
+ }
+ else
+ {
+ break;
+ }
+ majortickgp.Children.Add(majorticktt);
+ majortickrect.RenderTransform = majortickgp;
+ tb.RenderTransform = majorscalevaluett;
- AddToRootGrid(majortickrect);
- AddToRootGrid(tb);
+ AddToRootGrid(majortickrect);
+ AddToRootGrid(tb);
- //Drawing the minor axis ticks
- Double onedegree = ((i + majorTickUnitAngle) - i) / (MinorDivisionsCount);
+ //Drawing the minor axis ticks
+ Double onedegree = ((i + majorTickUnitAngle) - i) / (MinorDivisionsCount);
- if ((i < (ScaleStartAngle + ScaleSweepAngle)) && (Math.Round(minvalue, ScaleValuePrecision) <= Math.Round(MaxValue, ScaleValuePrecision)))
- {
- //Drawing the minor scale
- for (Double mi = i + onedegree; mi < (i + majorTickUnitAngle); mi = mi + onedegree)
+ if ((i < (ScaleStartAngle + ScaleSweepAngle)) && (Math.Round(minvalue, ScaleValuePrecision) <= Math.Round(MaxValue, ScaleValuePrecision)))
{
- //here the minortick is drawn as a rectangle
- Rectangle mr = new Rectangle();
- mr.Height = MinorTickSize.Height;
- mr.Width = MinorTickSize.Width;
- mr.Fill = new SolidColorBrush(MinorTickColor);
- mr.HorizontalAlignment = HorizontalAlignment.Center;
- mr.VerticalAlignment = VerticalAlignment.Center;
- Point p1 = new Point(0.5, 0.5);
- mr.RenderTransformOrigin = p1;
+ //Drawing the minor scale
+ for (Double mi = i + onedegree; mi < (i + majorTickUnitAngle); mi = mi + onedegree)
+ {
+ //here the minortick is drawn as a rectangle
+ Rectangle mr = new Rectangle();
+ mr.Height = MinorTickSize.Height;
+ mr.Width = MinorTickSize.Width;
+ mr.Fill = new SolidColorBrush(MinorTickColor);
+ mr.HorizontalAlignment = HorizontalAlignment.Center;
+ mr.VerticalAlignment = VerticalAlignment.Center;
+ Point p1 = new Point(0.5, 0.5);
+ mr.RenderTransformOrigin = p1;
+
+ TransformGroup minortickgp = new TransformGroup();
+ RotateTransform minortickrt = new RotateTransform();
+ minortickrt.Angle = mi;
+ minortickgp.Children.Add(minortickrt);
+ TranslateTransform minorticktt = new TranslateTransform();
- TransformGroup minortickgp = new TransformGroup();
- RotateTransform minortickrt = new RotateTransform();
- minortickrt.Angle = mi;
- minortickgp.Children.Add(minortickrt);
- TranslateTransform minorticktt = new TranslateTransform();
+ //Obtaining the angle in radians for calulating the points
+ Double mi_radian = (mi * Math.PI) / 180;
+ //Finding the point on the Scale where the minor ticks are drawn
+ minorticktt.X = (int)((ScaleRadius) * Math.Cos(mi_radian));
+ minorticktt.Y = (int)((ScaleRadius) * Math.Sin(mi_radian));
- //Obtaining the angle in radians for calulating the points
- Double mi_radian = (mi * Math.PI) / 180;
- //Finding the point on the Scale where the minor ticks are drawn
- minorticktt.X = (int)((ScaleRadius) * Math.Cos(mi_radian));
- minorticktt.Y = (int)((ScaleRadius) * Math.Sin(mi_radian));
+ minortickgp.Children.Add(minorticktt);
+ mr.RenderTransform = minortickgp;
+ AddToRootGrid(mr);
- minortickgp.Children.Add(minorticktt);
- mr.RenderTransform = minortickgp;
- AddToRootGrid(mr);
+ }
}
}
-
}
+ catch { }
}
/// <summary>
diff --git a/Software/Visual_Studio/Tango.CircularGauge/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.CircularGauge/Properties/AssemblyInfo.cs
index ad0fae039..774817e96 100644
--- a/Software/Visual_Studio/Tango.CircularGauge/Properties/AssemblyInfo.cs
+++ b/Software/Visual_Studio/Tango.CircularGauge/Properties/AssemblyInfo.cs
@@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
using System.Windows;
[assembly: AssemblyTitle("Tango - Circular Gauge Control")]
-[assembly: AssemblyVersion("2.0.8.1633")]
+[assembly: AssemblyVersion("2.0.9.1159")]
[assembly: ComVisible(false)]