public GroupingsPageViewModel() { _cipherService = ServiceContainer.Resolve <ICipherService>("cipherService"); _folderService = ServiceContainer.Resolve <IFolderService>("folderService"); _collectionService = ServiceContainer.Resolve <ICollectionService>("collectionService"); _syncService = ServiceContainer.Resolve <ISyncService>("syncService"); _vaultTimeoutService = ServiceContainer.Resolve <IVaultTimeoutService>("vaultTimeoutService"); _deviceActionService = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService"); _platformUtilsService = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService"); _messagingService = ServiceContainer.Resolve <IMessagingService>("messagingService"); _stateService = ServiceContainer.Resolve <IStateService>("stateService"); _passwordRepromptService = ServiceContainer.Resolve <IPasswordRepromptService>("passwordRepromptService"); _organizationService = ServiceContainer.Resolve <IOrganizationService>("organizationService"); _policyService = ServiceContainer.Resolve <IPolicyService>("policyService"); _logger = ServiceContainer.Resolve <ILogger>("logger"); Loading = true; GroupedItems = new ObservableRangeCollection <IGroupingsPageListItem>(); RefreshCommand = new Command(async() => { Refreshing = true; await LoadAsync(); }); CipherOptionsCommand = new Command <CipherView>(CipherOptionsAsync); AccountSwitchingOverlayViewModel = new AccountSwitchingOverlayViewModel(_stateService, _messagingService, _logger) { AllowAddAccountRow = true }; }
public HomeViewModel() { _stateService = ServiceContainer.Resolve <IStateService>("stateService"); _messagingService = ServiceContainer.Resolve <IMessagingService>("messagingService"); var logger = ServiceContainer.Resolve <ILogger>("logger"); PageTitle = AppResources.Bitwarden; AccountSwitchingOverlayViewModel = new AccountSwitchingOverlayViewModel(_stateService, _messagingService, logger) { AllowActiveAccountSelection = true }; }
public AutofillCiphersPageViewModel() { _platformUtilsService = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService"); _cipherService = ServiceContainer.Resolve <ICipherService>("cipherService"); _deviceActionService = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService"); _stateService = ServiceContainer.Resolve <IStateService>("stateService"); _passwordRepromptService = ServiceContainer.Resolve <IPasswordRepromptService>("passwordRepromptService"); _messagingService = ServiceContainer.Resolve <IMessagingService>("messagingService"); _logger = ServiceContainer.Resolve <ILogger>("logger"); GroupedItems = new ObservableRangeCollection <IGroupingsPageListItem>(); CipherOptionsCommand = new Command <CipherView>(CipherOptionsAsync); AccountSwitchingOverlayViewModel = new AccountSwitchingOverlayViewModel(_stateService, _messagingService, _logger) { AllowAddAccountRow = false }; }
public AccountSwitchingOverlayView CreateAccountSwitchingOverlayView(UIView containerView) { var overlay = new AccountSwitchingOverlayView() { LongPressAccountEnabled = false, AfterHide = () => { if (containerView != null) { containerView.Hidden = true; } } }; var vm = new AccountSwitchingOverlayViewModel(_stateService, _messagingService, _logger) { FromIOSExtension = true }; overlay.BindingContext = vm; overlay.IsVisible = false; var renderer = Platform.CreateRenderer(overlay.Content); renderer.SetElementSize(new Size(containerView.Frame.Size.Width, containerView.Frame.Size.Height)); var view = renderer.NativeView; view.TranslatesAutoresizingMaskIntoConstraints = false; containerView.AddSubview(view); containerView.AddConstraints(new NSLayoutConstraint[] { NSLayoutConstraint.Create(containerView, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, view, NSLayoutAttribute.Trailing, 1f, 0f), NSLayoutConstraint.Create(containerView, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, view, NSLayoutAttribute.Leading, 1f, 0f), NSLayoutConstraint.Create(containerView, NSLayoutAttribute.Top, NSLayoutRelation.Equal, view, NSLayoutAttribute.Top, 1f, 0f), NSLayoutConstraint.Create(containerView, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, view, NSLayoutAttribute.Bottom, 1f, 0f) }); containerView.Hidden = true; return(overlay); }
public LoginPageViewModel() { _deviceActionService = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService"); _authService = ServiceContainer.Resolve <IAuthService>("authService"); _syncService = ServiceContainer.Resolve <ISyncService>("syncService"); _platformUtilsService = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService"); _stateService = ServiceContainer.Resolve <IStateService>("stateService"); _environmentService = ServiceContainer.Resolve <IEnvironmentService>("environmentService"); _i18nService = ServiceContainer.Resolve <II18nService>("i18nService"); _messagingService = ServiceContainer.Resolve <IMessagingService>("messagingService"); _logger = ServiceContainer.Resolve <ILogger>("logger"); PageTitle = AppResources.Bitwarden; TogglePasswordCommand = new Command(TogglePassword); LogInCommand = new Command(async() => await LogInAsync()); AccountSwitchingOverlayViewModel = new AccountSwitchingOverlayViewModel(_stateService, _messagingService, _logger) { AllowAddAccountRow = true, AllowActiveAccountSelection = true }; }
public LockPageViewModel() { _apiService = ServiceContainer.Resolve <IApiService>("apiService"); _platformUtilsService = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService"); _deviceActionService = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService"); _vaultTimeoutService = ServiceContainer.Resolve <IVaultTimeoutService>("vaultTimeoutService"); _cryptoService = ServiceContainer.Resolve <ICryptoService>("cryptoService"); _messagingService = ServiceContainer.Resolve <IMessagingService>("messagingService"); _environmentService = ServiceContainer.Resolve <IEnvironmentService>("environmentService"); _stateService = ServiceContainer.Resolve <IStateService>("stateService"); _biometricService = ServiceContainer.Resolve <IBiometricService>("biometricService"); _keyConnectorService = ServiceContainer.Resolve <IKeyConnectorService>("keyConnectorService"); _logger = ServiceContainer.Resolve <ILogger>("logger"); PageTitle = AppResources.VerifyMasterPassword; TogglePasswordCommand = new Command(TogglePassword); SubmitCommand = new Command(async() => await SubmitAsync()); AccountSwitchingOverlayViewModel = new AccountSwitchingOverlayViewModel(_stateService, _messagingService, _logger) { AllowAddAccountRow = true, AllowActiveAccountSelection = true }; }
public SendAddEditPageViewModel() { _deviceActionService = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService"); _platformUtilsService = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService"); _messagingService = ServiceContainer.Resolve <IMessagingService>("messagingService"); _stateService = ServiceContainer.Resolve <IStateService>("stateService"); _sendService = ServiceContainer.Resolve <ISendService>("sendService"); _logger = ServiceContainer.Resolve <ILogger>("logger"); TogglePasswordCommand = new Command(TogglePassword); ToggleOptionsCommand = new Command(ToggleOptions); TypeOptions = new List <KeyValuePair <string, SendType> > { new KeyValuePair <string, SendType>(AppResources.TypeText, SendType.Text), new KeyValuePair <string, SendType>(AppResources.TypeFile, SendType.File), }; DeletionTypeOptions = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>(AppResources.OneHour, AppResources.OneHour), new KeyValuePair <string, string>(AppResources.OneDay, AppResources.OneDay), new KeyValuePair <string, string>(AppResources.TwoDays, AppResources.TwoDays), new KeyValuePair <string, string>(AppResources.ThreeDays, AppResources.ThreeDays), new KeyValuePair <string, string>(AppResources.SevenDays, AppResources.SevenDays), new KeyValuePair <string, string>(AppResources.ThirtyDays, AppResources.ThirtyDays), new KeyValuePair <string, string>(AppResources.Custom, AppResources.Custom), }; ExpirationTypeOptions = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>(AppResources.Never, AppResources.Never), new KeyValuePair <string, string>(AppResources.OneHour, AppResources.OneHour), new KeyValuePair <string, string>(AppResources.OneDay, AppResources.OneDay), new KeyValuePair <string, string>(AppResources.TwoDays, AppResources.TwoDays), new KeyValuePair <string, string>(AppResources.ThreeDays, AppResources.ThreeDays), new KeyValuePair <string, string>(AppResources.SevenDays, AppResources.SevenDays), new KeyValuePair <string, string>(AppResources.ThirtyDays, AppResources.ThirtyDays), new KeyValuePair <string, string>(AppResources.Custom, AppResources.Custom), }; DeletionDateTimeViewModel = new DateTimeViewModel(AppResources.DeletionDate, AppResources.DeletionTime); ExpirationDateTimeViewModel = new DateTimeViewModel(AppResources.ExpirationDate, AppResources.ExpirationTime) { OnDateChanged = date => { if (!_isOverridingPickers && !ExpirationDateTimeViewModel.Time.HasValue) { // auto-set time to current time upon setting date ExpirationDateTimeViewModel.Time = DateTimeNow().TimeOfDay; } }, OnTimeChanged = time => { if (!_isOverridingPickers && !ExpirationDateTimeViewModel.Date.HasValue) { // auto-set date to current date upon setting time ExpirationDateTimeViewModel.Date = DateTime.Today; } }, DatePlaceholder = "mm/dd/yyyy", TimePlaceholder = "--:-- --" }; AccountSwitchingOverlayViewModel = new AccountSwitchingOverlayViewModel(_stateService, _messagingService, _logger); }