示例#1
0
        public ConnWizardForm(IStoredConnection conn)
        {
            InitializeComponent();
            m_conn = conn;

            int top  = ClientSize.Height - (btnOk.Top + btnOk.Height);
            int left = ClientSize.Width - (btnOk.Left + btnOk.Width);
            int wi   = ClientSize.Width - 2 * left;

            var tun = m_conn as ITunellableStoredConnection;

            var        parent = Controls;
            TabControl pg     = null;

            if (tun != null)
            {
                pg = new TabControl();
                var pg1 = new TabPage {
                    Text = Texts.Get("s_connection")
                };
                var pg2 = new TabPage {
                    Text = Texts.Get("s_tunnelling")
                };
                pg.TabPages.Add(pg1);
                pg.TabPages.Add(pg2);
                pg.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom;
                Controls.Add(pg);

                pg.Top   = top;
                pg.Width = wi;
                pg.Left  = left;

                m_tunCfg = new TunnelConfigFrame();
                m_tunCfg.AllowDirectConnection  = tun.AllowDirectConnection;
                m_tunCfg.SelectedDriver         = tun.TunnelDriver;
                m_tunCfg.SelectedDriverChanged += new EventHandler(m_tunCfg_SelectedDriverChanged);
                pg2.Controls.Add(m_tunCfg);
                m_tunCfg.Dock = DockStyle.Fill;

                parent = pg1.Controls;
                top    = 10;
                left   = 10;
                wi     = pg.Width - 20;

                pg.SelectedIndexChanged += pg_TabIndexChanged;
            }

            m_frame = m_conn.CreateEditor();
            parent.Add(m_frame);
            m_frame.Left  = left;
            m_frame.Top   = top;
            m_frame.Width = wi;

            m_common = new CommonConnectionEditFrame(conn);
            parent.Add(m_common);
            m_common.Left  = left;
            m_common.Top   = m_frame.Height + top;
            m_common.Width = wi;

            m_common.LinkToSpecific(m_frame);

            Height = top + Height + m_frame.Height + m_common.Height + (tun != null ? 50 : 0);
            if (pg != null)
            {
                pg.Height = m_frame.Height + m_common.Height + 50;
            }

            Text = Texts.Get(m_conn.ConnectionTypeTitle);
            Translating.TranslateControl(this);
            btnAdvanced.Enabled = conn.ConnectionSettings != null;
            btnCtxhelp.Enabled  = m_conn.HelpTopic != null;
            Usage["contype"]    = conn.GetType().FullName;

            m_origHeight = Height;
            m_origWidth  = Width;
        }
示例#2
0
 public void LinkToSpecific(ConnectionEditFrame frame)
 {
     frame.ConnectionChanged += new EventHandler(frame_OnConnectionChanged);
     m_frame = frame;
     frame_OnConnectionChanged(this, EventArgs.Empty);
 }