예제 #1
0
 public void AddSecretKey(object sender, EventArgs args)
 {
     UIErrorHelper.CheckedExec(delegate() {
         AddSecretKeyWindowController cwc = new AddSecretKeyWindowController();
         NSApplication.SharedApplication.BeginSheet(cwc.Window, VMCertStoreSnapInEnvironment.Instance.mainWindow, () => {
         });
         nint result = NSApplication.SharedApplication.RunModalForWindow(cwc.Window);
         try {
             if (result == (nint)VMIdentityConstants.DIALOGOK)
             {
                 var dto          = cwc.SecretKeyDTO;
                 string storeName = (string)Tag;
                 string storePass = "";
                 using (var session = new VecsStoreSession(ServerNode.ServerDTO.VecsClient, storeName, storePass)) {
                     session.AddSecretKeyEntry(dto.Alias, dto.SecretKey, dto.Password, null);
                 }
                 ServerNode.UpdateStoreInfo(storeName);
                 NSNotificationCenter.DefaultCenter.PostNotificationName("ReloadTableView", this);
             }
         } finally {
             VMCertStoreSnapInEnvironment.Instance.mainWindow.EndSheet(cwc.Window);
             cwc.Dispose();
         }
     });
 }
예제 #2
0
 void AddSecretKey()
 {
     MMCActionHelper.CheckedExec(delegate()
     {
         var frm = new FormAddSecretKey();
         if (MMCDlgHelper.ShowForm(frm))
         {
             var dto          = frm.SecretKeyDTO;
             string storeName = (string)Tag;
             string storePass = "";
             using (var session = new VecsStoreSession(ServerDTO.VecsClient, storeName, storePass))
             {
                 // add secret key to session here.
                 session.AddSecretKeyEntry(dto.Alias, dto.SecretKey, dto.Password, null);
             }
             if (ListView != null)
             {
                 ListView.Refresh();
             }
         }
     });
 }