Пример #1
0
        private void SaveWallet()
        {
            try
            {
                SaveFileDialog saveFileDialog = new SaveFileDialog();
                saveFileDialog.FileName        = Properties.Settings.Default.WalletFileName.Length == 0 ? $"{DatabaseName}_{tcBitcoin.CashAccountCode}" : Properties.Settings.Default.WalletFileName;
                saveFileDialog.Filter          = "All files (*.*) | *.*";
                saveFileDialog.CheckFileExists = false;
                saveFileDialog.Title           = $"Save {tcBitcoin.CashAccountCode}";

                if (saveFileDialog.ShowDialog() == true)
                {
                    tcBitcoin.SaveWallet(saveFileDialog.FileName);
                    Properties.Settings.Default.WalletFileName = saveFileDialog.FileName;
                    Properties.Settings.Default.Save();
                    MessageBox.Show($"Wallet saved to {saveFileDialog.SafeFileName}", saveFileDialog.Title, MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }
            catch (Exception err)
            {
                MessageBox.Show($"{err.Message}", $"{err.Source}.{err.TargetSite.Name}", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }