Example #1
0
        /// <summary>
        /// Perform deletion
        /// </summary>
        private void delete()
        {
            _r = new APIRequest(txtURL.Text, txtKey.Text);
            //delete / datasets /{ dataset}/
            if (MessageBox.Show("Confirmez vous la suppression de cet élément?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }

            setWorking(true);

            var currentObj = (APIObject)treeView1.SelectedNode.Tag;

            if (treeView1.SelectedNode.Parent.Tag is APIObject)
            {
                _r.ParentId = ((APIObject)treeView1.SelectedNode.Parent.Tag).id;
            }

            displayResponseMessage(_r.Delete(currentObj));

            //refresh treeview
            if (currentObj is APIODataGouv.Classes.APIObject.DataSet || currentObj is Resource)
            {
                treeView1.SelectedNode = getParentOrganization(treeView1.SelectedNode);
                getDataSets();
            }

            setWorking(false);
        }