Example #1
0
 private void tabControl1_TabControlItemClosing(TabControlItemClosingEventArgs e)
 {
     if (this.tabControl1.Items.Count <= 1)
     {
         this.Close();
     }
 }
Example #2
0
        private void TcTerminals_TabControlItemClosing(TabControlItemClosingEventArgs e)
        {
            // we have to check the connection state in case tab is closing because of lost connection
            var currentConnection = this.selectionControler.CurrentConnection;

            if (currentConnection != null && currentConnection.Connected)
            {
                if (!this.AskToClose())
                {
                    e.Cancel = true;
                }
            }
        }
Example #3
0
        private void tcTerminals_TabControlItemClosing(TabControlItemClosingEventArgs e)
        {
        	Log.InsideMethod();
        	
            Boolean cancel = false;
            if (this.CurrentConnection != null && this.CurrentConnection.Connected)
            {
                Boolean close = false;
                if (Settings.WarnOnConnectionClose)
                {
                    close =
                        (MessageBox.Show(this, "Are you sure that you want to disconnect from the active terminal?",
                                         AssemblyInfo.Title, MessageBoxButtons.YesNo, MessageBoxIcon.Question) ==
                         DialogResult.Yes);
                }
                else
                {
                    close = true;
                }

                if (close)
                {
                    if (this.CurrentConnection != null)
                    {
                        this.CurrentConnection.Disconnect();
                        // Close tabitem functions handled under each connection disconnect methods.
                        cancel = true;
                    }

                    this.Text = AssemblyInfo.AboutText;
                }
                else
                {
                    cancel = true;
                }
            }

            e.Cancel = cancel;
        }