private async void Window_Loaded(object sender, RoutedEventArgs e) {
            this.DataContext = encodeSettings;
            SettingsTab.Items.CurrentChanging += new CurrentChangingEventHandler(Items_CurrentChanging);
            if (MediaPlayer.WindowsMediaPlayer.IsWmpInstalled) {
                playerOriginal = new WmpPlayerWindow();
                playerOriginal.Title = "Original";
                playerOriginal.WindowState = WindowState.Maximized;
                playerChanges = new WmpPlayerWindow();
                playerChanges.Title = "Preview Changes";
                playerChanges.WindowState = WindowState.Maximized;
                playerChanges.Player.Player.PositionChanged += Player_PositionChanged;
            } else {
                PreviewOriginalButton.Visibility = Visibility.Hidden;
                PreviewChangesButton.Visibility = Visibility.Hidden;
            }
            if (Settings.SavedFile.MediaPlayerApp != MediaPlayerApplication.Mpc)
                PreviewMpcButton.Visibility = Visibility.Hidden;
            business.EncodingCompleted += business_EncodingCompleted;
            ProcessingQueueList.ItemsSource = MediaEncoderBusiness.ProcessingQueue;
            MpcConfigBusiness.IsSvpEnabled = false;

            MediaEncoderSettings RecoverSettings = await business.AutoLoadPreviewFileAsync();
            if (RecoverSettings != null)
                SetEncodeSettings(RecoverSettings);

            encodeSettings.AutoCalculateSize = true;

            // Only recover jobs if there are no jobs running
            if (!MediaEncoderBusiness.ProcessingQueue.Any())
                await business.AutoLoadJobsAsync();
        }
        public async Task OpenMediaAsync(Media item) {
            this.Item = item;

            TitleText.Text = Item.Title;
            TitleText.ToolTip = Item.Title;
            PositionText.Text = "";
            playerWindow = WmpPlayerWindow.Instance();
            playerBusiness = new WmpPlayerBusiness(playerWindow.Player);
            playerBusiness.AllowClose = true;
            playerBusiness.Closed += playerBusiness_Closed;
            playerBusiness.PositionChanged += playerBusiness_PositionChanged;
            playerBusiness.Show();
            await playerBusiness.PlayVideoAsync(Item);
        }
예제 #3
0
 public IMediaPlayerBusiness GetNewPlayer()
 {
     if (Settings.SavedFile == null)
     {
         return(null);
     }
     else if (Settings.SavedFile.MediaPlayerApp == MediaPlayerApplication.Mpc)
     {
         return(new MpcPlayerBusiness());
     }
     else
     {
         return(new WmpPlayerBusiness(new WmpPlayerController(WmpPlayerWindow.Instance().Player, WmpPlayerWindow.Instance())));
     }
 }
        public async Task OpenMediaAsync(Media item)
        {
            this.Item = item;

            TitleText.Text                  = Item.Title;
            TitleText.ToolTip               = Item.Title;
            PositionText.Text               = "";
            playerWindow                    = WmpPlayerWindow.Instance();
            playerBusiness                  = new WmpPlayerBusiness(new WmpPlayerController(playerWindow.Player, playerWindow));
            playerBusiness.AllowClose       = true;
            playerBusiness.Closed          += playerBusiness_Closed;
            playerBusiness.PositionChanged += playerBusiness_PositionChanged;
            playerBusiness.Show();
            await playerBusiness.PlayVideoAsync(Item, false);
        }
 private async Task PlayVideoAsync(WmpPlayerWindow playerWindow, string fileName) {
     playerWindow.Show();
     playerWindow.Activate();
     await playerWindow.Player.OpenFileAsync(fileName);
     playerWindow.Player.MediaOpened += (s2, e2) => {
         if (encodeSettings.Position.HasValue)
             playerWindow.Player.Position = encodeSettings.Position.Value;
         playerWindow.Player.Player.Pause();
     };
 }
예제 #6
0
        public static WmpPlayerWindow Instance()
        {
            WmpPlayerWindow NewForm = new WmpPlayerWindow();

            return(NewForm);
        }
 public static WmpPlayerWindow Instance() {
     WmpPlayerWindow NewForm = new WmpPlayerWindow();
     return NewForm;
 }