Ejemplo n.º 1
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();
            }
        }
Ejemplo n.º 2
0
 public MainWindow()
 {
     InitializeComponent();
     ViewModel   = (MainWindowViewModel)DataContext;
     LyricWindow = new LyricWindow(this);
     LyricWindow.Show();
     OverallKeyHook = new OverallKeyHook(this);
     TryBindHotkeys();
     Unosquare.FFME.MediaElement.FFmpegDirectory = Path.Combine(Domain.PluginPath, "ffmpeg");
 }
Ejemplo n.º 3
0
 private void MenuOpenHideLyric_Click(object sender, RoutedEventArgs e)
 {
     if (ViewModel.IsLyricWindowShown)
     {
         App.Config.Lyric.EnableLyric = false;
         LyricWindow.Hide();
     }
     else
     {
         App.Config.Lyric.EnableLyric = true;
         LyricWindow.Show();
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Call lyric provider to check lyric
        /// todo: this should run synchronously.
        /// </summary>
        public void SetLyric()
        {
            if (!LyricWindow.IsVisible)
            {
                return;
            }
            if (App.HitsoundPlayer == null)
            {
                return;
            }
            var lyric = App.LyricProvider.GetLyric(App.HitsoundPlayer.Osufile.Metadata.GetUnicodeArtist(),
                                                   App.HitsoundPlayer.Osufile.Metadata.GetUnicodeTitle(), App.MusicPlayer.Duration);

            LyricWindow.SetNewLyric(lyric, App.HitsoundPlayer.Osufile);
            LyricWindow.StartWork();
        }