Beispiel #1
0
        public twiPutty(string session, ApplicationClosedCallback callback, Form container)
        {
            InitializeComponent();

            m_ApplicationExit = callback;
            containerForm     = container;
            sessionName       = session;

            if (session == "")
            {
                this.Text = ApplicationSettings.PuttyLocation;
            }
            else
            {
                this.Text = session;
            }

            this.applicationwrapper                 = new ApplicationPanel(container);
            this.applicationwrapper.Dock            = System.Windows.Forms.DockStyle.Fill;
            this.applicationwrapper.ApplicationName = ApplicationSettings.PuttyLocation;
            if (session != "")
            {
                this.applicationwrapper.ApplicationParameters = "-load " + session;
            }
            this.applicationwrapper.Location        = new System.Drawing.Point(0, 0);
            this.applicationwrapper.Name            = "applicationControl1";
            this.applicationwrapper.Size            = new System.Drawing.Size(284, 264);
            this.applicationwrapper.TabIndex        = 0;
            this.applicationwrapper.m_CloseCallback = this.m_ApplicationExit;
            this.Controls.Add(this.applicationwrapper);

            this.FormClosing            += new FormClosingEventHandler(twiPutty_FormClosing);
            this.TabPageContextMenuStrip = this.conMenuSessionTab;
        }
        IApplicationPanel <FrameworkElement, Size, Rect> ISuperPanel <FrameworkElement, Size, Rect> .CreateChild(ApplicationPanelHelper <FrameworkElement, Size, Rect> helper)
        {
            var panel = new ApplicationPanel(helper);

            Children.Add(panel);
            return(panel);
        }
        private void CreatePanel()
        {
            this.applicationwrapper1 = new ApplicationPanel();
            this.SuspendLayout();
            this.applicationwrapper1.Dock                  = System.Windows.Forms.DockStyle.Fill;
            this.applicationwrapper1.ApplicationName       = frmPuttyWrap.PuttyExe;
            this.applicationwrapper1.ApplicationParameters = this.ApplicationParameters;
            this.applicationwrapper1.Location              = new System.Drawing.Point(0, 0);
            this.applicationwrapper1.Name                  = "applicationControl1";
            this.applicationwrapper1.Size                  = new System.Drawing.Size(284, 264);
            this.applicationwrapper1.TabIndex              = 0;
            this.applicationwrapper1.m_CloseCallback       = this.m_ApplicationExit;
            this.Controls.Add(this.applicationwrapper1);

            this.ResumeLayout();
        }
Beispiel #4
0
        //********************************************************************************************
        private void OnLoad(object sender, EventArgs e)
        {
            if (server.Port == 0)
            {
                server.Port = 22;
            }

            SuspendLayout();

            switch (server.SshTerminal)
            {
            case 1:
            {
                PuttyClosedCallback closedCallback = delegate(bool closed)
                {
                    BeginInvoke((MethodInvoker) delegate
                        {
                            ((KRBTabControl)(Parent.Parent)).TabPages.Remove((TabPageEx)Parent);
                            DeletePuttySession();
                        });
                };

                PuttyStartedCallback startedCallback = delegate()
                {
                    BeginInvoke((MethodInvoker) delegate
                        {
                            statusLabel.Visible    = false;
                            loadingCircle1.Visible = false;
                            puttyPanel.Visible     = true;
                        });
                };

                puttyPanel                       = new ApplicationPanel();
                puttyPanel.Dock                  = System.Windows.Forms.DockStyle.Fill;
                puttyPanel.ApplicationName       = @"putty\putty.exe";
                puttyPanel.ApplicationParameters = String.Empty;
                puttyPanel.Name                  = "puttyPanel";
                puttyPanel.Margin                = new Padding(10);
                puttyPanel.TabIndex              = 0;
                puttyPanel.m_CloseCallback       = closedCallback;
                puttyPanel.m_StartCallback       = startedCallback;
                puttyPanel.Visible               = false;
                Controls.Add(puttyPanel);
            }
            break;

            case 2:
            {
                poderosaPanel              = new SshTerminalControl();
                poderosaPanel.Dock         = System.Windows.Forms.DockStyle.Fill;
                poderosaPanel.Visible      = false;
                poderosaPanel.SshProtocol  = (server.SSH1) ? SshProtocol.SSH1 : SshProtocol.SSH2;
                poderosaPanel.TerminalType = TerminalType.XTerm;
                poderosaPanel.Font         = new Font("Consolas", Main.config.GetValue("DEFAULT_SSH_FONT_SIZE").ToIntOrDefault(10));
                poderosaPanel.BackColor    = Color.Black;
                poderosaPanel.ForeColor    = Color.LightGray;
                poderosaPanel.HostName     = server.Host;
                poderosaPanel.Port         = server.Port;
                //terminalControl.IdentityFile = loginDialog.IdentityFile;
                poderosaPanel.Username = server.Username;
                poderosaPanel.Password = new SecureString();
                foreach (char character in server.Password)
                {
                    poderosaPanel.Password.AppendChar(character);
                }
                Controls.Add(poderosaPanel);
            }
            break;

            default:
                throw new Exception($"Invalid Terminal Type: {server.SshTerminal}");
            }
            ResumeLayout();
        }