void lstPlayerType_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            PlayableExternalConfigurator uiConfigurator = PlayableItemFactory.Instance.GetPlayableExternalConfiguratorByName(ExternalPlayerName);

            ConfigData.ExternalPlayer externalPlayer = uiConfigurator.GetDefaultConfiguration();

            FillControlsFromObject(externalPlayer, uiConfigurator, false, false);
        }
Ejemplo n.º 2
0
        private void AutoFillPaths(PlayableExternalConfigurator configurator)
        {
            foreach (string path in configurator.GetKnownPlayerPaths())
            {
                if (File.Exists(path))
                {
                    txtCommand.Text = path;
                    return;
                }
            }

            txtCommand.Text = string.Empty;
        }
Ejemplo n.º 3
0
        private bool ValidateUserInput()
        {
            // Validate Player Path
            if (!IsPathValid(txtCommand.Text))
            {
                MessageBox.Show("Please enter a valid player path.");
                return(false);
            }

            if ((lstMediaTypes.ItemsSource as EnumWrapperList <MediaType>).GetCheckedValues().Count == 0)
            {
                MessageBox.Show("Please select at least one media type.");
                return(false);
            }

            if ((lstVideoFormats.ItemsSource as EnumWrapperList <VideoFormat>).GetCheckedValues().Count == 0)
            {
                MessageBox.Show("Please select at least one video format.");
                return(false);
            }

            PlayableExternalConfigurator uiConfigurator = PlayableItemFactory.Instance.GetPlayableExternalConfiguratorByName(ExternalPlayerName);

            if ((lstMediaTypes.ItemsSource as EnumWrapperList <MediaType>).GetCheckedValues().Contains(MediaType.ISO) && uiConfigurator.ShowIsoDirectLaunchWarning)
            {
                if (MessageBox.Show(uiConfigurator.IsoDirectLaunchWarning, "Confirm ISO Media Type", MessageBoxButton.YesNo) != MessageBoxResult.Yes)
                {
                    return(false);
                }
            }

            /*if (chkHideTaskbar.IsChecked == true)
             * {
             *  string warning = "Hiding the windows taskbar can improve the external player experience but comes with a warning. If MediaBrowser crashes or becomes unstable during playback, you may have to reboot your computer to get your taskbar back. You can also get the taskbar back by starting and stopping another video that uses the same player. Are you sure you want to continue?";
             *
             *  if (MessageBox.Show(warning, "Confirm Hide Taskbar", MessageBoxButton.YesNo) != MessageBoxResult.Yes)
             *  {
             *      return false;
             *  }
             * }*/

            return(true);
        }
Ejemplo n.º 4
0
        private void SetControlVisibility(PlayableExternalConfigurator configurator)
        {
            // Expose all fields only for the base class
            // We can make this more flexible down the road if needed
            if (configurator.GetType() == typeof(PlayableExternalConfigurator))
            {
                chkSupportsMultiFileCommand.Visibility = System.Windows.Visibility.Visible;
                chkSupportsPLS.Visibility = System.Windows.Visibility.Visible;
            }
            else
            {
                chkSupportsMultiFileCommand.Visibility = System.Windows.Visibility.Hidden;
                chkSupportsPLS.Visibility = System.Windows.Visibility.Hidden;
            }

            lblArguments.Visibility        = configurator.AllowArgumentsEditing ? System.Windows.Visibility.Visible : System.Windows.Visibility.Hidden;
            txtArguments.Visibility        = configurator.AllowArgumentsEditing ? System.Windows.Visibility.Visible : System.Windows.Visibility.Hidden;
            lbConfigureMyPlayer.Visibility = configurator.SupportsConfiguringUserSettings ? System.Windows.Visibility.Visible : System.Windows.Visibility.Hidden;
        }
