示例#1
0
        public async Task InitAsync()
        {
            _supportsBiometric = await _platformUtilsService.SupportsBiometricAsync();

            var lastSync = await _syncService.GetLastSyncAsync();

            if (lastSync != null)
            {
                lastSync      = lastSync.Value.ToLocalTime();
                _lastSyncDate = string.Format("{0} {1}",
                                              _localizeService.GetLocaleShortDate(lastSync.Value),
                                              _localizeService.GetLocaleShortTime(lastSync.Value));
            }

            if (await _policyService.PolicyAppliesToUser(PolicyType.MaximumVaultTimeout))
            {
                _vaultTimeoutPolicy = (await _policyService.GetAll(PolicyType.MaximumVaultTimeout)).First();
                var minutes = _policyService.GetPolicyInt(_vaultTimeoutPolicy, "minutes").GetValueOrDefault();
                _vaultTimeouts = _vaultTimeouts.Where(t =>
                                                      t.Value <= minutes &&
                                                      (t.Value > 0 || t.Value == CustomVaultTimeoutValue) &&
                                                      t.Value != null).ToList();
            }

            _vaultTimeout = await _vaultTimeoutService.GetVaultTimeout();

            _vaultTimeoutDisplayValue = _vaultTimeouts.FirstOrDefault(o => o.Value == _vaultTimeout).Key;
            var action = await _stateService.GetVaultTimeoutActionAsync() ?? VaultTimeoutAction.Lock;

            _vaultTimeoutActionDisplayValue = _vaultTimeoutActions.FirstOrDefault(o => o.Value == action).Key;
            var pinSet = await _vaultTimeoutService.IsPinLockSetAsync();

            _pin       = pinSet.Item1 || pinSet.Item2;
            _biometric = await _vaultTimeoutService.IsBiometricLockSetAsync();

            _screenCaptureAllowed = await _stateService.GetScreenCaptureAllowedAsync();

            if (_vaultTimeoutDisplayValue == null)
            {
                _vaultTimeoutDisplayValue = AppResources.Custom;
            }

            _showChangeMasterPassword = IncludeLinksWithSubscriptionInfo() &&
                                        !await _keyConnectorService.GetUsesKeyConnector();

            _reportLoggingEnabled = await _loggerService.IsEnabled();

            BuildList();
        }
示例#2
0
        public object Convert(object value, Type targetType, object parameter,
                              System.Globalization.CultureInfo culture)
        {
            if (targetType != typeof(string))
            {
                throw new InvalidOperationException("The target must be a string.");
            }
            if (value == null)
            {
                return(string.Empty);
            }
            var d = ((DateTime)value).ToLocalTime();

            return(string.Format("{0} {1}",
                                 _localizeService.GetLocaleShortDate(d),
                                 _localizeService.GetLocaleShortTime(d)));
        }