コード例 #1
0
        public MainWindow()
        {
            PlayerViewModel.InitViewModel();

            InitializeComponent();
            ViewModel        = (MainWindowViewModel)DataContext;
            ViewModel.Player = PlayerViewModel.Current;
            LyricWindow      = new LyricWindow(this);
            if (AppSettings.Default.Lyric.EnableLyric)
            {
                LyricWindow.Show();
            }

            OverallKeyHook    = new OverallKeyHook(this);
            Animation.Loaded += Animation_Loaded;
            MiniPlayController.CloseButtonClicked += () =>
            {
                if (AppSettings.Default.General.ExitWhenClosed == null)
                {
                    Show();
                }
                Close();
            };
            MiniPlayController.MaxButtonClicked += () =>
            {
                Topmost = true;
                Topmost = false;
                Show();
                PlayerViewModel.Current.EnableVideo = true;
                GetCurrentFirst <MiniWindow>()?.Close();
            };
            TryBindHotKeys();
        }
コード例 #2
0
        /// <summary>
        /// Call lyric provider to check lyric
        /// </summary>
        public void SetLyricSynchronously()
        {
            if (!LyricWindow.IsVisible)
            {
                return;
            }

            Task.Run(async() =>
            {
                if (_searchLyricTask?.IsTaskBusy() == true)
                {
                    await Task.WhenAny(_searchLyricTask);
                }

                _searchLyricTask = Task.Run(async() =>
                {
                    var player = InstanceManage.GetInstance <PlayersInst>().AudioPlayer;
                    if (player == null)
                    {
                        return;
                    }

                    var meta      = player.OsuFile.Metadata;
                    var lyricInst = InstanceManage.GetInstance <LyricsInst>();
                    var lyric     = await lyricInst.LyricProvider.GetLyricAsync(meta.ArtistMeta.ToUnicodeString(),
                                                                                meta.TitleMeta.ToUnicodeString(), player.Duration);
                    LyricWindow.SetNewLyric(lyric, player.OsuFile);
                    LyricWindow.StartWork();
                });
            });
        }
コード例 #3
0
        /// <summary>
        /// Clear things.
        /// </summary>
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (PlayerConfig.Current.General.ExitWhenClosed == null && !ForceExit)
            {
                e.Cancel = true;
                FramePop.Navigate(new ClosingPage(this));
                return;
            }
            else if (PlayerConfig.Current.General.ExitWhenClosed == false && !ForceExit)
            {
                WindowState = WindowState.Minimized;
                Hide();
                e.Cancel = true;
                return;
            }

            ClearHitsoundPlayer();
            ComponentPlayer.DisposeAll();
            LyricWindow.Dispose();
            NotifyIcon.Dispose();
            if (ConfigWindow == null || ConfigWindow.IsClosed)
            {
                return;
            }
            if (ConfigWindow.IsInitialized)
            {
                ConfigWindow.Close();
            }
        }
コード例 #4
0
 private void MenuOpenHideLyric_Click(object sender, RoutedEventArgs e)
 {
     if (LyricWindow.IsShown)
     {
         LyricWindow.Hide();
     }
     else
     {
         LyricWindow.Show();
     }
 }
コード例 #5
0
 private void MenuOpenHideLyric_Click(object sender, RoutedEventArgs e)
 {
     if (ViewModel.IsLyricWindowShown)
     {
         PlayerConfig.Current.Lyric.EnableLyric = false;
         LyricWindow.Hide();
     }
     else
     {
         PlayerConfig.Current.Lyric.EnableLyric = true;
         LyricWindow.Show();
     }
 }
コード例 #6
0
        public MainWindow()
        {
            InitializeComponent();
            ViewModel = (MainWindowViewModel)DataContext;
            PlayerViewModel.InitViewModel();
            ViewModel.Player = PlayerViewModel.Current;
            LyricWindow      = new LyricWindow(this);

            LyricWindow.Show();
            OverallKeyHook = new OverallKeyHook(this);
            TryBindHotkeys();
            Unosquare.FFME.MediaElement.FFmpegDirectory = Path.Combine(Domain.PluginPath, "ffmpeg");
        }
コード例 #7
0
        /// <summary>
        /// Call lyric provider to check lyric
        /// todo: this should run synchronously.
        /// </summary>
        public void SetLyricSynchronously()
        {
            if (!LyricWindow.IsVisible)
            {
                return;
            }
            if (InstanceManage.GetInstance <PlayersInst>().AudioPlayer == null)
            {
                return;
            }
            var lyric = InstanceManage.GetInstance <LyricsInst>().LyricProvider.GetLyric(InstanceManage.GetInstance <PlayersInst>().AudioPlayer.OsuFile.Metadata.ArtistMeta.ToUnicodeString(),
                                                                                         InstanceManage.GetInstance <PlayersInst>().AudioPlayer.OsuFile.Metadata.TitleMeta.ToUnicodeString(), InstanceManage.GetInstance <PlayersInst>().AudioPlayer.Duration);

            LyricWindow.SetNewLyric(lyric, InstanceManage.GetInstance <PlayersInst>().AudioPlayer.OsuFile);
            LyricWindow.StartWork();
        }
コード例 #8
0
ファイル: MainWindow.xaml.cs プロジェクト: DaveCS1/Osu-Player
        public MainWindow()
        {
            PlayerViewModel.InitViewModel();

            InitializeComponent();
            ViewModel        = (MainWindowViewModel)DataContext;
            ViewModel.Player = PlayerViewModel.Current;
            LyricWindow      = new LyricWindow(this);
            if (AppSettings.Current.Lyric.EnableLyric)
            {
                LyricWindow.Show();
            }

            OverallKeyHook    = new OverallKeyHook(this);
            Animation.Loaded += Animation_Loaded;
            TryBindHotKeys();
        }
コード例 #9
0
        public MainWindow()
        {
            InitializeComponent();
            ViewModel        = (MainWindowViewModel)DataContext;
            WelcomeViewModel = (WelcomeViewModel)WelcomeArea.DataContext;
            PlayerViewModel.InitViewModel();
            ViewModel.Player = PlayerViewModel.Current;
            LyricWindow      = new LyricWindow(this);
            if (PlayerConfig.Current.Lyric.EnableLyric)
            {
                LyricWindow.Show();
            }

            OverallKeyHook = new OverallKeyHook(this);
            TryBindHotkeys();
            Unosquare.FFME.Library.FFmpegDirectory = Path.Combine(Domain.PluginPath, "ffmpeg");
        }