Esempio n. 1
0
 /// <summary>
 /// Updates certificate status and toobar.
 /// </summary>
 private void UpdateCertStatus()
 {
     if (m_pCert == null)
     {
         UI_Utils.GetGrayImage(ResManager.GetIcon("ssl.ico", new Size(32, 32)).ToBitmap());
         m_pSslToolbar.Items["create"].Enabled = true;
         m_pSslToolbar.Items["add"].Enabled    = true;
         m_pSslToolbar.Items["delete"].Enabled = false;
         m_pSslToolbar.Items["save"].Enabled   = false;
     }
     else
     {
         m_pSslIcon.Image = ResManager.GetIcon("ssl.ico", new Size(48, 48)).ToBitmap();
         m_pSslToolbar.Items["create"].Enabled = false;
         m_pSslToolbar.Items["add"].Enabled    = false;
         m_pSslToolbar.Items["delete"].Enabled = true;
         m_pSslToolbar.Items["save"].Enabled   = true;
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Creates and initializes window UI.
        /// </summary>
        private void InitUI()
        {
            this.ClientSize      = new Size(380, 210);
            this.StartPosition   = FormStartPosition.CenterParent;
            this.Text            = "Add/Edit Bind info";
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.MaximizeBox     = false;

            m_pIcon          = new PictureBox();
            m_pIcon.Size     = new Size(32, 32);
            m_pIcon.Location = new Point(10, 10);
            m_pIcon.Image    = ResManager.GetIcon("server.ico").ToBitmap();

            mt_Info           = new Label();
            mt_Info.Size      = new Size(200, 32);
            mt_Info.Location  = new Point(50, 10);
            mt_Info.TextAlign = ContentAlignment.MiddleLeft;
            mt_Info.Text      = "Specify IP binding information.";

            m_pSeparator1          = new GroupBox();
            m_pSeparator1.Size     = new Size(365, 3);
            m_pSeparator1.Location = new Point(10, 50);

            mt_HostName           = new Label();
            mt_HostName.Size      = new Size(100, 20);
            mt_HostName.Location  = new Point(0, 60);
            mt_HostName.TextAlign = ContentAlignment.MiddleRight;
            mt_HostName.Text      = "Host Name:";

            m_pHostName          = new TextBox();
            m_pHostName.Size     = new Size(270, 20);
            m_pHostName.Location = new Point(105, 60);

            mt_Protocol           = new Label();
            mt_Protocol.Size      = new Size(100, 20);
            mt_Protocol.Location  = new Point(0, 85);
            mt_Protocol.TextAlign = ContentAlignment.MiddleRight;
            mt_Protocol.Text      = "Protocol:";

            m_pProtocol                       = new ComboBox();
            m_pProtocol.Size                  = new Size(60, 20);
            m_pProtocol.Location              = new Point(105, 85);
            m_pProtocol.DropDownStyle         = ComboBoxStyle.DropDownList;
            m_pProtocol.SelectedIndexChanged += new EventHandler(m_pProtocol_SelectedIndexChanged);

            mt_IpEndPoint           = new Label();
            mt_IpEndPoint.Size      = new Size(100, 20);
            mt_IpEndPoint.Location  = new Point(0, 110);
            mt_IpEndPoint.TextAlign = ContentAlignment.MiddleRight;
            mt_IpEndPoint.Text      = "IP EndPoint:";

            m_pIP               = new ComboBox();
            m_pIP.Size          = new Size(200, 20);
            m_pIP.Location      = new Point(105, 110);
            m_pIP.DropDownStyle = ComboBoxStyle.DropDownList;

            m_pPort          = new NumericUpDown();
            m_pPort.Size     = new Size(63, 20);
            m_pPort.Location = new Point(310, 110);
            m_pPort.Minimum  = 0;
            m_pPort.Maximum  = 99999;

            mt_SslMode           = new Label();
            mt_SslMode.Size      = new Size(100, 20);
            mt_SslMode.Location  = new Point(0, 140);
            mt_SslMode.TextAlign = ContentAlignment.MiddleRight;
            mt_SslMode.Text      = "SSL Mode:";

            m_pSslMode                       = new ComboBox();
            m_pSslMode.Size                  = new Size(60, 20);
            m_pSslMode.Location              = new Point(105, 140);
            m_pSslMode.DropDownStyle         = ComboBoxStyle.DropDownList;
            m_pSslMode.SelectedIndexChanged += new EventHandler(m_pSslMode_SelectedIndexChanged);
            m_pSslMode.Items.Add("None");
            m_pSslMode.Items.Add("SSL");
            m_pSslMode.Items.Add("TLS");

            m_pSslToolbar              = new ToolStrip();
            m_pSslToolbar.Size         = new Size(95, 25);
            m_pSslToolbar.Location     = new Point(210, 140);
            m_pSslToolbar.Dock         = DockStyle.None;
            m_pSslToolbar.GripStyle    = ToolStripGripStyle.Hidden;
            m_pSslToolbar.BackColor    = this.BackColor;
            m_pSslToolbar.Renderer     = new ToolBarRendererEx();
            m_pSslToolbar.ItemClicked += new ToolStripItemClickedEventHandler(m_pSslToolbar_ItemClicked);
            // Create button
            ToolStripButton button_Create = new ToolStripButton();

            button_Create.Image       = ResManager.GetIcon("write.ico").ToBitmap();
            button_Create.Name        = "create";
            button_Create.ToolTipText = "Create SSL certificate.";
            m_pSslToolbar.Items.Add(button_Create);
            // Add button
            ToolStripButton button_Add = new ToolStripButton();

            button_Add.Image       = ResManager.GetIcon("add.ico").ToBitmap();
            button_Add.Name        = "add";
            button_Add.ToolTipText = "Add SSL certificate.";
            m_pSslToolbar.Items.Add(button_Add);
            // Delete button
            ToolStripButton button_Delete = new ToolStripButton();

            button_Delete.Enabled     = false;
            button_Delete.Image       = ResManager.GetIcon("delete.ico").ToBitmap();
            button_Delete.Name        = "delete";
            button_Delete.ToolTipText = "Delete SSL certificate.";
            m_pSslToolbar.Items.Add(button_Delete);
            // Save button
            ToolStripButton button_Save = new ToolStripButton();

            button_Save.Enabled     = false;
            button_Save.Image       = ResManager.GetIcon("save.ico").ToBitmap();
            button_Save.Name        = "save";
            button_Save.ToolTipText = "Export SSL certificate.";
            m_pSslToolbar.Items.Add(button_Save);

            m_pSslIcon             = new PictureBox();
            m_pSslIcon.Size        = new Size(32, 32);
            m_pSslIcon.Location    = new Point(180, 135);
            m_pSslIcon.BorderStyle = BorderStyle.None;
            m_pSslIcon.SizeMode    = PictureBoxSizeMode.StretchImage;
            m_pSslIcon.Image       = UI_Utils.GetGrayImage(ResManager.GetIcon("ssl.ico", new Size(32, 32)).ToBitmap());

            m_pSeparator2          = new GroupBox();
            m_pSeparator2.Size     = new Size(365, 2);
            m_pSeparator2.Location = new Point(5, 175);

            m_pCancel          = new Button();
            m_pCancel.Size     = new Size(70, 20);
            m_pCancel.Location = new Point(225, 185);
            m_pCancel.Text     = "Cancel";
            m_pCancel.Click   += new EventHandler(m_pCancel_Click);

            m_pOk          = new Button();
            m_pOk.Size     = new Size(70, 20);
            m_pOk.Location = new Point(300, 185);
            m_pOk.Text     = "Ok";
            m_pOk.Click   += new EventHandler(m_pOk_Click);

            this.Controls.Add(m_pIcon);
            this.Controls.Add(mt_Info);
            this.Controls.Add(m_pSeparator1);
            this.Controls.Add(mt_HostName);
            this.Controls.Add(m_pHostName);
            this.Controls.Add(mt_Protocol);
            this.Controls.Add(m_pProtocol);
            this.Controls.Add(mt_IpEndPoint);
            this.Controls.Add(m_pIP);
            this.Controls.Add(m_pPort);
            this.Controls.Add(mt_SslMode);
            this.Controls.Add(m_pSslMode);
            this.Controls.Add(m_pSslToolbar);
            this.Controls.Add(m_pSslIcon);
            this.Controls.Add(m_pSeparator2);
            this.Controls.Add(m_pCancel);
            this.Controls.Add(m_pOk);
        }