public ServerInfoPopOverController (VMCertStoreServerNode node) : base ("ServerInfoPopOver", NSBundle.MainBundle)
 {
     this.serverNode = node;
     if (serverNode.IsDetailsLoaded == false)
         serverNode.FillServerInfo ();
 }
 public async void ConnectToServer (string server)
 {
     var serverDTO = VMCertStoreServerDTO.CreateInstance ();
     Servernode = new VMCertStoreServerNode (serverDTO);
     ProgressWindowController pwc = new ProgressWindowController ();
     IntPtr session = new IntPtr (0);
     LoginWindowController lwc = new LoginWindowController (server);
     NSApplication.SharedApplication.BeginSheet (lwc.Window, this.Window, () => {
     });
     nint result = NSApplication.SharedApplication.RunModalForWindow (lwc.Window);
     try {
         if (result == (nint)VMIdentityConstants.DIALOGOK) {
             Servernode.ServerDTO.Server = lwc.Server;
             NSApplication.SharedApplication.BeginSheet (pwc.Window, this.Window as NSWindow, () => {
             });
             session = NSApplication.SharedApplication.BeginModalSession (pwc.Window);
             await Servernode.ServerDTO.LogintoServer (lwc.UserName, lwc.Password, lwc.DomainName);
             if (Servernode.ServerDTO.IsLoggedIn == true) {
                 InitialiseViews ();
                 NSNotificationCenter.DefaultCenter.PostNotificationName ("ReloadOutlineView", this);
                 Task.Run (() => Servernode.FillServerInfo ());
             } else
                 UIErrorHelper.ShowAlert ("Please check the login details or the user permissions.", "Unable to Login");
         }
     } catch (Exception e) {
         UIErrorHelper.ShowAlert ("", e.Message);
     } finally {
         if (pwc.ProgressBar != null) {
             pwc.ProgressBar.StopAnimation (pwc.Window);
             pwc.Window.Close ();
             NSApplication.SharedApplication.EndModalSession (session);
         }
         Window.EndSheet (lwc.Window);
         lwc.Dispose ();
     }
 }