예제 #1
0
        /// <summary>
        /// Opens the password menu and displays it to the user, allowing them to choose an existing password file.
        /// </summary>
        /// <param name="options">A list of options the user can choose from.</param>
        /// <returns>One of the values contained in <paramref name="options"/>, or null if no option was chosen.</returns>
        private string ShowPasswordMenu(IEnumerable <string> options)
        {
            MainWindowConfiguration windowConfig;

            try
            {
                windowConfig = MainWindowConfiguration.ParseMainWindowConfiguration(ConfigManager.Config);
            }
            catch (ConfigurationParseException e)
            {
                RaiseNotification(e.Message, ToolTipIcon.Error);
                return(null);
            }

            var menu = new PasswordSelectionWindow(options, windowConfig);

            menu.ShowDialog();
            if (menu.Success)
            {
                return(menu.GetSelection());
            }
            else
            {
                return(null);
            }
        }
예제 #2
0
        private string ShowFileSelectionWindow()
        {
            MainWindowConfiguration windowConfig;

            try
            {
                windowConfig = MainWindowConfiguration.ParseMainWindowConfiguration(ConfigManager.Config);
            }
            catch (ConfigurationParseException e)
            {
                RaiseNotification(e.Message, ToolTipIcon.Error);
                return(null);
            }

            // Ask the user where the password file should be placed.
            var pathWindow = new FileSelectionWindow(ConfigManager.Config.PasswordStore, windowConfig);

            pathWindow.ShowDialog();
            if (!pathWindow.Success)
            {
                return(null);
            }
            return(pathWindow.GetSelection());
        }