Exemple #1
0
        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();
            }
        }
Exemple #2
0
        void AddAllServers()

        {
            //TODO - convert to linq

            foreach (var server in VMDNSSnapInEnvironment.Instance.LocalData.GetServerArray())

            {
                VMDNSServerDTO dto = VMDNSServerDTO.CreateInstance();

                dto.Server = server;

                AddServerNode(dto);
            }
        }
Exemple #3
0
        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);
            }
        }