예제 #1
0
        public void ChooseBackgroundVideo()
        {
            string videoFilename = BackgroundVideoFilename;
            string initialPath   = string.IsNullOrEmpty(videoFilename) ? null : DosPathHelper.GetDirectory(videoFilename);
            Guid   dialogHandle  = ServiceRegistration.Get <IPathBrowser>().ShowPathBrowser(RES_HEADER_CHOOSE_VIDEO, true, false,
                                                                                            string.IsNullOrEmpty(initialPath) ? null : LocalFsResourceProviderBase.ToResourcePath(initialPath),
                                                                                            path =>
            {
                string choosenPath = LocalFsResourceProviderBase.ToDosPath(path.LastPathSegment.Path);
                if (string.IsNullOrEmpty(choosenPath))
                {
                    return(false);
                }

                return(MediaItemHelper.IsValidVideo(MediaItemHelper.CreateMediaItem(choosenPath)));
            });

            if (_pathBrowserCloseWatcher != null)
            {
                _pathBrowserCloseWatcher.Dispose();
            }

            _pathBrowserCloseWatcher = new PathBrowserCloseWatcher(this, dialogHandle, choosenPath =>
            {
                BackgroundVideoFilename = LocalFsResourceProviderBase.ToDosPath(choosenPath);
            },
                                                                   null);
        }
예제 #2
0
        /// <summary>
        /// Loads settings on startup or when changed inside configuration.
        /// </summary>
        protected void RefreshSettings(bool refresh = false)
        {
            EndBackgroundPlayback();
            if (_settings.Settings.EnableVideoBackground)
            {
                _videoFilename = _settings.Settings.VideoBackgroundFileName;
                _video         = string.IsNullOrWhiteSpace(_videoFilename) ? null : MediaItemHelper.CreateMediaItem(_videoFilename);
                IsEnabled      = MediaItemHelper.IsValidVideo(_video);
            }
            else
            {
                IsEnabled = false;
            }

            if (IsEnabled && refresh)
            {
                StartBackgroundPlayback();
            }
        }
예제 #3
0
        /// <summary>
        /// Loads settings on startup or when changed inside configuration.
        /// </summary>
        protected void RefreshSettings(bool refresh = false)
        {
            EndBackgroundPlayback();
            BackgroundManagerSettings settings = ServiceRegistration.Get <ISettingsManager>().Load <BackgroundManagerSettings>();

            if (settings.EnableVideoBackground)
            {
                _videoFilename = settings.VideoBackgroundFileName;
                _video         = string.IsNullOrWhiteSpace(_videoFilename) ? null : MediaItemHelper.CreateMediaItem(_videoFilename);
                IsEnabled      = MediaItemHelper.IsValidVideo(_video);
            }
            else
            {
                IsEnabled = false;
            }

            if (IsEnabled && refresh)
            {
                StartBackgroundPlayback();
            }
        }