Beispiel #1
0
 private void ResetDefaultsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     File.Delete(VPNSettings.VPNListPath);
     VPNList = VPNSettings.LoadVPNEntries(VPNSettings.VPNListPath);
     reloadElements();
     MessageBox.Show("VPN List Configuration has been reset to default.", "Configuration", MessageBoxButtons.OK, MessageBoxIcon.Information);
 }
Beispiel #2
0
 private void Form1_Load(object sender, EventArgs e)
 {
     VPNList = VPNSettings.LoadVPNEntries(VPNSettings.VPNListPath);
     vpncon  = new VPNConnection();
     random  = new Random();
     button1.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent;
     button1.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Transparent;
     UpdateElements();
 }
Beispiel #3
0
        private void ComboBox1_DrawItem(object sender, DrawItemEventArgs e)
        {
            if (e.Index < 0)
            {
                return;
            }


            Color foreColor = e.ForeColor;

            e.Graphics.SmoothingMode     = SmoothingMode.AntiAlias;
            e.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;

            if (e.State.HasFlag(DrawItemState.Focus) && !e.State.HasFlag(DrawItemState.ComboBoxEdit))
            {
                e.DrawBackground();
                e.DrawFocusRectangle();
            }
            else
            {
                using (Brush backgbrush = new SolidBrush(Color.WhiteSmoke))
                {
                    e.Graphics.FillRectangle(backgbrush, e.Bounds);
                    foreColor = Color.Black;
                }
            }
            using (Brush textbrush = new SolidBrush(foreColor))
            {
                e.Graphics.DrawString(comboBox1.Items[e.Index].ToString(),
                                      e.Font, textbrush, e.Bounds.Height + 10, e.Bounds.Y,
                                      StringFormat.GenericTypographic);
            }
            var item = (FlagCountryItem)comboBox1.Items[e.Index];

            e.Graphics.DrawImage(VPNSettings.GetFlag(item.code),
                                 new Rectangle(e.Bounds.Location,
                                               new Size(e.Bounds.Height - 2, e.Bounds.Height - 2)));
        }
Beispiel #4
0
        private void LoadVPNListToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog openFileDialog = new OpenFileDialog())
            {
                openFileDialog.Filter           = "txt Files (*.txt)|*.txt";
                openFileDialog.FilterIndex      = 2;
                openFileDialog.RestoreDirectory = true;

                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    var tmplist = VPNSettings.LoadVPNEntries(openFileDialog.FileName);
                    var count   = tmplist.Count;

                    if (count > 0)
                    {
                        VPNList = tmplist;
                        reloadElements();
                    }
                    string tmpmsg = string.Format("Loaded {0} VPN Entries from file!", count);
                    MessageBox.Show(tmpmsg, "VPN List", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }