public VideoPlayerControl() { DataContext = _playerControlVM; InitializeComponent(); _controlsHideAndShow = new FadeAnimationHelper(this, 2, _playControls, _systemButtons, _borderPrompt); //_imageBackground.Draggable(); _controlsHideAndShow.CanHideControls = () => { if (!string.IsNullOrWhiteSpace(_playerControlVM.State.FileName)) { Configuration config = MediaPlayerContext.Instance.AppConfig.Settings; bool isImage = !string.IsNullOrWhiteSpace(config.BackgroundImageFileName); return(config.IsSupportedVideoFile(_playerControlVM.State.FileName) || isImage); } else { return(false); } }; _playerControlVM.Init(_scrollPlayerContainer); _playControls.DataContext = _playerControlVM; _playerControlVM.PropertyChanged += _playerControlVM_PropertyChanged; }
private void TextBlock_TextUpdated(object sender, DataTransferEventArgs e) { _counter = 0; if (_bAllowShow) { _bAllowShow = false; FadeAnimationHelper.VisibilityShowAnimation(this, 0, (e1) => { _bAllowHide = true; }); } }
public MainWindow(string [] commandLine) { _commandLine = commandLine; Log.d("MediaPlayer.MkZ - MainWindow - c-tor"); InitializeComponent(); this.DataContext = Context; Context.PlayerVM = _player.DataContext as VideoPlayerControlVM; Context.MediaPlayerCommands = _mediaPlayerCommands = new MediaPlayerCommands(this, enableKeyboardShortcuts: true); _cmbFilesList.Items.Clear(); _cmbFilesList.ItemsSource = null; _controlsHideAndShow = new FadeAnimationHelper(this, 2, _imagesNavigation, _cursorArrow); _clock.Zoomable.EnableZoom(_scrollMain); _reiKiProgress.Zoomable.EnableZoom(_scrollMain); _zoomImage = new ScrollDragZoom(_imageBackground, _scrollMain); _zoomImage.FitWindow(0); Context.AppConfig.Settings.PropertyChanged += Config_PropertyChanged; Context.AppConfig.MediaDatabaseInfo.PropertyChanged += MediaDatabaseInfo_PropertyChanged; _hideHeaderAnimationHelper = new GridLengthAnimationHelper(this, rowHeader); SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged; Context.AppConfig.Load(); //add or select file if exists ProcessCommandLine(); MediaDB.OnPlayListSelectionChangedAction = (playList) => { SetPlayList(playList); }; _player.OnFullScreenButtonClick = (vm) => FullScreenToggle(); _player.OnFileDropAction = (fileNames) => { AddNewMediaFiles(fileNames, PlayerVM.Volume > 0 ? PlayerVM.Volume : 0.3); }; PlayerVM.MediaEndedAction = (vm) => OnMediaEnded(vm); PlayerVM.MediaFailedAction = (vm, ex) => OnMediaFailed(vm, ex); Context.AppConfig.Settings.MainWindowState.RestoreTo(this); this.WindowState = WindowState.Normal; //always normal - to position on correct screen for maximize }
private void timer_Tick(object sender, EventArgs e) { int timeOut = 5; if (bMouseOver) { timeOut = 50; } _timer.Stop(); _counter++; if (_bAllowHide && _counter > timeOut) { _bAllowHide = false; FadeAnimationHelper.VisibilityHideAnimation(this, 0, Visibility.Hidden, (e1) => { _bAllowShow = true; }); } _timer.Start(); }