diff options
| author | Grant Limberg <grant.limberg@zerotier.com> | 2016-11-17 14:25:55 -0800 |
|---|---|---|
| committer | Grant Limberg <grant.limberg@zerotier.com> | 2016-11-17 14:25:55 -0800 |
| commit | a4c274085233fe085efd68869dc979ea56183c87 (patch) | |
| tree | e292cbb0e91da7a061bbb314c35a73e7aaeaf52f /windows/WinUI/NetworksPage.xaml.cs | |
| parent | afa1b8cb2df152b0d589eee8020e756b66501194 (diff) | |
| download | infinitytier-a4c274085233fe085efd68869dc979ea56183c87.tar.gz infinitytier-a4c274085233fe085efd68869dc979ea56183c87.zip | |
added skeletons for join and about windows. moving things around a little bit too
Diffstat (limited to 'windows/WinUI/NetworksPage.xaml.cs')
| -rw-r--r-- | windows/WinUI/NetworksPage.xaml.cs | 99 |
1 files changed, 0 insertions, 99 deletions
diff --git a/windows/WinUI/NetworksPage.xaml.cs b/windows/WinUI/NetworksPage.xaml.cs deleted file mode 100644 index 39a2fefc..00000000 --- a/windows/WinUI/NetworksPage.xaml.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace WinUI -{ - /// <summary> - /// Interaction logic for NetworksPage.xaml - /// </summary> - public partial class NetworksPage : UserControl - { - public NetworksPage() - { - InitializeComponent(); - } - - public void setNetworks(List<ZeroTierNetwork> networks) - { - if (networks == null) - { - this.wrapPanel.Children.Clear(); - return; - } - - foreach (ZeroTierNetwork network in networks) - { - NetworkInfoView view = ChildWithNetwork(network); - if (view != null) - { - view.SetNetworkInfo(network); - } - else - { - wrapPanel.Children.Add( - new NetworkInfoView( - network)); - } - } - - // remove networks we're no longer joined to. - List<ZeroTierNetwork> tmpList = GetNetworksFromChildren(); - foreach (ZeroTierNetwork n in networks) - { - if (tmpList.Contains(n)) - { - tmpList.Remove(n); - } - } - - foreach (ZeroTierNetwork n in tmpList) - { - NetworkInfoView view = ChildWithNetwork(n); - if (view != null) - { - wrapPanel.Children.Remove(view); - } - } - } - - private NetworkInfoView ChildWithNetwork(ZeroTierNetwork network) - { - List<NetworkInfoView> list = wrapPanel.Children.OfType<NetworkInfoView>().ToList(); - - foreach (NetworkInfoView view in list) - { - if (view.HasNetwork(network)) - { - return view; - } - } - - return null; - } - - private List<ZeroTierNetwork> GetNetworksFromChildren() - { - List<ZeroTierNetwork> networks = new List<ZeroTierNetwork>(wrapPanel.Children.Count); - - List<NetworkInfoView> list = wrapPanel.Children.OfType<NetworkInfoView>().ToList(); - foreach (NetworkInfoView n in list) - { - networks.Add(n.network); - } - - return networks; - } - } -} |
