Ejemplo n.º 1
0
        public async Task <IPInformation> CreateIPInformation()
        {
            var ip = await CheckCurrentIPAsync();

            DateTime      timeStamp = DateTime.Now;
            IPInformation ipNow     = new IPInformation(ip, timeStamp, UniqueCheck(ip));

            return(ipNow);
        }
Ejemplo n.º 2
0
        //Connection testing

        //Methods for handling the listbox
        //Create listbox item
        public ListBoxItem FormatIntoListbox(IPInformation ipinfo)
        {
            StackPanel stackpanel = new StackPanel()
            {
                Orientation = Orientation.Horizontal
            };

            if (ipinfo.Unique)
            {
                stackpanel.Children.Add(new Ellipse()
                {
                    Fill = Brushes.Green, Width = 10, Height = 10
                });
            }
            else
            {
                stackpanel.Children.Add(new Ellipse()
                {
                    Fill = Brushes.Red, Width = 10, Height = 10
                });
            }
            stackpanel.Children.Add(new TextBlock()
            {
                Text = "IP: ", Margin = new Thickness {
                    Left = 5
                }
            });
            stackpanel.Children.Add(new TextBox()
            {
                Text = ipinfo.publicIP
            });
            stackpanel.Children.Add(new TextBlock()
            {
                Text = "Timestamp: ", Margin = new Thickness {
                    Left = 5
                }
            });
            stackpanel.Children.Add(new TextBox()
            {
                Text = ipinfo.IPTimeStamp.ToString("yyyy/MM/dd HH:mm:ss")
            });
            //ListOfIps.Items.Add(new ListBoxItem() { Content = stackpanel });
            //TODO: add a tooltip for unique or not
            return(new ListBoxItem()
            {
                Content = stackpanel
            });
        }