/// <summary> Обработчик нажатия на кнопку перегенерации ключа шифрования </summary>
        private void ButtonRegenerateEncryptionKey_Click(object sender, RoutedEventArgs e)
        {
            if (WindowMessageBox.Show(FactoryWindow.GetWindowUserSettings(), Application.Current.TryFindResource(@"ViewUserSettings_CreateNewKey") as string, Application.Current.TryFindResource(@"ViewUserSettings_AlertLostCorrespondence") as string, WindowMessageBoxButonEnum.ContinueCancel, WindowMessageBoxTypeEnum.Warning) != WindowMessageBoxButonEnum.Continue)
            {
                return;
            }

            var windowPasswordBox = FactoryWindow.GetWindowPasswordBox(PasswordBoxTypeEnum.RegenerateKey);

            windowPasswordBox.Owner = System.Windows.Window.GetWindow(this);

            windowPasswordBox.ShowDialog();

            if ((windowPasswordBox.ViewUserControl as ViewPasswordBox).Result)
            {
                var resultRegenerate = _viewModelUserSettings.RegenerateKeyPair();

                if (resultRegenerate)
                {
                    _viewModelUserSettings.ExportAviable = _viewModelUserSettings.CheckEncryptionkey();

                    _viewModelUserSettings.LocalSavePublicKey();

                    //Показ окна о генерации экрана, когда будет переделан механизм "растягивания" view на главном окне приложения, заменить здесь.
                    WindowMain.CurrentMainWindow.GridSecurityKeyGeneratedWinidow.Visibility = Visibility.Visible;
                }

                OnCloseWindow();
            }
        }
        /// <summary> Экспортировать ключ </summary>
        private void ButtonExport_Click(object sender, RoutedEventArgs e)
        {
            var windowPasswordBox = FactoryWindow.GetWindowPasswordBox(PasswordBoxTypeEnum.Export);

            windowPasswordBox.Owner = WindowMain.CurrentMainWindow;

            windowPasswordBox.ShowDialog();

            if ((windowPasswordBox.ViewUserControl as ViewPasswordBox).Result)
            {
                var encryptionkey = _viewModelUserSettings.GetUserPrivateKey();

                var saveFileDialog = new SaveFileDialog();
                saveFileDialog.Filter     = "Text Files | *.txt";
                saveFileDialog.DefaultExt = "txt";
                saveFileDialog.FileName   = "Dodicall_key.txt";

                var pathUser     = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
                var pathDownload = System.IO.Path.Combine(pathUser, "Downloads");

                saveFileDialog.InitialDirectory = pathDownload;
                if (saveFileDialog.ShowDialog() == true)
                {
                    File.WriteAllText(saveFileDialog.FileName, encryptionkey);
                    WindowStartup.Instance.ShowMessageTray(Application.Current.TryFindResource(@"ViewUserSettings_ExportSucced") as string);
                }
            }
        }
        /// <summary> Экспортировать в файл с вызовом окна пароля </summary>
        private void SaveAs()
        {
            var windowPasswordBox = FactoryWindow.GetWindowPasswordBox(PasswordBoxTypeEnum.Export);

            windowPasswordBox.Owner = WindowMain.CurrentMainWindow;

            windowPasswordBox.ShowDialog();
        }
        /// <summary> Копировать ключ в буфер обмена </summary>
        private void ButtonCopyToClipboard_Click(object sender, RoutedEventArgs e)
        {
            var windowPasswordBox = FactoryWindow.GetWindowPasswordBox(PasswordBoxTypeEnum.ExportToClipboard);

            windowPasswordBox.Owner = WindowMain.CurrentMainWindow;

            windowPasswordBox.ShowDialog();

            if ((windowPasswordBox.ViewUserControl as ViewPasswordBox).Result)
            {
                var encryptionkey = _viewModelUserSettings.GetUserPrivateKey();
                Clipboard.Clear();
                Clipboard.SetText(encryptionkey);

                WindowStartup.Instance.ShowMessageTray(Application.Current.TryFindResource(@"ViewUserSettings_ExportSucced") as string);
            }
        }
        /// <summary> Обработчик нажатия кнопки Импортировать </summary>
        private void ButtonImport_Click(object sender, RoutedEventArgs e)
        {
            var windowPasswordBox = FactoryWindow.GetWindowPasswordBox(PasswordBoxTypeEnum.Import);

            windowPasswordBox.Owner = WindowMain.CurrentMainWindow;

            windowPasswordBox.ShowDialog();

            if ((windowPasswordBox.ViewUserControl as ViewPasswordBox).Result)
            {
                var resultImport = _viewModelUserSettings.ImportAndSaveCryptKey();

                if (resultImport)
                {
                    ImportedPanel.Visibility = Visibility.Visible;
                }
                else
                {
                    WindowMessageBox.Show(this, Application.Current.TryFindResource(@"ViewUserSettings_ImportFail") as string);
                }
            }
        }