/// <summary> /// Event Handler for Remove Account /// </summary> private void OnRemoveAccount(object o, EventArgs args) { TreeSelection tSelect = AccTreeView.Selection; if (tSelect.CountSelectedRows() == 1) { TreeModel tModel; TreeIter iter; tSelect.GetSelected(out tModel, out iter); string domainID = (string)tModel.GetValue(iter, 0); DomainInformation dom = domainController.GetDomain(domainID); RemoveAccountDialog rad = new RemoveAccountDialog(dom); rad.TransientFor = topLevelWindow; int rc = rad.Run(); rad.Hide(); if ((ResponseType)rc == ResponseType.Yes) { try { removedDomains[dom.ID] = dom.ID; domainController.RemoveDomain(dom.ID, rad.RemoveiFoldersFromServer); RemoveDomain(dom.ID); } catch (Exception e) { if (removedDomains.ContainsKey(dom.ID)) { removedDomains.Remove(dom.ID); } iFolderExceptionDialog ied = new iFolderExceptionDialog(topLevelWindow, e); ied.Run(); ied.Hide(); ied.Destroy(); rad.Destroy(); // Clean up before bailing return; } AddButton.Sensitive = true; RemoveButton.Sensitive = false; DetailsButton.Sensitive = false; } rad.Destroy(); } }
private void OnRemoveAccount(object o, EventArgs args) { TreeSelection tSelect = AccTreeView.Selection; if(tSelect.CountSelectedRows() == 1) { TreeModel tModel; TreeIter iter; tSelect.GetSelected(out tModel, out iter); string domainID = (string) tModel.GetValue(iter, 0); DomainInformation dom = domainController.GetDomain(domainID); RemoveAccountDialog rad = new RemoveAccountDialog(dom); rad.TransientFor = topLevelWindow; int rc = rad.Run(); rad.Hide(); if((ResponseType)rc == ResponseType.Yes) { try { removedDomains[dom.ID] = dom.ID; domainController.RemoveDomain(dom.ID, rad.RemoveiFoldersFromServer); RemoveDomain(dom.ID); } catch(Exception e) { if (removedDomains.ContainsKey(dom.ID)) removedDomains.Remove(dom.ID); iFolderExceptionDialog ied = new iFolderExceptionDialog( topLevelWindow, e); ied.Run(); ied.Hide(); ied.Destroy(); rad.Destroy(); return; } AddButton.Sensitive = true; RemoveButton.Sensitive = false; DetailsButton.Sensitive = false; } rad.Destroy(); } }