示例#1
0
        public LrcLineView()
        {
            InitializeComponent();

            LrcLinePanel.Items.Clear();
            CurrentTimeText.Clear();
            CurrentLrcText.Clear();

            Manager = new LrcManager();
        }
示例#2
0
        //------------//

        public ViewerPanel(ContextObject context)
        {
            InitializeComponent();

            // apply global theme
            Resources.MergedDictionaries[0].MergedDictionaries.Clear();

            _context = context;

            //edit by gh
            mediaElement.MediaUriPlayer.LAVFilterDirectory = "LAVFilters-0.74.1-x64";
            //mediaElement.MediaUriPlayer.LAVFilterDirectory =
            //IntPtr.Size == 8 ? "LAVFilters-0.72-x64\\" : "LAVFilters-0.72-x86\\";
            //--------------//

            //ShowViedoControlContainer(null, null);
            viewerPanel.PreviewMouseMove += ShowViedoControlContainer;

            mediaElement.MediaOpened += MediaOpened;
            mediaElement.MediaEnded  += MediaEnded;
            mediaElement.MediaFailed += MediaFailed;

            //buttonPlayPause.Click += TogglePlayPause;
            //buttonLoop.Click += ToggleShouldLoop;
            buttonTime.Click            += (sender, e) => buttonTime.Tag = (string)buttonTime.Tag == "Time" ? "Length" : "Time";
            buttonMute.Click            += (sender, e) => volumeSliderLayer.Visibility = Visibility.Visible;
            volumeSliderLayer.MouseDown += (sender, e) => volumeSliderLayer.Visibility = Visibility.Collapsed;

            sliderProgress.PreviewMouseDown += (sender, e) =>
            {
                _wasPlaying = mediaElement.IsPlaying;
                mediaElement.Pause();
            };
            sliderProgress.PreviewMouseUp += (sender, e) =>
            {
                if (_wasPlaying)
                {
                    mediaElement.Play();
                }
            };

            PreviewMouseWheel += (sender, e) => ChangeVolume((double)e.Delta / 120 * 0.04);

            //add by gh
            Manager        = new LrcManager();
            Timer.Tick    += new EventHandler(Timer_Tick);
            Timer.Interval = new TimeSpan(0, 0, 0, 0, 100);
            //-------------//
        }