Пример #1
0
 public PrepareWindow(Window owner, string title, KeyDirectoryCache keyDirCache)
 {
     Owner = owner;
     Title = title;
     WindowStartupLocation = WindowStartupLocation.CenterOwner;
     Topmost          = Properties.Settings.Default.Topmost;
     this.keyDirCache = keyDirCache;
     InitializeComponent();
     textBoxKeyDirectory.Text = keyDirCache.GetLastUsed();
     textBoxName.Focus();
     UpdateControls();
 }
Пример #2
0
        // actions

        private void Init()
        {
            this.RestorePosition(
                Properties.Settings.Default.Left,
                Properties.Settings.Default.Top,
                Properties.Settings.Default.Width,
                Properties.Settings.Default.Height);
            Topmost = Properties.Settings.Default.Topmost;
            autoClearClipboardAfterSec = Properties.Settings.Default.AutoClearClipboard;
            autoHidePasswordAfterSec   = Properties.Settings.Default.AutoHidePassword;
            reenterPasswordAfterSec    = Properties.Settings.Default.ReenterPassword;
            menuItemImageShow          = new Image {
                Source = imageShow16x16, Height = 16, Width = 16
            };
            menuItemImageHide = new Image {
                Source = imageHide16x16, Height = 16, Width = 16
            };
            menuItemImageShowDisabled = new Image {
                Source = imageShow16x16, Opacity = 0.5, Height = 16, Width = 16
            };
            contextMenuItemImageShow = new Image {
                Source = imageShow16x16, Height = 16, Width = 16
            };
            contextMenuItemImageHide = new Image {
                Source = imageHide16x16, Height = 16, Width = 16
            };
            var cacheDirectory = Properties.Settings.Default.CacheDirectory.ReplaceSpecialFolder();

            PrepareDirectory(cacheDirectory);
            keyDirectoryCache = new KeyDirectoryCache(cacheDirectory);
            keyDirectoryCache.Load();
            PrepareDirectory(keyDirectoryCache.GetLastUsed());
            UpdateLoginColumn();
            UpdatePasswordColumn();
            UpdateToolbar();
            SortListView();
            UpdateControls();
            var filename = Properties.Settings.Default.LastUsedRepositoryFile;

            if (!string.IsNullOrEmpty(filename) && File.Exists(filename))
            {
                OpenRepository(filename, true);
            }
            else
            {
                CreateRepository();
            }
        }
 public PropertiesWindow(Window owner, string title, KeyDirectoryCache keyDirCache, PasswordRepository repository, string filename)
 {
     Owner = owner;
     Title = title;
     WindowStartupLocation = WindowStartupLocation.CenterOwner;
     Topmost          = Properties.Settings.Default.Topmost;
     this.keyDirCache = keyDirCache;
     this.repository  = repository;
     InitializeComponent();
     textBoxName.Text         = repository.Name;
     textBoxDescription.Text  = repository.Description;
     textBoxPasswordFile.Text = filename;
     textBoxKeyDirectory.Text = keyDirCache.Get(repository.Id);
     textBoxKey.Text          = repository.Id;
     textBoxName.Focus();
 }
        public LoginWindow(Window owner, string title, KeyDirectoryCache keyDirCache, string repositoryFile)
        {
            Owner = owner;
            Title = title;
            WindowStartupLocation = WindowStartupLocation.CenterOwner;
            Topmost             = Properties.Settings.Default.Topmost;
            this.keyDirCache    = keyDirCache;
            this.repositoryFile = repositoryFile;
            InitializeComponent();
            labelDescription.Content = string.Format(
                Properties.Resources.LABEL_ENTER_MASTER_PASSWORD_FOR_0,
                new FileInfo(repositoryFile).Name);
            var id = PasswordRepository.GetIdFromFile(repositoryFile);

            textBoxKey.Text          = id;
            textBoxKeyDirectory.Text = keyDirCache.Get(id);
            passwordBox.Focus();
            UpdateControls();
        }