main: Added settings page

This commit is contained in:
Nathan Woodburn 2023-06-08 18:08:02 +10:00
parent 529cad735b
commit b03bcd3f2c
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
8 changed files with 263 additions and 36 deletions

View File

@ -516,6 +516,9 @@ namespace FireWallet
else if (b.method == "TRANSFER")
{
sw.WriteLine(b.domain + "," + b.method + "," + b.toAddress);
} else if (b.method == "UPDATE")
{
sw.WriteLine(b.domain + "," + b.method + ",[" + string.Join(", ", b.update.Select(record => record.ToString())) + "]");
}
else
{
@ -541,6 +544,22 @@ namespace FireWallet
string[] split = line.Split(',');
try
{
if (split.Length > 2)
{
if (split[1] == "UPDATE")
{
// Select operation and import domains
string[] newDomains = new string[domains.Length + 1];
for (int i = 0; i < domains.Length; i++)
{
newDomains[i] = domains[i];
}
newDomains[domains.Length] = split[0];
domains = newDomains;
continue;
}
}
if (split.Length == 2)
{
AddBatch(split[0], split[1]);
@ -648,7 +667,7 @@ namespace FireWallet
public decimal bid { get; }
public decimal lockup { get; }
public string toAddress { get; }
DNS[]? update;
public DNS[]? update { get; }
public Batch(string domain, string method) // Normal TXs
{
this.domain = domain;

View File

@ -67,21 +67,23 @@
// buttonAddRecord
//
buttonAddRecord.FlatStyle = FlatStyle.Flat;
buttonAddRecord.Location = new Point(6, 163);
buttonAddRecord.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
buttonAddRecord.Location = new Point(6, 172);
buttonAddRecord.Name = "buttonAddRecord";
buttonAddRecord.Size = new Size(93, 46);
buttonAddRecord.TabIndex = 1;
buttonAddRecord.TabStop = false;
buttonAddRecord.Text = "Add Record";
buttonAddRecord.Text = "Add ";
buttonAddRecord.UseVisualStyleBackColor = true;
buttonAddRecord.Click += buttonAddRecord_Click;
//
// buttonCancel
//
buttonCancel.FlatStyle = FlatStyle.Flat;
buttonCancel.Location = new Point(557, 500);
buttonCancel.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
buttonCancel.Location = new Point(566, 500);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(93, 46);
buttonCancel.Size = new Size(102, 46);
buttonCancel.TabIndex = 1;
buttonCancel.TabStop = false;
buttonCancel.Text = "Cancel Edit";
@ -91,9 +93,10 @@
// buttonSend
//
buttonSend.FlatStyle = FlatStyle.Flat;
buttonSend.Location = new Point(888, 500);
buttonSend.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
buttonSend.Location = new Point(879, 500);
buttonSend.Name = "buttonSend";
buttonSend.Size = new Size(93, 46);
buttonSend.Size = new Size(102, 46);
buttonSend.TabIndex = 1;
buttonSend.TabStop = false;
buttonSend.Text = "Send Edit";

View File

@ -30,6 +30,7 @@ namespace FireWallet
nodeSettings = mainForm.nodeSettings;
cancel = true;
this.Text = domain + "/ DNS | FireWallet";
}
private void DNSForm_Load(object sender, EventArgs e)
{

View File

@ -292,6 +292,12 @@ namespace FireWallet
labelStatusTimeToNext.Text = reveal;
labelStatusNextState.Text = "Closing in:";
}
else if (state == "OPENING")
{
labelStatusNextState.Text = "Bidding in:";
string expires = stats["blocksUntilBidding"].ToString() + " Blocks (~" + stats["hoursUntilBidding"].ToString() + " hrs)";
labelStatusTimeToNext.Text = expires;
}
else
{
AddLog("State not added yet: " + state);

View File

@ -51,6 +51,7 @@ namespace FireWallet
labelaccountusername = new Label();
buttonaccountnew = new Button();
panelNav = new Panel();
buttonNavSettings = new Button();
buttonBatch = new Button();
buttonNavDomains = new Button();
buttonNavReceive = new Button();
@ -88,6 +89,18 @@ namespace FireWallet
panelDomainList = new Panel();
labelDomainSearch = new Label();
textBoxDomainSearch = new TextBox();
panelSettings = new Panel();
labelSettingsSaved = new Label();
buttonSettingsSave = new Button();
groupBoxSettingsExplorer = new GroupBox();
labelSettings1 = new Label();
textBoxExName = new TextBox();
labelSettings2 = new Label();
textBoxExBlock = new TextBox();
labelSettings3 = new Label();
textBoxExAddr = new TextBox();
labelSettings4 = new Label();
textBoxExTX = new TextBox();
statusStripmain.SuspendLayout();
panelaccount.SuspendLayout();
groupBoxaccount.SuspendLayout();
@ -100,6 +113,8 @@ namespace FireWallet
((System.ComponentModel.ISupportInitialize)pictureBoxReceiveQR).BeginInit();
panelDomains.SuspendLayout();
groupBoxDomains.SuspendLayout();
panelSettings.SuspendLayout();
groupBoxSettingsExplorer.SuspendLayout();
SuspendLayout();
//
// statusStripmain
@ -255,6 +270,7 @@ namespace FireWallet
//
// panelNav
//
panelNav.Controls.Add(buttonNavSettings);
panelNav.Controls.Add(buttonBatch);
panelNav.Controls.Add(buttonNavDomains);
panelNav.Controls.Add(buttonNavReceive);
@ -266,6 +282,19 @@ namespace FireWallet
panelNav.Size = new Size(114, 553);
panelNav.TabIndex = 6;
//
// buttonNavSettings
//
buttonNavSettings.FlatStyle = FlatStyle.Flat;
buttonNavSettings.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
buttonNavSettings.Location = new Point(12, 508);
buttonNavSettings.Name = "buttonNavSettings";
buttonNavSettings.Size = new Size(89, 33);
buttonNavSettings.TabIndex = 4;
buttonNavSettings.TabStop = false;
buttonNavSettings.Text = "Settings";
buttonNavSettings.UseVisualStyleBackColor = true;
buttonNavSettings.Click += buttonNavSettings_Click;
//
// buttonBatch
//
buttonBatch.FlatStyle = FlatStyle.Flat;
@ -628,7 +657,7 @@ namespace FireWallet
panelDomains.Controls.Add(groupBoxDomains);
panelDomains.Controls.Add(labelDomainSearch);
panelDomains.Controls.Add(textBoxDomainSearch);
panelDomains.Location = new Point(120, 27);
panelDomains.Location = new Point(1129, 22);
panelDomains.Name = "panelDomains";
panelDomains.Size = new Size(920, 536);
panelDomains.TabIndex = 18;
@ -674,11 +703,128 @@ namespace FireWallet
textBoxDomainSearch.TextChanged += textBoxDomainSearch_TextChanged;
textBoxDomainSearch.KeyDown += textBoxDomainSearch_KeyDown;
//
// panelSettings
//
panelSettings.Controls.Add(labelSettingsSaved);
panelSettings.Controls.Add(buttonSettingsSave);
panelSettings.Controls.Add(groupBoxSettingsExplorer);
panelSettings.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
panelSettings.Location = new Point(121, 21);
panelSettings.Name = "panelSettings";
panelSettings.Size = new Size(930, 550);
panelSettings.TabIndex = 19;
panelSettings.Visible = false;
//
// labelSettingsSaved
//
labelSettingsSaved.AutoSize = true;
labelSettingsSaved.Location = new Point(109, 515);
labelSettingsSaved.Name = "labelSettingsSaved";
labelSettingsSaved.Size = new Size(52, 21);
labelSettingsSaved.TabIndex = 6;
labelSettingsSaved.Text = "Saved";
labelSettingsSaved.Visible = false;
//
// buttonSettingsSave
//
buttonSettingsSave.FlatStyle = FlatStyle.Flat;
buttonSettingsSave.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
buttonSettingsSave.Location = new Point(14, 509);
buttonSettingsSave.Name = "buttonSettingsSave";
buttonSettingsSave.Size = new Size(89, 33);
buttonSettingsSave.TabIndex = 4;
buttonSettingsSave.TabStop = false;
buttonSettingsSave.Text = "Save";
buttonSettingsSave.UseVisualStyleBackColor = true;
buttonSettingsSave.Click += buttonSettingsSave_Click;
//
// groupBoxSettingsExplorer
//
groupBoxSettingsExplorer.Controls.Add(labelSettings1);
groupBoxSettingsExplorer.Controls.Add(textBoxExName);
groupBoxSettingsExplorer.Controls.Add(labelSettings2);
groupBoxSettingsExplorer.Controls.Add(textBoxExBlock);
groupBoxSettingsExplorer.Controls.Add(labelSettings3);
groupBoxSettingsExplorer.Controls.Add(textBoxExAddr);
groupBoxSettingsExplorer.Controls.Add(labelSettings4);
groupBoxSettingsExplorer.Controls.Add(textBoxExTX);
groupBoxSettingsExplorer.Location = new Point(14, 16);
groupBoxSettingsExplorer.Name = "groupBoxSettingsExplorer";
groupBoxSettingsExplorer.Size = new Size(487, 188);
groupBoxSettingsExplorer.TabIndex = 5;
groupBoxSettingsExplorer.TabStop = false;
groupBoxSettingsExplorer.Text = "Explorer Settings";
//
// labelSettings1
//
labelSettings1.AutoSize = true;
labelSettings1.Location = new Point(43, 31);
labelSettings1.Name = "labelSettings1";
labelSettings1.Size = new Size(108, 21);
labelSettings1.TabIndex = 0;
labelSettings1.Text = "Explorer (TXs):";
//
// textBoxExName
//
textBoxExName.Location = new Point(157, 133);
textBoxExName.Name = "textBoxExName";
textBoxExName.Size = new Size(307, 29);
textBoxExName.TabIndex = 4;
//
// labelSettings2
//
labelSettings2.AutoSize = true;
labelSettings2.Location = new Point(11, 66);
labelSettings2.Name = "labelSettings2";
labelSettings2.Size = new Size(140, 21);
labelSettings2.TabIndex = 0;
labelSettings2.Text = "Explorer (Address):";
//
// textBoxExBlock
//
textBoxExBlock.Location = new Point(157, 98);
textBoxExBlock.Name = "textBoxExBlock";
textBoxExBlock.Size = new Size(307, 29);
textBoxExBlock.TabIndex = 3;
//
// labelSettings3
//
labelSettings3.AutoSize = true;
labelSettings3.Location = new Point(23, 101);
labelSettings3.Name = "labelSettings3";
labelSettings3.Size = new Size(128, 21);
labelSettings3.TabIndex = 0;
labelSettings3.Text = "Explorer (Blocks):";
//
// textBoxExAddr
//
textBoxExAddr.Location = new Point(157, 63);
textBoxExAddr.Name = "textBoxExAddr";
textBoxExAddr.Size = new Size(307, 29);
textBoxExAddr.TabIndex = 2;
//
// labelSettings4
//
labelSettings4.AutoSize = true;
labelSettings4.Location = new Point(5, 136);
labelSettings4.Name = "labelSettings4";
labelSettings4.Size = new Size(146, 21);
labelSettings4.TabIndex = 0;
labelSettings4.Text = "Explorer (Domains):";
//
// textBoxExTX
//
textBoxExTX.Location = new Point(157, 28);
textBoxExTX.Name = "textBoxExTX";
textBoxExTX.Size = new Size(307, 29);
textBoxExTX.TabIndex = 1;
//
// MainForm
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1152, 575);
Controls.Add(panelSettings);
Controls.Add(panelDomains);
Controls.Add(panelRecieve);
Controls.Add(panelSend);
@ -711,6 +857,10 @@ namespace FireWallet
panelDomains.ResumeLayout(false);
panelDomains.PerformLayout();
groupBoxDomains.ResumeLayout(false);
panelSettings.ResumeLayout(false);
panelSettings.PerformLayout();
groupBoxSettingsExplorer.ResumeLayout(false);
groupBoxSettingsExplorer.PerformLayout();
ResumeLayout(false);
PerformLayout();
}
@ -770,5 +920,18 @@ namespace FireWallet
private Button buttonBatch;
private GroupBox groupBoxDomains;
private Panel panelDomainList;
private Button buttonNavSettings;
private Panel panelSettings;
private Label labelSettings1;
private Label labelSettings2;
private TextBox textBoxExName;
private TextBox textBoxExBlock;
private TextBox textBoxExAddr;
private TextBox textBoxExTX;
private Label labelSettings4;
private Label labelSettings3;
private Button buttonSettingsSave;
private GroupBox groupBoxSettingsExplorer;
private Label labelSettingsSaved;
}
}

