/// <summary> /// Perform add object operation /// </summary> /// <typeparam name="T">Requested object type</typeparam> private void addObject <T>() where T : IAPIObject, new() { setWorking(true); _r = new APIRequest(txtURL.Text, txtKey.Text); var o = new T(); var frm = new FrmNew(o); if (frm.ShowDialog() == DialogResult.OK) { displayResponseMessage(_r.AddObject(o, (APIObject)treeView1.SelectedNode.Tag)); //refresh treeview if (o is APIODataGouv.Classes.APIObject.DataSet || o is Resource) { treeView1.SelectedNode = getParentOrganization(treeView1.SelectedNode); getDataSets(); } setWorking(false); } }