I have a method that adds a marker line to my chart. The issue I have it that calling this method results in a non-blocking async call but in other code where I call this, I want to access the markers immediately after adding the marker. Is there a way to call Annotations.Add synchronously?
public void CreateNewMarker(DateTime markerDate, Color color)
{
try
{
MainChart.Annotations.Add(new VerticalLineAnnotation()
{
Stroke = new SolidColorBrush(color),
StrokeThickness = 1,
X1 = markerDate,
StrokeDashArray = new DoubleCollection(new List { 6, 3 }),
IsEditable = false
});
}
catch (Exception ex)
{
Tracing.TraceError(piuModule, className + “.CreateNewMarker()”, “Error during the CreateNewMarker() method”, ex);
}
}
Other Method
{
calls CreateNewMarker(0
Access new marker Annotations by index, MainChart.Annotations[markerIndex].X1
}
- Raymond Flach asked 3 years ago
- last edited 3 years ago
- You must login to post comments
Hi Raymond,
Thanks for your inquiry.
I am sorry for the misunderstanding. Adding Annotations is always a synchronous (blocking) call that is done in a UI thread.
You should be able to access the new annotation immediately after adding it.
We have also noticed there is no valid license assigned to your account.
If you wish to continue receiving technical support further please consider renewing your support subscription.
To do that please contact Sales here:
https://www.scichart.com/contact-us/
Or email us at [email protected]
If you believe this is not correct please provide your new order details.
- Oleksandr Shvets answered 3 years ago
- You must login to post comments
Please login first to submit.