Example #1
0
        public VideoState(OverlayPlugin manager, XmlNode node, IMediaPlayer player)
            : base(manager, node)
        {
            mPlayer = player;
            mVideo = GetString(node, null, "File");
            if (mVideo == null)
                throw new ArgumentException("Unable to load VideoState. No File attribute specified.");
            mVideo = Path.GetFullPath(mVideo);
            if (!File.Exists(mVideo))
                throw new ArgumentException("Unable to load VideoState. The file '" + mVideo + "' does not exist.");

            mPlayer.PlaybackFinished += new Action(mPlayer_VideoFinished);
            mMainWindow = GetManager(manager, node, "video state");
            mBounds = manager.GetBounds(node, "video state");

            XmlAttribute toAttr = node.Attributes["FinishState"];
            if (toAttr != null && manager.GetState(toAttr.Value) != null) {
                mTrigger = new SimpleTrigger();
                ITransitionStyle transition = manager.GetTransition(node, "video state finish transition", new FeatureFrameTransitionFactory(new FeatureFadeFactory(), 2000), "Transition");
                if (transition == null) {
                    Logger.Debug("No transition specified for VideoState. using default 2s bitmap fade transition.");
                    transition = new FeatureFrameTransitionFactory(new FeatureFadeFactory(), 2000);
                }
                AddTransition(new StateTransition(Manager, this, manager.GetState(toAttr.Value), mTrigger, transition));
            }

            LoadTriggers(node, manager, "StartTriggers", mStartTriggers, new Action(StartTriggered));
            LoadTriggers(node, manager, "StopTriggers", mStopTriggers, new Action(StopTriggered));

            mRestartMode = GetBool(node, false, "RestartMode");
            if (mRestartMode) {
                LoadTriggers(node, manager, "ResetTriggers", mResetTriggers, new Action(RestartTriggered));
            }
        }
Example #2
0
        public VideoState(string name, FrameOverlayManager mainWindow, string video, State parent, ITransitionStyle transition, IMediaPlayer player)
            : base(name, mainWindow.Manager, DefaultBG)
        {
            mPlayer = player;
            mMainWindow = mainWindow;
            mVideo = Path.GetFullPath(video);
            mPlayer.PlaybackFinished += mPlayer_VideoFinished;

            mTrigger = new SimpleTrigger();
            AddTransition(new StateTransition(Manager, this, parent, mTrigger, transition));
        }