Пример #1
0
        private void LoadConfiguration()
        {
            var userConfig = _config.GetUserTheaterConfiguration(_session.CurrentUser.Id);

            var homePageOption = SelectHomePage.Options.FirstOrDefault(i => string.Equals(i.Text, userConfig.HomePage, StringComparison.OrdinalIgnoreCase)) ??
                                 SelectHomePage.Options.FirstOrDefault(i => string.Equals(i.Text, "Default")) ??
                                 SelectHomePage.Options.First();

            SelectHomePage.SelectedValue = homePageOption.Value;

            var themeOption = SelectTheme.Options.FirstOrDefault(i => string.Equals(i.Text, userConfig.Theme, StringComparison.OrdinalIgnoreCase)) ??
                              SelectTheme.Options.FirstOrDefault(i => string.Equals(i.Text, "Default")) ??
                              SelectTheme.Options.First();

            SelectTheme.SelectedValue = themeOption.Value;

            var screensaverOption = SelectSreensaver.Options.FirstOrDefault(i => string.Equals(i.Text, userConfig.Screensaver, StringComparison.OrdinalIgnoreCase)) ??
                                    SelectSreensaver.Options.FirstOrDefault(i => string.Equals(i.Text, _screensaverManager.CurrentScreensaverName)) ??
                                    SelectSreensaver.Options.First();

            SelectSreensaver.SelectedValue = screensaverOption.Value;

            ChkShowBackButton.IsChecked = userConfig.ShowBackButton;

            ChkShowExternalDiscApp.IsChecked = userConfig.ShowExternalDiscApp;
        }
Пример #2
0
        private async void LoadConfiguration()
        {
            var userConfig = await _config.GetUserTheaterConfiguration(_session.CurrentUser.Id);

            var homePageOption = SelectHomePage.Options.FirstOrDefault(i => string.Equals(i.Text, userConfig.HomePage, StringComparison.OrdinalIgnoreCase)) ??
                                 SelectHomePage.Options.FirstOrDefault(i => string.Equals(i.Text, "Default")) ??
                                 SelectHomePage.Options.First();

            SelectHomePage.SelectedValue = homePageOption.Value;

            var themeOption = SelectTheme.Options.FirstOrDefault(i => string.Equals(i.Text, userConfig.Theme, StringComparison.OrdinalIgnoreCase)) ??
                              SelectTheme.Options.FirstOrDefault(i => string.Equals(i.Text, "Default")) ??
                              SelectTheme.Options.First();

            SelectTheme.SelectedValue = themeOption.Value;
        }
Пример #3
0
        /// <summary>
        /// Navigates to home page.
        /// </summary>
        /// <returns>DispatcherOperation.</returns>
        public async Task NavigateToHomePage()
        {
            _presentationManager.ShowLoadingAnimation();

            try
            {
                var userId = _sessionFactory().CurrentUser.Id;

                var userConfig = await _config.GetUserTheaterConfiguration(userId);

                var homePages = _presentationManager.HomePages.ToList();

                var homePage = homePages.FirstOrDefault(i => string.Equals(i.Name, userConfig.HomePage)) ??
                               homePages.FirstOrDefault(i => string.Equals(i.Name, "Default")) ??
                               homePages.First();

                var rootItem = await _apiClient.GetRootFolderAsync(userId);

                await Navigate(homePage.GetHomePage(rootItem));
            }
            finally
            {
                _presentationManager.HideLoadingAnimation();
            }
        }
Пример #4
0
        /// <summary>
        /// Navigates to home page.
        /// </summary>
        /// <returns>DispatcherOperation.</returns>
        public Task NavigateToHomePage()
        {
            var task = new TaskCompletionSource <bool>();

            App.Instance.ApplicationWindow.Dispatcher.InvokeAsync(async() =>
            {
                _presentationManager.ShowLoadingAnimation();
                try
                {
                    var userId = _sessionFactory().CurrentUser.Id;

                    var userConfig = _config.GetUserTheaterConfiguration(userId);

                    var homePages = _presentationManager.HomePages.ToList();

                    var homePage = homePages.FirstOrDefault(i => string.Equals(i.Name, userConfig.HomePage)) ??
                                   homePages.FirstOrDefault(i => string.Equals(i.Name, "Default")) ??
                                   homePages.First();

                    var rootItem = await _apiClient.GetRootFolderAsync(userId);

                    await Navigate(homePage.GetHomePage(rootItem));

                    //Clear history on home page navigate so that backspace on home page can lead to system options
                    ClearHistory();
                }
                finally
                {
                    _presentationManager.HideLoadingAnimation();
                    task.TrySetResult(true);
                }
            });

            return(task.Task);
        }
