public void AddPrivateKey() { AddPrivateKeyWindowController cwc = new AddPrivateKeyWindowController(); NSApplication.SharedApplication.BeginSheet(cwc.Window, VMCertStoreSnapInEnvironment.Instance.mainWindow, () => { }); nint result = NSApplication.SharedApplication.RunModalForWindow(cwc.Window); try { if (result == (nint)VMIdentityConstants.DIALOGOK) { var dto = cwc.PrivateKeyDTO; string storeName = (string)Tag; string storePass = ""; using (var session = new VecsStoreSession(ServerNode.ServerDTO.VecsClient, storeName, storePass)) { session.AddPrivateKeyEntry(dto.Alias, dto.PrivateKey, dto.Password, dto.Certificate); } UIErrorHelper.ShowAlert("Private Entity Added", "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 AddPrivateKey() { MMCActionHelper.CheckedExec(delegate() { var frm = new FormAddPrivateKey(); if (MMCDlgHelper.ShowForm(frm)) { var dto = frm.PrivateKeyDTO; string storeName = (string)Tag; string storePass = ""; using (var session = new VecsStoreSession(ServerDTO.VecsClient, storeName, storePass)) { session.AddPrivateKeyEntry(dto.Alias, dto.PrivateKey, dto.Password, dto.Certificate); } if (ListView != null) { ListView.Refresh(); } } }); }