Ejemplo n.º 1
0
        int TrySendCommandsFromToolbar(CommandData command, bool saveHistory)
        {
            int sent = 0;
            //String command = this.tsSendCommandCombo.Text; //this.tbTextCommand.Text;
            if (this.DockPanel.DocumentsCount > 0)
            {
                foreach (DockContent content in this.DockPanel.Documents)
                {
                    ctlPuttyPanel puttyPanel = content as ctlPuttyPanel;
                    if (puttyPanel != null && this.sendCommandsDocumentSelector.IsDocumentSelected(puttyPanel))
                    {
                        int handle = puttyPanel.AppPanel.AppWindowHandle.ToInt32();
                        Log.InfoFormat("SendCommand: session={0}, command=[{1}], handle={2}", puttyPanel.Session.SessionId, command, handle);

                        command.SendToTerminal(handle);
                        /*
                        foreach (Char c in command.Chars)
                        {
                            NativeMethods.SendMessage(handle, NativeMethods.WM_CHAR, (int)c, 0);
                        }

                        NativeMethods.SendMessage(handle, NativeMethods.WM_CHAR, (int)Keys.Enter, 0);*/
                        //NativeMethods.SendMessage(handle, NativeMethods.WM_KEYUP, (int)Keys.Enter, 0);
                        sent++;
                    }
                }
                if (sent > 0)
                {
                    // success...clear text and save in mru
                    this.tsSendCommandCombo.Text = string.Empty;
                    if (command != null && !string.IsNullOrEmpty(command.Command) && saveHistory)
                    {
                        this.tsSendCommandCombo.Items.Add(command.ToString());
                    }
                }
            }
            return sent;
        }
Ejemplo n.º 2
0
        int TrySendCommandsFromToolbar(CommandData command, bool saveHistory)
        {
            int sent = 0;
            if (this.DockPanel.DocumentsCount > 0)
            {
                foreach (DockContent content in this.DockPanel.Documents)
                {
                    ctlPuttyPanel puttyPanel = content as ctlPuttyPanel;
                    if (puttyPanel != null && this.sendCommandsDocumentSelector.IsDocumentSelected(puttyPanel))
                    {
                        int handle = puttyPanel.AppPanel.AppWindowHandle.ToInt32();
                        Log.InfoFormat("SendCommand: session={0}, command=[{1}], handle={2}", puttyPanel.Session.SessionId, command, handle);

                        command.SendToTerminal(handle);

                        sent++;
                    }
                }

                if (sent > 0)
                {
                    // success...clear text and save in mru
                    this.tsSendCommandCombo.Text = string.Empty;
                    if (command != null && !string.IsNullOrEmpty(command.Command) && saveHistory)
                    {
                        this.tsSendCommandCombo.Items.Add(command.ToString());
                    }
                }
            }
            return sent;
        }