Пример #5
0
 private void SetDefaultCurrentScreenSaverName()
 {
     if (_session.CurrentUser != null)
     {
         var conf = _theaterConfigurationManager.GetUserTheaterConfiguration(_session.CurrentUser.Id);
         CurrentScreensaverName = conf != null ? conf.Screensaver : "Backdrop";
     }
     else
     {
         CurrentScreensaverName = "Logo";
     }
 }
Пример #6
0
        public DisplayPreferencesViewModel(DisplayPreferences displayPreferences, IPresentationManager presentation, ITheaterConfigurationManager configurationManager, ISessionManager sessionManager)
        {
            DisplayPreferences    = displayPreferences;
            _presentation         = presentation;
            _configurationManager = configurationManager;
            _sessionManager       = sessionManager;
            _userConfig           = configurationManager.GetUserTheaterConfiguration(sessionManager.CurrentUser.Id);

            SaveCommand = new RelayCommand(obj => Save());
            IncreaseImageSizeCommand     = new RelayCommand(obj => IncreaseImageSize());
            DecreaseImageSizeCommand     = new RelayCommand(obj => DecreaseImageSize());
            ToggleScrollDirectionCommand = new RelayCommand(obj => ToggleScrollDirection());
        }
        public DisplayPreferencesViewModel(DisplayPreferences displayPreferences, IPresentationManager presentation, ITheaterConfigurationManager configurationManager, ISessionManager sessionManager)
        {
            DisplayPreferences = displayPreferences;
            _presentation = presentation;
            _configurationManager = configurationManager;
            _sessionManager = sessionManager;
            _userConfig = configurationManager.GetUserTheaterConfiguration(sessionManager.CurrentUser.Id);

            SaveCommand = new RelayCommand(obj => Save());
            IncreaseImageSizeCommand = new RelayCommand(obj => IncreaseImageSize());
            DecreaseImageSizeCommand = new RelayCommand(obj => DecreaseImageSize());
            ToggleScrollDirectionCommand = new RelayCommand(obj => ToggleScrollDirection());
        }
Пример #8
0
        public async Task <DisplayPreferences> GetDisplayPreferences(string displayPreferencesId, CancellationToken cancellationToken)
        {
            var displayPreferences = await _apiClient.GetDisplayPreferencesAsync(displayPreferencesId, _sessionFactory().CurrentUser.Id, "MBT-" + _themeManager.CurrentTheme.Name, cancellationToken);

            var userConfig = _configurationManager.GetUserTheaterConfiguration(_sessionFactory().CurrentUser.Id);

            //Reset to name ascending if config option is turned off
            if (!userConfig.RememberSortOrder)
            {
                displayPreferences.SortOrder = SortOrder.Ascending;
                displayPreferences.SortBy    = "SortName";
            }

            return(displayPreferences);
        }
Пример #9
0
        public IEnumerable <IApp> GetApps()
        {
            // dont return an app if we dont have a cdrom dive or if we are configured not to show
            var conf = _theaterConfigurationManager.GetUserTheaterConfiguration(_sessionManager.LocalUserId);

            if (conf.ShowExternalDiscApp && SystemHasCdRom())
            {
                return new List <IApp> {
                           new PlayExternalDiscApp(_playbackManager, _imageManager, _logManager)
                }
            }
            ;
            else
            {
                return(new List <IApp>());
            }
        }
Пример #10
0
        public async Task Login(string username, string password)
        {
            using (var provider = SHA1.Create())
            {
                var hash = provider.ComputeHash(Encoding.UTF8.GetBytes(password ?? string.Empty));

                var result = await _apiClient.AuthenticateUserAsync(username, hash);

                CurrentUser = result.User;
                _apiClient.CurrentUserId = CurrentUser.Id;
            }

            EventHelper.FireEventIfNotNull(UserLoggedIn, this, EventArgs.Empty, _logger);

            var userConfig = await _config.GetUserTheaterConfiguration(CurrentUser.Id);

            var theme = _themeManager.Themes.FirstOrDefault(i => string.Equals(i.Name, userConfig.Theme)) ?? _themeManager.DefaultTheme;

            await _themeManager.LoadTheme(theme);

            await _navService.NavigateToHomePage();

            _navService.ClearHistory();
        }
Пример #11
0
        private void UpdateUserConfiguredValues()
        {
            var config = _config.GetUserTheaterConfiguration(SessionManager.CurrentUser.Id);

            ShowBackButton = config.ShowBackButton;
        }