mirror of https://github.com/quasar/Quasar.git
Improved PW Recovery user notification of no results + redundancy
This commit is contained in:
parent
7f4cab6503
commit
1164f19fc7
|
@ -14,6 +14,7 @@ public partial class FrmPasswordRecovery : Form
|
|||
{
|
||||
private readonly Client[] _clients;
|
||||
private readonly object _addingLock = new object();
|
||||
private readonly RecoveredAccount _noResultsFound;
|
||||
|
||||
public FrmPasswordRecovery(Client[] connectedClients)
|
||||
{
|
||||
|
@ -25,9 +26,17 @@ public FrmPasswordRecovery(Client[] connectedClients)
|
|||
}
|
||||
|
||||
InitializeComponent();
|
||||
this.Text = WindowHelper.GetWindowTitle("Password Recovery", _clients.Length);
|
||||
Text = WindowHelper.GetWindowTitle("Password Recovery", _clients.Length);
|
||||
|
||||
txtFormat.Text = Settings.SaveFormat;
|
||||
|
||||
_noResultsFound = new RecoveredAccount()
|
||||
{
|
||||
Application = "No Results Found",
|
||||
URL = "N/A",
|
||||
Username = "N/A",
|
||||
Password = "N/A"
|
||||
};
|
||||
}
|
||||
|
||||
private void FrmPasswordRecovery_Load(object sender, EventArgs e)
|
||||
|
@ -76,7 +85,7 @@ public void AddPasswords(RecoveredAccount[] accounts, string identification)
|
|||
if (lvg == null) //Create new group
|
||||
{
|
||||
lvg = new ListViewGroup { Name = acc.Application.Replace(" ", string.Empty), Header = acc.Application };
|
||||
this.Invoke(new MethodInvoker(() => lstPasswords.Groups.Add(lvg))); //Add the new group
|
||||
Invoke(new MethodInvoker(() => lstPasswords.Groups.Add(lvg))); //Add the new group
|
||||
}
|
||||
|
||||
lvi.Group = lvg;
|
||||
|
@ -87,8 +96,25 @@ public void AddPasswords(RecoveredAccount[] accounts, string identification)
|
|||
UpdateRecoveryCount();
|
||||
}
|
||||
|
||||
if (accounts.Length == 0)
|
||||
MessageBox.Show("Could not recover anything!", "Password Recovery", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
if (accounts.Length == 0) //No accounts found
|
||||
{
|
||||
var lvi = new ListViewItem { Tag = _noResultsFound, Text = identification };
|
||||
|
||||
lvi.SubItems.Add(_noResultsFound.URL); // URL
|
||||
lvi.SubItems.Add(_noResultsFound.Username); // User
|
||||
lvi.SubItems.Add(_noResultsFound.Password); // Pass
|
||||
|
||||
var lvg = GetGroupFromApplication(_noResultsFound.Application);
|
||||
|
||||
if (lvg == null) //Create new group
|
||||
{
|
||||
lvg = new ListViewGroup { Name = _noResultsFound.Application, Header = _noResultsFound.Application };
|
||||
Invoke(new MethodInvoker(() => lstPasswords.Groups.Add(lvg))); //Add the new group
|
||||
}
|
||||
|
||||
lvi.Group = lvg;
|
||||
Invoke(new MethodInvoker(() => { lstPasswords.Items.Add(lvi); }));
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@ -139,7 +165,7 @@ private StringBuilder GetLoginData(bool selected = false)
|
|||
private ListViewGroup GetGroupFromApplication(string app)
|
||||
{
|
||||
ListViewGroup lvg = null;
|
||||
this.Invoke(new MethodInvoker(delegate
|
||||
Invoke(new MethodInvoker(delegate
|
||||
{
|
||||
foreach (var @group in lstPasswords.Groups.Cast<ListViewGroup>().Where(@group => @group.Header == app))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue