Added flush dns after change dns

This commit is contained in:
Jaex 2014-03-22 05:16:35 +02:00
parent a83cc7e5ed
commit 152243fa7d
2 changed files with 6 additions and 1 deletions

View file

@ -86,7 +86,7 @@ private void cbAdapters_SelectedIndexChanged(object sender, EventArgs e)
{
string[] dns = adapter.GetDNS();
if (dns != null)
if (dns != null && dns.Length == 2)
{
tempPrimaryDNS = dns[0];
txtPreferredDNS.Text = tempPrimaryDNS;
@ -122,6 +122,8 @@ private void btnSave_Click(object sender, EventArgs e)
if (result)
{
NativeMethods.DnsFlushResolverCache();
tempPrimaryDNS = txtPreferredDNS.Text;
tempSecondaryDNS = txtAlternateDNS.Text;
btnSave.Enabled = false;

View file

@ -630,6 +630,9 @@ public static partial class NativeMethods
[DllImport("avifil32.dll")]
public static extern int AVIMakeCompressedStream(out IntPtr compressedStream, IntPtr sourceStream, ref AVICOMPRESSOPTIONS options, IntPtr clsidHandler);
[DllImport("dnsapi.dll")]
public static extern uint DnsFlushResolverCache();
#endregion Other dll
}
}