Пример #1
0
 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
 };
Пример #2
0
 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);
 }
Пример #3
0
        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;
            }
        }