Esempio n. 1
0
        private void ButtonNew_Click(object sender, EventArgs e)
        {
            var newForm = new AddChangeAlias(aliasDictionary, "Create new alias item" + "\n\r" + "submit proper fields", true);

            if (newForm.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }
            var dataBase = new SqliteDatabase(labelDB.Text);

            dataBase.AddNewItems(newForm.TextBoxAliasName, newForm.TextBoxPath);
            aliasDictionary.Add(newForm.TextBoxAliasName, newForm.TextBoxPath);
            RefreshAlias();
            RefreshIp();
            labelAliasInfo.Text  = "New alias " + newForm.TextBoxAliasName + " created";
            buttonChange.Enabled = false;
            buttonDelete.Enabled = false;
        }
Esempio n. 2
0
        private void ButtonRename_Click(object sender, EventArgs e)
        {
            ListViewItem selectedItem = listViewAliases.SelectedItems[0];
            string       oldAlias     = selectedItem.SubItems[0].Text;
            string       oldPath      = selectedItem.SubItems[1].Text;
            var          newForm      = new AddChangeAlias(aliasDictionary, "Change alias item" + "\n\r" + "make it", false, oldAlias, oldPath);

            if (newForm.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }
            var dataBase = new SqliteDatabase(labelDB.Text);

            dataBase.RenameAlias(oldAlias, newForm.TextBoxAliasName, newForm.TextBoxPath);
            aliasDictionary.Remove(oldAlias);
            aliasDictionary.Add(newForm.TextBoxAliasName, newForm.TextBoxPath);
            RefreshAlias();
            labelAliasInfo.Text = "Alias " + oldAlias[0] + " changed";

            buttonChange.Enabled = false;
            buttonDelete.Enabled = false;
        }