public MainWindow() { listOfFiles.Add(new RSlocalFile(@"C:\Users\marti\Desktop\Drumstik\plus.png", "Ajouter un fichier local ")); listOfFiles.Add(new RSlocalFile(@"C:\Users\marti\Desktop\Drumstik\mock1.jpg", "mocktitle1")); listOfFiles.Add(new RSlocalFile(@"C:\Users\marti\Desktop\Drumstik\mock2.jpg", "mocktitle2")); listOfFiles.Add(new RSlocalFile(@"C:\Users\marti\Desktop\Drumstik\mock3.png", "mocktitle3")); InitializeComponent(); this.DataContext = this; apiExercices = api.getExercices(); this.MinWidth = 930; this.MinHeight = 450; scroll.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden; _ = printExercicesAsync(); if (exercices.Count > 0) { currentExercices.Add(exercices.First()); } sideShow(); UpdateExercices(exercices); RScache cache = new RScache(); open.ItemsSource = cache.RefreshLocalFiles(LocalfilesAddedByUser, EveryListFiles, listOfFiles); }
private void open_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (open.SelectedIndex == 0) { AddLocalFile local = new AddLocalFile(); if (local.ShowDialog() == true) { _ = new RSlocalFile(local.Foo.url, local.Foo.title); } if (local.Foo.url != "" && local.Foo.title != "") { RScache cache = new RScache(); cache.cacheLocalFiles(LocalfilesAddedByUser, local.Foo.url, local.Foo.title); open.ItemsSource = cache.RefreshLocalFiles(LocalfilesAddedByUser, EveryListFiles, listOfFiles); } } }
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))); } }