Implement "Reconnect All" feature

Messages and questions from developers working on mRemoteNG.

Implement "Reconnect All" feature

Postby yegorich » Mon Jul 11, 2016 10:37 pm

Hi,

I have following setup: multiple clones of the same connection. When I put my PC to sleep and then wake it up, all my SSH connections are lost. I'd like to have one button/option, that would iterate through all available tabs and issue reconnect. I have tried following code, but IC.Protocol.Close(); seems to change tabs collection, so I get an exception. Any ideas or would someone like to implement such a feature?

Code: Select all
private static void mMenFileReconnectAll_Click(object sender, EventArgs e)
        {
            if (!(Runtime.WindowList == null || Runtime.WindowList.Count == 0))
            {
                foreach (BaseWindow window in Runtime.WindowList)
                {
                    var connectionWindow = window as ConnectionWindow;
                    if (connectionWindow == null)
                        return;

                    foreach (Crownwood.Magic.Controls.TabPage tab in connectionWindow.TabController.TabPages)
                    {
                        if (tab.Tag is InterfaceControl)
                        {
                            InterfaceControl IC = (InterfaceControl)tab.Tag;
                            IC.Protocol.Close();
                            Runtime.OpenConnection(IC.Info, ConnectionInfo.Force.DoNotJump);
                        }
                    }
                }
            }
        }


Thanks,
yegorich
yegorich
 
Posts: 1
Joined: Mon Jul 11, 2016 10:29 pm

Implement "Reconnect All" feature

Sponsor
 

Return to Developers

Who is online

Users browsing this forum: No registered users and 1 guest

cron