Ejemplo n.º 5
0
        public void UpdateObjectFromControls(CommonConfigData.ExternalPlayer externalPlayer)
        {
            PlayableExternalConfigurator uiConfigurator = PlayableItemFactory.Instance.GetPlayableExternalConfiguratorByName(ExternalPlayerName);
            var externalPlayerDefault = uiConfigurator.GetDefaultConfiguration();

            externalPlayer.LaunchType         = externalPlayerDefault.LaunchType;
            externalPlayer.ExternalPlayerName = lstPlayerType.SelectedItem.ToString();

            externalPlayer.Args    = txtArguments.Text;
            externalPlayer.Command = txtCommand.Text;

            externalPlayer.MinimizeMCE      = chkMinimizeMce.IsChecked.Value;
            externalPlayer.ShowSplashScreen = chkShowSplashScreen.IsChecked.Value;
            //externalPlayer.HideTaskbar = chkHideTaskbar.IsChecked.Value;
            externalPlayer.SupportsMultiFileCommandArguments = chkSupportsMultiFileCommand.IsChecked.Value;
            externalPlayer.SupportsPlaylists = chkSupportsPLS.IsChecked.Value;

            externalPlayer.MediaTypes   = (lstMediaTypes.ItemsSource as EnumWrapperList <MediaType>).GetCheckedValues();
            externalPlayer.VideoFormats = (lstVideoFormats.ItemsSource as EnumWrapperList <VideoFormat>).GetCheckedValues();
        }
        public void FillControlsFromObject(ConfigData.ExternalPlayer externalPlayer, PlayableExternalConfigurator uiConfigurator, bool refreshMediaTypes, bool refreshVideoFormats)
        {
            lstPlayerType.SelectedItem = externalPlayer.ExternalPlayerName;

            txtArguments.Text = externalPlayer.Args;

            chkMinimizeMce.IsChecked      = externalPlayer.MinimizeMCE;
            chkShowSplashScreen.IsChecked = externalPlayer.ShowSplashScreen;
            //chkHideTaskbar.IsChecked = externalPlayer.HideTaskbar;
            chkSupportsMultiFileCommand.IsChecked = externalPlayer.SupportsMultiFileCommandArguments;
            chkSupportsPLS.IsChecked = externalPlayer.SupportsPlaylists;

            if (refreshMediaTypes)
            {
                EnumWrapperList <MediaType> mediaTypes = lstMediaTypes.ItemsSource as EnumWrapperList <MediaType>;
                mediaTypes.SetValues(externalPlayer.MediaTypes);
                SetListDataSource(lstMediaTypes, mediaTypes);
            }

            if (refreshVideoFormats)
            {
                EnumWrapperList <VideoFormat> videoFormats = lstVideoFormats.ItemsSource as EnumWrapperList <VideoFormat>;
                videoFormats.SetValues(externalPlayer.VideoFormats);
                SetListDataSource(lstVideoFormats, videoFormats);
            }

            SetControlVisibility(uiConfigurator);
            SetTips(uiConfigurator);

            if (string.IsNullOrEmpty(externalPlayer.Command))
            {
                AutoFillPaths(uiConfigurator);
            }
            else
            {
                txtCommand.Text = externalPlayer.Command;
            }
        }
Ejemplo n.º 7
0
        void lnkConfigureMyPlayer_Click(object sender, RoutedEventArgs e)
        {
            if (!ValidateUserInput())
            {
                return;
            }

            PlayableExternalConfigurator uiConfigurator = PlayableItemFactory.Instance.GetPlayableExternalConfiguratorByName(ExternalPlayerName);

            if (MessageBox.Show(uiConfigurator.ConfigureUserSettingsConfirmationMessage, "Configure Player", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
            {
                var currentConfiguration = uiConfigurator.GetDefaultConfiguration();
                currentConfiguration.Command = txtCommand.Text;

                try
                {
                    uiConfigurator.ConfigureUserSettings(currentConfiguration);
                }
                catch
                {
                    MessageBox.Show("There was an error configuring some settings. Please open your player and verify them.");
                }
            }
        }
Ejemplo n.º 8
0
 private void SetTips(PlayableExternalConfigurator configurator)
 {
     txtCommand.ToolTip    = configurator.CommandFieldTooltip;
     lblTipsHeader.Content = configurator.ExternalPlayerName + " Player Tips:";
     txtTips.Text          = configurator.PlayerTips;
 }