mirror of
https://github.com/Nathanwoodburn/FireWallet.git
synced 2024-11-10 17:28:17 +11:00
mainForm.cs: Added domain sorting feature and updated UI
- Added comboBoxDomainSort_DropDownClosed method to update domains - Added comboBoxDomainSort control to panelDomains - Added labelDomainSort control to MainForm.Designer.cs - Updated UpdateDomains method to sort domains based on selected option
This commit is contained in:
parent
42536e47bb
commit
f06bc5b711
31
FireWallet/MainForm.Designer.cs
generated
31
FireWallet/MainForm.Designer.cs
generated
@ -95,6 +95,7 @@ namespace FireWallet
|
|||||||
textBoxReceiveAddress = new TextBox();
|
textBoxReceiveAddress = new TextBox();
|
||||||
labelReceive1 = new Label();
|
labelReceive1 = new Label();
|
||||||
panelDomains = new Panel();
|
panelDomains = new Panel();
|
||||||
|
comboBoxDomainSort = new ComboBox();
|
||||||
buttonExportDomains = new Button();
|
buttonExportDomains = new Button();
|
||||||
groupBoxDomains = new GroupBox();
|
groupBoxDomains = new GroupBox();
|
||||||
panelDomainList = new Panel();
|
panelDomainList = new Panel();
|
||||||
@ -122,6 +123,7 @@ namespace FireWallet
|
|||||||
textBoxExAddr = new TextBox();
|
textBoxExAddr = new TextBox();
|
||||||
labelSettings4 = new Label();
|
labelSettings4 = new Label();
|
||||||
textBoxExTX = new TextBox();
|
textBoxExTX = new TextBox();
|
||||||
|
labelDomainSort = new Label();
|
||||||
statusStripmain.SuspendLayout();
|
statusStripmain.SuspendLayout();
|
||||||
panelaccount.SuspendLayout();
|
panelaccount.SuspendLayout();
|
||||||
groupBoxaccount.SuspendLayout();
|
groupBoxaccount.SuspendLayout();
|
||||||
@ -783,6 +785,8 @@ namespace FireWallet
|
|||||||
//
|
//
|
||||||
// panelDomains
|
// panelDomains
|
||||||
//
|
//
|
||||||
|
panelDomains.Controls.Add(labelDomainSort);
|
||||||
|
panelDomains.Controls.Add(comboBoxDomainSort);
|
||||||
panelDomains.Controls.Add(buttonRenewAll);
|
panelDomains.Controls.Add(buttonRenewAll);
|
||||||
panelDomains.Controls.Add(buttonExportDomains);
|
panelDomains.Controls.Add(buttonExportDomains);
|
||||||
panelDomains.Controls.Add(groupBoxDomains);
|
panelDomains.Controls.Add(groupBoxDomains);
|
||||||
@ -794,6 +798,19 @@ namespace FireWallet
|
|||||||
panelDomains.TabIndex = 18;
|
panelDomains.TabIndex = 18;
|
||||||
panelDomains.Visible = false;
|
panelDomains.Visible = false;
|
||||||
//
|
//
|
||||||
|
// comboBoxDomainSort
|
||||||
|
//
|
||||||
|
comboBoxDomainSort.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboBoxDomainSort.FlatStyle = FlatStyle.Flat;
|
||||||
|
comboBoxDomainSort.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
|
comboBoxDomainSort.FormattingEnabled = true;
|
||||||
|
comboBoxDomainSort.Items.AddRange(new object[] { "Default", "Alphabetical", "Expiring", "Value" });
|
||||||
|
comboBoxDomainSort.Location = new Point(686, 12);
|
||||||
|
comboBoxDomainSort.Name = "comboBoxDomainSort";
|
||||||
|
comboBoxDomainSort.Size = new Size(121, 29);
|
||||||
|
comboBoxDomainSort.TabIndex = 11;
|
||||||
|
comboBoxDomainSort.DropDownClosed += comboBoxDomainSort_DropDownClosed;
|
||||||
|
//
|
||||||
// buttonExportDomains
|
// buttonExportDomains
|
||||||
//
|
//
|
||||||
buttonExportDomains.FlatStyle = FlatStyle.Flat;
|
buttonExportDomains.FlatStyle = FlatStyle.Flat;
|
||||||
@ -1064,17 +1081,27 @@ namespace FireWallet
|
|||||||
textBoxExTX.Size = new Size(307, 29);
|
textBoxExTX.Size = new Size(307, 29);
|
||||||
textBoxExTX.TabIndex = 1;
|
textBoxExTX.TabIndex = 1;
|
||||||
//
|
//
|
||||||
|
// labelDomainSort
|
||||||
|
//
|
||||||
|
labelDomainSort.AutoSize = true;
|
||||||
|
labelDomainSort.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
|
labelDomainSort.Location = new Point(638, 15);
|
||||||
|
labelDomainSort.Name = "labelDomainSort";
|
||||||
|
labelDomainSort.Size = new Size(42, 21);
|
||||||
|
labelDomainSort.TabIndex = 12;
|
||||||
|
labelDomainSort.Text = "Sort:";
|
||||||
|
//
|
||||||
// MainForm
|
// MainForm
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(1152, 575);
|
ClientSize = new Size(1152, 575);
|
||||||
|
Controls.Add(panelDomains);
|
||||||
Controls.Add(panelSend);
|
Controls.Add(panelSend);
|
||||||
Controls.Add(panelSettings);
|
Controls.Add(panelSettings);
|
||||||
Controls.Add(panelaccount);
|
Controls.Add(panelaccount);
|
||||||
Controls.Add(panelPortfolio);
|
Controls.Add(panelPortfolio);
|
||||||
Controls.Add(panelRecieve);
|
Controls.Add(panelRecieve);
|
||||||
Controls.Add(panelDomains);
|
|
||||||
Controls.Add(panelNav);
|
Controls.Add(panelNav);
|
||||||
Controls.Add(statusStripmain);
|
Controls.Add(statusStripmain);
|
||||||
Icon = (Icon)resources.GetObject("$this.Icon");
|
Icon = (Icon)resources.GetObject("$this.Icon");
|
||||||
@ -1205,5 +1232,7 @@ namespace FireWallet
|
|||||||
private ToolStripMenuItem supportDiscordServerToolStripMenuItem;
|
private ToolStripMenuItem supportDiscordServerToolStripMenuItem;
|
||||||
private Label labelHIPArrow;
|
private Label labelHIPArrow;
|
||||||
private Label labelSendingHIPAddress;
|
private Label labelSendingHIPAddress;
|
||||||
|
private ComboBox comboBoxDomainSort;
|
||||||
|
private Label labelDomainSort;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1216,6 +1216,8 @@ namespace FireWallet
|
|||||||
groupBoxDomains.Width = panelDomains.Width - 20;
|
groupBoxDomains.Width = panelDomains.Width - 20;
|
||||||
groupBoxDomains.Left = 10;
|
groupBoxDomains.Left = 10;
|
||||||
groupBoxDomains.Height = panelDomains.Height - groupBoxDomains.Top - 10;
|
groupBoxDomains.Height = panelDomains.Height - groupBoxDomains.Top - 10;
|
||||||
|
comboBoxDomainSort.SelectedIndex = 0;
|
||||||
|
|
||||||
UpdateDomains();
|
UpdateDomains();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1881,6 +1883,33 @@ namespace FireWallet
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
int renewable = 0;
|
int renewable = 0;
|
||||||
panelDomainList.Controls.Clear();
|
panelDomainList.Controls.Clear();
|
||||||
|
|
||||||
|
// Sort the domains
|
||||||
|
switch (comboBoxDomainSort.Text)
|
||||||
|
{
|
||||||
|
case "Default":
|
||||||
|
break;
|
||||||
|
case "Alphabetical":
|
||||||
|
names = new JArray(names.OrderBy(obj => (string)obj["name"]));
|
||||||
|
break;
|
||||||
|
case "Expiring":
|
||||||
|
names = new JArray(names.OrderBy(obj =>
|
||||||
|
{
|
||||||
|
JToken daysUntilExpireToken = obj["stats"]?["daysUntilExpire"];
|
||||||
|
return (int)(daysUntilExpireToken ?? int.MaxValue);
|
||||||
|
}));
|
||||||
|
break;
|
||||||
|
case "Value":
|
||||||
|
// Sort by most valuable first
|
||||||
|
names = new JArray(names.OrderByDescending(obj =>
|
||||||
|
{
|
||||||
|
JToken valueToken = obj?["value"];
|
||||||
|
return (int)(valueToken ?? 0);
|
||||||
|
}));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
foreach (JObject name in names)
|
foreach (JObject name in names)
|
||||||
{
|
{
|
||||||
Domains[i] = name["name"].ToString();
|
Domains[i] = name["name"].ToString();
|
||||||
@ -2212,5 +2241,10 @@ namespace FireWallet
|
|||||||
};
|
};
|
||||||
Process.Start(psi);
|
Process.Start(psi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void comboBoxDomainSort_DropDownClosed(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
UpdateDomains();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user