private void Initialise () { var serverDTO = VMDirServerDTO.CreateInstance (); serverNode = new VMDirServerInfo (serverDTO); navigationController = new OutlineViewNavigationController (); }
public async void ConnectToServer (string server) { var serverDTO = VMDirServerDTO.CreateInstance (); if (!string.IsNullOrWhiteSpace (server)) serverDTO.Server = server; ProgressWindowController pwc = new ProgressWindowController (); IntPtr session = new IntPtr (0); ConnectToLdapWindowController awc = new ConnectToLdapWindowController (serverDTO); NSApplication.SharedApplication.BeginSheet (awc.Window, this.Window, () => { }); nint result = NSApplication.SharedApplication.RunModalForWindow (awc.Window); try { if (result == VMIdentityConstants.DIALOGOK) { NSApplication.SharedApplication.BeginSheet (pwc.Window, this.Window as NSWindow, () => { }); session = NSApplication.SharedApplication.BeginModalSession (pwc.Window); serverNode = new VMDirServerInfo (serverDTO); await serverNode.DoLogin (); InitialiseViews (); } } catch (Exception e) { UIErrorHelper.ShowAlert ("Connection is not successful. " + e.Message, "Alert"); } finally { if (pwc.ProgressBar != null) { pwc.ProgressBar.StopAnimation (pwc.Window); pwc.Window.Close (); NSApplication.SharedApplication.EndModalSession (session); } Window.EndSheet (awc.Window); awc.Dispose (); } }