示例#1
0
        private void Tv_Vpn_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            if (Tv_Vpn.SelectedItem != null && Tv_Vpn.SelectedItem is VpnViewModel)
            {
                var obj = (VpnViewModel)Tv_Vpn.SelectedValue;
                SelectedVPN = obj.VpnObj;
                lbl_Card_VpnName.Content       = obj.VpnObj.VpnName;
                lbl_Card_Company.Content       = obj.VpnObj.Company;
                lbl_Card_Location.Content      = obj.VpnObj.Location;
                lbl_Card_ServerAddress.Content = obj.VpnObj.ServerAddress;
                lbl_Card_User.Content          = obj.VpnObj.UserName;
                lbl_Card_Password.Content      =
                    new Func <string>(() =>
                {
                    string result = "";
                    foreach (var item in obj.VpnObj.Password)
                    {
                        result = result + "*";
                    }
                    return(result);
                })();

                LoadTextBoxFromLabels();
            }
            else
            {
            }
        }
示例#2
0
        void ConnectVPN()
        {
            if (txt_ServerAddress.Text != "" && txt_UserName.Text != "" && txt_Password.Text != "")
            {
                string serverAddress = txt_ServerAddress.Text;
                string userName      = txt_UserName.Text;
                string password      = txt_Password.Text;
                ConnectVPNInfo = new VPNobject {
                    ServerAddress = serverAddress, UserName = userName, Password = password, VpnName = txt_VpnName.Text == "" ? "-" : txt_VpnName.Text
                };

                ThreadStart connect = delegate { ConnectThread(serverAddress, VPNAdapterName, userName, password); };

                connectThread = new Thread(connect)
                {
                    IsBackground = true
                };

                connectThread.Start();
            }
            else
            {
                Snackbar.MessageQueue.Enqueue("ServerAddress - User Name - Password - Required");
            }
        }
示例#3
0
 private bool AddNewRecord()
 {
     if (txt_VpnName.Text != "" && txt_ServerAddress.Text != "" && txt_UserName.Text != "" && txt_Password.Text != "")
     {
         if (!db.IsThereRecord(txt_VpnName.Text))
         {
             VPNobject data = new VPNobject
             {
                 VpnName       = txt_VpnName.Text,
                 ServerAddress = txt_ServerAddress.Text,
                 UserName      = txt_UserName.Text,
                 Password      = txt_Password.Text,
                 Location      = txt_Location.Text != "" ? txt_Location.Text : "Undefined",
                 Company       = txt_Company.Text != "" ? txt_Company.Text : "Undefined"
             };
             db.AddRecord(ref data);
             Snackbar.MessageQueue.Enqueue("New VPN added with successful!");
             return(true);
         }
         else
         {
             Snackbar.MessageQueue.Enqueue("the VPN name is already exist!");
         }
     }
     else
     {
         Snackbar.MessageQueue.Enqueue("VPN Name - ServerAddress - User Name - Password - Required");
     }
     return(false);
 }
示例#4
0
        static void Main(string[] args)
        {
            db = new DB("VPNSpotDB");
            db.CheckDB();
            VPNobject data = new VPNobject {
                VpnName = "Deneme", Company = "eopy", UserName = "******", Password = "******", Location = "izmir", ServerAddress = "serverAddd"
            };

            db.AddRecord(ref data);
        }
示例#5
0
 private bool UpdateRecord()
 {
     if (txt_VpnName.Text != "" && txt_ServerAddress.Text != "" && txt_UserName.Text != "" && txt_Password.Text != "")
     {
         if (!db.IsThereRecord(txt_VpnName.Text, SelectedVPN.Id))
         {
             VPNobject data = new VPNobject
             {
                 Id            = SelectedVPN.Id,
                 VpnName       = txt_VpnName.Text,
                 ServerAddress = txt_ServerAddress.Text,
                 UserName      = txt_UserName.Text,
                 Password      = txt_Password.Text,
                 Location      = txt_Location.Text != "" ? txt_Location.Text : "Undefined",
                 Company       = txt_Company.Text != "" ? txt_Company.Text : "Undefined"
             };
             if (db.UpdateRecord(data) != -1)
             {
                 LoadObjectFromTextBox();
                 LoadLabelsFromObject();
                 Snackbar.MessageQueue.Enqueue("The VPN updated with successful!");
                 return(true);
             }
             else
             {
                 Snackbar.MessageQueue.Enqueue("Unsuccesful!");
                 return(false);
             }
         }
         else
         {
             Snackbar.MessageQueue.Enqueue("the VPN name is already exist!");
         }
     }
     else
     {
         Snackbar.MessageQueue.Enqueue("VPN Name - ServerAddress - User Name - Password - Required");
     }
     return(false);
 }
示例#6
0
文件: Vpn.cs 项目: esen2202/VPNSpot
 public Vpn(VPNobject vpnObj)
 {
     this.VpnObj = vpnObj;
 }
示例#7
0
 void SelectTreeViewItem(VPNobject item)
 {
     throw new Exception();
 }