Пример #1
0
        private void Controller_OnLikeClick(object sender, RoutedEventArgs e)
        {
            var entry = _beatmapDbOperator.GetBeatmapByIdentifiable(Services.Get <PlayerList>().CurrentIdentity);

            if (entry == null)
            {
                Notification.Show("该图不存在于该osu!db中", Title);
                return;
            }

            //if (!ViewModel.IsMiniMode)
            FramePop.Navigate(new SelectCollectionPage(entry));
            //else
            //{
            //    var collection = _appDbOperator.GetCollections().First(k => k.Locked);
            //    if (Services.Get<PlayerList>().CurrentInfo.IsFavorite)
            //    {
            //        _appDbOperator.RemoveMapFromCollection(entry, collection);
            //        Services.Get<PlayerList>().CurrentInfo.IsFavorite = false;
            //    }
            //    else
            //    {
            //        await SelectCollectionPage.AddToCollectionAsync(collection, new[] { entry });
            //        Services.Get<PlayerList>().CurrentInfo.IsFavorite = true;
            //    }
            //}

            IsMapFavorite(Services.Get <PlayerList>().CurrentInfo.Identity);
        }
Пример #2
0
        /// <summary>
        /// Clear things.
        /// </summary>
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (AppSettings.Current.General.ExitWhenClosed == null && !ForceExit)
            {
                e.Cancel = true;
                FramePop.Navigate(new ClosingPage(this));
                return;
            }
            else if (AppSettings.Current.General.ExitWhenClosed == false && !ForceExit)
            {
                WindowState = WindowState.Minimized;
                Hide();
                e.Cancel = true;
                return;
            }

            PlayController.Default?.Dispose();
            LyricWindow.Dispose();
            NotifyIcon.Dispose();
            if (ConfigWindow == null || ConfigWindow.IsClosed)
            {
                return;
            }
            if (ConfigWindow.IsInitialized)
            {
                ConfigWindow.Close();
            }
        }
Пример #3
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);
        }
Пример #4
0
        /// <summary>
        /// Clear things.
        /// </summary>
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (App.Config.General.ExitWhenClosed == null && !ForceExit)
            {
                e.Cancel = true;
                FramePop.Navigate(new ClosingPage(this));
                return;
            }
            else if (App.Config.General.ExitWhenClosed == false && !ForceExit)
            {
                WindowState = WindowState.Minimized;
                Hide();
                e.Cancel = true;
                return;
            }

            ClearHitsoundPlayer();
            _cts.Dispose();
            WavePlayer.Device?.Dispose();
            WavePlayer.MasteringVoice?.Dispose();
            LyricWindow.Dispose();
            NotifyIcon.Dispose();
            _sbWindow?.Close();
            if (ConfigWindow == null || ConfigWindow.IsClosed)
            {
                return;
            }
            if (ConfigWindow.IsInitialized)
            {
                ConfigWindow.Close();
            }
        }
Пример #5
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);
        }
Пример #6
0
 private void BtnAddCollection_Click(object sender, RoutedEventArgs e)
 {
     FramePop.Navigate(new AddCollectionPage(this));
 }