Hi,
I found an interesting thing.
By working on an example project i found out that Min and Max of ranges is compared.
So I must take care with assignment that min does not become larger than max (proper sequence).
The "safe way" is to set all min values to 0 (or what ever is the possible minimum) and than set max followed by min.
Anyhow - I also was afraid that you also check value against LinearScale.Max.
You don't I found out - look interesting if value exceeds max :)
Anyhow - I thought you do this and since LinearScale.Max is dynamic (can be less than last value) I set value to 0.
After this I set LinearScale.Max followed by value.
Next I was investigating if I have a locking problem with my service :))
The reason - every second call the marker shows 0 - and at the next call the correct value.
I only guess the following occurs (pseudocode):
if (value != oldValue)
StartAnimation()
void StartAnimation() {
if (AnimationIsRunning) return;
if(curPosition!=newValue)
AnimateMarker();
}
I do:
linMarker.Value=0; // avoid exceed of max
linScale.Max=newMax;
...//set all the other values (min, ranges and so on)
linMarker.Value=newVal;
This code is fast enough (of course) to finish while the animation is still running the result is an animation to the "first different value".
So setting the marker to zero does (at initial call) nothing - the marker is at zero.
Since the animation is not running - the next set of value starts the animation. (in this case newVal).
At the next call I assign 0 - the logic detects - ah, different value - animate.
When I then set newVal - it does nothing because an animation is already running.
The next call - setting to 0 does nothing (it's 0 from the last "mistake") - no animation.
newVal is assigned - animation not running....
I guess this is not intended.
Of course - in my scenario (since I learned that linearScale.Max can be less than value) it is not needed to set value to 0 initial.
But imagine some "fast data input" (multiple simultaneous service calls, replay of a queue...) - I guess it is possible, that data arrives faster than the animation duration - and this would result in the same problem.
Regards
Manfred
I found an interesting thing.
By working on an example project i found out that Min and Max of ranges is compared.
So I must take care with assignment that min does not become larger than max (proper sequence).
The "safe way" is to set all min values to 0 (or what ever is the possible minimum) and than set max followed by min.
Anyhow - I also was afraid that you also check value against LinearScale.Max.
You don't I found out - look interesting if value exceeds max :)
Anyhow - I thought you do this and since LinearScale.Max is dynamic (can be less than last value) I set value to 0.
After this I set LinearScale.Max followed by value.
Next I was investigating if I have a locking problem with my service :))
The reason - every second call the marker shows 0 - and at the next call the correct value.
I only guess the following occurs (pseudocode):
if (value != oldValue)
StartAnimation()
void StartAnimation() {
if (AnimationIsRunning) return;
if(curPosition!=newValue)
AnimateMarker();
}
I do:
linMarker.Value=0; // avoid exceed of max
linScale.Max=newMax;
...//set all the other values (min, ranges and so on)
linMarker.Value=newVal;
This code is fast enough (of course) to finish while the animation is still running the result is an animation to the "first different value".
So setting the marker to zero does (at initial call) nothing - the marker is at zero.
Since the animation is not running - the next set of value starts the animation. (in this case newVal).
At the next call I assign 0 - the logic detects - ah, different value - animate.
When I then set newVal - it does nothing because an animation is already running.
The next call - setting to 0 does nothing (it's 0 from the last "mistake") - no animation.
newVal is assigned - animation not running....
I guess this is not intended.
Of course - in my scenario (since I learned that linearScale.Max can be less than value) it is not needed to set value to 0 initial.
But imagine some "fast data input" (multiple simultaneous service calls, replay of a queue...) - I guess it is possible, that data arrives faster than the animation duration - and this would result in the same problem.
Regards
Manfred