void delete() { bool success = true; try { if (tabControl1.SelectedIndex == 0) { string name = dataGridView1[0, dataGridView1.CurrentRow.Index].Value.ToString(); TrustedContact.remove(name); } else { string name = dataGridView2[0, dataGridView2.CurrentRow.Index].Value.ToString(); MyKey.remove(name); } } catch (Exception ex) { MessageBox.Show("Nie zaznaczono elementu do usunięcia!", "Informacja", MessageBoxButtons.OK, MessageBoxIcon.Warning); LogService.add(ex.ToString()); } if (!success) { MessageBox.Show("Wystąpił błąd!", "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error); } refreshDgv(); }
void saveSettings() { getData(); XMLService.initialSetup(); Setting.set(); MyKey.add(); Dispose(); }
void load() { if (viewId == 0) { dataGridView1.DataSource = MyKey.getData(); } else { dataGridView1.DataSource = TrustedContact.getData(); } }
public static string getPrivKey(string name) { string privPubKey = null; try { MyKey.get(name); privPubKey = MyKey.privPubKey; privPubKey = decryptRSAKey(privPubKey); } catch (Exception ex) { LogService.add(ex.ToString()); } return(privPubKey); }
void save() { MyKey.name = textBox1.Text; MyKey.privPubKey = textBox3.Text; MyKey.note = textBox2.Text; if (checkName()) { MyKey.add(); refreshDgv(); Dispose(); } else { MessageBox.Show("Nazwa " + MyKey.name + " już istnieje! Wybierz inną!", "Ostrzeżenie", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public static string getPubKey(string name) { string pubKey = null; try { MyKey.get(name); string privPubKey = MyKey.privPubKey; privPubKey = decryptRSAKey(privPubKey); RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(); rsa.FromXmlString(privPubKey); pubKey = rsa.ToXmlString(false); } catch (Exception ex) { LogService.add(ex.ToString()); } return(pubKey); }
void loadMyKeys() { dataGridView2.DataSource = MyKey.getData(); //dataGridView2.Columns[2].HeaderText = "Para kluczy"; }
bool checkName() { bool unique = MyKey.checkName(MyKey.name); return(unique); }