diff --git a/SiaDrive/SiaDriveDlg.cpp b/SiaDrive/SiaDriveDlg.cpp index aafa2fa..1e47deb 100644 --- a/SiaDrive/SiaDriveDlg.cpp +++ b/SiaDrive/SiaDriveDlg.cpp @@ -178,6 +178,8 @@ HRESULT CSiaDriveDlg::OnButtonCancel(IHTMLElement* /*pElement*/) HRESULT CSiaDriveDlg::OnButtonConfirmSeed(IHTMLElement* /*pElement*/) { _seedCreation = false; + _walletCreatedSeed = L""; + UpdateData(FALSE); this->Navigate(this->m_strCurrentUrl); return S_OK; @@ -347,10 +349,31 @@ void CSiaDriveDlg::DisplayCreateWallet() } } +void CSiaDriveDlg::RemoveElementById(const String& id) +{ + CComPtr element; + if (SUCCEEDED(GetDomElementById(id.c_str(), element))) + { + CComPtr parent; + if (SUCCEEDED(element->get_parentNode(&parent))) + { + CComPtr removed; + parent->removeChild(element, &removed); + } + } +} + +void CSiaDriveDlg::ClearCreateElements() +{ + RemoveElementById(L"create_wallet"); + RemoveElementById(L"disp_wallet_seed"); +} + void CSiaDriveDlg::DisplayWalletTab() { if (_siaApi.GetWallet()->GetCreated()) { + ClearCreateElements(); if (_siaApi.GetWallet()->GetLocked()) { DisplayUnlockWallet(); diff --git a/SiaDrive/SiaDriveDlg.h b/SiaDrive/SiaDriveDlg.h index 5fbf787..213b21f 100644 --- a/SiaDrive/SiaDriveDlg.h +++ b/SiaDrive/SiaDriveDlg.h @@ -45,11 +45,13 @@ protected: virtual BOOL PreTranslateMessage(MSG* pMsg) override; private: + void ClearCreateElements(); void DisplayCreateWallet(); void DisplayWalletTab(); void DisplaySeedCreated(const String& seed); bool DisplaySiaInfo(); void DisplayUnlockWallet(); + void RemoveElementById(const String& id); bool UpdateUi(const bool& refresh = true); HRESULT GetDomElementById(const CString& id, CComPtr& node); HRESULT GetDomElementAndNodeById(const CString& id, CComPtr& node, CComPtr& elem);