private void bindingSource_PositionChanged(object sender, EventArgs e)
        {
            ProxyConnection currentItem = bindingSource.Current as ProxyConnection;

            if ((object)currentItem != null)
            {
                SelectProxyConnectionEditorControl(currentItem.ProxyConnectionEditor);
            }
        }
        private void StreamSplitterManager_Activated(object sender, EventArgs e)
        {
            ProxyConnection currentItem = bindingSource.Current as ProxyConnection;

            if ((object)currentItem != null && (object)currentItem.ProxyConnectionEditor != null)
            {
                SelectProxyConnectionEditorControl(currentItem.ProxyConnectionEditor);
            }

            toolTipNewHelp.Hide(this);
        }
        private void bindingSource_AddingNew(object sender, System.ComponentModel.AddingNewEventArgs e)
        {
            ProxyConnection connection = new ProxyConnection
            {
                ConnectionString = "name=New Proxy Connection " + (bindingSource.Count + 1)
            };

            e.NewObject = connection;

            // Adding editing control happens before item is added to binding list so
            // control will be available when connection is inserted
            AddProxyConnectionEditorControl(connection);
        }
        private void PostProxyConnectionsLoad(object state)
        {
            Invoke((Action)bindingSource.MoveFirst);

            ProxyConnection proxyConnection = bindingSource.Current as ProxyConnection;

            if ((object)proxyConnection != null)
            {
                Invoke((Action <ProxyConnectionEditor>)SelectProxyConnectionEditorControl, proxyConnection.ProxyConnectionEditor);
            }

            Invoke((Action)Activate);
            Invoke((Action)ShowToolTipHelpForEmptyConfiguration);
        }
        private void RemoveProxyConnectionEditorControl(ProxyConnection connection)
        {
            if ((object)connection != null)
            {
                ProxyConnectionEditor editorControl = connection.ProxyConnectionEditor;

                if ((object)editorControl != null)
                {
                    flowLayoutPanelProxyConnections.Controls.Remove(editorControl);
                    editorControl.Dispose();
                }
            }

            ConfigurationSaved = false;
            Application.DoEvents();
        }
        private void AddProxyConnectionEditorControl(ProxyConnection connection)
        {
            toolTipNewHelp.Hide(this);

            // Create a new editing control for the proxy connection
            ProxyConnectionEditor editorControl = new ProxyConnectionEditor
            {
                ProxyConnection = connection
            };

            flowLayoutPanelProxyConnections.Controls.Add(editorControl);
            editorControl.buttonApply.Enabled = m_lastConnectedState;
            bindingSource.MoveLast();

            ConfigurationSaved = false;
            Application.DoEvents();
        }