internal void OnDisconnected(Connection connection)
 {
     // unregister not the method here, but the registered method
     connection.OnDisconnected -= this.mainForm.OnDisconnected;
     TerminalTabControlItem tabToClose = this.FindTabToClose(connection);
     this.InvokeCloseTab(tabToClose);
 }
        public static Size GetSize(Connection connection, IFavorite favorite)
        {
            int height = favorite.Display.Height;
            int width = favorite.Display.Width;

            switch (favorite.Display.DesktopSize)
            {
                case DesktopSize.x640:
                    return new Size(640, 480);
                case DesktopSize.x800:
                    return new Size(800, 600);
                case DesktopSize.x1024:
                    return new Size(1024, 768);
                case DesktopSize.x1152:
                    return new Size(1152, 864);
                case DesktopSize.x1280:
                    return new Size(1280, 1024);
                case DesktopSize.FullScreen:
                    width = Screen.FromControl(connection).Bounds.Width - 13;
                    height = Screen.FromControl(connection).Bounds.Height - 1;
                    return GetMaxAvailableSize(width, height);
                case DesktopSize.FitToWindow:
                case DesktopSize.AutoScale:
                    width = connection.Parent.Width;
                    height = connection.Parent.Height;
                    return GetMaxAvailableSize(width, height);
                default:
                    return new Size(width, height);
            }
        }
 private TerminalTabControlItem FindTabToClose(Connection connection)
 {
     return this.tcTerminals.Items
         .OfType<TerminalTabControlItem>()
         .FirstOrDefault(tab => tab.Connection == connection);
 }
Ejemplo n.º 4
0
 internal void OnDisconnected(Connection connection)
 {
     this.tabControlRemover.OnDisconnected(connection);
 }