private void CreateVPNRow(string vpnName, string hostname) { BitmapImage bitmap; Image img = new Image { Width = 25 }; img.Margin = new Thickness(2, 2, 2, 2); VPN newVPN = new VPN(); newVPN.Name = vpnName; newVPN.HostName = hostname; newVPN.Status = VPN_Controller.CheckConnection(newVPN.Name); if (newVPN.Status) { SetIcon("Connection_OK.ico", out BitmapImage bitmapSource, out Image image); bitmap = bitmapSource; img = image; } else { SetIcon("Connection_error.ico", out BitmapImage bitmapSource, out Image image); bitmap = bitmapSource; img = image; } img.Source = bitmap; newVPN.Image = bitmap; VpnList.Add(newVPN); }
public void Save() { if (VpnList == null) { return; } //Validate Data List <VpnBase> toRemove = new List <VpnBase>(); foreach (VpnBase aVpn in VpnList) { if (aVpn.Type == VpnType.Undefined) { toRemove.Add(aVpn); continue; } if (aVpn.Validate(true) == false) { return; } } //Remove Undefined VPNs foreach (VpnBase aVpn in toRemove) { StorageCore.Core.DeleteUserVpnConnection(aVpn.Id); VpnList.Remove(aVpn); } //Save Data foreach (VpnBase aVpn in VpnList) { StorageCore.Core.EditUserVpnConnection( aVpn.Id, aVpn.TypeId, aVpn.Parameter1, aVpn.Parameter2, aVpn.Parameter3, aVpn.Parameter4, aVpn.Parameter5, aVpn.Parameter6, aVpn.Parameter7, aVpn.Parameter8, aVpn.Parameter9, aVpn.Parameter10, aVpn.Name); } }