mirror of
https://github.com/Nathanwoodburn/FireWallet.git
synced 2024-12-25 23:38:15 +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();
|
||||
labelReceive1 = new Label();
|
||||
panelDomains = new Panel();
|
||||
comboBoxDomainSort = new ComboBox();
|
||||
buttonExportDomains = new Button();
|
||||
groupBoxDomains = new GroupBox();
|
||||
panelDomainList = new Panel();
|
||||
@ -122,6 +123,7 @@ namespace FireWallet
|
||||
textBoxExAddr = new TextBox();
|
||||
labelSettings4 = new Label();
|
||||
textBoxExTX = new TextBox();
|
||||
labelDomainSort = new Label();
|
||||
statusStripmain.SuspendLayout();
|
||||
panelaccount.SuspendLayout();
|
||||
groupBoxaccount.SuspendLayout();
|
||||
@ -783,6 +785,8 @@ namespace FireWallet
|
||||
//
|
||||
// panelDomains
|
||||
//
|
||||
panelDomains.Controls.Add(labelDomainSort);
|
||||
panelDomains.Controls.Add(comboBoxDomainSort);
|
||||
panelDomains.Controls.Add(buttonRenewAll);
|
||||
panelDomains.Controls.Add(buttonExportDomains);
|
||||
panelDomains.Controls.Add(groupBoxDomains);
|
||||
@ -794,6 +798,19 @@ namespace FireWallet
|
||||
panelDomains.TabIndex = 18;
|
||||
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.FlatStyle = FlatStyle.Flat;
|
||||
@ -1064,17 +1081,27 @@ namespace FireWallet
|
||||
textBoxExTX.Size = new Size(307, 29);
|
||||
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
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1152, 575);
|
||||
Controls.Add(panelDomains);
|
||||
Controls.Add(panelSend);
|
||||
Controls.Add(panelSettings);
|
||||
Controls.Add(panelaccount);
|
||||
Controls.Add(panelPortfolio);
|
||||
Controls.Add(panelRecieve);
|
||||
Controls.Add(panelDomains);
|
||||
Controls.Add(panelNav);
|
||||
Controls.Add(statusStripmain);
|
||||
Icon = (Icon)resources.GetObject("$this.Icon");
|
||||
@ -1205,5 +1232,7 @@ namespace FireWallet
|
||||
private ToolStripMenuItem supportDiscordServerToolStripMenuItem;
|
||||
private Label labelHIPArrow;
|
||||
private Label labelSendingHIPAddress;
|
||||
private ComboBox comboBoxDomainSort;
|
||||
private Label labelDomainSort;
|
||||
}
|
||||
}
|
@ -1216,6 +1216,8 @@ namespace FireWallet
|
||||
groupBoxDomains.Width = panelDomains.Width - 20;
|
||||
groupBoxDomains.Left = 10;
|
||||
groupBoxDomains.Height = panelDomains.Height - groupBoxDomains.Top - 10;
|
||||
comboBoxDomainSort.SelectedIndex = 0;
|
||||
|
||||
UpdateDomains();
|
||||
|
||||
}
|
||||
@ -1881,6 +1883,33 @@ namespace FireWallet
|
||||
int i = 0;
|
||||
int renewable = 0;
|
||||
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)
|
||||
{
|
||||
Domains[i] = name["name"].ToString();
|
||||
@ -2212,5 +2241,10 @@ namespace FireWallet
|
||||
};
|
||||
Process.Start(psi);
|
||||
}
|
||||
|
||||
private void comboBoxDomainSort_DropDownClosed(object sender, EventArgs e)
|
||||
{
|
||||
UpdateDomains();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user