public Modal(MainWindow modalWin, object ex)
 {
     oneExercice = (RSexercice)ex;
     mainWin     = modalWin;
     InitializeComponent();
     titleBox.Text = oneExercice.title;
 }
        public void printExercices()
        {
            RScache cache = new RScache();

            foreach (RSapiExercice apiEx in apiExercices)
            {
                RSexercice    exercice     = new RSexercice(apiEx);
                RSapiResource thumbnailRes = exercice.getThumbnailResource();
                if (thumbnailRes != null)
                {
                    string thumbnailLocalPath = cache.getLocalPathForURL(thumbnailRes.url, thumbnailRes.name);
                    if (thumbnailLocalPath == null)
                    {
                        thumbnailLocalPath = cache.downloadThumbnailAsync(thumbnailRes);
                    }
                    exercice.ThumbnailLocalPath = thumbnailLocalPath;
                }
                Application.Current.Dispatcher.BeginInvoke(new Action(() => this.exercices.Add(exercice)));
            }
        }