コード例 #1
0
        public PasswordEditorViewModel( IPasswordEditorModel model,
                                        DerivedPasswordViewModel.Factory derivedPasswordFactory,
                                        IExclusiveDelayedScheduler scheduler,
                                        IClipboardService clipboardService,
                                        IDialogService dialogService,
                                        IGuidToColorConverter guidToColor )
        {
            _model = model;
            _scheduler = scheduler;
            _clipboardService = clipboardService;
            _dialogService = dialogService;
            _guidToColor = guidToColor;
            _derivedPasswords = new ObservableCollection<DerivedPasswordViewModel>(
                _model.DerivedPasswords.Select( dp => derivedPasswordFactory( dp, _model ) ) );

            foreach ( DerivedPasswordViewModel passwordSlotViewModel in DerivedPasswords )
                passwordSlotViewModel.PropertyChanged += OnDerivedPasswordPropertyChanged;

            _saveCommand = new RelayCommand( ExecuteSave, CanExecuteSave );
            _copyCommand = new RelayCommand( ExecuteCopy, CanExecuteCopy );
            _deleteCommand = new RelayCommand( ExecuteDelete, CanExecuteDelete );

            _closeSelfCommand = new RelayCommand( ( ) => RaiseCloseRequested( CloseEditorEventType.Self ) );
            _closeAllCommand = new RelayCommand( ( ) => RaiseCloseRequested( CloseEditorEventType.All ) );
            _closeAllButSelfCommand = new RelayCommand( ( ) => RaiseCloseRequested( CloseEditorEventType.AllButSelf ) );
            _closeToTheRightCommand = new RelayCommand( ( ) => RaiseCloseRequested( CloseEditorEventType.RightOfSelf ) );
            _closeInsecureCommand = new RelayCommand( ( ) => RaiseCloseRequested( CloseEditorEventType.Insecure ) );

            Refresh( );
        }
 public PasswordListEntryViewModel( PasswordDigestDocument password, IGuidToColorConverter guidColorConverter,
                                    IFuzzyDateFormatter fuzzyDateFormatter )
 {
     _password = password;
     _guidColorConverter = guidColorConverter;
     _fuzzyDateFormatter = fuzzyDateFormatter;
 }