private Beatmap GetSelected()
        {
            if (MapList.SelectedItem == null)
            {
                return(null);
            }
            var selectedItem = (BeatmapDataModel)MapList.SelectedItem;

            return(_beatmapDbOperator.GetBeatmapsFromFolder(selectedItem.FolderName)
                   .FirstOrDefault(k => k.Version == selectedItem.Version));
        }
Beispiel #2
0
        private void ItemPlay_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            if (ResultList.SelectedItem == null)
            {
                return;
            }
            var ok   = (BeatmapDataModel)ResultList.SelectedItem;
            var page = new DiffSelectPage(_mainWindow,
                                          _beatmapDbOperator.GetBeatmapsFromFolder(ok.GetIdentity().FolderName));

            page.Callback = async() =>
            {
                //await _mainWindow.PlayNewFile(Path.Combine(Domain.OsuSongPath, page.SelectedMap.FolderName,
                //      page.SelectedMap.BeatmapFileName));
                var map = _beatmapDbOperator.GetBeatmapByIdentifiable(page.SelectedMap);
                await PlayController.Default.PlayNewFile(map);

                await Services.Get <PlayerList>().RefreshPlayListAsync(PlayerList.FreshType.All, PlayListMode.RecentList);

                _mainWindow.FramePop.Navigate(null);
            };
            _mainWindow.FramePop.Navigate(page);
        }