From aa24aba3a95ecf34d7b6d0c6b91f2229906e0739 Mon Sep 17 00:00:00 2001 From: Tim Young Date: Tue, 10 Apr 2018 09:03:29 +0300 Subject: [PATCH] remove all the wireless connections on network load. They will be rebuilt. --- EduNetworkBuilder/Network.cs | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/EduNetworkBuilder/Network.cs b/EduNetworkBuilder/Network.cs index 8e5bdf6..3a245cb 100644 --- a/EduNetworkBuilder/Network.cs +++ b/EduNetworkBuilder/Network.cs @@ -326,8 +326,7 @@ namespace EduNetworkBuilder break; case "link": newNL = new NetworkLink(Individual); - if(newNL.theLinkType != LinkType.wireless) - NetComponents.Add(newNL); //do no load wireless links. Rebuild them + NetComponents.Add(newNL); break; case "device": newND = new NetworkDevice(Individual); @@ -404,6 +403,7 @@ namespace EduNetworkBuilder } } } + DoAllRemoveAllWirelessLinks(); //remove all wireless links. They will be rebuilt below DoAllVerifyLinks(); DoAllAutoJoin(); OpenHelpIfNeeded(skipOpeningWindows); @@ -2118,6 +2118,26 @@ namespace EduNetworkBuilder return didanything; } + public bool DoAllRemoveAllWirelessLinks() + { + NetworkLink nl; + bool didanything = false; + NetworkComponent nc; + for (int i = NetComponents.Count - 1; i >= 0; i--) + { + nc = NetComponents[i]; + if (nc is NetworkLink) + { + nl = (NetworkLink)nc; + if(nl.theLinkType == LinkType.wireless) + { + didanything = true; + nl.Destroy(); //We will rebuild it later + } + } + } + return didanything; + } public bool DoAllMarkAsLinked() { bool didanything = false;