コード例 #1
0
        private void edutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count != 1)
            {
                return;
            }

            var first = listView1.SelectedItems[0];
            var entryId = logins.FindIndex(p => p.Login == first.SubItems[0].Text);
            var entry = logins[entryId];

            fAddEditEntry edit = new fAddEditEntry();

            edit.Type = fAddEditEntry.EntryType.Edit;

            edit.EntryName = entry.Name;
            edit.EntryLogin = entry.Login;
            edit.EntryPassword = entry.Password;

            edit.ShowDialog(this);

            if (!edit.IsValidEntry)
                return;

            entry.Name = edit.EntryName;
            entry.Login = edit.EntryLogin;
            entry.Password = edit.EntryPassword;

            logins.RemoveAt(entryId);
            logins.Add(entry);

            listView1.Items.Clear();

            PopulateList();
        }
コード例 #2
0
        private void addToolStripMenuItem_Click(object sender, EventArgs e)
        {
            fAddEditEntry add = new fAddEditEntry();

            add.Type = fAddEditEntry.EntryType.Add;

            add.ShowDialog(this);

            if (!add.IsValidEntry)
                return;

            AddNewEntry(add.EntryName, add.EntryLogin, add.EntryPassword,
                DateTime.Now);
        }