View File

@ -215,7 +215,7 @@ namespace FireWallet
this.Height = Screen.PrimaryScreen.Bounds.Height / 5 * 3;
applyTransparency(theme);
ResizeForm();
}
private void ThemeControl(Control c)
{
@ -360,6 +360,10 @@ namespace FireWallet
groupBoxaccount.Top = (this.ClientSize.Height - groupBoxaccount.Height) / 2;
groupBoxDomains.Width = panelDomains.Width - 20;
groupBoxDomains.Left = 10;
groupBoxDomains.Height = panelDomains.Height - groupBoxDomains.Top - 10;
buttonNavSettings.Top = panelNav.Height - buttonNavSettings.Height - 10;
buttonSettingsSave.Top = panelSettings.Height - buttonSettingsSave.Height - 10;
}
#endregion
#region Accounts
@ -792,10 +796,8 @@ namespace FireWallet
private async void SendPanel_Click(object sender, EventArgs e)
{
panelPortfolio.Hide();
hidePages();
panelSend.Show();
panelRecieve.Hide();
panelDomains.Hide();
buttonNavPortfolio.BackColor = ColorTranslator.FromHtml(theme["background"]);
buttonNavPortfolio.ForeColor = ColorTranslator.FromHtml(theme["foreground"]);
buttonNavReceive.BackColor = ColorTranslator.FromHtml(theme["background"]);
@ -833,10 +835,8 @@ namespace FireWallet
}
private async void ReceivePanel_Click(object sender, EventArgs e)
{
panelSend.Hide();
panelPortfolio.Hide();
hidePages();
panelRecieve.Show();
panelDomains.Hide();
buttonNavSend.BackColor = ColorTranslator.FromHtml(theme["background"]);
buttonNavSend.ForeColor = ColorTranslator.FromHtml(theme["foreground"]);
buttonNavPortfolio.BackColor = ColorTranslator.FromHtml(theme["background"]);
@ -874,9 +874,7 @@ namespace FireWallet
}
private void buttonNavDomains_Click(object sender, EventArgs e)
{
panelSend.Hide();
panelPortfolio.Hide();
panelRecieve.Hide();
hidePages();
panelDomains.Show();
buttonNavSend.BackColor = ColorTranslator.FromHtml(theme["background"]);
@ -894,9 +892,29 @@ namespace FireWallet
textBoxDomainSearch.Focus();
groupBoxDomains.Width = panelDomains.Width - 20;
groupBoxDomains.Left = 10;
groupBoxDomains.Height = panelDomains.Height - groupBoxDomains.Top - 10;
UpdateDomains();
}
private void hidePages()
{
panelSend.Hide();
panelPortfolio.Hide();
panelRecieve.Hide();
panelDomains.Hide();
panelSettings.Hide();
}
private void buttonNavSettings_Click(object sender, EventArgs e)
{
hidePages();
panelSettings.Show();
buttonSettingsSave.Top = panelSettings.Height - buttonSettingsSave.Height - 10;
textBoxExTX.Text = userSettings["explorer-tx"];
textBoxExAddr.Text = userSettings["explorer-addr"];
textBoxExBlock.Text = userSettings["explorer-block"];
textBoxExName.Text = userSettings["explorer-domain"];
labelSettingsSaved.Hide();
}
#endregion
#region Send
private async void textBoxSendingTo_Leave(object sender, EventArgs e)
@ -1096,22 +1114,6 @@ namespace FireWallet
}
}
#endregion
private void textBoxDomainSearch_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyValue == 13)
{
textBoxDomainSearch.Text = textBoxDomainSearch.Text.Trim().ToLower();
e.SuppressKeyPress = true;
DomainForm domainForm = new DomainForm(this, textBoxDomainSearch.Text, userSettings["explorer-tx"], userSettings["explorer-domain"]);
domainForm.Show();
}
}
#region Batching
public void AddBatch(string domain, string operation)
{
@ -1164,11 +1166,39 @@ namespace FireWallet
}
#endregion
private void textBoxDomainSearch_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyValue == 13)
{
textBoxDomainSearch.Text = textBoxDomainSearch.Text.Trim().ToLower();
e.SuppressKeyPress = true;
DomainForm domainForm = new DomainForm(this, textBoxDomainSearch.Text, userSettings["explorer-tx"], userSettings["explorer-domain"]);
domainForm.Show();
}
}
private void textBoxDomainSearch_TextChanged(object sender, EventArgs e)
{
string domainSearch = textBoxDomainSearch.Text;
domainSearch = Regex.Replace(textBoxDomainSearch.Text, "[^a-zA-Z0-9-_]", "");
textBoxDomainSearch.Text = domainSearch;
}
private void buttonSettingsSave_Click(object sender, EventArgs e)
{
StreamWriter sw = new StreamWriter(dir + "settings.txt");
sw.WriteLine("explorer-tx: " + textBoxExTX.Text);
sw.WriteLine("explorer-addr: " + textBoxExAddr.Text);
sw.WriteLine("explorer-block: " + textBoxExBlock.Text);
sw.WriteLine("explorer-domain: " + textBoxExName.Text);
sw.WriteLine("confirmations: " + userSettings["confirmations"]);
sw.WriteLine("portfolio-tx: " + userSettings["portfolio-tx"]);
sw.WriteLine("hide-splash: " + userSettings["hide-splash"]);
sw.Dispose();
LoadSettings();
labelSettingsSaved.Show();
}
}
}

View File

@ -85,6 +85,9 @@ You can add transactions to the batch from the domain window or the DNS editor.
## Importing
You can also import a list of domains to the batch window.
The "CANCEL" transaction type is used to cancel an transfer.
At the momemt "UPDATE" or coin only transactions are not supported.
![Batch Import](assets/batch_import.png)

View File

@ -1,3 +1,4 @@
woodburn1,OPEN
woodburn1,BID,1,3
woodburn2,BID,1,3
woodburn3,BID,1,3
@ -5,3 +6,4 @@ woodburn4,BID,1,3
woodburn5,BID,1,3
woodburn6,BID,1,4
woodburn8,TRANSFER,hs1qlmlgnx0g3ynk4ylxkkdh9c9nernclnfq4lw6s9
exampledomainnathan118,UPDATE,[{"type": "DS","keyTag": 20167,"algorithm": 13,"digestType": 2,"digest":"4a2ab3224727a4754a6c3d77621a5b04241a3d9c7ae7e5fa17f73121b9ff0e06"}, {"type": "NS","ns": "ns1.woodburn."}, {"type": "NS","ns": "ns2.woodburn."}, {"type": "TXT","txt": ["TEST"]}]