public void AddCertificate(object sender, EventArgs args) { AddCertificateWindowController cwc = new AddCertificateWindowController(); NSApplication.SharedApplication.BeginSheet(cwc.Window, VMCertStoreSnapInEnvironment.Instance.mainWindow, () => { }); nint result = NSApplication.SharedApplication.RunModalForWindow(cwc.Window); try { if (result == (nint)VMIdentityConstants.DIALOGOK) { var dto = cwc.CertificateDTO; string storeName = (string)Tag; string storePass = ""; using (var session = new VecsStoreSession(ServerNode.ServerDTO.VecsClient, storeName, storePass)) { session.AddCertificateEntry(dto.Alias, "", "", dto.Certificate); } UIErrorHelper.ShowAlert("Successfully added Certificate", "Info"); ServerNode.UpdateStoreInfo(storeName); NSNotificationCenter.DefaultCenter.PostNotificationName("ReloadTableView", this); } } catch (Exception e) { UIErrorHelper.ShowAlert(e.Message, "Alert"); } finally { VMCertStoreSnapInEnvironment.Instance.mainWindow.EndSheet(cwc.Window); cwc.Dispose(); } }
void AddCertificate() { MMCActionHelper.CheckedExec(delegate() { var frm = new frmAddCertificate(); if (MMCDlgHelper.ShowForm(frm)) { var dto = frm.CertificateDTO; string storeName = (string)Tag; string storePass = ""; using (var session = new VecsStoreSession(ServerDTO.VecsClient, storeName, storePass)) { session.AddCertificateEntry(dto.Alias, "", "", dto.Certificate); if (ListView != null) { ListView.Refresh(); } } } }); }