private void 打开钱包数据库OToolStripMenuItem_Click(object sender, EventArgs e) { using (OpenWalletDialog dialog = new OpenWalletDialog()) { if (dialog.ShowDialog() != DialogResult.OK) { return; } string path = dialog.WalletPath; LoadingFrm loadingFrm = new LoadingFrm("Opening..."); SplashScreen.Show(loadingFrm); NEP6Wallet nep6wallet = new NEP6Wallet(dialog.WalletPath, null); try { nep6wallet.Unlock(dialog.Password); } catch (CryptographicException) { SplashScreen.Close(); MessageBox.Show(Strings.PasswordIncorrect); return; } Settings.Default.LastWalletPath = path; Settings.Default.Save(); ChangeWallet(nep6wallet); Program.Wallet = nep6wallet; SplashScreen.Close(); } }
private void 创建钱包数据库NToolStripMenuItem_Click(object sender, EventArgs e) { using (CreateWalletDialog dialog = new CreateWalletDialog()) { if (dialog.ShowDialog() != DialogResult.OK) { return; } LoadingFrm loadingFrm = new LoadingFrm("Creating..."); SplashScreen.Show(loadingFrm); NEP6Wallet wallet = new NEP6Wallet(dialog.WalletPath, null); wallet.Unlock(dialog.Password); WalletAccount account = wallet.CreateAccount(); wallet.Save(); Settings.Default.LastWalletPath = dialog.WalletPath; Settings.Default.Save(); Program.Wallet = wallet; //ZoroChainSystem.Singleton.SetWallet(Program.Wallet); SplashScreen.Close(); } }
private void 创建新地址NToolStripMenuItem_Click(object sender, EventArgs e) { LoadingFrm loadingFrm = new LoadingFrm("Creating..."); SplashScreen.Show(loadingFrm); WalletAccount account = Program.Wallet.CreateAccount(); AddAccount(account); if (Program.Wallet is NEP6Wallet wallet) { wallet.Save(); } SplashScreen.Close(); }
private static void CreateInstance(LoadingFrm loadingFrm) { if (_SplashForm == null) { lock (_obj) { object obj = loadingFrm; _SplashForm = obj as Form; _SplashForm.TopMost = true; _SplashForm.ShowInTaskbar = false; _SplashForm.BringToFront(); _SplashForm.StartPosition = FormStartPosition.CenterScreen; if (_SplashForm == null) { throw (new Exception()); } } } }
public static void Show(LoadingFrm splashFormType) { if (_SplashThread != null) { return; } if (splashFormType == null) { throw (new Exception()); } _SplashThread = new Thread(new ThreadStart(delegate() { CreateInstance(splashFormType); Application.Run(_SplashForm); })); _SplashThread.IsBackground = true; _SplashThread.SetApartmentState(ApartmentState.STA); _SplashThread.Start(); }