public void PickRandomContentPlaylistAssetTest()
        {
            Playlist             playlist       = (Playlist)Serializer.Deserialize(typeof(Playlist), @"c:\OxigenIIAppDataSamples\AppData\ss_play_list.dat", true, "password");
            AssetScheduler       assetScheduler = new AssetScheduler();
            ContentPlaylistAsset actual;

            PlaylistAssetPicker cpp = new PlaylistAssetPicker(playlist, assetScheduler);

            actual = cpp.SelectAsset();

            Assert.IsNotNull(actual);
        }
        public void PickRandomContentPlaylistAssetTest1()
        {
            Playlist             playlist       = null;                                              // TODO: Initialize to an appropriate value
            AssetScheduler       assetScheduler = null;                                              // TODO: Initialize to an appropriate value
            PlaylistAssetPicker  target         = new PlaylistAssetPicker(playlist, assetScheduler); // TODO: Initialize to an appropriate value
            ContentPlaylistAsset expected       = null;                                              // TODO: Initialize to an appropriate value
            ContentPlaylistAsset actual;

            actual = target.SelectAsset();
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
        /// <summary>
        /// Shows a content asset on the screensaver and sets the timer to its length
        /// </summary>
        /// <param name="cpp">ContentPlaylistAssetPicker to determine a random content asset to pick</param>
        /// <param name="timer">Timer object to check whether the asset display length has elapsed</param>
        /// <returns>The information on the content playlist asset, null if no available asset found</returns>
        public static ContentPlaylistAsset ShowContentAsset(PlaylistAssetPicker playlistAssetPicker, Timer timer)
        {
            ContentPlaylistAsset cpa = playlistAssetPicker.PickRandomContentPlaylistAsset();

            if (cpa == null)
            {
                return(null);
            }

            timer.Interval = cpa.DisplayLength * 1000; // convert to seconds

            return(cpa);
        }
Exemple #4
0
        /// <summary>
        /// Default constructor that runs the screensaver in normal mode
        /// </summary>
        /// <param name="screenNo">index number of screen to run screensaver on</param>
        /// <param name="playlist">The playlist from which to draw assets</param>
        /// <param name="advertDisplayThreshold">threshold to determine whether to display an asset or an advert as the next asset</param>
        /// <param name="bErrorOnSetup">When error has occurred during setting up, screen saver will not run in normal mode</param>
        public ScreenSaver(int screenNo, Playlist playlist, float advertDisplayThreshold,
                           float protectedContentTime, float displayMessageAssetDisplayLength, int requestTimeout,
                           bool bMuteFlash, bool bMuteVideo, int flashVolume, int videoVolume,
                           bool bErrorOnSetup, string displayMessage, string appToRun,
                           string tempDecryptPath, string assetPath, bool bInsufficientMemoryForLargeFiles, float defaultDisplayLength, Logger logger)
        {
            _logger = logger;

            InitializeComponent();

            _logger.WriteTimestampedMessage("successfully InitializeComponent.");

            Cursor.Hide();

            _logger.WriteTimestampedMessage("successfully hidden the cursor.");

            this.ShowInTaskbar = false;

            _logger.WriteTimestampedMessage("successfully removed from taskbar.");

            _screenNo = screenNo;

            _logSingletonAccessor = new LogSingletonAccessor();

            _logger.WriteTimestampedMessage("successfully created a LogSingletonAccessor object.");

            _advertDisplayThreshold           = advertDisplayThreshold;
            _protectedContentTime             = protectedContentTime;
            _displayMessageAssetDisplayLength = displayMessageAssetDisplayLength == -1F ? 15F : displayMessageAssetDisplayLength;
            _requestTimeout = requestTimeout;
            _bErrorOnSetup  = bErrorOnSetup;
            _bInsufficientMemoryForLargeFiles = bInsufficientMemoryForLargeFiles;
            _displayMessage       = displayMessage;
            _appToRun             = appToRun;
            _tempDecryptPath      = tempDecryptPath;
            _assetPath            = assetPath;
            _defaultDisplayLength = defaultDisplayLength;

            _bPrimaryMonitor = IsPrimaryMonitor();

            if (!_bErrorOnSetup)
            {
                _bMuteFlash = bMuteFlash;
                _bMuteVideo = bMuteVideo;

                _flashVolume = flashVolume;
                _videoVolume = videoVolume;
            }

            if (_bErrorOnSetup)
            {
                _assetPath = "";
            }

            _logger.WriteTimestampedMessage("successfully allocated global variables.");

            _assetScheduler = new AssetScheduler();

            _logger.WriteTimestampedMessage("successfully created an AssetScheduler object.");

            _playlistAssetPicker = new PlaylistAssetPicker(playlist, _assetScheduler, _displayMessageAssetDisplayLength, assetPath,
                                                           _requestTimeout, _bErrorOnSetup, _logger, _bInsufficientMemoryForLargeFiles);

            _logger.WriteTimestampedMessage("successfully created a PlaylistAssetPicker object.");

            _stopwatch = new Stopwatch();

            _logger.WriteTimestampedMessage("successfully created a Stopwatch object.");

            _players = new PlayerContainer();

            if (PlayerContainer.QuickTimeRightVersionExists())
            {
                _players.Add(PlayerType.VideoQT, new QuicktimePlayer(_bMuteVideo, _videoVolume, _logger));
            }

            if (PlayerContainer.WindowsMediaPlayerRightVersionExists())
            {
                _players.Add(PlayerType.VideoNonQT, new WindowsMediaPlayer(_bMuteVideo, _videoVolume, _logger));
            }

            // these players always exist
            _players.Add(PlayerType.Flash, new FlashPlayer(bMuteFlash, _logger));
            _players.Add(PlayerType.Image, new ImagePlayer());
            _players.Add(PlayerType.WebSite, new WebsitePlayer(_logger));
            _players.Add(PlayerType.NoAssetsAnimator, new NoAssetsPlayer());

            foreach (IPlayer player in _players.AllPlayers())
            {
                Controls.Add(player.Control);
            }

            //Control.CheckForIllegalCrossThreadCalls = false;

            // set z-index of all containers/players to the same value
            int index = 2;

            foreach (IPlayer player in _players.AllPlayers())
            {
                _logger.WriteMessage(player.GetType() + " index set to " + index);
                Controls.SetChildIndex(player.Control, index);
                index++;
            }

            _currentSlide            = new Slide(_players.APlayers);
            _previousSlide           = new Slide(_players.BPlayers);
            _faderForm               = new FaderForm();
            _ddFormFader             = new DDFormFader(_faderForm.Handle);
            _faderForm.StartPosition = FormStartPosition.Manual;
            AddOwnedForm(_faderForm);

            _logger.WriteTimestampedMessage("successfully added the fader form as a form owned by the Screensaver Form.");
        }