Esempio n. 1
0
        /// <summary>
        /// Startet eine Putty Session in einem gedockten Fenster
        /// </summary>
        /// <param name="sessionName">Name der Session die gestartet werden soll</param>
        /// <param name="callForm">Das Formular auf dem die Action Invoked werden soll</param>
        /// <param name="containerForm">Das Formular in dem das neue Fenster angedockt werden soll</param>
        /// <param name="dockPanel">Das für das Docking verantwortliche DockPanel</param>
        /// <param name="dockstate">Angabe wie das neue Fenster angedockt werden soll</param>
        public static void StartPuttySession(string sessionName, Form callForm, Form containerForm, DockPanel dockPanel, DockState dockstate = DockState.Document)
        {
            StartPuttyAgentIfNeeded();

            twiPutty puttyWindow = null;

            ApplicationClosedCallback callback = delegate(bool closed) {
                if (puttyWindow != null)
                {
                    if (puttyWindow.InvokeRequired)
                    {
                        callForm.BeginInvoke((MethodInvoker) delegate() {
                            puttyWindow.Close();
                        });
                    }
                    else
                    {
                        puttyWindow.Close();
                    }
                }
            };

            puttyWindow = new twiPutty(sessionName, callback, containerForm);
            puttyWindow.Show(dockPanel, dockstate);
        }
        public void StartQuickSession(string protocol, string host, string port)
        {
            string name = protocol + "-" + host + "-" + port;

            recentRepository.AddSession(host, protocol, Convert.ToInt32(port), name);

            frmSessions.AddSessionToRecentSessionList(name);

            twiPutty puttyWindow = null;

            ApplicationClosedCallback callback = delegate(bool closed) {
                if (puttyWindow != null)
                {
                    if (puttyWindow.InvokeRequired)
                    {
                        this.BeginInvoke((MethodInvoker) delegate() {
                            puttyWindow.Close();
                        });
                    }
                    else
                    {
                        puttyWindow.Close();
                    }
                }
            };

            puttyWindow = new twiPutty(name, callback, this);
            puttyWindow.Show(ContentPanel, WeifenLuo.WinFormsUI.Docking.DockState.Document);
        }
        private void settingsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            twiPutty puttyWindow = null;

            ApplicationClosedCallback callback = delegate(bool closed) {
                if (puttyWindow != null)
                {
                    if (puttyWindow.InvokeRequired)
                    {
                        this.BeginInvoke((MethodInvoker) delegate() {
                            puttyWindow.Close();
                        });
                    }
                    else
                    {
                        puttyWindow.Close();
                    }
                }
            };

            puttyWindow = new twiPutty("", callback, this);
            puttyWindow.Show(ContentPanel, WeifenLuo.WinFormsUI.Docking.DockState.Document);
        }