data binding a gauge in almost realtime

2 posts, 0 answers
  1. chris
    chris avatar
    4 posts
    Member since:
    Jul 2011

    Posted 23 Sep 2011 Link to this post

    good day

    problem

    i need to create a data stream and bind it to a gauge in almost real time for an undefined amount of time. the app is monitoring a radio network  and im  creating a data dash board representing the current state of the network.

    i have a wcf service that is called every 3 seconds using dispatch timer,  which populates a list of objects. i would like to data bind  the collection to the gauge control.

    workflow
    1. user clicks start
    2. wcf service is called every 3 seconds
    3. results are added to a queue collection
    4. create a buffer in queue. (dont start data binding until the queue count = 20) 
    5. if queue count = 20 then bind data to gauge
    6. if queue count = 5 then wait until queue count reaches 20 before databinding
    7. client clicks stop and wcf service stops polling data 

    questions

    1. does the wcf service need to be run on a different thread? if so how do i connect the ui thread with the background thread
    2. can i data bind a stream to a gauge? If so how would i create the stream?

    if anyone can help in anyway it would be greatly appreciated

    thanks

    chris maley

  2. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 28 Sep 2011 Link to this post

    Hi Chris,

    1. You can call a method of the UI thread from the background thread using the Dispatcher.BeginInvoke method. But usually the WCF service client contains methods for asyncronous requests. So, it seems it is not needed to run the methods of WCF service client from different thread.

    2. According to your requirements I would recommend to use the Value property of an indicator directly in codebehind for setting the value from the response of the WCF service to a gauge. The sample code is below.
    <telerik:LinearGauge x:Name="linearGauge">
       <telerik:LinearScale x:Name="linearScale" Min="1" Max="12">
           <telerik:IndicatorList>
               <telerik:Marker x:Name="indicator"/>
           </telerik:IndicatorList>
       </telerik:LinearScale>
    </telerik:LinearGauge>
    private void SetIndicatorValue(double value)
    {
        this.indicator.Value = value;
    }

    Kind regards,
    Andrey Murzov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
Back to Top