From f7b63cb8e1d9d7ac75b20ed6ea4453ac141eec52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=20Kr=C3=BCger?= Date: Mon, 17 Jan 2022 22:25:15 +0100 Subject: [PATCH] -> IPScanner implemented --- Networking/Pages/IPScanner.xaml | 2 +- Networking/Pages/IPScanner.xaml.cs | 39 ++++++++--------------- Networking/Pages/WF_IPScanner.Designer.cs | 22 +++++++------ WpfApp1/MainWindow.xaml | 2 +- 4 files changed, 28 insertions(+), 37 deletions(-) diff --git a/Networking/Pages/IPScanner.xaml b/Networking/Pages/IPScanner.xaml index 94aab39..80880e7 100644 --- a/Networking/Pages/IPScanner.xaml +++ b/Networking/Pages/IPScanner.xaml @@ -6,7 +6,7 @@ xmlns:local="clr-namespace:Networking.Pages" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800" Background="White"> - + diff --git a/Networking/Pages/IPScanner.xaml.cs b/Networking/Pages/IPScanner.xaml.cs index 98003a8..cc32aae 100644 --- a/Networking/Pages/IPScanner.xaml.cs +++ b/Networking/Pages/IPScanner.xaml.cs @@ -1,7 +1,9 @@ using IPScanner; using PTConverter.Plugin; using System; +using System.Collections; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Linq; using System.Net; using System.Text; @@ -19,45 +21,30 @@ using System.Windows.Shapes; namespace Networking.Pages { + public class Device + { + public string IP { get; set; } + public string Ping { get; set; } + public string Host { get; set; } + public string Identification { get; set; } + } + /// /// Interaktionslogik für Networking.xaml /// public partial class IPScanner : UserControl, IPage { - public IPScanner() { InitializeComponent(); + } - public string GetCategory() => ""; + public string GetCategory() => "Networking"; public UserControl GetPage() => new IPScanner(); - public string GetUnderCategory() => ""; + public string GetUnderCategory() => "IPScanner"; - string IPtoString(byte[] array) - { - // - // Concatenate all the elements into a StringBuilder. - // - StringBuilder strinbuilder = new StringBuilder(); - for (int i = 0; i < array.Count(); i++) - { - - strinbuilder.Append(array[i]); - if (i != array.Count() - 1) - strinbuilder.Append('.'); - } - return strinbuilder.ToString(); - } - - private string GetPingTime(IPScanResult result) - { - if (result.ping > -1) - return result.ping + " ms"; - return "N/A"; - } - } } diff --git a/Networking/Pages/WF_IPScanner.Designer.cs b/Networking/Pages/WF_IPScanner.Designer.cs index be4f568..51300d9 100644 --- a/Networking/Pages/WF_IPScanner.Designer.cs +++ b/Networking/Pages/WF_IPScanner.Designer.cs @@ -41,6 +41,7 @@ namespace Networking.Pages // // lvIPList // + this.lvIPList.Activation = System.Windows.Forms.ItemActivation.OneClick; this.lvIPList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); @@ -50,11 +51,14 @@ namespace Networking.Pages this.chHost, this.chRecognized}); this.lvIPList.FullRowSelect = true; + this.lvIPList.GridLines = true; this.lvIPList.HideSelection = false; - this.lvIPList.Location = new System.Drawing.Point(12, 87); + this.lvIPList.HoverSelection = true; + this.lvIPList.Location = new System.Drawing.Point(0, 32); this.lvIPList.MultiSelect = false; this.lvIPList.Name = "lvIPList"; - this.lvIPList.Size = new System.Drawing.Size(714, 282); + this.lvIPList.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.lvIPList.Size = new System.Drawing.Size(800, 418); this.lvIPList.TabIndex = 1; this.lvIPList.UseCompatibleStateImageBehavior = false; this.lvIPList.View = System.Windows.Forms.View.Details; @@ -62,7 +66,7 @@ namespace Networking.Pages // chIP // this.chIP.Text = "IP"; - this.chIP.Width = 93; + this.chIP.Width = 191; // // chPing // @@ -71,18 +75,18 @@ namespace Networking.Pages // chHost // this.chHost.Text = "Host"; - this.chHost.Width = 88; + this.chHost.Width = 241; // // chRecognized // this.chRecognized.Text = "Recognized as"; - this.chRecognized.Width = 119; + this.chRecognized.Width = 296; // // btnScan // - this.btnScan.Location = new System.Drawing.Point(323, 58); + this.btnScan.Location = new System.Drawing.Point(319, 4); this.btnScan.Name = "btnScan"; - this.btnScan.Size = new System.Drawing.Size(75, 23); + this.btnScan.Size = new System.Drawing.Size(112, 23); this.btnScan.TabIndex = 7; this.btnScan.Text = "Scan"; this.btnScan.UseVisualStyleBackColor = true; @@ -91,7 +95,7 @@ namespace Networking.Pages // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(9, 64); + this.label1.Location = new System.Drawing.Point(5, 9); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(50, 13); this.label1.TabIndex = 6; @@ -99,7 +103,7 @@ namespace Networking.Pages // // tbIPRange // - this.tbIPRange.Location = new System.Drawing.Point(66, 61); + this.tbIPRange.Location = new System.Drawing.Point(62, 6); this.tbIPRange.Name = "tbIPRange"; this.tbIPRange.Size = new System.Drawing.Size(251, 20); this.tbIPRange.TabIndex = 8; diff --git a/WpfApp1/MainWindow.xaml b/WpfApp1/MainWindow.xaml index d845a0e..46cd2c2 100644 --- a/WpfApp1/MainWindow.xaml +++ b/WpfApp1/MainWindow.xaml @@ -9,7 +9,7 @@ Title="MainWindow" Height="450" Width="800"> - +