示例#1
0
        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();
        }
示例#2
0
        void saveSettings()
        {
            getData();
            XMLService.initialSetup();
            Setting.set();
            MyKey.add();

            Dispose();
        }
示例#3
0
 void load()
 {
     if (viewId == 0)
     {
         dataGridView1.DataSource = MyKey.getData();
     }
     else
     {
         dataGridView1.DataSource = TrustedContact.getData();
     }
 }
示例#4
0
        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);
        }
示例#5
0
        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);
            }
        }
示例#6
0
        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);
        }
示例#7
0
 void loadMyKeys()
 {
     dataGridView2.DataSource = MyKey.getData();
     //dataGridView2.Columns[2].HeaderText = "Para kluczy";
 }
示例#8
0
        bool checkName()
        {
            bool unique = MyKey.checkName(MyKey.name);

            return(unique);
        }