kamagra how much to take

Building Infragistics Gauges in WebPart

Recently, I employ the Infragistics controls for a client project where personnel data had to be displayed in a dashboard-like format, the Gauge (UltraGauge) control being the most popular within the organization. There was some pre-existing ad-hoc development, so I got to examine numerous variations of how to suitably instantiate the various Infragistics components.

Consider the below GaugeBuilders class. The BasicGaugeFactory method consumes an id string since the UltraGauge.ID property is the only diverse property between UltraGauges on instantiatation. While this hydrates the object with the sufficient properties, the QueryAndAssignGaugeValues method consumes the UltraGauge control and an integer representing the value to set the gauge at. Since there are various Types of UltraGauges so value setting contrasts, such as RadialGauge, SegmentedDigitalGauge, LinearGauge, UltraGauge.GetType() has to be tested, probably in a not so efficient format.

Arguably, the two of these could easily be merged into one method, whereby the gauge is created and set within a single call. Or QueryAndAssignGaugeValues could just be called after UltraGauge.LoadPreset. It’s really just a preference.

  1. using System;
  2. using System.Web.UI.WebControls;
  3. using Infragistics.UltraGauge.Resources;
  4. using Infragistics.WebUI.UltraWebGauge;
  5.  
  6. namespace infragistics.Generic
  7. {
  8. public class GaugeBuilders
  9. {
  10. public static UltraGauge BasicGaugeFactory(string id)
  11. {
  12. var gauge = new UltraGauge {ID = id, Height = Unit.Pixel(250), Width = Unit.Pixel(250)};
  13. WebGaugeDeploymentScenario deployment = gauge.DeploymentScenario;
  14. deployment.Mode = ImageDeploymentMode.FileSystem;
  15. deployment.FilePath = "~/GaugeImages";
  16. deployment.ImageURL = "~/GaugeImages/gauge_month_#SEQNUM(100).png";
  17. deployment.ImageTQpe = GaugeImageType.Png;
  18. gauge.LoadPreset( @"Path_To_Your_XML_Structure_FIle ", true);
  19. return gauge;
  20. }
  21.  
  22. public static void QueryAndAssignGaugeValues(UltraGauge gaugeParameter, int number)
  23. {
  24. foreach (Gauge gauge in gaugeParameter.Gauges)
  25. {
  26. Type gaugeType = gauge.GetType();
  27. if (Equals(gaugeType, typeof (RadialGauge)))
  28. {
  29. var rg = (RadialGauge) gauge;
  30. rg.Scales[0].Markers[0].Value = number;
  31. }
  32. if (Equals(gaugeType, typeof (SegmentedDigitalGauge)))
  33. {
  34. var rg = (SegmentedDigitalGauge) gauge;
  35. rg.Text = number.ToString();
  36. }
  37. if (Equals(gaugeType, typeof (LinearGauge)))
  38. {
  39. var rg = (LinearGauge) gauge;
  40. if (rg.Scales[0] != null)
  41. {
  42. rg.Scales[0].Markers[0].Value = Convert.ToInt32(number);
  43. }
  44. }
  45. }
  46. }
  47. }
  48. }
Share

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>