public async void ConnectToServer(string server) { var serverDTO = VMDNSServerDTO.CreateInstance(); serverNode = new VMDNSServerNode(serverDTO); string[] servers = VMDNSSnapInEnvironment.instance.LocalData.GetServerArray(); ProgressWindowController pwc = new ProgressWindowController(); IntPtr session = new IntPtr(0); LoginWindowController lwc = new LoginWindowController(servers); 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; serverNode.ServerDTO.DomainName = lwc.DomainName; serverNode.ServerDTO.UserName = lwc.UserName; serverNode.ServerDTO.Password = lwc.Password; NSApplication.SharedApplication.BeginSheet(pwc.Window, this.Window as NSWindow, () => { }); session = NSApplication.SharedApplication.BeginModalSession(pwc.Window); //use await here and make it async await serverNode.ServerDTO.LoginToServer(); if (serverNode.ServerDTO.IsLoggedIn == true) { serverNode.FillZonesInfo(); InitialiseViews(); ReloadOutlineView(null); } else { UIErrorHelper.ShowAlert(string.Empty, VMIdentityConstants.SERVER_CONNECT_ERROR); } } } catch (Exception e) { UIErrorHelper.ShowAlert(string.Empty, 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(); } }
void AddServerNode(VMDNSServerDTO dto) { var node = new VMDNSServerNode(dto); this.ServerNode = node; this.Children.Add(node); }
public void RefreshMethod(VMDNSServerDTO dto) { if (dto == null) { RefreshAll(); } else { AddServerNode(dto); } }
void AddAllServers() { //TODO - convert to linq foreach (var server in VMDNSSnapInEnvironment.Instance.LocalData.GetServerArray()) { VMDNSServerDTO dto = VMDNSServerDTO.CreateInstance(); dto.Server = server; AddServerNode(dto); } }
void AddServer() { var frm = new SelectComputerUI(); frm.Text = "Add DNS server"; if (SnapIn.Console.ShowDialog(frm) == DialogResult.OK) { var serverDTO = VMDNSServerDTO.CreateInstance(); serverDTO.Server = frm.ServerName; VMDNSSnapInEnvironment.Instance.LocalData.AddServer(serverDTO.Server); VMDNSSnapInEnvironment.Instance.SaveLocalData(); RefreshMethod(serverDTO); } }
public VMDNSServerNode(VMDNSServerDTO dto) : base() { ServerDTO = dto; DisplayName = ServerDTO.Server; this.ImageIndex = this.SelectedImageIndex = (int)VMDNSTreeImageIndex.Server; this.EnabledStandardVerbs = StandardVerbs.Refresh | StandardVerbs.Delete; LoginAction = new Microsoft.ManagementConsole.Action("Login", "Login", -1, ACTION_LOGIN); this.ActionsPaneItems.Add(LoginAction); }
public NodesListView(List <ScopeNodeBase> nodesList, VMDNSServerDTO dto) { Entries = nodesList; ServerDTO = dto; }
public VMDNSServerNode(VMDNSServerDTO serverDTO) { this.ServerDTO = serverDTO; IsLoggedIn = false; }