コード例 #1
0
        public void SetUpPasswordEditorViewModel( )
        {
            TestInjection
                .TestContainer( TestInjection.Mock<IClipboardService>( ),
                                ImmediateScheduler.Module )
                .InjectProperties( this );

            PasswordRepository.PasswordData = new InMemoryPasswordData( );

            ViewModel = ViewModelFactory.NewPasswordEditor( );
        }
コード例 #2
0
        private void RemoveEditor( PasswordEditorViewModel editorViewModel )
        {
            TabItem tabItem = FindTabItem( editorViewModel );

            if ( tabItem != null )
            {
                _tabbed.RemoveItem( tabItem );
                if ( !_tabbed.SelectedIndex.HasValue && _tabbed.ItemCount > 0 )
                    _tabbed.SelectedIndex = 0;
            }
        }
 public PasswordEditorViewModelFactory( PasswordEditorViewModel.Factory factory,
                                        IPasswordManagerEditor editor )
 {
     _factory = factory;
     _editor = editor;
 }
コード例 #4
0
 private Func<PasswordEditorViewModel, bool> CloseRequestPredicate( PasswordEditorViewModel source, CloseEditorEventType type )
 {
     switch ( type )
     {
         case CloseEditorEventType.Self:
             return e => e == source;
         case CloseEditorEventType.All:
             return e => true;
         case CloseEditorEventType.AllButSelf:
             return e => e != source;
         case CloseEditorEventType.RightOfSelf:
             return e => Editors.IndexOf( e ) > Editors.IndexOf( source );
         case CloseEditorEventType.Insecure:
             return e => e.RequiredGuidColor == e.ActualGuidColor && e.RequiredGuidColor != Colors.Transparent;
         default:
             throw new ArgumentOutOfRangeException( "type" );
     }
 }
コード例 #5
0
        private TabItem FindTabItem( PasswordEditorViewModel editorViewModel )
        {
            Func<TabItem, bool> hasMatchingEditor =
                item => item.Content is PasswordEditor
                        && ( (PasswordEditor) item.Content ).ViewModel == editorViewModel;

            return _tabbed.Items.FirstOrDefault( hasMatchingEditor );
        }
コード例 #6
0
 private static TabItem CreateTabItem( PasswordEditorViewModel editorViewModel )
 {
     return new TabItem
                {
                    Header = new PasswordEditorHeader { ViewModel = editorViewModel },
                    Content = new PasswordEditor { ViewModel = editorViewModel }
                };
 }
コード例 #7
0
 private void AddEditor( PasswordEditorViewModel editorViewModel )
 {
     TabItem newItem = CreateTabItem( editorViewModel );
     _tabbed.AddItem( newItem );
     _tabbed.SelectedItem = newItem;
 }