예제 #1
0
        public void BuildLists(II18nService i18nService)
        {
            ConfigTypes = Enum.GetNames(typeof(SsoType))
                          .Select(configType => new SelectListItem
            {
                Value = configType,
                Text  = i18nService.T(configType),
            }).ToList();

            SpNameIdFormats = Enum.GetNames(typeof(Saml2NameIdFormat))
                              .Select(nameIdFormat => new SelectListItem
            {
                Value = nameIdFormat,
                Text  = i18nService.T(nameIdFormat),
            }).ToList();

            BindingTypes = Enum.GetNames(typeof(Saml2BindingType))
                           .Select(bindingType => new SelectListItem
            {
                Value = bindingType,
                Text  = i18nService.T(bindingType),
            }).ToList();

            SigningBehaviors = Enum.GetNames(typeof(Saml2SigningBehavior))
                               .Select(behavior => new SelectListItem
            {
                Value = behavior,
                Text  = i18nService.T(behavior),
            }).ToList();

            SigningAlgorithms = SamlSigningAlgorithms.GetEnumerable().Select(a =>
                                                                             new SelectListItem(a, a)).ToList();
        }
예제 #2
0
 public AccountController(
     IAuthenticationSchemeProvider schemeProvider,
     IClientStore clientStore,
     IIdentityServerInteractionService interaction,
     ILogger <AccountController> logger,
     IOrganizationRepository organizationRepository,
     IOrganizationUserRepository organizationUserRepository,
     ISsoConfigRepository ssoConfigRepository,
     ISsoUserRepository ssoUserRepository,
     IUserRepository userRepository,
     IPolicyRepository policyRepository,
     IUserService userService,
     II18nService i18nService,
     UserManager <User> userManager)
 {
     _schemeProvider             = schemeProvider;
     _clientStore                = clientStore;
     _interaction                = interaction;
     _logger                     = logger;
     _organizationRepository     = organizationRepository;
     _organizationUserRepository = organizationUserRepository;
     _userRepository             = userRepository;
     _ssoConfigRepository        = ssoConfigRepository;
     _ssoUserRepository          = ssoUserRepository;
     _policyRepository           = policyRepository;
     _userService                = userService;
     _i18nService                = i18nService;
     _userManager                = userManager;
 }
예제 #3
0
        public TracksViewModelBase(IUnityContainer container) : base(container)
        {
            // Dependency injection
            this.container         = container;
            this.trackRepository   = container.Resolve <ITrackRepository>();
            this.dialogService     = container.Resolve <IDialogService>();
            this.searchService     = container.Resolve <ISearchService>();
            this.playbackService   = container.Resolve <IPlaybackService>();
            this.collectionService = container.Resolve <ICollectionService>();
            this.i18nService       = container.Resolve <II18nService>();
            this.eventAggregator   = container.Resolve <IEventAggregator>();
            this.providerService   = container.Resolve <IProviderService>();
            this.playlistService   = container.Resolve <IPlaylistService>();

            // Commands
            this.ToggleTrackOrderCommand      = new DelegateCommand(() => this.ToggleTrackOrder());
            this.AddTracksToPlaylistCommand   = new DelegateCommand <string>(async(playlistName) => await this.AddTracksToPlaylistAsync(playlistName, this.SelectedTracks));
            this.PlayNextCommand              = new DelegateCommand(async() => await this.PlayNextAsync());
            this.AddTracksToNowPlayingCommand = new DelegateCommand(async() => await this.AddTracksToNowPlayingAsync());

            // PubSub Events
            this.eventAggregator.GetEvent <SettingShowRemoveFromDiskChanged>().Subscribe((_) => OnPropertyChanged(() => this.ShowRemoveFromDisk));

            // Events
            this.i18nService.LanguageChanged += (_, __) =>
            {
                OnPropertyChanged(() => this.TotalDurationInformation);
                OnPropertyChanged(() => this.TotalSizeInformation);
                this.RefreshLanguage();
            };

            this.playbackService.TrackStatisticsChanged += PlaybackService_TrackStatisticsChanged;
        }
예제 #4
0
 public Fido2Service()
 {
     this._apiService           = ServiceContainer.Resolve <IApiService>("apiService");
     this._authService          = ServiceContainer.Resolve <IAuthService>("authService");
     this._i18nService          = ServiceContainer.Resolve <II18nService>("i18nService");
     this._platformUtilsService = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService");
 }
