Ejemplo n.º 1
0
 private void TryBindHotKeys()
 {
     OverallKeyHook.AddKeyHook(HotKeyType.TogglePlay, () => _controller.PlayList.CurrentInfo?.TogglePlayHandle());
     OverallKeyHook.AddKeyHook(HotKeyType.PrevSong, async() => await _controller.PlayPrevAsync());
     OverallKeyHook.AddKeyHook(HotKeyType.NextSong, async() => await _controller.PlayNextAsync());
     OverallKeyHook.AddKeyHook(HotKeyType.VolumeUp, () =>
     {
         AppSettings.Default.Volume.Main += 0.05f;
         AppSettings.SaveDefault();
     });
     OverallKeyHook.AddKeyHook(HotKeyType.VolumeDown, () =>
     {
         AppSettings.Default.Volume.Main -= 0.05f;
         AppSettings.SaveDefault();
     });
     OverallKeyHook.AddKeyHook(HotKeyType.SwitchFullMiniMode, () => { TriggerMiniWindow(); });
     OverallKeyHook.AddKeyHook(HotKeyType.AddCurrentToFav, () =>
     {
         //TODO
     });
     OverallKeyHook.AddKeyHook(HotKeyType.SwitchLyricWindow, () =>
     {
         if (LyricWindow.IsShown)
         {
             LyricWindow.Hide();
         }
         else
         {
             LyricWindow.Show();
         }
     });
 }
Ejemplo n.º 2
0
        private void TryBindHotKeys()
        {
            var page = new Pages.Settings.HotKeyPage();

            OverallKeyHook.AddKeyHook(page.PlayPause.Name, () => { PlayController.Default.TogglePlay(); });
            OverallKeyHook.AddKeyHook(page.Previous.Name, () =>
            {
                //TODO
            });
            OverallKeyHook.AddKeyHook(page.Next.Name, async() => { await PlayController.Default.PlayNext(); });
            OverallKeyHook.AddKeyHook(page.VolumeUp.Name, () => { AppSettings.Current.Volume.Main += 0.05f; });
            OverallKeyHook.AddKeyHook(page.VolumeDown.Name, () => { AppSettings.Current.Volume.Main -= 0.05f; });
            OverallKeyHook.AddKeyHook(page.FullMini.Name, () =>
            {
                //TODO
            });
            OverallKeyHook.AddKeyHook(page.AddToFav.Name, () =>
            {
                //TODO
            });
            OverallKeyHook.AddKeyHook(page.Lyric.Name, () =>
            {
                if (LyricWindow.IsShown)
                {
                    LyricWindow.Hide();
                }
                else
                {
                    LyricWindow.Show();
                }
            });
        }
Ejemplo n.º 3
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();
        }
Ejemplo n.º 4
0
        private void TryBindHotkeys()
        {
            var page = new Pages.Settings.HotKeyPage(this);

            OverallKeyHook.AddKeyHook(page.PlayPause.Name, () => { BtnPlay_Click(null, null); });
            OverallKeyHook.AddKeyHook(page.Previous.Name, () =>
            {
                //TODO
            });
            OverallKeyHook.AddKeyHook(page.Next.Name, () => { BtnNext_Click(null, null); });
            OverallKeyHook.AddKeyHook(page.VolumeUp.Name, () => { PlayerConfig.Current.Volume.Main += 0.05f; });
            OverallKeyHook.AddKeyHook(page.VolumeDown.Name, () => { PlayerConfig.Current.Volume.Main -= 0.05f; });
            OverallKeyHook.AddKeyHook(page.FullMini.Name, () =>
            {
                //TODO
            });
            OverallKeyHook.AddKeyHook(page.AddToFav.Name, () =>
            {
                //TODO
            });
            OverallKeyHook.AddKeyHook(page.Lyric.Name, () =>
            {
                if (LyricWindow.IsHide)
                {
                    LyricWindow.Show();
                }
                else
                {
                    LyricWindow.Hide();
                }
            });
        }
Ejemplo n.º 5
0
 private void MenuOpenHideLyric_Click(object sender, RoutedEventArgs e)
 {
     if (LyricWindow.IsShown)
     {
         LyricWindow.Hide();
     }
     else
     {
         LyricWindow.Show();
     }
 }
Ejemplo n.º 6
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();
     }
 }
Ejemplo n.º 7
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");
        }
Ejemplo n.º 8
0
        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();
        }
Ejemplo n.º 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");
        }