public static async Task <List <AdapterProfile> > GetListOfAdaptersAsync()
        {
            var hostnames = await HostNameProvider.GetConnectedHostsAsync();

            var profiles = HostNameProvider.GetCorrespondingProfiles();

            List <AdapterProfile> adapters = new List <AdapterProfile>();

            for (int i = 0; i < hostnames.Count; i++)
            {
                adapters.Add(new AdapterProfile(hostnames[i], profiles[i].ProfileName));
            }

            return(adapters);
        }
Beispiel #2
0
        public async Task ListenAllConnectedAsync()
        {
            var hostnames = await HostNameProvider.GetConnectedHostsAsync();

            if (hostnames.Count == 0)
            {
                if (NetworkNotAvailable != null)
                {
                    NetworkNotAvailable(this, null);
                }
                return;
            }

            foreach (var host in hostnames)
            {
                await server.BindPortAsync(host, SHUB_PORT);
            }
            await server.BindPortAsync(HostNameProvider.GetLoopbackHost(), SHUB_PORT);
        }
        private async void bConnect_Click(object sender, RoutedEventArgs e)
        {
            origin = DateTime.Now;

            var host = await HostNameProvider.GetConnectedHostsAsync();

            if (host.Count == 0)
            {
                event_NetworkNotAvailable(client, null);
                return;
            }

            await server.ListenViaDefaultAsync();

            //await client.ScanAsync(host[0]);

            //ServerLogTime("Scan done");
            //await client.ConnectAsync((TClientProfile)clientManager.AvailableFolder[0]);

            UIChange(true);
        }
Beispiel #4
0
        private async void Page_Loaded(object sender, RoutedEventArgs e)
        {
            if (!initialized)
            {
                initialized = true;

                var hostnames = await HostNameProvider.GetConnectedHostsAsync();

                if (hostnames.Count == 0)
                {
                    MessageDialog dialog = new MessageDialog(
                        "Network is not available. Please connect to a network and then restart the appplication.");
                    dialog.Commands.Add(new UICommand("Exit application", new UICommandInvokedHandler((c) =>
                    {
                        Application.Current.Exit();
                    })));
                    await dialog.ShowAsync();
                }

                await client.ActivateAsyncPhone();
            }
        }
Beispiel #5
0
 public async Task <List <HostName> > GetListOfHostAsync()
 {
     return(await HostNameProvider.GetConnectedHostsAsync());
 }
Beispiel #6
0
 public async Task ScanViaDefaultAsync()
 {
     await ScanAsync((await HostNameProvider.GetConnectedHostsAsync())[0]);
 }