/// <summary> /// Utility funcion to avoid repetition of this action, remove the previous skeleton and draw the new one. /// </summary> public static void redraw(Canvas canvas, Skeleton actual, string tag, Color color) { modifyUI(new ThreadStart(() => { try { DrawingUtils.deleteElements(canvas, tag); } catch (Exception) { } })); modifyUI(new ThreadStart(() => { try { SkeletonUtils.DrawSkeleton(canvas, actual, color, tag); } catch (Exception) { } })); }
public void dataArrived(object data) { if (recorder.finished()) { if (client != null) { client.unsubscribe(this); Application.Current.Dispatcher.BeginInvoke(new ThreadStart(() => DrawingUtils.deleteElements(skeletonCanvas, tag))); return; } else { recorder.restart(); } } SkeletonUtils.redraw(skeletonCanvas, recorder.next(), tag, color); }