Example #1
0
        /// <summary>
        /// Popup a dialog for adding music to a collection.
        /// </summary>
        private async void BtnLike_Click(object sender, RoutedEventArgs e)
        {
            var entry = BeatmapQuery.FilterByIdentity(InstanceManage.GetInstance <PlayerList>().CurrentIdentity);

            //var entry = App.PlayerList?.CurrentInfo.Beatmap;
            if (entry == null)
            {
                MsgBox.Show(this, "该图不存在于该osu!db中。", Title, MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return;
            }

            if (!ViewModel.IsMiniMode)
            {
                FramePop.Navigate(new SelectCollectionPage(this, entry));
            }
            else
            {
                var collection = DbOperate.GetCollections().First(k => k.Locked);
                if (InstanceManage.GetInstance <PlayerList>().CurrentInfo.IsFavorite)
                {
                    DbOperate.RemoveMapFromCollection(entry, collection);
                    InstanceManage.GetInstance <PlayerList>().CurrentInfo.IsFavorite = false;
                }
                else
                {
                    await SelectCollectionPage.AddToCollectionAsync(collection, entry);

                    InstanceManage.GetInstance <PlayerList>().CurrentInfo.IsFavorite = true;
                }
            }

            IsMapFavorite(InstanceManage.GetInstance <PlayerList>().CurrentInfo.Identity);
        }
Example #2
0
        /// <summary>
        /// Popup a dialog for adding music to a collection.
        /// </summary>
        private void BtnLike_Click(object sender, RoutedEventArgs e)
        {
            if (!ValidateDb())
            {
                return;
            }
            var entry = App.Beatmaps.GetBeatmapByIdentity(App.PlayerList.CurrentIdentity);

            //var entry = App.PlayerList?.CurrentInfo.Entry;
            if (entry == null)
            {
                MsgBox.Show(this, "该图不存在于该osu!db中。", Title, MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return;
            }

            if (!ViewModel.IsMiniMode)
            {
                FramePop.Navigate(new SelectCollectionPage(this, entry));
            }
            else
            {
                var collection = DbOperator.GetCollections().First(k => k.Locked);
                if (App.PlayerList.CurrentInfo.IsFaved)
                {
                    DbOperator.RemoveMapFromCollection(entry, collection);
                    App.PlayerList.CurrentInfo.IsFaved = false;
                }
                else
                {
                    SelectCollectionPage.AddToCollection(collection, entry);
                    App.PlayerList.CurrentInfo.IsFaved = true;
                }
            }

            SetFaved(App.PlayerList.CurrentInfo.Identity);
        }