Contact Sales: +1-888-365-2779
Community & Support
Skip Navigation LinksHome / Community & Support / Code Library / Silverlight > General and Integration Projects > RagGauge in Serverdashboard

Not answered RagGauge in Serverdashboard

Feed from this thread
  • Posted on Apr 17, 2009 (permalink)

    Requirements

    RadControls     2009.1.413.1020
    version

     

    .NET version    3.5

     

    Visual Studio version

    2008 SP1

    programming language

    C#

    browser support

    all browsers supported by RadControls


    PROJECT DESCRIPTION
    This project is based on the idea of http://demos.telerik.com/silverlight/#Gauge/Gallery/LinearScale.
    It has less controls (only gauges) but it works with live data (your server).

    It also shows interaction with HTML and consuming a WCF service.
    Documentation can be found on my blog http://manni-at.spaces.live.com/blog/cns!82CF2A6C0D0C6F3C!172.entry?_c=BlogPart

    To run the project - open it in VS2008 and run it.
    Two screenshots are included in the ZIP file.

    Have fun

    Manfred
    Attached files

    Reply

  • Andrey Andrey admin's avatar

    Posted on Apr 21, 2009 (permalink)

    Hello Manfred,

    Thank you for submitting this project, we really appreciate your involvement and we have updated your Telerik points for that.

    I have a couple quick notes on your code. You are using transformations on marker object to move it slightly from the original “OverCenter” location. You actually can do it using easy way: by changing Location and Offset properties. Location property allows you put marker in 7 predefined positions and Offset property allows you shift it using relative measure. The same position of marker can be achieved by using following values:

    <gauge:Marker x:Name="gauge_markerCPU"   
          Location="CenterInside"   
          Offset="0.01" 
          RelativeHeight="0.04"   
          RelativeWidth="0.08"   
          IsAnimated="True"   
          BorderBrush="#FFF38005" > 
    </gauge:Marker> 
     

    You are also using transformations to scale and rotate marker. You can achieve same result by simple change the RelativeHeight and RelativeWidth properties. The same size of marker can be achieved by using following values:
    <gauge:Marker x:Name="gauge_markerRAMUsed"   
          Location="OverCenter"   
          RelativeHeight="0.06"   
          RelativeWidth="0.03"   
          IsAnimated="True">  
    </gauge:Marker> 
     

    Best wishes,
    Andrey Murzov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.

    Reply

  • Posted on Apr 21, 2009 (permalink)

    Hi Andrey,

    thank you for this information.
    And to make clear how it came to this approach - Blend is guilty :)
    Of course I am - but I made the final design in blend - and when I had the marker in focus the easiest way was to add a transformation.

    I have also a followup on the code.
    It's about the "Dispose issue". Microsoft finally replied that this is a WCF feature (usefull most of the time).
    And MS declared that isn't documented as well as it should be.
    -> And now - surprisingly WCF does it. Although this is a good idea from some point of view it breaks the C# rules.  
    -> I think something like this should be pointed out very clearly in documentation.  
     
    Totally agreed:) When I first look at this, I thought it might be the implementation of C++ destructor magic 
    in managed code which will stumble many WCF developers from the very beginning:)  
     
    I will suggest WCF technical writer to improve the documentation.  
     
    Thanks for your valuable feedback.  
     
    Marco  
     
    And the solution (to avoid this "do not Dispose Flag" is to decorate the functions like this:
    [OperationBehavior(AutoDisposeParameters=false)] 
    The new service code can look like this
    public class PerfSvc {  
        [OperationContract]  
        [OperationBehavior(AutoDisposeParameters = false)]  
        public string GetPerfString() {  
            return (GetCachedPerfInfo().ToString());  
        }  
     
        [OperationContract]  
        [OperationBehavior(AutoDisposeParameters = false)]  
        public PerfInfos GetPerfInfo() {  
            return (GetCachedPerfInfo());  
        }  
        private static PerfInfos GetCachedPerfInfo() {  
            Cache cH = HttpRuntime.Cache;  
            if (cH == null) {  
                return (new PerfInfos() { ErrMess = "No Cache" });  
            }  
     
            PerfInfos pI = cH["PerfInf"as PerfInfos;  
     
            if (pI == null) {  
                //pI = new PerfInfos(true, true);   //be sure to creat "cache stable instance" NO LONGER NEEDED  
                pI = new PerfInfos(true);   //use the normal (with init) constructor  
                cH.Insert("PerfInf", pI, null, DateTime.Now.AddMinutes(20), Cache.NoSlidingExpiration,  
                    CacheItemPriority.Default, RemovedCallback);  
            }  
            pI.LockedReadCurValues();  
            return pI;  
        }  
     
        public static void RemovedCallback(String strKey, Object oValue, CacheItemRemovedReason rEason) {  
            PerfInfos pI = oValue as PerfInfos;  
            if (pI != null) {  
                //pI.CleanUp(); //calls dispose for a "cache stable object" NO LONGER NEEDED  
                pI.Dispose();   //simply use a dispose  
            }  
        }  
     
     
    After chaning this you can alos remove the "do not dispose code" from PerfInfos - but this (both) is optional.
    I'll document these things in my blog as well.

    Regards

    Manfred

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Code Library / Silverlight > General and Integration Projects > RagGauge in Serverdashboard