diff --git a/FireWallet/MainForm.Designer.cs b/FireWallet/MainForm.Designer.cs index 297588a..e78567d 100644 --- a/FireWallet/MainForm.Designer.cs +++ b/FireWallet/MainForm.Designer.cs @@ -37,7 +37,7 @@ timerNodeStatus = new System.Windows.Forms.Timer(components); panelaccount = new Panel(); groupBoxaccount = new GroupBox(); - label1 = new Label(); + labelloginprompt = new Label(); comboBoxaccount = new ComboBox(); textBoxaccountpassword = new TextBox(); buttonaccountlogin = new Button(); @@ -45,9 +45,9 @@ labelaccountusername = new Label(); buttonaccountnew = new Button(); panelNav = new Panel(); - buttonReceive = new Button(); - buttonSend = new Button(); - buttonPortfolio = new Button(); + buttonNavReceive = new Button(); + buttonNavSend = new Button(); + buttonNavPortfolio = new Button(); panelPortfolio = new Panel(); groupBoxTransactions = new GroupBox(); groupBoxinfo = new GroupBox(); @@ -59,6 +59,17 @@ labelLocked = new Label(); labelBalance = new Label(); panelSend = new Panel(); + checkBoxSendSubFee = new CheckBox(); + buttonSendMax = new Button(); + buttonSendHNS = new Button(); + labelSendingError = new Label(); + labelSendingFee = new Label(); + textBoxSendingAmount = new TextBox(); + textBoxSendingTo = new TextBox(); + labelSendingMax = new Label(); + labelSendingAmount = new Label(); + labelSendingTo = new Label(); + labelSendPrompt = new Label(); statusStripmain.SuspendLayout(); panelaccount.SuspendLayout(); groupBoxaccount.SuspendLayout(); @@ -66,6 +77,7 @@ panelPortfolio.SuspendLayout(); groupBoxinfo.SuspendLayout(); groupBoxbalance.SuspendLayout(); + panelSend.SuspendLayout(); SuspendLayout(); // // statusStripmain @@ -128,7 +140,7 @@ // // groupBoxaccount // - groupBoxaccount.Controls.Add(label1); + groupBoxaccount.Controls.Add(labelloginprompt); groupBoxaccount.Controls.Add(comboBoxaccount); groupBoxaccount.Controls.Add(textBoxaccountpassword); groupBoxaccount.Controls.Add(buttonaccountlogin); @@ -143,15 +155,15 @@ groupBoxaccount.TabStop = false; groupBoxaccount.Text = "Login"; // - // label1 + // labelloginprompt // - label1.AutoSize = true; - label1.Font = new Font("Segoe UI", 15.75F, FontStyle.Regular, GraphicsUnit.Point); - label1.Location = new Point(6, 19); - label1.Name = "label1"; - label1.Size = new Size(281, 30); - label1.TabIndex = 7; - label1.Text = "Please Login to your account"; + labelloginprompt.AutoSize = true; + labelloginprompt.Font = new Font("Segoe UI", 15.75F, FontStyle.Regular, GraphicsUnit.Point); + labelloginprompt.Location = new Point(6, 19); + labelloginprompt.Name = "labelloginprompt"; + labelloginprompt.Size = new Size(281, 30); + labelloginprompt.TabIndex = 7; + labelloginprompt.Text = "Please Login to your account"; // // comboBoxaccount // @@ -216,49 +228,52 @@ // // panelNav // - panelNav.Controls.Add(buttonReceive); - panelNav.Controls.Add(buttonSend); - panelNav.Controls.Add(buttonPortfolio); + panelNav.Controls.Add(buttonNavReceive); + panelNav.Controls.Add(buttonNavSend); + panelNav.Controls.Add(buttonNavPortfolio); panelNav.Dock = DockStyle.Left; panelNav.Location = new Point(0, 22); panelNav.Name = "panelNav"; panelNav.Size = new Size(114, 553); panelNav.TabIndex = 6; // - // buttonReceive + // buttonNavReceive // - buttonReceive.FlatStyle = FlatStyle.Flat; - buttonReceive.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); - buttonReceive.Location = new Point(12, 134); - buttonReceive.Name = "buttonReceive"; - buttonReceive.Size = new Size(89, 30); - buttonReceive.TabIndex = 1; - buttonReceive.Text = "Receive"; - buttonReceive.UseVisualStyleBackColor = true; + buttonNavReceive.FlatStyle = FlatStyle.Flat; + buttonNavReceive.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); + buttonNavReceive.Location = new Point(12, 134); + buttonNavReceive.Name = "buttonNavReceive"; + buttonNavReceive.Size = new Size(89, 30); + buttonNavReceive.TabIndex = 1; + buttonNavReceive.TabStop = false; + buttonNavReceive.Text = "Receive"; + buttonNavReceive.UseVisualStyleBackColor = true; // - // buttonSend + // buttonNavSend // - buttonSend.FlatStyle = FlatStyle.Flat; - buttonSend.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); - buttonSend.Location = new Point(12, 80); - buttonSend.Name = "buttonSend"; - buttonSend.Size = new Size(89, 30); - buttonSend.TabIndex = 1; - buttonSend.Text = "Send"; - buttonSend.UseVisualStyleBackColor = true; - buttonSend.Click += buttonSend_Click; + buttonNavSend.FlatStyle = FlatStyle.Flat; + buttonNavSend.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); + buttonNavSend.Location = new Point(12, 80); + buttonNavSend.Name = "buttonNavSend"; + buttonNavSend.Size = new Size(89, 30); + buttonNavSend.TabIndex = 1; + buttonNavSend.TabStop = false; + buttonNavSend.Text = "Send"; + buttonNavSend.UseVisualStyleBackColor = true; + buttonNavSend.Click += SendPanel_Click; // - // buttonPortfolio + // buttonNavPortfolio // - buttonPortfolio.FlatStyle = FlatStyle.Flat; - buttonPortfolio.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); - buttonPortfolio.Location = new Point(12, 25); - buttonPortfolio.Name = "buttonPortfolio"; - buttonPortfolio.Size = new Size(89, 30); - buttonPortfolio.TabIndex = 0; - buttonPortfolio.Text = "Portfolio"; - buttonPortfolio.UseVisualStyleBackColor = true; - buttonPortfolio.Click += buttonPortfolio_Click; + buttonNavPortfolio.FlatStyle = FlatStyle.Flat; + buttonNavPortfolio.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); + buttonNavPortfolio.Location = new Point(12, 25); + buttonNavPortfolio.Name = "buttonNavPortfolio"; + buttonNavPortfolio.Size = new Size(89, 30); + buttonNavPortfolio.TabIndex = 0; + buttonNavPortfolio.TabStop = false; + buttonNavPortfolio.Text = "Portfolio"; + buttonNavPortfolio.UseVisualStyleBackColor = true; + buttonNavPortfolio.Click += PortfolioPanel_Click; // // panelPortfolio // @@ -367,12 +382,138 @@ // // panelSend // + panelSend.Controls.Add(checkBoxSendSubFee); + panelSend.Controls.Add(buttonSendMax); + panelSend.Controls.Add(buttonSendHNS); + panelSend.Controls.Add(labelSendingError); + panelSend.Controls.Add(labelSendingFee); + panelSend.Controls.Add(textBoxSendingAmount); + panelSend.Controls.Add(textBoxSendingTo); + panelSend.Controls.Add(labelSendingMax); + panelSend.Controls.Add(labelSendingAmount); + panelSend.Controls.Add(labelSendingTo); + panelSend.Controls.Add(labelSendPrompt); panelSend.Location = new Point(120, 25); panelSend.Name = "panelSend"; - panelSend.Size = new Size(200, 100); + panelSend.Size = new Size(974, 521); panelSend.TabIndex = 2; panelSend.Visible = false; // + // checkBoxSendSubFee + // + checkBoxSendSubFee.AutoSize = true; + checkBoxSendSubFee.CheckAlign = ContentAlignment.MiddleRight; + checkBoxSendSubFee.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); + checkBoxSendSubFee.Location = new Point(254, 258); + checkBoxSendSubFee.Name = "checkBoxSendSubFee"; + checkBoxSendSubFee.Size = new Size(206, 25); + checkBoxSendSubFee.TabIndex = 16; + checkBoxSendSubFee.Text = "Subtract Fee from Output"; + checkBoxSendSubFee.UseVisualStyleBackColor = true; + // + // buttonSendMax + // + buttonSendMax.FlatStyle = FlatStyle.Flat; + buttonSendMax.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); + buttonSendMax.Location = new Point(609, 159); + buttonSendMax.Name = "buttonSendMax"; + buttonSendMax.Size = new Size(81, 29); + buttonSendMax.TabIndex = 15; + buttonSendMax.Text = "Max"; + buttonSendMax.UseVisualStyleBackColor = true; + buttonSendMax.Click += buttonSendMax_Click; + // + // buttonSendHNS + // + buttonSendHNS.FlatStyle = FlatStyle.Flat; + buttonSendHNS.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); + buttonSendHNS.Location = new Point(361, 315); + buttonSendHNS.Name = "buttonSendHNS"; + buttonSendHNS.Size = new Size(150, 46); + buttonSendHNS.TabIndex = 14; + buttonSendHNS.Text = "Send"; + buttonSendHNS.UseVisualStyleBackColor = true; + buttonSendHNS.Click += buttonSendHNS_Click; + // + // labelSendingError + // + labelSendingError.AutoSize = true; + labelSendingError.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); + labelSendingError.Location = new Point(615, 131); + labelSendingError.Name = "labelSendingError"; + labelSendingError.Size = new Size(52, 21); + labelSendingError.TabIndex = 13; + labelSendingError.Text = "label1"; + labelSendingError.Visible = false; + // + // labelSendingFee + // + labelSendingFee.AutoSize = true; + labelSendingFee.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); + labelSendingFee.Location = new Point(254, 234); + labelSendingFee.Name = "labelSendingFee"; + labelSendingFee.Size = new Size(109, 21); + labelSendingFee.TabIndex = 12; + labelSendingFee.Text = "Estimated Fee:"; + // + // textBoxSendingAmount + // + textBoxSendingAmount.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); + textBoxSendingAmount.Location = new Point(346, 159); + textBoxSendingAmount.Name = "textBoxSendingAmount"; + textBoxSendingAmount.Size = new Size(344, 29); + textBoxSendingAmount.TabIndex = 11; + textBoxSendingAmount.Leave += textBoxSendingAmount_Leave; + // + // textBoxSendingTo + // + textBoxSendingTo.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); + textBoxSendingTo.Location = new Point(346, 98); + textBoxSendingTo.Name = "textBoxSendingTo"; + textBoxSendingTo.Size = new Size(344, 29); + textBoxSendingTo.TabIndex = 11; + textBoxSendingTo.Leave += textBoxSendingTo_Leave; + // + // labelSendingMax + // + labelSendingMax.AutoSize = true; + labelSendingMax.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); + labelSendingMax.Location = new Point(254, 204); + labelSendingMax.Name = "labelSendingMax"; + labelSendingMax.Size = new Size(99, 21); + labelSendingMax.TabIndex = 10; + labelSendingMax.Text = "Max Amount"; + // + // labelSendingAmount + // + labelSendingAmount.AutoSize = true; + labelSendingAmount.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); + labelSendingAmount.Location = new Point(254, 162); + labelSendingAmount.Name = "labelSendingAmount"; + labelSendingAmount.Size = new Size(66, 21); + labelSendingAmount.TabIndex = 9; + labelSendingAmount.Text = "Amount"; + // + // labelSendingTo + // + labelSendingTo.AutoSize = true; + labelSendingTo.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); + labelSendingTo.Location = new Point(254, 101); + labelSendingTo.Name = "labelSendingTo"; + labelSendingTo.Size = new Size(86, 21); + labelSendingTo.TabIndex = 8; + labelSendingTo.Text = "Sending To"; + // + // labelSendPrompt + // + labelSendPrompt.AutoSize = true; + labelSendPrompt.Font = new Font("Segoe UI", 15F, FontStyle.Regular, GraphicsUnit.Point); + labelSendPrompt.Location = new Point(395, 38); + labelSendPrompt.Name = "labelSendPrompt"; + labelSendPrompt.Size = new Size(101, 28); + labelSendPrompt.TabIndex = 0; + labelSendPrompt.Text = "Send HNS"; + // // MainForm // AutoScaleDimensions = new SizeF(7F, 15F); @@ -399,6 +540,8 @@ groupBoxinfo.PerformLayout(); groupBoxbalance.ResumeLayout(false); groupBoxbalance.PerformLayout(); + panelSend.ResumeLayout(false); + panelSend.PerformLayout(); ResumeLayout(false); PerformLayout(); } @@ -415,15 +558,15 @@ private Label labelaccountusername; private Label labelaccountpassword; private GroupBox groupBoxaccount; - private Label label1; + private Label labelloginprompt; private ComboBox comboBoxaccount; private TextBox textBoxaccountpassword; private ToolStripStatusLabel toolStripStatusLabelstatus; private ToolStripSplitButton toolStripSplitButtonlogout; private Panel panelNav; - private Button buttonPortfolio; - private Button buttonSend; - private Button buttonReceive; + private Button buttonNavPortfolio; + private Button buttonNavSend; + private Button buttonNavReceive; private Panel panelPortfolio; private Label labelLocked; private Label labelBalance; @@ -435,5 +578,16 @@ private Label labelSyncPercent; private GroupBox groupBoxTransactions; private Panel panelSend; + private Label labelSendPrompt; + private Label labelSendingMax; + private Label labelSendingAmount; + private Label labelSendingTo; + private TextBox textBoxSendingTo; + private TextBox textBoxSendingAmount; + private Label labelSendingFee; + private Label labelSendingError; + private Button buttonSendHNS; + private Button buttonSendMax; + private CheckBox checkBoxSendSubFee; } } \ No newline at end of file diff --git a/FireWallet/MainForm.cs b/FireWallet/MainForm.cs index d3c4098..f1873a5 100644 --- a/FireWallet/MainForm.cs +++ b/FireWallet/MainForm.cs @@ -16,8 +16,8 @@ namespace FireWallet int Network; string account; string password; - double balance; - double balanceLocked; + decimal balance; + decimal balanceLocked; int screen; // 0 = login, 1 = portfolio int height; double syncProgress; @@ -288,6 +288,7 @@ namespace FireWallet sw.WriteLine("transparency-percent: 90"); sw.WriteLine("selected-bg: #000000"); sw.WriteLine("selected-fg: #ffffff"); + sw.WriteLine("error: #ff0000"); sw.Dispose(); AddLog("Created theme file"); @@ -415,7 +416,7 @@ namespace FireWallet toolStripSplitButtonlogout.Visible = true; panelNav.Visible = true; screen = 1; - buttonPortfolio.PerformClick(); + buttonNavPortfolio.PerformClick(); } } @@ -449,6 +450,7 @@ namespace FireWallet } panelaccount.Visible = true; panelNav.Visible = false; + panelSend.Visible = false; toolStripStatusLabelaccount.Text = "Account: Not Logged In"; screen = 0; @@ -476,15 +478,21 @@ namespace FireWallet JObject resp = JObject.Parse(response); - double available = Convert.ToDouble(resp["unconfirmed"].ToString()) / 1000000; - double locked = Convert.ToDouble(resp["lockedUnconfirmed"].ToString()) / 1000000; + decimal available = Convert.ToDecimal(resp["unconfirmed"].ToString()) / 1000000; + decimal locked = Convert.ToDecimal(resp["lockedUnconfirmed"].ToString()) / 1000000; available = available - locked; - available = Math.Round(available, 2); - locked = Math.Round(locked, 2); + available = decimal.Round(available, 2); + locked = decimal.Round(locked, 2); balance = available; balanceLocked = locked; } - + /// + /// Post to HSD API + /// + /// Path to post to + /// Whether to use port 12039 + /// Content to post + /// private async Task APIPost(string path, bool wallet, string content) { string key = nodeSettings["Key"]; @@ -516,6 +524,12 @@ namespace FireWallet return await resp.Content.ReadAsStringAsync(); } + /// + /// Get from HSD API + /// + /// Path to get + /// Whether to use port 12039 + /// private async Task APIGet(string path, bool wallet) { string key = nodeSettings["Key"]; @@ -548,7 +562,7 @@ namespace FireWallet } } - private async void GetInfo() + private async void GetTXHistory() { // Get height and progress String APIresponse = await APIGet("", false); @@ -650,6 +664,32 @@ namespace FireWallet } + private async Task GetFee() + { + try + { + string response = await APIGet("fee", false); + JObject resp = JObject.Parse(response); + decimal fee = Convert.ToDecimal(resp["rate"].ToString()); + fee = fee / 1000000; + if (fee < 0.0001m) fee = 1; + + return fee.ToString(); + //return resp["rate"].ToString(); + } + catch + { + return "1"; + } + } + private async Task ValidAddress(string address) + { + string output = await APIPost("", false, "{\"method\": \"validateaddress\",\"params\": [ \"" + address + "\" ]}"); + JObject APIresp = JObject.Parse(output); + JObject result = JObject.Parse(APIresp["result"].ToString()); + if (result["isvalid"].ToString() == "True") return true; + else return false; + } #endregion #region Timers @@ -659,42 +699,173 @@ namespace FireWallet // If logged in, update info if (panelaccount.Visible == false) { - GetInfo(); + GetTXHistory(); } } #endregion #region Nav - private async void buttonPortfolio_Click(object sender, EventArgs e) + private async void PortfolioPanel_Click(object sender, EventArgs e) { - buttonSend.BackColor = ColorTranslator.FromHtml(theme["background"]); - buttonSend.ForeColor = ColorTranslator.FromHtml(theme["foreground"]); + buttonNavSend.BackColor = ColorTranslator.FromHtml(theme["background"]); + buttonNavSend.ForeColor = ColorTranslator.FromHtml(theme["foreground"]); panelSend.Hide(); panelPortfolio.Show(); await UpdateBalance(); - GetInfo(); + GetTXHistory(); labelBalance.Text = "Available: " + balance.ToString() + " HNS"; labelLocked.Text = "Locked: " + balanceLocked.ToString() + " HNS"; labelBalanceTotal.Text = "Total: " + (balance + balanceLocked).ToString() + " HNS"; if (theme.ContainsKey("selected-bg") && theme.ContainsKey("selected-fg")) { - buttonPortfolio.BackColor = ColorTranslator.FromHtml(theme["selected-bg"]); - buttonPortfolio.ForeColor = ColorTranslator.FromHtml(theme["selected-fg"]); + buttonNavPortfolio.BackColor = ColorTranslator.FromHtml(theme["selected-bg"]); + buttonNavPortfolio.ForeColor = ColorTranslator.FromHtml(theme["selected-fg"]); + } + } + + private async void SendPanel_Click(object sender, EventArgs e) + { + panelPortfolio.Hide(); + panelSend.Show(); + buttonNavPortfolio.BackColor = ColorTranslator.FromHtml(theme["background"]); + buttonNavPortfolio.ForeColor = ColorTranslator.FromHtml(theme["foreground"]); + if (theme.ContainsKey("selected-bg") && theme.ContainsKey("selected-fg")) + { + buttonNavSend.BackColor = ColorTranslator.FromHtml(theme["selected-bg"]); + buttonNavSend.ForeColor = ColorTranslator.FromHtml(theme["selected-fg"]); + } + if (theme.ContainsKey("error")) + { + labelSendingError.ForeColor = ColorTranslator.FromHtml(theme["error"]); + } + + labelSendPrompt.Left = (panelSend.Width - labelSendPrompt.Width) / 2; + buttonSendHNS.Left = (panelSend.Width - buttonSendHNS.Width) / 2; + labelSendingTo.Left = (panelSend.Width - labelSendingTo.Width - textBoxSendingTo.Width) / 2; + labelSendingAmount.Left = labelSendingTo.Left; + textBoxSendingTo.Left = labelSendingTo.Left + labelSendingTo.Width + 10; + textBoxSendingAmount.Left = textBoxSendingTo.Left; + labelSendingMax.Left = labelSendingTo.Left; + labelSendingError.Left = textBoxSendingTo.Left + textBoxSendingTo.Width + 10; + labelSendingFee.Left = labelSendingTo.Left; + buttonSendMax.Left = textBoxSendingAmount.Left + textBoxSendingAmount.Width - buttonSendMax.Width; + checkBoxSendSubFee.Left = labelSendingTo.Left; + + labelSendingMax.Text = "Max: " + balance.ToString() + " HNS"; + textBoxSendingTo.Focus(); + string fee = await GetFee(); + labelSendingFee.Text = "Est. Fee: " + fee + " HNS"; + labelSendingError.Hide(); + + } + #endregion + #region Send + private async void textBoxSendingTo_Leave(object sender, EventArgs e) + { + try + { + bool valid = await ValidAddress(textBoxSendingTo.Text); + if (valid) + { + labelSendingError.Hide(); + labelSendingError.Text = ""; + } + else + { + labelSendingError.Show(); + labelSendingError.Text = "Invalid Address"; + } + } + catch (Exception ex) + { + labelSendingError.Show(); + labelSendingError.Text = ex.Message; + } + } + + private void textBoxSendingAmount_Leave(object sender, EventArgs e) + { + decimal amount = 0; + if (decimal.TryParse(textBoxSendingAmount.Text, out amount)) + { + labelSendingError.Hide(); + labelSendingError.Text = ""; + } + else + { + labelSendingError.Show(); + labelSendingError.Text = "Invalid Amount"; + } + } + + private async void buttonSendMax_Click(object sender, EventArgs e) + { + string fee = await GetFee(); + decimal feeDecimal = decimal.Parse(fee); + textBoxSendingAmount.Text = (balance - feeDecimal).ToString(); + } + + private async void buttonSendHNS_Click(object sender, EventArgs e) + { + try + { + string address = textBoxSendingTo.Text; + bool valid = await ValidAddress(address); + if (!valid) + { + labelSendingError.Show(); + labelSendingError.Text = "Invalid Address"; + return; + } + decimal amount = 0; + if (!decimal.TryParse(textBoxSendingAmount.Text, out amount)) + { + labelSendingError.Show(); + labelSendingError.Text += " Invalid Amount"; + return; + } + string feeString = await GetFee(); + decimal fee = decimal.Parse(feeString); + string subtractFee = "false"; + if (checkBoxSendSubFee.Checked) subtractFee = "true"; + else if (amount > (balance - fee)) + { + labelSendingError.Show(); + labelSendingError.Text += " Insufficient Funds"; + return; + } + + AddLog("Sending " + amount.ToString() + " HNS to " + address); + string content = "{\"method\": \"sendtoaddress\",\"params\": [ \"" + address + "\", " + + amount.ToString() + ", \"\", \"\", " + subtractFee + " ]}"; + string output = await APIPost("", true, content); + JObject APIresp = JObject.Parse(output); + if (APIresp["error"].ToString() == "null") + { + NotifyForm notify = new NotifyForm("Error Transaction Failed"); + notify.ShowDialog(); + return; + } + string hash = APIresp["result"].ToString(); + string link = userSettings["explorer-tx"] + hash; + NotifyForm notifySuccess = new NotifyForm("Transaction Sent\nThis transaction could take up to 20 minutes to mine", + "Explorer",link); + notifySuccess.ShowDialog(); + textBoxSendingTo.Text = ""; + textBoxSendingAmount.Text = ""; + labelSendingError.Hide(); + labelSendingError.Text = ""; + buttonNavPortfolio.PerformClick(); + + } + catch (Exception ex) + { + AddLog(ex.Message); + labelSendingError.Show(); + labelSendingError.Text = ex.Message; } } #endregion - private void buttonSend_Click(object sender, EventArgs e) - { - panelPortfolio.Hide(); - panelSend.Show(); - buttonPortfolio.BackColor = ColorTranslator.FromHtml(theme["background"]); - buttonPortfolio.ForeColor = ColorTranslator.FromHtml(theme["foreground"]); - if (theme.ContainsKey("selected-bg") && theme.ContainsKey("selected-fg")) - { - buttonSend.BackColor = ColorTranslator.FromHtml(theme["selected-bg"]); - buttonSend.ForeColor = ColorTranslator.FromHtml(theme["selected-fg"]); - } - } } } \ No newline at end of file