예제 #5
0
        public PolicyEditModel(Policy model, II18nService i18nService)
            : base(model)
        {
            if (model == null)
            {
                return;
            }

            // Inject service and create static lists
            TranslateStrings(i18nService);

            if (model.Data != null)
            {
                var options = new JsonSerializerOptions
                {
                    PropertyNameCaseInsensitive = true,
                };

                switch (model.Type)
                {
                case PolicyType.MasterPassword:
                    MasterPasswordDataModel = JsonSerializer.Deserialize <MasterPasswordDataModel>(model.Data, options);
                    break;

                case PolicyType.PasswordGenerator:
                    PasswordGeneratorDataModel = JsonSerializer.Deserialize <PasswordGeneratorDataModel>(model.Data, options);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
        }
        public PlaybackService(IFileService fileService, II18nService i18nService, ITrackRepository trackRepository,
                               IEqualizerService equalizerService, IQueuedTrackRepository queuedTrackRepository, IContainerProvider container, IPlaylistService playlistService)
        {
            this.fileService           = fileService;
            this.i18nService           = i18nService;
            this.trackRepository       = trackRepository;
            this.queuedTrackRepository = queuedTrackRepository;
            this.equalizerService      = equalizerService;
            this.playlistService       = playlistService;
            this.container             = container;

            this.context = SynchronizationContext.Current;

            this.queueManager = new QueueManager(this.trackRepository);

            // Event handlers
            this.fileService.ImportingTracks += (_, __) => this.canGetSavedQueuedTracks = false;
            this.fileService.TracksImported  += (tracks, track) => this.EnqueueFromFilesAsync(tracks, track);
            this.i18nService.LanguageChanged += (_, __) => this.UpdateQueueLanguageAsync();

            // Set up timers
            this.progressTimer.Interval = TimeSpan.FromSeconds(this.progressTimeoutSeconds).TotalMilliseconds;
            this.progressTimer.Elapsed += new ElapsedEventHandler(this.ProgressTimeoutHandler);

            this.saveQueuedTracksTimer.Interval = TimeSpan.FromSeconds(this.saveQueuedTracksTimeoutSeconds).TotalMilliseconds;
            this.saveQueuedTracksTimer.Elapsed += new ElapsedEventHandler(this.SaveQueuedTracksTimeoutHandler);

            this.savePlaybackCountersTimer.Interval = TimeSpan.FromSeconds(this.savePlaybackCountersTimeoutSeconds).TotalMilliseconds;
            this.savePlaybackCountersTimer.Elapsed += new ElapsedEventHandler(this.SavePlaybackCountersHandler);

            this.Initialize();
        }
예제 #7
0
        public Shell(IUnityContainer container, IWindowsIntegrationService windowsIntegrationService, II18nService i18nService,
            INotificationService notificationService, IWin32InputService win32InputService, IAppearanceService appearanceService,
            IPlaybackService playbackService, IMetadataService metadataService, IEventAggregator eventAggregator)
        {
            InitializeComponent();

            this.container = container;
            this.windowsIntegrationService = windowsIntegrationService;
            this.notificationService = notificationService;
            this.win32InputService = win32InputService;
            this.playbackService = playbackService;
            this.metadataService = metadataService;
            this.appearanceService = appearanceService;
            this.i18nService = i18nService;
            this.eventAggregator = eventAggregator;

            this.shellService = container.Resolve<IShellService>(
                new ParameterOverride("nowPlayingPage", typeof(NowPlaying.NowPlaying).FullName),
                new ParameterOverride("fullPlayerPage", typeof(FullPlayer.FullPlayer).FullName),
                new ParameterOverride("coverPlayerPage", typeof(CoverPlayer).FullName),
                new ParameterOverride("microplayerPage", typeof(MicroPlayer).FullName),
                new ParameterOverride("nanoPlayerPage", typeof(NanoPlayer).FullName)
                );

            this.InitializeServices();
            this.InitializeWindows();
            this.InitializeTrayIcon();
            this.InitializeCommands();
        }
예제 #8
0
        public Shell(IUnityContainer container, IRegionManager regionManager, IAppearanceService appearanceService, II18nService i18nService, IJumpListService jumpListService, IEventAggregator eventAggregator, INoteService noteService)
        {
            InitializeComponent();

            // Dependency injection
            this.container         = container;
            this.regionManager     = regionManager;
            this.appearanceService = appearanceService;
            this.i18nService       = i18nService;
            this.jumplistService   = jumpListService;
            this.eventAggregator   = eventAggregator;
            this.noteService       = noteService;

            // Theming
            this.appearanceService.ApplyTheme(SettingsClient.Get <string>("Appearance", "Theme"));
            this.appearanceService.ApplyColorScheme(SettingsClient.Get <bool>("Appearance", "FollowWindowsColor"), SettingsClient.Get <string>("Appearance", "ColorScheme"));

            // I18n
            this.i18nService.ApplyLanguageAsync(SettingsClient.Get <string>("Appearance", "Language"));

            // Events
            this.eventAggregator.GetEvent <ShowMainWindowEvent>().Subscribe((x) => this.ActivateNow());

            // Geometry
            this.SetGeometry(SettingsClient.Get <int>("General", "Top"), SettingsClient.Get <int>("General", "Left"), SettingsClient.Get <int>("General", "Width") > 50 ? SettingsClient.Get <int>("General", "Width") : Defaults.DefaultMainWindowWidth, SettingsClient.Get <int>("General", "Height") > 50 ? SettingsClient.Get <int>("General", "Height") : Defaults.DefaultMainWindowHeight, Defaults.DefaultMainWindowLeft, Defaults.DefaultMainWindowTop);

            // Main window state
            this.WindowState = SettingsClient.Get <bool>("General", "IsMaximized") ? WindowState.Maximized : WindowState.Normal;
        }
예제 #9
0
        public Shell(IContainerProvider container, IWindowsIntegrationService windowsIntegrationService, II18nService i18nService,
                     INotificationService notificationService, IWin32InputService win32InputService, IAppearanceService appearanceService,
                     IPlaybackService playbackService, IMetadataService metadataService, ILifetimeService lifetimeService,
                     IEventAggregator eventAggregator)
        {
            InitializeComponent();

            this.container = container;
            this.windowsIntegrationService = windowsIntegrationService;
            this.notificationService       = notificationService;
            this.win32InputService         = win32InputService;
            this.playbackService           = playbackService;
            this.metadataService           = metadataService;
            this.appearanceService         = appearanceService;
            this.i18nService     = i18nService;
            this.lifetimeService = lifetimeService;
            this.eventAggregator = eventAggregator;

            this.shellService = container.Resolve <Func <string, string, string, string, string, IShellService> >()(
                typeof(NowPlaying.NowPlaying).FullName, typeof(FullPlayer.FullPlayer).FullName, typeof(CoverPlayer).FullName,
                typeof(MicroPlayer).FullName, typeof(NanoPlayer).FullName);

            this.InitializeServices();
            this.InitializeWindows();
            this.InitializeTrayIcon();
            this.InitializeCommands();
        }
예제 #10
0
        public CommonViewModelBase(IUnityContainer container) : base(container)
        {
            // UnityContainer
            this.container = container;

            // EventAggregator
            this.eventAggregator = container.Resolve <IEventAggregator>();

            // Services
            this.providerService   = container.Resolve <IProviderService>();
            this.indexingService   = container.Resolve <IIndexingService>();
            this.playbackService   = container.Resolve <IPlaybackService>();
            this.searchService     = container.Resolve <ISearchService>();
            this.dialogService     = container.Resolve <IDialogService>();
            this.collectionService = container.Resolve <ICollectionService>();
            this.metadataService   = container.Resolve <IMetadataService>();
            this.i18nService       = container.Resolve <II18nService>();
            this.playlistService   = container.Resolve <IPlaylistService>();

            // Handlers
            this.providerService.SearchProvidersChanged += (_, __) => { this.GetSearchProvidersAsync(); };

            // Repositories
            this.trackRepository = container.Resolve <ITrackRepository>();

            // Initialize the search providers in the ContextMenu
            this.GetSearchProvidersAsync();

            // Initialize
            this.Initialize();
        }
예제 #11
0
        public SsoConfigEditViewModel(SsoConfig ssoConfig, II18nService i18nService,
                                      GlobalSettings globalSettings)
        {
            if (ssoConfig != null)
            {
                Id      = ssoConfig.Id;
                Enabled = ssoConfig.Enabled;
            }

            SsoConfigurationData configurationData;

            if (!string.IsNullOrWhiteSpace(ssoConfig?.Data))
            {
                var options = new JsonSerializerOptions
                {
                    PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
                };
                configurationData = JsonSerializer.Deserialize <SsoConfigurationData>(ssoConfig.Data, options);
            }
            else
            {
                configurationData = new SsoConfigurationData();
            }

            Data = new SsoConfigDataViewModel(configurationData, globalSettings);
            BuildLists(i18nService);
        }
예제 #12
0
        public TracksViewModelBase(IContainerProvider container) : base(container)
        {
            // Dependency injection
            this.container         = container;
            this.trackRepository   = container.Resolve <ITrackRepository>();
            this.dialogService     = container.Resolve <IDialogService>();
            this.searchService     = container.Resolve <ISearchService>();
            this.playbackService   = container.Resolve <IPlaybackService>();
            this.collectionService = container.Resolve <ICollectionService>();
            this.i18nService       = container.Resolve <II18nService>();
            this.eventAggregator   = container.Resolve <IEventAggregator>();
            this.providerService   = container.Resolve <IProviderService>();
            this.playlistService   = container.Resolve <IPlaylistService>();
            this.metadataService   = container.Resolve <IMetadataService>();

            // Events
            this.metadataService.MetadataChanged += MetadataChangedHandlerAsync;

            // Commands
            this.ToggleTrackOrderCommand      = new DelegateCommand(() => this.ToggleTrackOrder());
            this.AddTracksToPlaylistCommand   = new DelegateCommand <string>(async(playlistName) => await this.AddTracksToPlaylistAsync(playlistName, this.SelectedTracks));
            this.PlaySelectedCommand          = new DelegateCommand(async() => await this.PlaySelectedAsync());
            this.PlayNextCommand              = new DelegateCommand(async() => await this.PlayNextAsync());
            this.AddTracksToNowPlayingCommand = new DelegateCommand(async() => await this.AddTracksToNowPlayingAsync());

            this.UpdateShowTrackArtCommand = new DelegateCommand <bool?>((showTrackArt) =>
            {
                SettingsClient.Set <bool>("Appearance", "ShowTrackArtOnPlaylists", showTrackArt.Value, true);
            });

            // Settings changed
            SettingsClient.SettingChanged += (_, e) =>
            {
                if (SettingsClient.IsSettingChanged(e, "Behaviour", "ShowRemoveFromDisk"))
                {
                    RaisePropertyChanged(nameof(this.ShowRemoveFromDisk));
                }


                if (SettingsClient.IsSettingChanged(e, "Appearance", "ShowTrackArtOnPlaylists"))
                {
                    this.ShowTrackArt = (bool)e.SettingValue;
                    this.UpdateShowTrackArtAsync();
                }
            };

            // Events
            this.i18nService.LanguageChanged += (_, __) =>
            {
                RaisePropertyChanged(nameof(this.TotalDurationInformation));
                RaisePropertyChanged(nameof(this.TotalSizeInformation));
                this.RefreshLanguage();
            };

            this.playbackService.PlaybackCountersChanged += PlaybackService_PlaybackCountersChanged;

            // Load settings
            this.ShowTrackArt = SettingsClient.Get <bool>("Appearance", "ShowTrackArtOnPlaylists");
        }
예제 #13
0
        public AppearanceLanguageViewModel(II18nService i18nService)
        {
            this.i18nService = i18nService;

            this.GetLanguagesAsync();

            this.i18nService.LanguagesChanged += (_, __) => this.GetLanguagesAsync();
        }
예제 #14
0
 public UserVerificationService(IApiService apiService, IPlatformUtilsService platformUtilsService,
                                II18nService i18nService, ICryptoService cryptoService)
 {
     _apiService           = apiService;
     _platformUtilsService = platformUtilsService;
     _i18nService          = i18nService;
     _cryptoService        = cryptoService;
 }
예제 #15
0
 public ViewPageFieldViewModel(ViewPageViewModel vm, CipherView cipher, FieldView field)
 {
     _i18nService             = ServiceContainer.Resolve <II18nService>("i18nService");
     _vm                      = vm;
     _cipher                  = cipher;
     Field                    = field;
     ToggleHiddenValueCommand = new Command(ToggleHiddenValue);
 }
예제 #16
0
파일: App.xaml.cs 프로젝트: kactetus/Vitomu
 private void InitializeServices()
 {
     this.i18nService = SimpleIoc.Default.GetInstance <II18nService>();
     this.i18nService.ApplyLanguageAsync(SettingsClient.Get <string>("Configuration", "Language")); // Set default language
     this.convertService  = SimpleIoc.Default.GetInstance <IConvertService>();
     this.jumpListService = SimpleIoc.Default.GetInstance <IJumpListService>();
     this.jumpListService.PopulateJumpListAsync();
 }
예제 #17
0
 public ProductService(WebSpecDbContext dbContext, II18nService i18nService, ILogger <ProductService> logger,
                       IImageService imageService, IWishlistService wishlistService)
 {
     this.dbContext       = dbContext;
     this.i18nService     = i18nService;
     this.logger          = logger;
     this.imageService    = imageService;
     this.wishlistService = wishlistService;
 }
예제 #18
0
 public CollectionService(
     ICryptoService cryptoService,
     IStateService stateService,
     II18nService i18nService)
 {
     _cryptoService = cryptoService;
     _stateService  = stateService;
     _i18nService   = i18nService;
 }
 public ApiV1ProductController(ICategoryService categoryService, IImageService imageService, IProductService productService, IWishlistService wishlistService, II18nService i18nService,
                               ILogger <ApiV1ProductController> logger)
 {
     this.categoryService = categoryService;
     this.imageService    = imageService;
     this.productService  = productService;
     this.wishlistService = wishlistService;
     this.i18nService     = i18nService;
     this.logger          = logger;
 }
예제 #20
0
        public ShellViewModel(IAppearanceService appearanceService, II18nService i18nService, IDialogService dialogService, IEventAggregator eventAggregator, IRegionManager regionManager)
        {
            // Dependency injection
            this.regionManager     = regionManager;
            this.appearanceService = appearanceService;
            this.i18nService       = i18nService;
            this.dialogService     = dialogService;
            this.eventAggregator   = eventAggregator;

            // Theming
            this.appearanceService.ApplyColorScheme(SettingsClient.Get <bool>("Appearance", "FollowWindowsColor"), SettingsClient.Get <string>("Appearance", "ColorScheme"));

            // I18n
            this.i18nService.ApplyLanguageAsync(SettingsClient.Get <string>("Appearance", "Language"));

            // Commands
            this.OpenPathCommand = new DelegateCommand <string>((string path) =>
            {
                try
                {
                    Actions.TryOpenPath(path);
                }
                catch (Exception ex)
                {
                    LogClient.Error("Could not open the path {0} in Explorer. Exception: {1}", path, ex.Message);
                }
            });

            ApplicationCommands.OpenPathCommand.RegisterCommand(this.OpenPathCommand);

            this.OpenLinkCommand = new DelegateCommand <string>((string link) =>
            {
                try
                {
                    Actions.TryOpenLink(link);
                }
                catch (Exception ex)
                {
                    LogClient.Error("Could not open the link {0}. Exception: {1}", link, ex.Message);
                }
            });

            ApplicationCommands.OpenLinkCommand.RegisterCommand(this.OpenLinkCommand);

            this.NavigateBetweenMainCommand = new DelegateCommand <string>((index) => this.NavigateBetweenMain(index));
            ApplicationCommands.NavigateBetweenMainCommand.RegisterCommand(this.NavigateBetweenMainCommand);

            // Events
            this.dialogService.DialogVisibleChanged += isDialogVisible => this.IsDimmed = isDialogVisible;

            this.SubMenuSlideInFrom = 40;
            this.ContentSlideInFrom = 30;
            this.SearchSlideInFrom  = 20;
        }
예제 #21
0
 public SsoController(
     ISsoConfigRepository ssoConfigRepository,
     EnterprisePortalCurrentContext enterprisePortalCurrentContext,
     II18nService i18nService,
     GlobalSettings globalSettings)
 {
     _ssoConfigRepository            = ssoConfigRepository;
     _enterprisePortalCurrentContext = enterprisePortalCurrentContext;
     _i18nService    = i18nService;
     _globalSettings = globalSettings;
 }
예제 #22
0
 public CollectionService(
     ICryptoService cryptoService,
     IUserService userService,
     IStorageService storageService,
     II18nService i18nService)
 {
     _cryptoService  = cryptoService;
     _userService    = userService;
     _storageService = storageService;
     _i18nService    = i18nService;
 }
예제 #23
0
        public HomePage()
        {
            _messagingService     = ServiceContainer.Resolve <IMessagingService>("messagingService");
            _platformUtilsService = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService");
            _i18nService          = ServiceContainer.Resolve <II18nService>("i18nService");
            _cozyClientService    = ServiceContainer.Resolve <ICozyClientService>("cozyClientService");
            _broadcasterService   = ServiceContainer.Resolve <IBroadcasterService>("broadcasterService");

            _messagingService.Send("showStatusBar", false);
            InitializeComponent();
            _logo.Source = !ThemeManager.UsingLightTheme ? "logo_white.png" : "logo.png";
        }
예제 #24
0
 public FolderService(
     ICryptoService cryptoService,
     IStateService stateService,
     IApiService apiService,
     II18nService i18nService,
     ICipherService cipherService)
 {
     _cryptoService = cryptoService;
     _stateService  = stateService;
     _apiService    = apiService;
     _i18nService   = i18nService;
     _cipherService = cipherService;
 }
예제 #25
0
 protected BaseChangePasswordViewModel()
 {
     _platformUtilsService      = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService");
     _stateService              = ServiceContainer.Resolve <IStateService>("stateService");
     _policyService             = ServiceContainer.Resolve <IPolicyService>("policyService");
     _passwordGenerationService =
         ServiceContainer.Resolve <IPasswordGenerationService>("passwordGenerationService");
     _i18nService         = ServiceContainer.Resolve <II18nService>("i18nService");
     _cryptoService       = ServiceContainer.Resolve <ICryptoService>("cryptoService");
     _deviceActionService = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService");
     _apiService          = ServiceContainer.Resolve <IApiService>("apiService");
     _syncService         = ServiceContainer.Resolve <ISyncService>("syncService");
 }
예제 #26
0
        public CommonViewModelBase(IContainerProvider container) : base(container)
        {
            // Dependency injection
            this.container         = container;
            this.eventAggregator   = container.Resolve <IEventAggregator>();
            this.indexingService   = container.Resolve <IIndexingService>();
            this.playbackService   = container.Resolve <IPlaybackService>();
            this.searchService     = container.Resolve <ISearchService>();
            this.dialogService     = container.Resolve <IDialogService>();
            this.collectionService = container.Resolve <ICollectionService>();
            this.metadataService   = container.Resolve <IMetadataService>();
            this.i18nService       = container.Resolve <II18nService>();
            this.playlistService   = container.Resolve <IPlaylistService>();
            this.foldersService    = container.Resolve <IFoldersService>();

            // Commands
            this.ShowSelectedTrackInformationCommand = new DelegateCommand(() => this.ShowSelectedTrackInformation());
            this.SelectedTracksCommand = new DelegateCommand <object>((parameter) => this.SelectedTracksHandler(parameter));
            this.EditTracksCommand     = new DelegateCommand(() => this.EditSelectedTracks(), () => !this.IsIndexing);
            this.LoadedCommand         = new DelegateCommand(async() => await this.LoadedCommandAsync());
            this.UnloadedCommand       = new DelegateCommand(async() => await this.UnloadedCommandAsync());
            this.ShuffleAllCommand     = new DelegateCommand(() => this.playbackService.EnqueueAsync(true, false));

            // Events
            this.playbackService.PlaybackFailed      += (_, __) => this.ShowPlayingTrackAsync();
            this.playbackService.PlaybackPaused      += (_, __) => this.ShowPlayingTrackAsync();
            this.playbackService.PlaybackResumed     += (_, __) => this.ShowPlayingTrackAsync();
            this.playbackService.PlaybackStopped     += (_, __) => this.ShowPlayingTrackAsync();
            this.playbackService.PlaybackSuccess     += (_, __) => this.ShowPlayingTrackAsync();
            this.collectionService.CollectionChanged += async(_, __) => await this.FillListsAsync(); // Refreshes the lists when the Collection has changed

            this.foldersService.FoldersChanged += async(_, __) => await this.FillListsAsync();       // Refreshes the lists when marked folders have changed

            this.indexingService.RefreshLists += async(_, __) => await this.FillListsAsync();        // Refreshes the lists when the indexer has finished indexing

            this.indexingService.IndexingStarted += (_, __) => this.SetEditCommands();
            this.indexingService.IndexingStopped += (_, __) => this.SetEditCommands();
            this.searchService.DoSearch          += (searchText) => this.FilterLists();
            this.metadataService.RatingChanged   += MetadataService_RatingChangedAsync;
            this.metadataService.LoveChanged     += MetadataService_LoveChangedAsync;

            // Flags
            this.EnableRating = SettingsClient.Get <bool>("Behaviour", "EnableRating");
            this.EnableLove   = SettingsClient.Get <bool>("Behaviour", "EnableLove");

            // This makes sure the IsIndexing is correct even when this ViewModel is
            // created after the Indexer is started, and thus after triggering the
            // IndexingService.IndexerStarted event.
            this.SetEditCommands();
        }
예제 #27
0
        public PlaylistViewModelBase(IContainerProvider container) : base(container)
        {
            // Dependency injection
            this.container       = container;
            this.playbackService = container.Resolve <IPlaybackService>();
            this.eventAggregator = container.Resolve <IEventAggregator>();
            this.searchService   = container.Resolve <ISearchService>();
            this.dialogService   = container.Resolve <IDialogService>();
            this.providerService = container.Resolve <IProviderService>();
            this.i18nService     = container.Resolve <II18nService>();

            // Commands
            this.PlaySelectedCommand          = new DelegateCommand(async() => await this.PlaySelectedAsync());
            this.PlayNextCommand              = new DelegateCommand(async() => await this.PlayNextAsync());
            this.AddTracksToNowPlayingCommand = new DelegateCommand(async() => await this.AddTracksToNowPlayingAsync());
            this.UpdateShowTrackArtCommand    = new DelegateCommand <bool?>((showTrackArt) =>
            {
                SettingsClient.Set <bool>("Appearance", "ShowTrackArtOnPlaylists", showTrackArt.Value, true);
            });

            // Settings
            SettingsClient.SettingChanged += (_, e) =>
            {
                if (SettingsClient.IsSettingChanged(e, "Behaviour", "EnableRating"))
                {
                    this.EnableRating = (bool)e.SettingValue;
                }

                if (SettingsClient.IsSettingChanged(e, "Behaviour", "EnableLove"))
                {
                    this.EnableLove = (bool)e.SettingValue;
                }
            };

            // Events
            this.i18nService.LanguageChanged += (_, __) => this.RefreshLanguage();

            SettingsClient.SettingChanged += (_, e) =>
            {
                if (SettingsClient.IsSettingChanged(e, "Appearance", "ShowTrackArtOnPlaylists"))
                {
                    this.ShowTrackArt = (bool)e.SettingValue;
                    this.UpdateShowTrackArtAsync();
                }
            };

            // Settings
            this.ShowTrackArt = SettingsClient.Get <bool>("Appearance", "ShowTrackArtOnPlaylists");
        }
예제 #28
0
 public SendService(
     ICryptoService cryptoService,
     IUserService userService,
     IApiService apiService,
     IStorageService storageService,
     II18nService i18nService,
     ICryptoFunctionService cryptoFunctionService)
 {
     _cryptoService         = cryptoService;
     _userService           = userService;
     _apiService            = apiService;
     _storageService        = storageService;
     _i18nService           = i18nService;
     _cryptoFunctionService = cryptoFunctionService;
 }
예제 #29
0
 public PoliciesController(
     IUserService userService,
     IOrganizationService organizationService,
     IPolicyService policyService,
     IPolicyRepository policyRepository,
     EnterprisePortalCurrentContext enterprisePortalCurrentContext,
     II18nService i18nService)
 {
     _userService                    = userService;
     _organizationService            = organizationService;
     _policyService                  = policyService;
     _policyRepository               = policyRepository;
     _enterprisePortalCurrentContext = enterprisePortalCurrentContext;
     _i18nService                    = i18nService;
 }
예제 #30
0
        public RegisterPageViewModel()
        {
            _deviceActionService  = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService");
            _apiService           = ServiceContainer.Resolve <IApiService>("apiService");
            _cryptoService        = ServiceContainer.Resolve <ICryptoService>("cryptoService");
            _platformUtilsService = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService");
            _i18nService          = ServiceContainer.Resolve <II18nService>("i18nService");
            _environmentService   = ServiceContainer.Resolve <IEnvironmentService>("environmentService");

            PageTitle                    = AppResources.CreateAccount;
            TogglePasswordCommand        = new Command(TogglePassword);
            ToggleConfirmPasswordCommand = new Command(ToggleConfirmPassword);
            SubmitCommand                = new Command(async() => await SubmitAsync());
            ShowTerms                    = !_platformUtilsService.IsSelfHost();
        }