public static CollectionViewModel CopyFrom(Collection collection) => new CollectionViewModel { Id = collection.Id, Name = collection.Name, Index = collection.Index, ImagePath = collection.ImagePath, Description = collection.Description, CreateTime = collection.CreateTime, Locked = collection.Locked };
public static void AddToCollection(Collection col, BeatmapEntry entry) { if (string.IsNullOrEmpty(col.ImagePath)) { OsuFile osuFile = new OsuFile(Path.Combine(Domain.OsuSongPath, entry.FolderName, entry.BeatmapFileName)); if (osuFile.Events.BackgroundInfo != null) { var imgPath = Path.Combine(Domain.OsuSongPath, entry.FolderName, osuFile.Events.BackgroundInfo.Filename); if (File.Exists(imgPath)) { col.ImagePath = imgPath; DbOperator.UpdateCollection(col); } } } DbOperator.AddMapToCollection(entry, col); }
public CollectionPage(MainWindow mainWindow, Collection collection) { _mainWindow = mainWindow; _collection = collection; InitializeComponent(); UpdateList(); if (collection.Locked) { BtnDelCol.Visibility = Visibility.Collapsed; } //LblTitle.Content = _collection.Name; var item = ViewModels?.FirstOrDefault(k => k.GetIdentity().Equals(App.PlayerList?.CurrentInfo?.Identity)); if (item != null) { MapList.SelectedItem = item; } }